Changeset 14404 for trunk/wp-admin/includes/nav-menu.php
- Timestamp:
- 05/03/2010 08:26:11 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/nav-menu.php
r14374 r14404 17 17 */ 18 18 function start_lvl(&$output, $depth) {} 19 19 20 20 /** 21 21 * @see Walker_Nav_Menu::end_lvl() … … 26 26 */ 27 27 function end_lvl(&$output, $depth) {} 28 28 29 29 /** 30 30 * @see Walker::start_el() … … 50 50 '_wpnonce', 51 51 ); 52 52 53 53 $original_title = ''; 54 54 if ( 'taxonomy' == $item->type ) { … … 60 60 ?> 61 61 <li id="menu-item-<?php echo $item_id; ?>" class="menu-item menu-item-depth-<?php echo $depth; ?> menu-item-<?php echo strtolower(esc_attr( $item->append )); ?>"> 62 <dl class="<?php 62 <dl class="<?php 63 63 if ( isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item'] ) 64 64 echo 'menu-item-edit-active'; … … 72 72 <span class="item-order"> 73 73 <a href="<?php 74 echo wp_nonce_url( 74 echo wp_nonce_url( 75 75 add_query_arg( 76 76 array( 77 'action' => 'move-up-menu-item', 77 'action' => 'move-up-menu-item', 78 78 'menu-item' => $item_id, 79 79 ), 80 remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) 81 ), 82 'move-item' 83 ); 80 remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) 81 ), 82 'move-item' 83 ); 84 84 ?>" class="item-move-up"><abbr title="<?php esc_attr_e('Move up'); ?>">↑</abbr></a> 85 85 | 86 86 <a href="<?php 87 echo wp_nonce_url( 87 echo wp_nonce_url( 88 88 add_query_arg( 89 89 array( 90 'action' => 'move-down-menu-item', 90 'action' => 'move-down-menu-item', 91 91 'menu-item' => $item_id, 92 92 ), 93 remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) 94 ), 93 remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) 94 ), 95 95 'move-item' 96 ); 96 ); 97 97 ?>" class="item-move-down"><abbr title="<?php esc_attr_e('Move down'); ?>">↓</abbr></a> 98 98 </span> 99 <a class="item-edit" id="edit-<?php echo $item_id; ?>" title="<?php _e('Edit Menu Item'); ?>" href="<?php 100 echo add_query_arg('edit-menu-item', $item_id, remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) ); 99 <a class="item-edit" id="edit-<?php echo $item_id; ?>" title="<?php _e('Edit Menu Item'); ?>" href="<?php 100 echo add_query_arg('edit-menu-item', $item_id, remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) ); 101 101 ?>#menu-item-settings-<?php echo $item_id; ?>">Edit Menu Item</a> 102 102 </span> … … 104 104 </dl> 105 105 106 <div class="menu-item-settings <?php 106 <div class="menu-item-settings <?php 107 107 if ( isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item'] ) 108 108 echo 'menu-item-edit-active'; 109 109 else 110 110 echo 'menu-item-edit-inactive'; 111 ?>" id="menu-item-settings-<?php echo $item_id; ?>"> 111 ?>" id="menu-item-settings-<?php echo $item_id; ?>"> 112 112 <?php if( 'custom' == $item->type ) : ?> 113 113 <p class="field-url description description-wide"> … … 158 158 </label> 159 159 </p> 160 160 161 161 <span class="menu-item-actions description-wide submitbox"> 162 162 <?php if( 'custom' != $item->type ) : ?> 163 163 <p class="link-to-original"><?php 164 _e('Original '); 164 _e('Original '); 165 165 echo esc_html( $item->append ); 166 166 echo ":"; ?> … … 170 170 </p> 171 171 <?php endif; ?> 172 <a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?>" href="<?php 172 <a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?>" href="<?php 173 173 echo wp_nonce_url( 174 174 add_query_arg( … … 177 177 'menu-item' => $item_id, 178 178 ), 179 remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) 179 remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) 180 180 ), 181 181 'delete-menu_item_' . $item_id … … 183 183 <input class="button-primary save-menu-item" name="save_menu_item" type="submit" value="<?php esc_attr_e('Save Menu Item'); ?>" /> 184 184 </span> 185 185 186 186 <input class="menu-item-data-append" type="hidden" name="menu-item-append[<?php echo $item_id; ?>]" value="<?php echo $item->append; ?>" /> 187 187 <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?>]" value="<?php echo $item_id; ?>" /> … … 191 191 <input class="menu-item-data-position" type="hidden" class="menu-item-position" name="menu-item-position[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_order ); ?>" /> 192 192 <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->type ); ?>" /> 193 </div><!-- .menu-item-settings--> 193 </div><!-- .menu-item-settings--> 194 194 <ul class="menu-item-transport"></ul> 195 195 <?php … … 202 202 * 203 203 * @since 3.0.0 204 * 204 * 205 205 * @param array $request The unsanitized request values. 206 206 */ … … 314 314 wp_nav_menu_post_type_meta_boxes(); 315 315 wp_nav_menu_taxonomy_meta_boxes(); 316 317 316 317 318 318 // Register advanced menu items (columns) 319 319 add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns'); 320 320 321 321 add_filter( 'columns_prefs_header', create_function( '', "return __('Show advanced menu properties');" )); 322 323 324 322 323 324 325 325 // If first time editing, disable advanced items by default. 326 326 if( false === get_user_option( 'managenav-menuscolumnshidden' ) ) { … … 423 423 424 424 $removed_args = array( 425 'action', 425 'action', 426 426 'customlink-tab', 427 427 'edit-menu-item', … … 477 477 $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0; 478 478 479 $args = array( 480 'offset' => $offset, 479 $args = array( 480 'offset' => $offset, 481 481 'order' => 'ASC', 482 'orderby' => 'title', 483 'posts_per_page' => $per_page, 484 'post_type' => $post_type_name, 485 'suppress_filters' => true, 482 'orderby' => 'title', 483 'posts_per_page' => $per_page, 484 'post_type' => $post_type_name, 485 'suppress_filters' => true, 486 486 ); 487 487 … … 512 512 $parent_ids = array_unique($parent_ids); 513 513 $child_ids = array_unique($child_ids); 514 514 515 515 $missing_parents = array(); 516 516 do { … … 521 521 $parent_ids[] = $missing_parent->post_parent; 522 522 } 523 523 524 524 $missing_parents = array_filter( array_diff( array_unique( $parent_ids ), array_unique( $child_ids ) ) ); 525 525 526 526 } while( 0 < count( $missing_parents ) ); 527 527 528 528 } 529 529 530 530 $page_links = paginate_links( array( 531 'base' => add_query_arg( 531 'base' => add_query_arg( 532 532 array( 533 533 $post_type_name . '-tab' => 'all', … … 535 535 ) 536 536 ), 537 'format' => '', 537 'format' => '', 538 538 'prev_text' => __('«'), 539 539 'next_text' => __('»'), … … 541 541 'current' => $pagenum 542 542 )); 543 543 544 544 if ( !$posts ) 545 545 $error = '<li id="error">'. sprintf( __( 'No %s exists' ), $post_type['args']->label ) .'</li>'; … … 555 555 556 556 $removed_args = array( 557 'action', 557 'action', 558 558 'customlink-tab', 559 559 'edit-menu-item', … … 570 570 </ul> 571 571 572 <div class="tabs-panel <?php 572 <div class="tabs-panel <?php 573 573 echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); 574 574 ?>" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search"> 575 <?php 575 <?php 576 576 if ( isset( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { 577 577 $searched = esc_attr( $_REQUEST['quick-search-posttype-' . $post_type_name] ); … … 615 615 if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) { 616 616 $checkbox_items = preg_replace('/(type=(.)checkbox(\2))/', '$1 checked=$2checked$2', $checkbox_items); 617 617 618 618 } 619 619 echo $checkbox_items; … … 628 628 <p class="button-controls"> 629 629 <span class="list-controls"> 630 <a href="<?php 630 <a href="<?php 631 631 echo add_query_arg( 632 632 array( … … 670 670 671 671 $args = array( 672 'child_of' => 0, 672 'child_of' => 0, 673 673 'exclude' => '', 674 'hide_empty' => false, 675 'hierarchical' => 1, 676 'include' => '', 677 'include_last_update_time' => false, 678 'number' => $per_page, 674 'hide_empty' => false, 675 'hierarchical' => 1, 676 'include' => '', 677 'include_last_update_time' => false, 678 'number' => $per_page, 679 679 'offset' => $offset, 680 680 'order' => 'ASC', 681 'orderby' => 'name', 681 'orderby' => 'name', 682 682 'pad_counts' => false, 683 683 ); … … 686 686 687 687 $page_links = paginate_links( array( 688 'base' => add_query_arg( 688 'base' => add_query_arg( 689 689 array( 690 690 $taxonomy_name . '-tab' => 'all', … … 692 692 ) 693 693 ), 694 'format' => '', 694 'format' => '', 695 695 'prev_text' => __('«'), 696 696 'next_text' => __('»'), … … 698 698 'current' => $pagenum 699 699 )); 700 700 701 701 $walker = new Walker_Nav_Menu_Checklist; 702 702 // @todo transient caching of these results with proper invalidation on updating of a tax of this type … … 716 716 717 717 $removed_args = array( 718 'action', 718 'action', 719 719 'customlink-tab', 720 720 'edit-menu-item', … … 741 741 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $popular_terms), 0, (object) $args ); 742 742 ?> 743 <?php 743 <?php 744 744 ?> 745 745 </ul> 746 746 </div><!-- /.tabs-panel --> 747 747 748 <div class="tabs-panel <?php 748 <div class="tabs-panel <?php 749 749 echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); 750 750 ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>"> 751 <?php 751 <?php 752 752 if ( isset( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) { 753 753 $searched = esc_attr( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ); … … 762 762 <input type="submit" class="quick-search-submit button-secondary" value="<?php esc_attr_e('Search'); ?>" /> 763 763 </p> 764 764 765 765 <ul id="<?php echo $taxonomy_name; ?>-search-checklist" class="list:<?php echo $taxonomy_name?> categorychecklist form-no-clear"> 766 766 <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?> … … 796 796 <p class="button-controls"> 797 797 <span class="list-controls"> 798 <a href="<?php 798 <a href="<?php 799 799 echo add_query_arg( 800 800 array( … … 835 835 // Loop through all the menu items' POST values 836 836 foreach( (array) $menu_data as $_possible_db_id => $_item_object_data ) { 837 if ( 837 if ( 838 838 empty( $_item_object_data['menu-item-object-id'] ) && // checkbox is not checked 839 ( 840 ! isset( $_item_object_data['menu-item-type'] ) || // and item type either isn't set 839 ( 840 ! isset( $_item_object_data['menu-item-type'] ) || // and item type either isn't set 841 841 in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) || // or URL is the default 842 'custom' != $_item_object_data['menu-item-type'] || // or it's not a custom menu item 842 'custom' != $_item_object_data['menu-item-type'] || // or it's not a custom menu item 843 843 ! empty( $_item_object_data['menu-item-db-id'] ) // or it *is* a custom menu item that already exists 844 844 ) … … 848 848 849 849 // if this possible menu item doesn't actually have a menu database ID yet 850 if ( 850 if ( 851 851 empty( $_item_object_data['menu-item-db-id'] ) || 852 852 ( 0 > $_possible_db_id ) || … … 857 857 $_actual_db_id = (int) $_item_object_data['menu-item-db-id']; 858 858 } 859 859 860 860 $args = array( 861 861 'menu-item-db-id' => ( isset( $_item_object_data['menu-item-db-id'] ) ? $_item_object_data['menu-item-db-id'] : '' ), … … 886 886 * 887 887 * @since 3.0.0 888 * 888 * 889 889 * @access private 890 890 * … … 897 897 if ( 'attachment' == $object->name ) 898 898 return false; 899 899 900 900 // pages should show most recent 901 901 if ( 'page' == $object->name ) { … … 920 920 } 921 921 } 922 922 923 923 return $object; 924 924 } … … 934 934 function wp_get_nav_menu_to_edit( $menu_item_id = 0 ) { 935 935 $menu = wp_get_nav_menu_object( $menu_item_id ); 936 936 937 937 // If the menu exists, get its items. 938 938 if ( is_nav_menu( $menu ) ) { 939 939 $menu_items = wp_get_nav_menu_items( $menu->term_id, array('post_status' => 'any') ); 940 940 941 $walker = new Walker_Nav_Menu_Edit; 941 $walker = new Walker_Nav_Menu_Edit; 942 942 943 943 return walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $menu_items), 0, (object) array('walker' => $walker ) ); 944 944 } elseif ( is_wp_error( $menu ) ) { 945 return $menu; 945 return $menu; 946 946 } 947 947
Note: See TracChangeset
for help on using the changeset viewer.