Changes from branches/4.0/src/wp-includes/formatting.php at r30450 to trunk/src/wp-includes/formatting.php at r29707
- File:
-
- 1 edited
-
trunk/src/wp-includes/formatting.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r30450 r29707 29 29 */ 30 30 function wptexturize($text, $reset = false) { 31 global $wp_cockneyreplace , $shortcode_tags;31 global $wp_cockneyreplace; 32 32 static $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements, 33 33 $default_no_texturize_tags, $default_no_texturize_shortcodes, $run_texturize = true; … … 206 206 // Look for shortcodes and HTML elements. 207 207 208 $tagnames = array_keys( $shortcode_tags );209 $tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );210 $tagregexp = "(?:$tagregexp)(?![\\w-])"; // Excerpt of get_shortcode_regex().211 212 $comment_regex =213 '!' // Start of comment, after the <.214 . '(?:' // Unroll the loop: Consume everything until --> is found.215 . '-(?!->)' // Dash not followed by end of comment.216 . '[^\-]*+' // Consume non-dashes.217 . ')*+' // Loop possessively.218 . '-->'; // End of comment.219 220 208 $regex = '/(' // Capture the entire match. 221 209 . '<' // Find start of element. 222 210 . '(?(?=!--)' // Is this a comment? 223 . $comment_regex// Find end of comment211 . '.+?--\s*>' // Find end of comment 224 212 . '|' 225 213 . '[^>]+>' // Find end of element … … 227 215 . '|' 228 216 . '\[' // Find start of shortcode. 229 . '[\/\[]?' // Shortcodes may begin with [/ or [[ 230 . $tagregexp // Only match registered shortcodes, because performance. 217 . '\[?' // Shortcodes may begin with [[ 231 218 . '(?:' 232 . '[^\[\]<>] +' // Shortcodes do not contain other shortcodes. Quantifier critical.219 . '[^\[\]<>]' // Shortcodes do not contain other shortcodes. 233 220 . '|' 234 . '<[^ \[\]>]*>' // HTML elements permitted. Prevents matching ] before >.235 . ') *+' // Possessive critical.221 . '<[^>]+>' // HTML elements permitted. Prevents matching ] before >. 222 . ')++' 236 223 . '\]' // Find end of shortcode. 237 224 . '\]?' // Shortcodes may end with ]] … … 255 242 continue; 256 243 257 } elseif ( '[' === $first && 1 === preg_match( '/^\[ \/?' . $tagregexp . '(?:[^\[\]<>]+|<[^\[\]>]*>)*+\]$/', $curl ) ) {244 } elseif ( '[' === $first && 1 === preg_match( '/^\[(?:[^\[\]<>]|<[^>]+>)++\]$/', $curl ) ) { 258 245 // This is a shortcode delimiter. 259 246 260 247 _wptexturize_pushpop_element( $curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes ); 261 248 262 } elseif ( '[' === $first && 1 === preg_match( '/^\[ [\/\[]?' . $tagregexp . '(?:[^\[\]<>]+|<[^\[\]>]*>)*+\]\]?$/', $curl ) ) {249 } elseif ( '[' === $first && 1 === preg_match( '/^\[\[?(?:[^\[\]<>]|<[^>]+>)++\]\]?$/', $curl ) ) { 263 250 // This is an escaped shortcode delimiter. 264 251
Note: See TracChangeset
for help on using the changeset viewer.