Shortcodes: don't allow unclosed HTML elements in attributes
Merges [34134] for 3.9 branch Built from https://develop.svn.wordpress.org/branches/3.9@34148 git-svn-id: http://core.svn.wordpress.org/branches/3.9@34116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0c61562bf5
commit
008ebcfae7
|
@ -801,6 +801,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' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -458,6 +458,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…
Reference in New Issue