Shortcodes: don't allow unclosed HTML elements in attributes
Built from https://develop.svn.wordpress.org/trunk@34134 git-svn-id: http://core.svn.wordpress.org/trunk@34102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
097c4fd2f4
commit
3778cae8ec
|
@ -870,6 +870,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' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -462,6 +462,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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-34133';
|
$wp_version = '4.4-alpha-34134';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue