Changeset 29873
- Timestamp:
- 10/11/2014 02:32:15 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r29781 r29873 206 206 // Look for shortcodes and HTML elements. 207 207 208 $comment_regex = 209 '!'// Start of comment, after the <.210 . '(?:'// Unroll the loop: Consume everything until --> is found.211 . '-(?!->)'// Dash not followed by end of comment.212 . '[^\-]*+'// Consume non-dashes.213 . ')*+'// Loop possessively.214 . '(?:-->)?';// End of comment. If not found, match all input.215 208 $comment_regex = 209 '!' // Start of comment, after the <. 210 . '(?:' // Unroll the loop: Consume everything until --> is found. 211 . '-(?!->)' // Dash not followed by end of comment. 212 . '[^\-]*+' // Consume non-dashes. 213 . ')*+' // Loop possessively. 214 . '(?:-->)?'; // End of comment. If not found, match all input. 215 216 216 $shortcode_regex = 217 '\['// Find start of shortcode.218 . '[\/\[]?'// Shortcodes may begin with [/ or [[219 . '[^\s\/\[\]]'// No whitespace before name.220 . '[^\[\]]*+'// Shortcodes do not contain other shortcodes. Possessive critical.221 . '\]'// Find end of shortcode.222 . '\]?';// Shortcodes may end with ]]223 224 $regex = 225 '/('// Capture the entire match.226 . '<'// Find start of element.227 . '(?(?=!--)'// Is this a comment?228 . $comment_regex// Find end of comment.229 . 230 . '[^>]+>'// Find end of element.231 . 232 . 233 . $shortcode_regex// Find shortcodes.234 . 217 '\[' // Find start of shortcode. 218 . '[\/\[]?' // Shortcodes may begin with [/ or [[ 219 . '[^\s\/\[\]]' // No whitespace before name. 220 . '[^\[\]]*+' // Shortcodes do not contain other shortcodes. Possessive critical. 221 . '\]' // Find end of shortcode. 222 . '\]?'; // Shortcodes may end with ]] 223 224 $regex = 225 '/(' // Capture the entire match. 226 . '<' // Find start of element. 227 . '(?(?=!--)' // Is this a comment? 228 . $comment_regex // Find end of comment. 229 . '|' 230 . '[^>]+>' // Find end of element. 231 . ')' 232 . '|' 233 . $shortcode_regex // Find shortcodes. 234 . ')/s'; 235 235 236 236 $textarr = preg_split( $regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); … … 262 262 } else { 263 263 // Looks like an escaped shortcode. 264 // Do not texturize.265 // Do not push to the shortcodes stack.266 264 continue; 267 265 }
Note: See TracChangeset
for help on using the changeset viewer.