Make WordPress Core

Ticket #41057: 41057.diff

File 41057.diff, 4.2 KB (added by pento, 7 years ago)
  • src/wp-includes/class-wp-admin-bar.php

     
    434434                if ( $node->type != 'container' || empty( $node->children ) )
    435435                        return;
    436436
    437                 ?><div id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>" class="ab-group-container"><?php
    438                         foreach ( $node->children as $group ) {
    439                                 $this->_render_group( $group );
    440                         }
    441                 ?></div><?php
     437                echo '<div id="' . esc_attr( 'wp-admin-bar-' . $node->id ) . '" class="ab-group-container">';
     438                foreach ( $node->children as $group ) {
     439                        $this->_render_group( $group );
     440                }
     441                echo '</div>';
    442442        }
    443443
    444444        /**
     
    457457                else
    458458                        $class = '';
    459459
    460                 ?><ul id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $class; ?>><?php
    461                         foreach ( $node->children as $item ) {
    462                                 $this->_render_item( $item );
    463                         }
    464                 ?></ul><?php
     460                echo "<ul id='" . esc_attr( 'wp-admin-bar-' . $node->id ) . "'$class>";
     461                foreach ( $node->children as $item ) {
     462                        $this->_render_item( $item );
     463                }
     464                echo '</ul>';
    465465        }
    466466
    467467        /**
     
    491491                if ( $menuclass )
    492492                        $menuclass = ' class="' . esc_attr( trim( $menuclass ) ) . '"';
    493493
    494                 ?>
     494                echo "<li id='" . esc_attr( 'wp-admin-bar-' . $node->id ) . "'$menuclass>";
    495495
    496                 <li id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $menuclass; ?>><?php
    497                         if ( $has_link ):
    498                                 ?><a class="ab-item"<?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php
    499                                         if ( ! empty( $node->meta['onclick'] ) ) :
    500                                                 ?> onclick="<?php echo esc_js( $node->meta['onclick'] ); ?>"<?php
    501                                         endif;
    502                                 if ( ! empty( $node->meta['target'] ) ) :
    503                                         ?> target="<?php echo esc_attr( $node->meta['target'] ); ?>"<?php
    504                                 endif;
    505                                 if ( ! empty( $node->meta['title'] ) ) :
    506                                         ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php
    507                                 endif;
    508                                 if ( ! empty( $node->meta['rel'] ) ) :
    509                                         ?> rel="<?php echo esc_attr( $node->meta['rel'] ); ?>"<?php
    510                                 endif;
    511                                 if ( ! empty( $node->meta['lang'] ) ) :
    512                                         ?> lang="<?php echo esc_attr( $node->meta['lang'] ); ?>"<?php
    513                                 endif;
    514                                 if ( ! empty( $node->meta['dir'] ) ) :
    515                                         ?> dir="<?php echo esc_attr( $node->meta['dir'] ); ?>"<?php
    516                                 endif;
    517                                 ?>><?php
    518                         else:
    519                                 ?><div class="ab-item ab-empty-item"<?php echo $aria_attributes;
    520                                 if ( ! empty( $node->meta['title'] ) ) :
    521                                         ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php
    522                                 endif;
    523                                 if ( ! empty( $node->meta['lang'] ) ) :
    524                                         ?> lang="<?php echo esc_attr( $node->meta['lang'] ); ?>"<?php
    525                                 endif;
    526                                 if ( ! empty( $node->meta['dir'] ) ) :
    527                                         ?> dir="<?php echo esc_attr( $node->meta['dir'] ); ?>"<?php
    528                                 endif;
    529                                 ?>><?php
    530                         endif;
    531 
    532                         echo $node->title;
    533 
    534                         if ( $has_link ) :
    535                                 ?></a><?php
    536                         else:
    537                                 ?></div><?php
    538                         endif;
    539 
    540                         if ( $is_parent ) :
    541                                 ?><div class="ab-sub-wrapper"><?php
    542                                         foreach ( $node->children as $group ) {
    543                                                 $this->_render_group( $group );
    544                                         }
    545                                 ?></div><?php
    546                         endif;
     496                if ( $has_link ) {
     497                        $attributes = array( 'onclick', 'target', 'title', 'rel', 'lang', 'dir' );
     498                        echo "<a class='ab-item'$aria_attributes href='" . esc_url( $node->href ) . "'>";
     499                        if ( ! empty( $node->meta['onclick'] ) ) {
     500                                echo ' onclick="' . esc_js( $node->meta['onclick'] ) . '"';
     501                        }
     502                } else {
     503                        $attributes = array( 'onclick', 'target', 'title', 'rel', 'lang', 'dir' );
     504                        echo '<div class="ab-item ab-empty-item"' . $aria_attributes;
     505                }
     506
     507                foreach ( $attributes as $attribute ) {
     508                        if ( ! empty( $node->meta[ $attribute ] ) ) {
     509                                echo " $attribute='" . esc_attr( $node->meta[ $attribute ] ) . '"';
     510                        }
     511                }
    547512
    548                         if ( ! empty( $node->meta['html'] ) )
    549                                 echo $node->meta['html'];
     513                echo ">{$node->title}";
     514
     515                if ( $has_link ) {
     516                        echo '</a>';
     517                } else {
     518                        echo '</div>';
     519                }
     520
     521                if ( $is_parent ) {
     522                        echo '<div class="ab-sub-wrapper">';
     523                        foreach ( $node->children as $group ) {
     524                                $this->_render_group( $group );
     525                        }
     526                        echo '</div>';
     527                }
     528
     529                if ( ! empty( $node->meta['html'] ) ) {
     530                        echo $node->meta['html'];
     531                }
    550532
    551                         ?>
    552                 </li><?php
     533                echo '</li>';
    553534        }
    554535
    555536        /**