mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-02 05:31:25 +01:00
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. Props aaroncampbell. Fixes #34939 for trunk. Built from https://develop.svn.wordpress.org/trunk@36097 git-svn-id: http://core.svn.wordpress.org/trunk@36062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
67c5150ba6
commit
2038a29352
@ -216,7 +216,7 @@ function wptexturize( $text, $reset = false ) {
|
|||||||
|
|
||||||
// Look for shortcodes and HTML elements.
|
// 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] );
|
$tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
|
||||||
$found_shortcodes = ! empty( $tagnames );
|
$found_shortcodes = ! empty( $tagnames );
|
||||||
$shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex( $tagnames ) : '';
|
$shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex( $tagnames ) : '';
|
||||||
|
@ -95,9 +95,9 @@ function add_shortcode($tag, $func) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 0 !== preg_match( '@[<>&/\[\]\x00-\x20]@', $tag ) ) {
|
if ( 0 !== preg_match( '@[<>&/\[\]\x00-\x20=]@', $tag ) ) {
|
||||||
/* translators: %s: shortcode name */
|
/* translators: 1: shortcode name, 2: space separated list of reserved characters */
|
||||||
$message = sprintf( __( 'Invalid shortcode name: %s. Do not use spaces or reserved characters: & / < > [ ]' ), $tag );
|
$message = sprintf( __( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ), $tag, '& / < > [ ] =' );
|
||||||
_doing_it_wrong( __FUNCTION__, $message, '4.4.0' );
|
_doing_it_wrong( __FUNCTION__, $message, '4.4.0' );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ function do_shortcode( $content, $ignore_html = false ) {
|
|||||||
return $content;
|
return $content;
|
||||||
|
|
||||||
// Find all registered tag names in $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] );
|
$tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
|
||||||
|
|
||||||
if ( empty( $tagnames ) ) {
|
if ( empty( $tagnames ) ) {
|
||||||
@ -578,7 +578,7 @@ function strip_shortcodes( $content ) {
|
|||||||
return $content;
|
return $content;
|
||||||
|
|
||||||
// Find all registered tag names in $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] );
|
$tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
|
||||||
|
|
||||||
if ( empty( $tagnames ) ) {
|
if ( empty( $tagnames ) ) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.5-alpha-36096';
|
$wp_version = '4.5-alpha-36097';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user