Toolbar: Properly escape the onclick attribute.
The onclick attribute was being escaped twice, once with `esc_js` and again with `esc_attr`. Fixes #48117. Props tmatsuur, dinhtungdu. Built from https://develop.svn.wordpress.org/trunk@46734 git-svn-id: http://core.svn.wordpress.org/trunk@46534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3a735ec87a
commit
ba7170de9c
|
@ -550,16 +550,19 @@ class WP_Admin_Bar {
|
|||
if ( $has_link ) {
|
||||
$attributes = array( 'onclick', 'target', 'title', 'rel', 'lang', 'dir' );
|
||||
echo "<a class='ab-item'$aria_attributes href='" . esc_url( $node->href ) . "'";
|
||||
if ( ! empty( $node->meta['onclick'] ) ) {
|
||||
echo ' onclick="' . esc_js( $node->meta['onclick'] ) . '"';
|
||||
}
|
||||
} else {
|
||||
$attributes = array( 'onclick', 'target', 'title', 'rel', 'lang', 'dir' );
|
||||
echo '<div class="ab-item ab-empty-item"' . $aria_attributes;
|
||||
}
|
||||
|
||||
foreach ( $attributes as $attribute ) {
|
||||
if ( ! empty( $node->meta[ $attribute ] ) ) {
|
||||
if ( empty( $node->meta[ $attribute ] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( 'onclick' === $attribute ) {
|
||||
echo " $attribute='" . esc_js( $node->meta[ $attribute ] ) . "'";
|
||||
} else {
|
||||
echo " $attribute='" . esc_attr( $node->meta[ $attribute ] ) . "'";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.4-alpha-46733';
|
||||
$wp_version = '5.4-alpha-46734';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue