Changeset 33522 for branches/4.0/src/wp-includes/shortcodes.php
- Timestamp:
- 07/31/2015 01:43:11 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.0/src/wp-includes/shortcodes.php
r33381 r33522 333 333 334 334 $pattern = get_shortcode_regex(); 335 336 $comment_regex = 337 '!' // Start of comment, after the <. 338 . '(?:' // Unroll the loop: Consume everything until --> is found. 339 . '-(?!->)' // Dash not followed by end of comment. 340 . '[^\-]*+' // Consume non-dashes. 341 . ')*+' // Loop possessively. 342 . '(?:-->)?'; // End of comment. If not found, match all input. 343 344 $regex = 345 '/(' // Capture the entire match. 346 . '<' // Find start of element. 347 . '(?(?=!--)' // Is this a comment? 348 . $comment_regex // Find end of comment. 349 . '|' 350 . '[^>]*>?' // Find end of element. If not found, match all input. 351 . ')' 352 . ')/s'; 353 354 $textarr = preg_split( $regex, $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); 335 $textarr = wp_html_split( $content ); 355 336 356 337 foreach ( $textarr as &$element ) { 357 if ( ' <' !== $element[0] ) {338 if ( '' == $element || '<' !== $element[0] ) { 358 339 continue; 359 340 } … … 370 351 } 371 352 372 if ( $ignore_html || '<!--' === substr( $element, 0, 4 ) ) {353 if ( $ignore_html || '<!--' === substr( $element, 0, 4 ) || '<![CDATA[' === substr( $element, 0, 9 ) ) { 373 354 // Encode all [ and ] chars. 374 355 $element = strtr( $element, $trans );
Note: See TracChangeset
for help on using the changeset viewer.