- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/nav-menu.php
r17143 r18277 68 68 $title = $item->title; 69 69 70 if ( isset( $item->post_status ) && 'draft' == $item->post_status ) { 70 if ( ! empty( $item->_invalid ) ) { 71 $classes[] = 'menu-item-invalid'; 72 /* translators: %s: title of menu item which is invalid */ 73 $title = sprintf( __( '%s (Invalid)' ), $item->title ); 74 } elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) { 71 75 $classes[] = 'pending'; 72 76 /* translators: %s: title of menu item in draft status */ … … 183 187 ), 184 188 'delete-menu_item_' . $item_id 185 ); ?>"><?php _e('Remove'); ?></a> <span class="meta-sep"> | </span> <a class="item-cancel submitcancel" id="cancel-<?php echo $item_id; ?>" href="<?php echo add_query_arg( array('edit-menu-item' => $item_id, 'cancel' => time()), remove_query_arg( $removed_args, admin_url( 'nav-menus.php') ) );189 ); ?>"><?php _e('Remove'); ?></a> <span class="meta-sep"> | </span> <a class="item-cancel submitcancel" id="cancel-<?php echo $item_id; ?>" href="<?php echo esc_url( add_query_arg( array('edit-menu-item' => $item_id, 'cancel' => time()), remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) ) ) ); 186 190 ?>#menu-item-settings-<?php echo $item_id; ?>"><?php _e('Cancel'); ?></a> 187 191 </div> … … 208 212 */ 209 213 class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu { 214 function __construct( $fields = false ) { 215 if ( $fields ) { 216 $this->db_fields = $fields; 217 } 218 } 219 220 function start_lvl( &$output, $depth ) { 221 $indent = str_repeat( "\t", $depth ); 222 $output .= "\n$indent<ul class='children'>\n"; 223 } 224 225 function end_lvl( &$output, $depth ) { 226 $indent = str_repeat( "\t", $depth ); 227 $output .= "\n$indent</ul>"; 228 } 210 229 211 230 /** … … 320 339 the_post(); 321 340 if ( 'markup' == $response_format ) { 322 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $var_by_ref =get_the_ID() ) ) ), 0, (object) $args );341 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( get_the_ID() ) ) ), 0, (object) $args ); 323 342 } elseif ( 'json' == $response_format ) { 324 343 echo json_encode( … … 615 634 $error = '<li id="error">'. $post_type['args']->labels->not_found .'</li>'; 616 635 617 $walker = new Walker_Nav_Menu_Checklist; 636 $db_fields = false; 637 if ( is_post_type_hierarchical( $post_type_name ) ) { 638 $db_fields = array( 'parent' => 'post_parent', 'id' => 'ID' ); 639 } 640 641 $walker = new Walker_Nav_Menu_Checklist( $db_fields ); 618 642 619 643 $current_tab = 'most-recent'; … … 671 695 <input type="text" class="quick-search input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-posttype-<?php echo $post_type_name; ?>" /> 672 696 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> 673 <?php submit_button( __( 'Search' ), 'quick-search-submit button-secondary hide-if-js', 'submit', false ); ?>697 <?php submit_button( __( 'Search' ), 'quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-posttype-' . $post_type_name ) ); ?> 674 698 </p> 675 699 … … 717 741 'post_content' => '', 718 742 'post_excerpt' => '', 743 'post_parent' => '', 719 744 'post_title' => _x('Home', 'nav menu home label'), 720 745 'post_type' => 'nav_menu_item', … … 725 750 } 726 751 752 $posts = apply_filters( 'nav_menu_items_'.$post_type_name, $posts, $args, $post_type ); 727 753 $checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args ); 728 754 … … 822 848 )); 823 849 824 $walker = new Walker_Nav_Menu_Checklist; 850 $db_fields = false; 851 if ( is_taxonomy_hierarchical( $taxonomy_name ) ) { 852 $db_fields = array( 'parent' => 'parent', 'id' => 'term_id' ); 853 } 854 855 $walker = new Walker_Nav_Menu_Checklist( $db_fields ); 825 856 826 857 $current_tab = 'most-used'; … … 898 929 <input type="text" class="quick-search input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" /> 899 930 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> 900 <?php submit_button( __( 'Search' ), 'quick-search-submit button-secondary hide-if-js', 'submit', false ); ?>931 <?php submit_button( __( 'Search' ), 'quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?> 901 932 </p> 902 933 … … 1073 1104 return new WP_Error( 'menu_walker_not_exist', sprintf( __('The Walker class named <strong>%s</strong> does not exist.'), $walker_class_name ) ); 1074 1105 1075 $some_pending_menu_items = false;1106 $some_pending_menu_items = $some_invalid_menu_items = false; 1076 1107 foreach( (array) $menu_items as $menu_item ) { 1077 1108 if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status ) 1078 1109 $some_pending_menu_items = true; 1110 if ( ! empty( $menu_item->_invalid ) ) 1111 $some_invalid_menu_items = true; 1079 1112 } 1080 1113 1081 1114 if ( $some_pending_menu_items ) 1082 1115 $result .= '<div class="updated inline"><p>' . __('Click Save Menu to make pending menu items public.') . '</p></div>'; 1116 1117 if ( $some_invalid_menu_items ) 1118 $result .= '<div class="error inline"><p>' . __('There are some invalid menu items. Please check or delete them.') . '</p></div>'; 1083 1119 1084 1120 $result .= '<ul class="menu" id="menu-to-edit"> ';
Note: See TracChangeset
for help on using the changeset viewer.