diff --git a/src/wp-includes/nav-menu-template.php b/src/wp-includes/nav-menu-template.php index 5feac802f8..a0499fb9ea 100644 --- a/src/wp-includes/nav-menu-template.php +++ b/src/wp-includes/nav-menu-template.php @@ -195,6 +195,8 @@ class Walker_Nav_Menu extends Walker { * * @since 3.0.0 * + * @staticvar array $menu_id_slugs + * * @param array $args { * Optional. Array of nav menu arguments. * @@ -219,7 +221,7 @@ class Walker_Nav_Menu extends Walker { * @type string $items_wrap How the list items should be wrapped. Default is a ul with an id and class. * Uses printf() format with numbered placeholders. * } - * @return mixed Menu output if $echo is false, false if there are no items or no menu was found. + * @return object|false|void Menu output if $echo is false, false if there are no items or no menu was found. */ function wp_nav_menu( $args = array() ) { static $menu_id_slugs = array(); @@ -430,6 +432,9 @@ function wp_nav_menu( $args = array() ) { * @access private * @since 3.0.0 * + * @global WP_Query $wp_query + * @global WP_Rewrite $wp_rewrite + * * @param array $menu_items The current menu item objects to which to add the class property information. */ function _wp_menu_item_classes_by_context( &$menu_items ) { @@ -651,13 +656,17 @@ function _wp_menu_item_classes_by_context( &$menu_items ) { * * @uses Walker_Nav_Menu to create HTML list content. * @since 3.0.0 - * @see Walker::walk() for parameters and return description. + * + * @param array $items + * @param int $depth + * @param object $r + * @return string */ function walk_nav_menu_tree( $items, $depth, $r ) { $walker = ( empty($r->walker) ) ? new Walker_Nav_Menu : $r->walker; $args = array( $items, $depth, $r ); - return call_user_func_array( array($walker, 'walk'), $args ); + return call_user_func_array( array( $walker, 'walk' ), $args ); } /** @@ -665,11 +674,17 @@ function walk_nav_menu_tree( $items, $depth, $r ) { * * @since 3.0.1 * @access private + * + * @staticvar array $used_ids + * @param string $id + * @param object $item + * @return string */ function _nav_menu_item_id_use_once( $id, $item ) { static $_used_ids = array(); - if ( in_array( $item->ID, $_used_ids ) ) + if ( in_array( $item->ID, $_used_ids ) ) { return ''; + } $_used_ids[] = $item->ID; return $id; } diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu.php index 2c610e80da..88922ccdd1 100644 --- a/src/wp-includes/nav-menu.php +++ b/src/wp-includes/nav-menu.php @@ -13,7 +13,7 @@ * @since 3.0.0 * * @param string $menu Menu ID, slug, or name. - * @return mixed false if $menu param isn't supplied or term does not exist, menu object if successful. + * @return object|false False if $menu param isn't supplied or term does not exist, menu object if successful. */ function wp_get_nav_menu_object( $menu ) { if ( ! $menu ) @@ -65,6 +65,8 @@ function is_nav_menu( $menu ) { * * @since 3.0.0 * + * @global array $_wp_registered_nav_menus + * * @param array $locations Associative array of menu location identifiers (like a slug) and descriptive text. */ function register_nav_menus( $locations = array() ) { @@ -78,6 +80,8 @@ function register_nav_menus( $locations = array() ) { /** * Unregisters a navigation menu for a theme. * + * @global array $_wp_registered_nav_menus + * * @param string $location The menu location identifier. * @return bool True on success, false on failure. */ @@ -99,7 +103,7 @@ function unregister_nav_menu( $location ) { * * @since 3.0.0 * - * @param string $location Menu location identifier, like a slug. + * @param string $location Menu location identifier, like a slug. * @param string $description Menu location descriptive text. */ function register_nav_menu( $location, $description ) { @@ -109,6 +113,9 @@ function register_nav_menu( $location, $description ) { * Returns an array of all registered navigation menus in a theme * * @since 3.0.0 + * + * @global array $_wp_registered_nav_menus + * * @return array */ function get_registered_nav_menus() { @@ -134,6 +141,7 @@ function get_nav_menu_locations() { * Whether a registered nav menu location has a menu assigned to it. * * @since 3.0.0 + * * @param string $location Menu location identifier. * @return bool Whether location has a menu. */ @@ -220,7 +228,7 @@ function wp_delete_nav_menu( $menu ) { * * @since 3.0.0 * - * @param int $menu_id The ID of the menu or "0" to create a new menu. + * @param int $menu_id The ID of the menu or "0" to create a new menu. * @param array $menu_data The array of menu data. * @return int|WP_Error Menu ID on success, WP_Error object on failure. */ @@ -298,9 +306,9 @@ function wp_update_nav_menu_object( $menu_id = 0, $menu_data = array() ) { * * @since 3.0.0 * - * @param int $menu_id The ID of the menu. Required. If "0", makes the menu item a draft orphan. - * @param int $menu_item_db_id The ID of the menu item. If "0", creates a new menu item. - * @param array $menu_item_data The menu item's data. + * @param int $menu_id The ID of the menu. Required. If "0", makes the menu item a draft orphan. + * @param int $menu_item_db_id The ID of the menu item. If "0", creates a new menu item. + * @param array $menu_item_data The menu item's data. * @return int|WP_Error The menu item's database ID or WP_Error object on failure. */ function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array() ) { @@ -486,6 +494,8 @@ function wp_get_nav_menus( $args = array() ) { * @since 3.0.0 * @access private * + * @global string $_menu_item_sort_prop + * * @param object $a The first object to compare * @param object $b The second object to compare * @return int -1, 0, or 1 if $a is considered to be respectively less than, equal to, or greater than $b. @@ -522,10 +532,7 @@ function _sort_nav_menu_items( $a, $b ) { * @return bool False if invalid, otherwise true. */ function _is_valid_nav_menu_item( $item ) { - if ( ! empty( $item->_invalid ) ) - return false; - - return true; + return empty( $item->_invalid ); } /** @@ -533,9 +540,12 @@ function _is_valid_nav_menu_item( $item ) { * * @since 3.0.0 * + * @global string $_menu_item_sort_prop + * @staticvar array $fetched + * * @param string $menu Menu name, ID, or slug. * @param array $args Optional. Arguments to pass to {@see get_posts()}. - * @return mixed $items Array of menu items, otherwise false. + * @return false|array $items Array of menu items, otherwise false. */ function wp_get_nav_menu_items( $menu, $args = array() ) { $menu = wp_get_nav_menu_object( $menu ); @@ -782,9 +792,9 @@ function wp_setup_nav_menu_item( $menu_item ) { * * @since 3.0.0 * - * @param int $object_id The ID of the original object. + * @param int $object_id The ID of the original object. * @param string $object_type The type of object, such as "taxonomy" or "post_type." - * @param string $taxonomy If $object_type is "taxonomy", $taxonomy is the name of the tax that $object_id belongs to + * @param string $taxonomy If $object_type is "taxonomy", $taxonomy is the name of the tax that $object_id belongs to * @return array The array of menu item IDs; empty array if none; */ function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_type', $taxonomy = '' ) { @@ -868,8 +878,7 @@ function _wp_delete_tax_menu_item( $object_id = 0, $tt_id, $taxonomy ) { * * @param string $new_status The new status of the post object. * @param string $old_status The old status of the post object. - * @param object $post The post object being transitioned from one status to another. - * @return void + * @param object $post The post object being transitioned from one status to another. */ function _wp_auto_add_pages_to_menu( $new_status, $old_status, $post ) { if ( 'publish' != $new_status || 'publish' == $old_status || 'page' != $post->post_type )