Ticket #37767: 37767.patch
File 37767.patch, 1.2 KB (added by , 8 years ago) |
---|
-
src/wp-includes/shortcodes.php
565 565 * @global array $shortcode_tags 566 566 * 567 567 * @param string $content Content to remove shortcode tags. 568 * @param array $tag_array (Optional) Array of tags to be stripped - will ignore global 568 569 * @return string Content without shortcode tags. 569 570 */ 570 function strip_shortcodes( $content ) {571 function strip_shortcodes( $content , $tag_array = false) { 571 572 global $shortcode_tags; 572 573 573 574 if ( false === strpos( $content, '[' ) ) { … … 577 578 if (empty($shortcode_tags) || !is_array($shortcode_tags)) 578 579 return $content; 579 580 580 // Find all registered tag names in $content. 581 // Find all registered tag names in $content. -- if Tag array is set, then use this instead of global 581 582 preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches ); 582 $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );583 $tagnames = array_intersect( array_keys( ( $tag_array !== false && is_array($tag_array) ? $tag_array : $shortcode_tags ) , $matches[1] ); 583 584 584 585 if ( empty( $tagnames ) ) { 585 586 return $content;