mirror of
git://develop.git.wordpress.org/
synced 2025-03-15 09:29:48 +01:00
Shortcodes: don't allow unclosed HTML elements in attributes
Merges [34134] for 4.3 branch git-svn-id: https://develop.svn.wordpress.org/branches/4.3@34144 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
456d7625f3
commit
1ef7a790b5
@ -863,6 +863,8 @@ function img_caption_shortcode( $attr, $content = null ) {
|
||||
$content = $matches[1];
|
||||
$attr['caption'] = trim( $matches[2] );
|
||||
}
|
||||
} elseif ( strpos( $attr['caption'], '<' ) !== false ) {
|
||||
$attr['caption'] = wp_kses( $attr['caption'], 'post' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -462,6 +462,15 @@ function shortcode_parse_atts($text) {
|
||||
elseif (isset($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 {
|
||||
$atts = ltrim($text);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user