X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/874d2a2f468a0d1e69aab49b1fe2d9d79d3e1142..5d244c8fd9a27c9f89dd08da2af6fbc67d4fce63:/wp-includes/formatting.php
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index e79043bc..7bd354af 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -11,13 +11,13 @@
* Replaces common plain text characters into formatted entities
*
* As an example,
- *
- * 'cause today's effort makes it worth tomorrow's "holiday"...
- *
+ *
+ * 'cause today's effort makes it worth tomorrow's "holiday" ...
+ *
* Becomes:
- *
- * ’cause today’s effort makes it worth tomorrow’s “holiday”…
- *
+ *
+ * ’cause today’s effort makes it worth tomorrow’s “holiday” …
+ *
* Code within certain html blocks are skipped.
*
* @since 0.71
@@ -215,26 +215,30 @@ function wptexturize($text, $reset = false) {
. '-(?!->)' // Dash not followed by end of comment.
. '[^\-]*+' // Consume non-dashes.
. ')*+' // Loop possessively.
- . '-->'; // End of comment.
-
- $regex = '/(' // Capture the entire match.
- . '<' // Find start of element.
- . '(?(?=!--)' // Is this a comment?
- . $comment_regex // Find end of comment
- . '|'
- . '[^>]+>' // Find end of element
- . ')'
+ . '(?:-->)?'; // End of comment. If not found, match all input.
+
+ $shortcode_regex =
+ '\[' // Find start of shortcode.
+ . '[\/\[]?' // Shortcodes may begin with [/ or [[
+ . $tagregexp // Only match registered shortcodes, because performance.
+ . '(?:'
+ . '[^\[\]<>]+' // Shortcodes do not contain other shortcodes. Quantifier critical.
. '|'
- . '\[' // Find start of shortcode.
- . '[\/\[]?' // Shortcodes may begin with [/ or [[
- . $tagregexp // Only match registered shortcodes, because performance.
- . '(?:'
- . '[^\[\]<>]+' // Shortcodes do not contain other shortcodes. Quantifier critical.
- . '|'
- . '<[^\[\]>]*>' // HTML elements permitted. Prevents matching ] before >.
- . ')*+' // Possessive critical.
- . '\]' // Find end of shortcode.
- . '\]?' // Shortcodes may end with ]]
+ . '<[^\[\]>]*>' // HTML elements permitted. Prevents matching ] before >.
+ . ')*+' // Possessive critical.
+ . '\]' // Find end of shortcode.
+ . '\]?'; // Shortcodes may end with ]]
+
+ $regex =
+ '/(' // Capture the entire match.
+ . '<' // Find start of element.
+ . '(?(?=!--)' // Is this a comment?
+ . $comment_regex // Find end of comment.
+ . '|'
+ . '[^>]+>' // Find end of element.
+ . ')'
+ . '|'
+ . $shortcode_regex // Find shortcodes.
. ')/s';
$textarr = preg_split( $regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
@@ -242,30 +246,31 @@ function wptexturize($text, $reset = false) {
foreach ( $textarr as &$curl ) {
// Only call _wptexturize_pushpop_element if $curl is a delimiter.
$first = $curl[0];
- if ( '<' === $first && '>' === substr( $curl, -1 ) ) {
- // This is an HTML delimiter.
+ if ( '<' === $first && '