From dbb12be45a61ad06cb04b51b6b14bc081a1a0467 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sat, 26 Dec 2015 04:48:23 +0000 Subject: [PATCH] Shortcodes: `=` is a reserved character in shortcode names, mark it as such. This allows for shortcodes such as `[shortcode=attribute]` to work, which while never intentionally supported were widely used in the pre-shortcode days. Merges [36097] to the 4.4 branch, minus a string change. Props aaroncampbell. Fixes #34939. Built from https://develop.svn.wordpress.org/branches/4.4@36098 git-svn-id: http://core.svn.wordpress.org/branches/4.4@36063 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 2 +- wp-includes/shortcodes.php | 6 +++--- wp-includes/version.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index cb8e5ba590..8de0a1d4f2 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -216,7 +216,7 @@ function wptexturize( $text, $reset = false ) { // Look for shortcodes and HTML elements. - preg_match_all( '@\[/?([^<>&/\[\]\x00-\x20]++)@', $text, $matches ); + preg_match_all( '@\[/?([^<>&/\[\]\x00-\x20=]++)@', $text, $matches ); $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] ); $found_shortcodes = ! empty( $tagnames ); $shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex( $tagnames ) : ''; diff --git a/wp-includes/shortcodes.php b/wp-includes/shortcodes.php index 22f33c32ef..ab8c43337f 100644 --- a/wp-includes/shortcodes.php +++ b/wp-includes/shortcodes.php @@ -95,7 +95,7 @@ function add_shortcode($tag, $func) { return; } - if ( 0 !== preg_match( '@[<>&/\[\]\x00-\x20]@', $tag ) ) { + if ( 0 !== preg_match( '@[<>&/\[\]\x00-\x20=]@', $tag ) ) { /* translators: %s: shortcode name */ $message = sprintf( __( 'Invalid shortcode name: %s. Do not use spaces or reserved characters: & / < > [ ]' ), $tag ); _doing_it_wrong( __FUNCTION__, $message, '4.4.0' ); @@ -210,7 +210,7 @@ function do_shortcode( $content, $ignore_html = false ) { return $content; // Find all registered tag names in $content. - preg_match_all( '@\[([^<>&/\[\]\x00-\x20]++)@', $content, $matches ); + preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches ); $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] ); if ( empty( $tagnames ) ) { @@ -578,7 +578,7 @@ function strip_shortcodes( $content ) { return $content; // Find all registered tag names in $content. - preg_match_all( '@\[([^<>&/\[\]\x00-\x20]++)@', $content, $matches ); + preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches ); $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] ); if ( empty( $tagnames ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 6a2c77968f..69d5e7f91d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4.1-alpha-36082'; +$wp_version = '4.4.1-alpha-36098'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.