~canonical-sysadmins/wordpress/4.8.1

« back to all changes in this revision

Viewing changes to wp-includes/class-wp-admin-bar.php

  • Committer: Barry Price
  • Date: 2016-08-17 04:49:28 UTC
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: barry.price@canonical.com-20160817044928-viijiwb4tl8jwzmp
new upstream release 4.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
                                return is_ssl() ? 'https://' : 'http://';
28
28
 
29
29
                        case 'menu' :
30
 
                                _deprecated_argument( 'WP_Admin_Bar', '3.3', 'Modify admin bar nodes with WP_Admin_Bar::get_node(), WP_Admin_Bar::add_node(), and WP_Admin_Bar::remove_node(), not the <code>menu</code> property.' );
 
30
                                _deprecated_argument( 'WP_Admin_Bar', '3.3.0', 'Modify admin bar nodes with WP_Admin_Bar::get_node(), WP_Admin_Bar::add_node(), and WP_Admin_Bar::remove_node(), not the <code>menu</code> property.' );
31
31
                                return array(); // Sorry, folks.
32
32
                }
33
33
        }
127
127
                        if ( empty( $args['title'] ) )
128
128
                                return;
129
129
 
130
 
                        _doing_it_wrong( __METHOD__, __( 'The menu ID should not be empty.' ), '3.3' );
 
130
                        _doing_it_wrong( __METHOD__, __( 'The menu ID should not be empty.' ), '3.3.0' );
131
131
                        // Deprecated: Generate an ID from the title.
132
132
                        $args['id'] = esc_attr( sanitize_title( trim( $args['title'] ) ) );
133
133
                }
477
477
                $is_parent = ! empty( $node->children );
478
478
                $has_link  = ! empty( $node->href );
479
479
 
480
 
                $tabindex = isset( $node->meta['tabindex'] ) ? (int) $node->meta['tabindex'] : '';
481
 
                $aria_attributes = $tabindex ? 'tabindex="' . $tabindex . '"' : '';
 
480
                // Allow only numeric values, then casted to integers, and allow a tabindex value of `0` for a11y.
 
481
                $tabindex = ( isset( $node->meta['tabindex'] ) && is_numeric( $node->meta['tabindex'] ) ) ? (int) $node->meta['tabindex'] : '';
 
482
                $aria_attributes = ( '' !== $tabindex ) ? ' tabindex="' . $tabindex . '"' : '';
482
483
 
483
484
                $menuclass = '';
484
485
 
497
498
 
498
499
                <li id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $menuclass; ?>><?php
499
500
                        if ( $has_link ):
500
 
                                ?><a class="ab-item" <?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php
 
501
                                ?><a class="ab-item"<?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php
501
502
                                        if ( ! empty( $node->meta['onclick'] ) ) :
502
503
                                                ?> onclick="<?php echo esc_js( $node->meta['onclick'] ); ?>"<?php
503
504
                                        endif;
518
519
                                endif;
519
520
                                ?>><?php
520
521
                        else:
521
 
                                ?><div class="ab-item ab-empty-item" <?php echo $aria_attributes;
 
522
                                ?><div class="ab-item ab-empty-item"<?php echo $aria_attributes;
522
523
                                if ( ! empty( $node->meta['title'] ) ) :
523
524
                                        ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php
524
525
                                endif;
559
560
         * @param object $node
560
561
         */
561
562
        public function recursive_render( $id, $node ) {
562
 
                _deprecated_function( __METHOD__, '3.3', 'WP_Admin_bar::render(), WP_Admin_Bar::_render_item()' );
 
563
                _deprecated_function( __METHOD__, '3.3.0', 'WP_Admin_bar::render(), WP_Admin_Bar::_render_item()' );
563
564
                $this->_render_item( $node );
564
565
        }
565
566