KSES: Allow the download
attribute on <a>
tags.
To avoid this being a vector for bypassing the filetypes that are allowed to be uploaded, this attribute is only allowed to be added without a value. Merges [43813] from the 5.0 branch to trunk. Props kalpshit, arshidkv12, welcher, peterwilsoncc, marina_wp, pento. Fixes #44724. git-svn-id: https://develop.svn.wordpress.org/trunk@44156 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
466ec7483a
commit
524f5be4c6
@ -66,6 +66,9 @@ if ( ! CUSTOM_TAGS ) {
|
||||
'rev' => true,
|
||||
'name' => true,
|
||||
'target' => true,
|
||||
'download' => array(
|
||||
'valueless' => 'y',
|
||||
),
|
||||
),
|
||||
'abbr' => array(),
|
||||
'acronym' => array(),
|
||||
|
@ -46,11 +46,18 @@ class Tests_Kses extends WP_UnitTestCase {
|
||||
'rev' => 'revision',
|
||||
'name' => 'name',
|
||||
'target' => '_blank',
|
||||
'download' => '',
|
||||
);
|
||||
|
||||
foreach ( $attributes as $name => $value ) {
|
||||
$string = "<a $name='$value'>I link this</a>";
|
||||
$expect_string = "<a $name='" . trim( $value, ';' ) . "'>I link this</a>";
|
||||
if ( $value ) {
|
||||
$attr = "$name='$value'";
|
||||
$expected_attr = "$name='" . trim( $value, ';' ) . "'";
|
||||
} else {
|
||||
$attr = $expected_attr = $name;
|
||||
}
|
||||
$string = "<a $attr>I link this</a>";
|
||||
$expect_string = "<a $expected_attr>I link this</a>";
|
||||
$this->assertEquals( $expect_string, wp_kses( $string, $allowedposttags ) );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user