X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/fa11948979fd6a4ea5705dc613b239699a459db3..refs/tags/wordpress-4.4:/wp-includes/class-wp-admin-bar.php?ds=sidebyside diff --git a/wp-includes/class-wp-admin-bar.php b/wp-includes/class-wp-admin-bar.php index d35886d4..f4021008 100644 --- a/wp-includes/class-wp-admin-bar.php +++ b/wp-includes/class-wp-admin-bar.php @@ -1,29 +1,40 @@ menu property.' ); return array(); // Sorry, folks. - break; } } + /** + * @access public + */ public function initialize() { $this->user = new stdClass; @@ -70,10 +81,16 @@ class WP_Admin_Bar { do_action( 'admin_bar_init' ); } + /** + * @param array $node + */ public function add_menu( $node ) { $this->add_node( $node ); } + /** + * @param string $id + */ public function remove_menu( $id ) { $this->remove_node( $id ); } @@ -81,13 +98,17 @@ class WP_Admin_Bar { /** * Add a node to the menu. * - * @param array $args - The arguments for each node. - * - id - string - The ID of the item. - * - title - string - The title of the node. - * - parent - string - The ID of the parent node. Optional. - * - href - string - The link for the item. Optional. - * - group - boolean - If the node is a group. Optional. Default false. - * - meta - array - Meta data including the following keys: html, class, onclick, target, title, tabindex. + * @param array $args { + * Arguments for adding a node. + * + * @type string $id ID of the item. + * @type string $title Title of the node. + * @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', + * 'onclick', 'target', 'title', 'tabindex'. Default empty. + * } */ public function add_node( $args ) { // Shim for old method signature: add_node( $parent_id, $menu_obj, $args ) @@ -140,6 +161,9 @@ class WP_Admin_Bar { $this->_set_node( $args ); } + /** + * @param array $args + */ final protected function _set_node( $args ) { $this->nodes[ $args['id'] ] = (object) $args; } @@ -147,6 +171,7 @@ class WP_Admin_Bar { /** * Gets a node. * + * @param string $id * @return object Node. */ final public function get_node( $id ) { @@ -154,6 +179,10 @@ class WP_Admin_Bar { return clone $node; } + /** + * @param string $id + * @return object|void + */ final protected function _get_node( $id ) { if ( $this->bound ) return; @@ -165,6 +194,9 @@ class WP_Admin_Bar { return $this->nodes[ $id ]; } + /** + * @return array|void + */ final public function get_nodes() { if ( ! $nodes = $this->_get_nodes() ) return; @@ -175,6 +207,9 @@ class WP_Admin_Bar { return $nodes; } + /** + * @return array|void + */ final protected function _get_nodes() { if ( $this->bound ) return; @@ -187,10 +222,14 @@ class WP_Admin_Bar { * * @since 3.3.0 * - * @param array $args - The arguments for each node. - * - id - string - The ID of the item. - * - parent - string - The ID of the parent node. Optional. Default root. - * - meta - array - Meta data including the following keys: class, onclick, target, title. + * @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'. + * } */ final public function add_group( $args ) { $args['group'] = true; @@ -201,22 +240,31 @@ class WP_Admin_Bar { /** * Remove a node. * - * @param string The ID of the item. + * @param string $id The ID of the item. */ public function remove_node( $id ) { $this->_unset_node( $id ); } + /** + * @param string $id + */ final protected function _unset_node( $id ) { unset( $this->nodes[ $id ] ); } + /** + * @access public + */ public function render() { $root = $this->_bind(); if ( $root ) $this->_render( $root ); } + /** + * @return object|void + */ final protected function _bind() { if ( $this->bound ) return; @@ -338,6 +386,11 @@ class WP_Admin_Bar { return $root; } + /** + * + * @global bool $is_IE + * @param object $root + */ final protected function _render( $root ) { global $is_IE; @@ -356,9 +409,11 @@ class WP_Admin_Bar { } ?> -