X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/542cf06a610bc430421351ace7a2cc45f393b990..refs/tags/wordpress-3.3.1-scripts:/wp-admin/includes/nav-menu.php
diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php
index 8c8e9697..7c338027 100644
--- a/wp-admin/includes/nav-menu.php
+++ b/wp-admin/includes/nav-menu.php
@@ -13,7 +13,6 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
* @since 3.0.0
*
* @param string $output Passed by reference.
- * @param int $depth Depth of page.
*/
function start_lvl(&$output) {}
@@ -22,7 +21,6 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
* @since 3.0.0
*
* @param string $output Passed by reference.
- * @param int $depth Depth of page.
*/
function end_lvl(&$output) {
}
@@ -34,7 +32,6 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
* @param string $output Passed by reference. Used to append additional content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
- * @param int $current_page Menu item ID.
* @param object $args
*/
function start_el(&$output, $item, $depth, $args) {
@@ -57,6 +54,8 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
$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;
@@ -70,7 +69,11 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
$title = $item->title;
- if ( isset( $item->post_status ) && 'draft' == $item->post_status ) {
+ 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 );
@@ -85,7 +88,7 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
type_label ); ?>
-
+
↓
-
@@ -140,13 +143,10 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
-
+
-
-
+ target, '_blank' ); ?> />
+
@@ -164,13 +164,13 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
-
+
@@ -210,6 +210,21 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
* @uses Walker_Nav_Menu
*/
class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
+ function __construct( $fields = false ) {
+ if ( $fields ) {
+ $this->db_fields = $fields;
+ }
+ }
+
+ function start_lvl( &$output, $depth ) {
+ $indent = str_repeat( "\t", $depth );
+ $output .= "\n$indent\n";
+ }
+
+ function end_lvl( &$output, $depth ) {
+ $indent = str_repeat( "\t", $depth );
+ $output .= "\n$indent ";
+ }
/**
* @see Walker::start_el()
@@ -218,7 +233,6 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
* @param string $output Passed by reference. Used to append additional content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
- * @param int $current_page Menu item ID.
* @param object $args
*/
function start_el(&$output, $item, $depth, $args) {
@@ -249,7 +263,6 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
$output .= '';
$output .= '';
$output .= '';
- $output .= '';
$output .= '';
$output .= '';
}
@@ -324,7 +337,8 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
while ( have_posts() ) {
the_post();
if ( 'markup' == $response_format ) {
- echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $var_by_ref = get_the_ID() ) ) ), 0, (object) $args );
+ $var_by_ref = get_the_ID();
+ echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $var_by_ref ) ) ), 0, (object) $args );
} elseif ( 'json' == $response_format ) {
echo json_encode(
array(
@@ -499,7 +513,7 @@ function wp_nav_menu_locations_meta_box() {
?>
- class="button-primary" name="nav-menu-locations" value="" />
+
'. $post_type['args']->labels->not_found .'';
- $walker = new Walker_Nav_Menu_Checklist;
+ $db_fields = false;
+ if ( is_post_type_hierarchical( $post_type_name ) ) {
+ $db_fields = array( 'parent' => 'post_parent', 'id' => 'ID' );
+ }
+
+ $walker = new Walker_Nav_Menu_Checklist( $db_fields );
$current_tab = 'most-recent';
if ( isset( $_REQUEST[$post_type_name . '-tab'] ) && in_array( $_REQUEST[$post_type_name . '-tab'], array('all', 'search') ) ) {
@@ -652,7 +671,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
?>">
'post_date', 'order' => 'DESC', 'showposts' => 15 ) );
+ $recent_args = array_merge( $args, array( 'orderby' => 'post_date', 'order' => 'DESC', 'posts_per_page' => 15 ) );
$most_recent = $get_posts->query( $recent_args );
$args['walker'] = $walker;
echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $most_recent), 0, (object) $args );
@@ -673,9 +692,9 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
}
?>
-
+
-
+ 'submit-quick-search-posttype-' . $post_type_name ) ); ?>
@@ -721,6 +740,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
'object_id' => $_nav_menu_placeholder,
'post_content' => '',
'post_excerpt' => '',
+ 'post_parent' => '',
'post_title' => _x('Home', 'nav menu home label'),
'post_type' => 'nav_menu_item',
'type' => 'custom',
@@ -729,6 +749,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
}
}
+ $posts = apply_filters( 'nav_menu_items_'.$post_type_name, $posts, $args, $post_type );
$checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args );
if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) {
@@ -826,7 +847,12 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
'current' => $pagenum
));
- $walker = new Walker_Nav_Menu_Checklist;
+ $db_fields = false;
+ if ( is_taxonomy_hierarchical( $taxonomy_name ) ) {
+ $db_fields = array( 'parent' => 'parent', 'id' => 'term_id' );
+ }
+
+ $walker = new Walker_Nav_Menu_Checklist( $db_fields );
$current_tab = 'most-used';
if ( isset( $_REQUEST[$taxonomy_name . '-tab'] ) && in_array( $_REQUEST[$taxonomy_name . '-tab'], array('all', 'most-used', 'search') ) ) {
@@ -900,9 +926,9 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
}
?>
-
+
-
+ 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?>