Make WordPress Core

Ticket #48117: 48117.diff

File 48117.diff, 1.1 KB (added by dinhtungdu, 5 years ago)
  • src/wp-includes/class-wp-admin-bar.php

     
    540540                if ( $has_link ) {
    541541                        $attributes = array( 'onclick', 'target', 'title', 'rel', 'lang', 'dir' );
    542542                        echo "<a class='ab-item'$aria_attributes href='" . esc_url( $node->href ) . "'";
    543                         if ( ! empty( $node->meta['onclick'] ) ) {
    544                                 echo ' onclick="' . esc_js( $node->meta['onclick'] ) . '"';
    545                         }
    546543                } else {
    547544                        $attributes = array( 'onclick', 'target', 'title', 'rel', 'lang', 'dir' );
    548545                        echo '<div class="ab-item ab-empty-item"' . $aria_attributes;
    549546                }
    550547
    551548                foreach ( $attributes as $attribute ) {
    552                         if ( ! empty( $node->meta[ $attribute ] ) ) {
     549                        if ( empty( $node->meta[ $attribute ] ) ) {
     550                                continue;
     551                        }
     552
     553                        if ( 'onclick' === $attribute ) {
     554                                echo " $attribute='" . esc_js( $node->meta[ $attribute ] ) . "'";
     555                        } else {
    553556                                echo " $attribute='" . esc_attr( $node->meta[ $attribute ] ) . "'";
    554557                        }
    555558                }