]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/shortcodes.php
WordPress 4.5
[autoinstalls/wordpress.git] / wp-includes / shortcodes.php
index 22f33c32efe3f201304802b5186bdcc19def7b4e..132d63a5dca10da426dfc91b76fdafe659ad2edf 100644 (file)
@@ -95,9 +95,9 @@ function add_shortcode($tag, $func) {
                return;
        }
 
-       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 );
+       if ( 0 !== preg_match( '@[<>&/\[\]\x00-\x20=]@', $tag ) ) {
+               /* translators: 1: shortcode name, 2: space separated list of reserved characters */
+               $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' );
                return;
        }
@@ -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 ) ) {
@@ -597,9 +597,12 @@ function strip_shortcodes( $content ) {
 }
 
 /**
+ * Strips a shortcode tag based on RegEx matches against post content.
  *
- * @param array $m
- * @return string|false
+ * @since 3.3.0
+ *
+ * @param array $m RegEx matches against post content.
+ * @return string|false The content stripped of the tag, otherwise false.
  */
 function strip_shortcode_tag( $m ) {
        // allow [[foo]] syntax for escaping a tag