mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-14 14:45:45 +01:00
Shortcodes: don't allow unclosed HTML elements in attributes
Merges [34134] for 3.7 branch Built from https://develop.svn.wordpress.org/branches/3.7@34150 git-svn-id: http://core.svn.wordpress.org/branches/3.7@34118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
24a1b34acc
commit
82dac61d61
@ -634,6 +634,8 @@ function img_caption_shortcode($attr, $content = null) {
|
|||||||
$content = $matches[1];
|
$content = $matches[1];
|
||||||
$attr['caption'] = trim( $matches[2] );
|
$attr['caption'] = trim( $matches[2] );
|
||||||
}
|
}
|
||||||
|
} elseif ( strpos( $attr['caption'], '<' ) !== false ) {
|
||||||
|
$attr['caption'] = wp_kses( $attr['caption'], 'post' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow plugins/themes to override the default caption template.
|
// Allow plugins/themes to override the default caption template.
|
||||||
|
@ -448,6 +448,15 @@ function shortcode_parse_atts($text) {
|
|||||||
elseif (isset($m[8]))
|
elseif (isset($m[8]))
|
||||||
$atts[] = stripcslashes($m[8]);
|
$atts[] = stripcslashes($m[8]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reject any unclosed HTML elements
|
||||||
|
foreach( $atts as &$value ) {
|
||||||
|
if ( false !== strpos( $value, '<' ) ) {
|
||||||
|
if ( 1 !== preg_match( '/^[^<]*+(?:<[^>]*+>[^<]*+)*+$/', $value ) ) {
|
||||||
|
$value = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$atts = ltrim($text);
|
$atts = ltrim($text);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user