diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-includes/class-wp-admin-bar.php --- a/wp/wp-includes/class-wp-admin-bar.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-includes/class-wp-admin-bar.php Fri Sep 05 18:40:08 2025 +0200 @@ -12,27 +12,21 @@ * * @since 3.1.0 */ +#[AllowDynamicProperties] class WP_Admin_Bar { private $nodes = array(); private $bound = false; public $user; /** - * @since 3.3.0 + * Deprecated menu property. * - * @param string $name - * @return string|array|void + * @since 3.1.0 + * @deprecated 3.3.0 Modify admin bar nodes with WP_Admin_Bar::get_node(), + * WP_Admin_Bar::add_node(), and WP_Admin_Bar::remove_node(). + * @var array */ - public function __get( $name ) { - switch ( $name ) { - case 'proto': - return is_ssl() ? 'https://' : 'http://'; - - case 'menu': - _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 menu property.' ); - return array(); // Sorry, folks. - } - } + public $menu = array(); /** * Initializes the admin bar. @@ -40,7 +34,7 @@ * @since 3.1.0 */ public function initialize() { - $this->user = new stdClass; + $this->user = new stdClass(); if ( is_user_logged_in() ) { /* Populate settings we need for the menu based on the current user. */ @@ -113,6 +107,7 @@ * * @since 3.1.0 * @since 4.5.0 Added the ability to pass 'lang' and 'dir' meta data. + * @since 6.5.0 Added the ability to pass 'menu_title' for an ARIA menu name. * * @param array $args { * Arguments for adding a node. @@ -123,7 +118,7 @@ * @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', 'lang', 'dir', - * 'onclick', 'target', 'title', 'tabindex'. Default empty. + * 'onclick', 'target', 'title', 'tabindex', 'menu_title'. Default empty. * } */ public function add_node( $args ) { @@ -319,8 +314,10 @@ return; } - // Add the root node. - // Clear it first, just in case. Don't mess with The Root. + /* + * Add the root node. + * Clear it first, just in case. Don't mess with The Root. + */ $this->remove_node( 'root' ); $this->add_node( array( @@ -368,11 +365,15 @@ $default_id = $parent->id . '-default'; $default = $this->_get_node( $default_id ); - // The default group is added here to allow groups that are - // added before standard menu items to render first. + /* + * The default group is added here to allow groups that are + * added before standard menu items to render first. + */ if ( ! $default ) { - // Use _set_node because add_node can be overloaded. - // Make sure to specify default settings for all properties. + /* + * Use _set_node because add_node can be overloaded. + * Make sure to specify default settings for all properties. + */ $this->_set_node( array( 'id' => $default_id, @@ -391,16 +392,20 @@ } $parent = $default; - // Groups in groups aren't allowed. Add a special 'container' node. - // The container will invisibly wrap both groups. + /* + * Groups in groups aren't allowed. Add a special 'container' node. + * The container will invisibly wrap both groups. + */ } elseif ( 'group' === $parent->type && 'group' === $node->type ) { $container_id = $parent->id . '-container'; $container = $this->_get_node( $container_id ); // We need to create a container for this group, life is sad. if ( ! $container ) { - // Use _set_node because add_node can be overloaded. - // Make sure to specify default settings for all properties. + /* + * Use _set_node because add_node can be overloaded. + * Make sure to specify default settings for all properties. + */ $this->_set_node( array( 'id' => $container_id, @@ -453,8 +458,10 @@ * @param object $root */ final protected function _render( $root ) { - // Add browser classes. - // We have to do this here since admin bar shows on the front end. + /* + * Add browser classes. + * We have to do this here since admin bar shows on the front end. + */ $class = 'nojq nojs'; if ( wp_is_mobile() ) { $class .= ' mobile'; @@ -472,9 +479,6 @@ } ?> - - - type ) { $this->_render_container( $node ); return; @@ -517,7 +523,11 @@ $class = ''; } - echo "