Shortcodes: Trim whitespace after sanitizing the shortcode output.

props Ankit K Gupta, obenland, miqrogroove.
fixes #33259.

git-svn-id: https://develop.svn.wordpress.org/trunk@33600 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
ocean90 2015-08-09 20:48:02 +00:00
parent 3f7b1ca2ff
commit 239759914f
2 changed files with 9 additions and 1 deletions

View File

@ -399,7 +399,7 @@ function do_shortcodes_in_html_tags( $content, $ignore_html ) {
if ( $count > 0 ) {
// Sanitize the shortcode output using KSES.
$new_attr = wp_kses_one_attr( $new_attr, $elname );
if ( '' !== $new_attr ) {
if ( '' !== trim( $new_attr ) ) {
// The shortcode is safe to use now.
$attr = $new_attr;
}

View File

@ -418,6 +418,14 @@ EOF;
'<!--[if lt IE 7]>',
'<!--[if lt IE 7]>',
),
array(
'1 <a href="[test-shortcode-tag]"> 2 <a href="[test-shortcode-tag]" >',
'1 <a href=""> 2 <a href="" >',
),
array(
'1 <a noise="[test-shortcode-tag]"> 2 <a noise=" [test-shortcode-tag] " >',
'1 <a noise="[test-shortcode-tag]"> 2 <a noise=" [test-shortcode-tag] " >',
),
array(
'[gallery title="<div>hello</div>"]',
'',