Fix do_shortcode('<[shortcode]') edge case.

Props miqrogroove.

Merges [33499] to the 3.7 branch.
See #33116.


git-svn-id: https://develop.svn.wordpress.org/branches/3.7@33568 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2015-08-04 07:18:50 +00:00
parent 5f769dd707
commit f86b572d73
2 changed files with 17 additions and 0 deletions

View File

@ -345,6 +345,11 @@ function do_shortcodes_in_html_tags( $content, $ignore_html ) {
$attributes = wp_kses_attr_parse( $element );
if ( false === $attributes ) {
// Some plugins are doing things like [name] <[email]>.
if ( 1 === preg_match( '%^<\s*\[\[?[^\[\]]+\]%', $element ) ) {
$element = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $element );
}
// Looks like we found some crazy unfiltered HTML. Skipping it for sanity.
$element = strtr( $element, $trans );
continue;

View File

@ -404,6 +404,14 @@ EOF;
'<div [[gallery]]>',
'<div [gallery]>',
),
array(
'<[[gallery]]>',
'<[gallery]>',
),
array(
'<div style="background:url([[gallery]])">',
'<div style="background:url([[gallery]])">',
),
array(
'[gallery]<div>Hello</div>[/gallery]',
'',
@ -442,6 +450,10 @@ EOF;
'<div [[gallery]]>', // Shortcodes will never be stripped inside elements.
'<div [[gallery]]>',
),
array(
'<[[gallery]]>',
'<[[gallery]]>',
),
array(
'[gallery]<div>Hello</div>[/gallery]',
'',