]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/class-wp-admin-bar.php
WordPress 4.5
[autoinstalls/wordpress.git] / wp-includes / class-wp-admin-bar.php
index f40210085e7fce594da5c2403df5002817c0bec9..b89c6542dd6d5f52d5caaf130b6ea7a5e084c975 100644 (file)
@@ -96,7 +96,11 @@ class WP_Admin_Bar {
        }
 
        /**
-        * Add a node to the menu.
+        * Adds a node to the menu.
+        *
+        * @since 3.1.0
+        * @since 4.5.0 Added the ability to pass 'lang' and 'dir' meta data.
+        * @access public
         *
         * @param array $args {
         *     Arguments for adding a node.
@@ -106,7 +110,7 @@ class WP_Admin_Bar {
         *     @type string $parent Optional. ID of the parent node.
         *     @type string $href   Optional. Link for the item.
         *     @type bool   $group  Optional. Whether or not the node is a group. Default false.
-        *     @type array  $meta   Meta data including the following keys: 'html', 'class', 'rel',
+        *     @type array  $meta   Meta data including the following keys: 'html', 'class', 'rel', 'lang', 'dir',
         *                          'onclick', 'target', 'title', 'tabindex'. Default empty.
         * }
         */
@@ -506,12 +510,24 @@ class WP_Admin_Bar {
                                if ( ! empty( $node->meta['rel'] ) ) :
                                        ?> rel="<?php echo esc_attr( $node->meta['rel'] ); ?>"<?php
                                endif;
+                               if ( ! empty( $node->meta['lang'] ) ) :
+                                       ?> lang="<?php echo esc_attr( $node->meta['lang'] ); ?>"<?php
+                               endif;
+                               if ( ! empty( $node->meta['dir'] ) ) :
+                                       ?> dir="<?php echo esc_attr( $node->meta['dir'] ); ?>"<?php
+                               endif;
                                ?>><?php
                        else:
                                ?><div class="ab-item ab-empty-item" <?php echo $aria_attributes;
                                if ( ! empty( $node->meta['title'] ) ) :
                                        ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php
                                endif;
+                               if ( ! empty( $node->meta['lang'] ) ) :
+                                       ?> lang="<?php echo esc_attr( $node->meta['lang'] ); ?>"<?php
+                               endif;
+                               if ( ! empty( $node->meta['dir'] ) ) :
+                                       ?> dir="<?php echo esc_attr( $node->meta['dir'] ); ?>"<?php
+                               endif;
                                ?>><?php
                        endif;