X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/11be15bd505d66a91e2c80062190b13e315a04a9..e3ff8f35458a959c1879c0a4976701ed8dcfe651:/wp-admin/includes/nav-menu.php diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index 7e9fe6ad..a6aac330 100644 --- a/wp-admin/includes/nav-menu.php +++ b/wp-admin/includes/nav-menu.php @@ -1,289 +1,17 @@ $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; - - $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; - - ob_start(); - $item_id = esc_attr( $item->ID ); - $removed_args = array( - 'action', - 'customlink-tab', - 'edit-menu-item', - 'menu-item', - 'page-tab', - '_wpnonce', - ); - - $original_title = ''; - if ( 'taxonomy' == $item->type ) { - $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' ); - if ( is_wp_error( $original_title ) ) - $original_title = false; - } elseif ( 'post_type' == $item->type ) { - $original_object = get_post( $item->object_id ); - $original_title = $original_object->post_title; - } - - $classes = array( - 'menu-item menu-item-depth-' . $depth, - 'menu-item-' . esc_attr( $item->object ), - 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive'), - ); - - $title = $item->title; - - if ( ! empty( $item->_invalid ) ) { - $classes[] = 'menu-item-invalid'; - /* translators: %s: title of menu item which is invalid */ - $title = sprintf( __( '%s (Invalid)' ), $item->title ); - } elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) { - $classes[] = 'pending'; - /* translators: %s: title of menu item in draft status */ - $title = sprintf( __('%s (Pending)'), $item->title ); - } - - $title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label; - - $submenu_text = ''; - if ( 0 == $depth ) - $submenu_text = 'style="display: none;"'; - - ?> -
' . __('The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.') . '
'; - return; - } - - $locations = get_registered_nav_menus(); - $menus = wp_get_nav_menus(); - $menu_locations = get_nav_menu_locations(); - $num_locations = count( array_keys($locations) ); - - echo '' . _n( 'Select a menu to use within your theme.', 'Select the menus you will use in your theme.', $num_locations ) . '
'; - - foreach ( $locations as $location => $description ) { - ?> -- -
- - -- + + - 'submit-quick-search-posttype-' . $post_type_name ) ); ?> + 'submit-quick-search-posttype-' . $post_type_name ) ); ?>
- + + - 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?> + 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?>
' . __( 'Add menu items from the column on the left.' ) . '
'; $result .= ''; - if( empty($menu_items) ) + if ( empty($menu_items) ) return $result . ' '; + /** + * Filters the Walker class used when adding nav menu items. + * + * @since 3.0.0 + * + * @param string $class The walker class to use. Default 'Walker_Nav_Menu_Edit'. + * @param int $menu_id ID of the menu being rendered. + */ $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id ); - if ( class_exists( $walker_class_name ) ) + if ( class_exists( $walker_class_name ) ) { $walker = new $walker_class_name; - else - return new WP_Error( 'menu_walker_not_exist', sprintf( __('The Walker class named %s does not exist.'), $walker_class_name ) ); + } else { + return new WP_Error( 'menu_walker_not_exist', + /* translators: %s: walker class name */ + sprintf( __( 'The Walker class named %s does not exist.' ), + '' . $walker_class_name . '' + ) + ); + } $some_pending_menu_items = $some_invalid_menu_items = false; - foreach( (array) $menu_items as $menu_item ) { + foreach ( (array) $menu_items as $menu_item ) { if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status ) $some_pending_menu_items = true; if ( ! empty( $menu_item->_invalid ) ) $some_invalid_menu_items = true; } - if ( $some_pending_menu_items ) - $result .= '' . __('Click Save Menu to make pending menu items public.') . '
' . __( 'Click Save Menu to make pending menu items public.' ) . '
' . __('There are some invalid menu items. Please check or delete them.') . '
' . __( 'There are some invalid menu items. Please check or delete them.' ) . '