_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.' );
returnarray(); // Sorry, folks.
}
}
/**
* @access public
*/
publicfunctioninitialize() {
$this->user = newstdClass;
if ( is_user_logged_in() ) {
/* Populate settings we need for the menu based on the current user. */
_deprecated_argument( __METHOD__, $version, sprintf( 'Use <code>%s</code> as the parent for the <code>%s</code> admin bar node instead of <code>%s</code>.', $new_parent, $args['id'], $args['parent'] ) );
$args['parent'] = $new_parent;
}
$this->_set_node( $args );
}
/**
* @param array $args
*/
finalprotectedfunction_set_node( $args ) {
$this->nodes[ $args['id'] ] = (object) $args;
}
/**
* Gets a node.
*
* @param string $id
* @return object Node.
*/
finalpublicfunctionget_node( $id ) {
if ( $node = $this->_get_node( $id ) )
returnclone$node;
}
/**
* @param string $id
* @return object|void
*/
finalprotectedfunction_get_node( $id ) {
if ( $this->bound )
return;
if ( empty( $id ) )
$id = 'root';
if ( isset( $this->nodes[ $id ] ) )
return$this->nodes[ $id ];
}
/**
* @return array|void
*/
finalpublicfunctionget_nodes() {
if ( ! $nodes = $this->_get_nodes() )
return;
foreach ( $nodesas &$node ) {
$node = clone$node;
}
return$nodes;
}
/**
* @return array|void
*/
finalprotectedfunction_get_nodes() {
if ( $this->bound )
return;
return$this->nodes;
}
/**
* Add a group to a menu node.
*
* @since 3.3.0
*
* @param array $args {
* Array of arguments for adding a group.
*
* @type string $id ID of the item.
* @type string $parent Optional. ID of the parent node. Default 'root'.
* @type array $meta Meta data for the group including the following keys:
* 'class', 'onclick', 'target', and 'title'.
* }
*/
finalpublicfunctionadd_group( $args ) {
$args['group'] = true;
$this->add_node( $args );
}
/**
* Remove a node.
*
* @param string $id The ID of the item.
*/
publicfunctionremove_node( $id ) {
$this->_unset_node( $id );
}
/**
* @param string $id
*/
finalprotectedfunction_unset_node( $id ) {
unset( $this->nodes[ $id ] );
}
/**
* @access public
*/
publicfunctionrender() {
$root = $this->_bind();
if ( $root )
$this->_render( $root );
}
/**
* @return object|void
*/
finalprotectedfunction_bind() {
if ( $this->bound )
return;
// Add the root node.
// Clear it first, just in case. Don't mess with The Root.
$this->remove_node( 'root' );
$this->add_node( array(
'id' => 'root',
'group' => false,
) );
// Normalize nodes: define internal 'children' and 'type' properties.