Make WordPress Core

Ticket #35022: 35022.2.patch

File 35022.2.patch, 2.2 KB (added by gitlost, 9 years ago)

Change shortcode regex in wptexturize() as well.

  • src/wp-includes/formatting.php

     
    216216
    217217        // Look for shortcodes and HTML elements.
    218218
    219         preg_match_all( '@\[/?([^<>&/\[\]\x00-\x20=]++)@', $text, $matches );
     219        preg_match_all( '@\[/?([^' . WP_SHORTCODE_NAME_TERMINATORS  . ']++)@u', $text, $matches );
    220220        $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
    221221        $found_shortcodes = ! empty( $tagnames );
    222222        $shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex( $tagnames ) : '';
  • src/wp-includes/shortcodes.php

     
    4141 */
    4242$shortcode_tags = array();
    4343
     44define( 'WP_SHORTCODE_NAME_TERMINATORS', '<>&\/\[\]\x00-\x20=\x{00a0}' );
     45
    4446/**
    4547 * Add hook for shortcode tag.
    4648 *
     
    9597                return;
    9698        }
    9799
    98         if ( 0 !== preg_match( '@[<>&/\[\]\x00-\x20=]@', $tag ) ) {
     100        if ( 0 !== preg_match( '@[' . WP_SHORTCODE_NAME_TERMINATORS . ']@u', $tag ) ) {
    99101                /* translators: 1: shortcode name, 2: space separated list of reserved characters */
    100102                $message = sprintf( __( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ), $tag, '& / < > [ ] =' );
    101103                _doing_it_wrong( __FUNCTION__, $message, '4.4.0' );
     
    210212                return $content;
    211213
    212214        // Find all registered tag names in $content.
    213         preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );
     215        preg_match_all( '@\[([^' . WP_SHORTCODE_NAME_TERMINATORS . ']++)@u', $content, $matches );
    214216        $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
    215217
    216218        if ( empty( $tagnames ) ) {
     
    578580                return $content;
    579581
    580582        // Find all registered tag names in $content.
    581         preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );
     583        preg_match_all( '@\[([^' . WP_SHORTCODE_NAME_TERMINATORS . ']++)@u', $content, $matches );
    582584        $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
    583585
    584586        if ( empty( $tagnames ) ) {