Make WordPress Core


Ignore:
Timestamp:
07/31/2015 01:42:39 AM (11 years ago)
Author:
azaozz
Message:

Backport r33469 and r33470 to 4.1.
See #33106.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1/src/wp-includes/shortcodes.php

    r33380 r33521  
    326326       
    327327        $pattern = get_shortcode_regex();
    328 
    329         $comment_regex =
    330                   '!'           // Start of comment, after the <.
    331                 . '(?:'         // Unroll the loop: Consume everything until --> is found.
    332                 .     '-(?!->)' // Dash not followed by end of comment.
    333                 .     '[^\-]*+' // Consume non-dashes.
    334                 . ')*+'         // Loop possessively.
    335                 . '(?:-->)?';   // End of comment. If not found, match all input.
    336 
    337         $regex =
    338                   '/('                   // Capture the entire match.
    339                 .     '<'                // Find start of element.
    340                 .     '(?(?=!--)'        // Is this a comment?
    341                 .         $comment_regex // Find end of comment.
    342                 .     '|'
    343                 .         '[^>]*>?'      // Find end of element. If not found, match all input.
    344                 .     ')'
    345                 . ')/s';
    346 
    347         $textarr = preg_split( $regex, $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
     328        $textarr = wp_html_split( $content );
    348329
    349330        foreach ( $textarr as &$element ) {
    350                 if ( '<' !== $element[0] ) {
     331                if ( '' == $element || '<' !== $element[0] ) {
    351332                        continue;
    352333                }
    … …  
    363344                }
    364345
    365                 if ( $ignore_html || '<!--' === substr( $element, 0, 4 ) ) {
     346                if ( $ignore_html || '<!--' === substr( $element, 0, 4 ) || '<![CDATA[' === substr( $element, 0, 9 ) ) {
    366347                        // Encode all [ and ] chars.
    367348                        $element = strtr( $element, $trans );
Note: See TracChangeset for help on using the changeset viewer.