mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-07 22:24:36 +00:00
Shortcodes: Improve the reliablity of shortcodes inside HTML tags.
Props miqrogroove. See #15694. git-svn-id: https://develop.svn.wordpress.org/trunk@33359 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -403,6 +403,82 @@ EOF;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for bugginess using normal input with latest patches.
|
||||
*
|
||||
* @dataProvider data_escaping
|
||||
*/
|
||||
function test_escaping( $input, $output ) {
|
||||
return $this->assertEquals( $output, do_shortcode( $input ) );
|
||||
}
|
||||
|
||||
function data_escaping() {
|
||||
return array(
|
||||
array(
|
||||
'<!--[if lt IE 7]>',
|
||||
'<!--[if lt IE 7]>',
|
||||
),
|
||||
array(
|
||||
'[gallery title="<div>hello</div>"]',
|
||||
'',
|
||||
),
|
||||
array(
|
||||
'[caption caption="test" width="2"]<div>hello</div>[/caption]',
|
||||
'<div style="width: 12px" class="wp-caption alignnone"><div>hello</div><p class="wp-caption-text">test</p></div>',
|
||||
),
|
||||
array(
|
||||
'<div [gallery]>',
|
||||
'<div >',
|
||||
),
|
||||
array(
|
||||
'<div [[gallery]]>',
|
||||
'<div [gallery]>',
|
||||
),
|
||||
array(
|
||||
'[gallery]<div>Hello</div>[/gallery]',
|
||||
'',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for bugginess using normal input with latest patches.
|
||||
*
|
||||
* @dataProvider data_escaping2
|
||||
*/
|
||||
function test_escaping2( $input, $output ) {
|
||||
return $this->assertEquals( $output, strip_shortcodes( $input ) );
|
||||
}
|
||||
|
||||
function data_escaping2() {
|
||||
return array(
|
||||
array(
|
||||
'<!--[if lt IE 7]>',
|
||||
'<!--[if lt IE 7]>',
|
||||
),
|
||||
array(
|
||||
'[gallery title="<div>hello</div>"]',
|
||||
'',
|
||||
),
|
||||
array(
|
||||
'[caption caption="test" width="2"]<div>hello</div>[/caption]',
|
||||
'',
|
||||
),
|
||||
array(
|
||||
'<div [gallery]>', // Shortcodes will never be stripped inside elements.
|
||||
'<div [gallery]>',
|
||||
),
|
||||
array(
|
||||
'<div [[gallery]]>', // Shortcodes will never be stripped inside elements.
|
||||
'<div [[gallery]]>',
|
||||
),
|
||||
array(
|
||||
'[gallery]<div>Hello</div>[/gallery]',
|
||||
'',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 26343
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user