Changeset 14287 for trunk/wp-admin/includes/nav-menu.php
- Timestamp:
- 04/29/2010 03:43:39 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/nav-menu.php
r14285 r14287 33 33 '_wpnonce', 34 34 ); 35 36 $original_title = ''; 37 if ( 'taxonomy' == $item->type ) { 38 $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' ); 39 } elseif ( 'post_type' == $item->type ) { 40 $original_object = get_post( $item->object_id ); 41 $original_title = $original_object->post_title; 42 } 35 43 ?> 36 <li id="menu-item-<?php echo $item_id; ?>"> 37 <dl> 44 <li id="menu-item-<?php echo $item_id; ?>" class="menu-item-<?php echo strtolower(esc_attr( $item->append )); ?>"> 45 <dl class="<?php 46 if ( isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item'] ) 47 echo 'menu-item-edit-active'; 48 else 49 echo 'menu-item-edit-inactive'; 50 ?>"> 38 51 <dt> 39 52 <span class="item-title"><?php echo esc_html( $item->title ); ?></span> … … 66 79 ); 67 80 ?>" class="item-move-down"><abbr title="<?php esc_attr_e('Move down'); ?>">↓</abbr></a> 68 |69 81 </span> 70 82 <a class="item-edit" id="edit-<?php echo $item_id; ?>" title="<?php _e('Edit Menu Item'); ?>" href="<?php 71 83 echo add_query_arg('edit-menu-item', $item_id, remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) ); 72 ?>#menu-item-settings-<?php echo $item_id; ?>"><?php _e('Edit'); ?></a> | 73 <a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?>" href="<?php 74 echo wp_nonce_url( 75 add_query_arg( 76 array( 77 'action' => 'delete-menu-item', 78 'menu-item' => $item_id, 79 ), 80 remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) 81 ), 82 'delete-menu_item_' . $item_id 83 ); ?>"><?php _e('Delete'); ?></a> 84 ?>#menu-item-settings-<?php echo $item_id; ?>">Edit Menu Item</a> 84 85 </span> 85 86 </dt> … … 87 88 88 89 <div class="menu-item-settings <?php 89 if ( isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item'] ) : 90 echo ' menu-item-edit-active'; 91 else : 92 echo ' menu-item-edit-inactive'; 93 endif; 94 ?>" id="menu-item-settings-<?php echo $item_id; ?>"> 95 <p class="description"> 90 if ( isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item'] ) 91 echo 'menu-item-edit-active'; 92 else 93 echo 'menu-item-edit-inactive'; 94 ?>" id="menu-item-settings-<?php echo $item_id; ?>"> 95 <?php if( 'custom' == $item->type ) : ?> 96 <p class="field-url description description-wide"> 97 <label for="edit-menu-item-url-<?php echo $item_id; ?>"> 98 <?php _e( 'URL' ); ?><br /> 99 <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->url ); ?>" /> 100 </label> 101 </p> 102 <?php endif; ?> 103 <p class="description description-thin"> 96 104 <label for="edit-menu-item-title-<?php echo $item_id; ?>"> 97 <?php _e( ' Menu Title' ); ?><br />105 <?php _e( 'Navigation Label' ); ?><br /> 98 106 <input type="text" id="edit-menu-item-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-title" name="menu-item-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->title ); ?>" /> 99 107 </label> 100 108 </p> 101 <p class="description"> 102 <label for="edit-menu-item-url-<?php echo $item_id; ?>"> 103 <?php _e( 'URL' ); ?><br /> 104 <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->url ); ?>" /> 105 </label> 106 </p> 107 <p class="description"> 109 <p class="description description-thin"> 108 110 <label for="edit-menu-item-attr-title-<?php echo $item_id; ?>"> 109 111 <?php _e( 'Title Attribute' ); ?><br /> … … 111 113 </label> 112 114 </p> 113 <p class=" description">115 <p class="field-link-target description description-thin"> 114 116 <label for="edit-menu-item-target-<?php echo $item_id; ?>"> 115 117 <?php _e( 'Link Target' ); ?><br /> … … 120 122 </label> 121 123 </p> 122 <p class=" description">124 <p class="field-css-classes description description-thin"> 123 125 <label for="edit-menu-item-classes-<?php echo $item_id; ?>"> 124 126 <?php _e( 'CSS Classes (optional)' ); ?><br /> … … 126 128 </label> 127 129 </p> 128 <p class=" description">130 <p class="field-xfn description description-thin"> 129 131 <label for="edit-menu-item-xfn-<?php echo $item_id; ?>"> 130 <?php _e( 'Link Relationship (XFN) (optional)' ); ?><br />132 <?php _e( 'Link Relationship (XFN)' ); ?><br /> 131 133 <input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->xfn ); ?>" /> 132 134 </label> 133 135 </p> 134 <p class=" description">136 <p class="field-description description description-wide"> 135 137 <label for="edit-menu-item-description-<?php echo $item_id; ?>"> 136 <?php _e( 'Description (optional)' ); ?><br />138 <?php _e( 'Description' ); ?><br /> 137 139 <textarea id="edit-menu-item-description-<?php echo $item_id; ?>" class="widefat edit-menu-item-description" rows="3" name="menu-item-description[<?php echo $item_id; ?>]"><?php echo esc_html( $item->description ); ?></textarea> 138 140 <span class="description"><?php _e('The description will be displayed in the menu if the current theme supports it.'); ?></span> 139 141 </label> 140 142 </p> 143 144 <span class="menu-item-actions description-wide submitbox"> 145 <?php if( 'custom' != $item->type ) : ?> 146 <p class="link-to-original"><?php 147 _e('Original '); 148 echo esc_html( $item->append ); 149 echo ":"; ?> 150 <a href="<?php echo esc_attr( $item->url ); ?>"> 151 <?php echo esc_html($original_title); ?> 152 </a> 153 </p> 154 <?php endif; ?> 155 <a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?>" href="<?php 156 echo wp_nonce_url( 157 add_query_arg( 158 array( 159 'action' => 'delete-menu-item', 160 'menu-item' => $item_id, 161 ), 162 remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) 163 ), 164 'delete-menu_item_' . $item_id 165 ); ?>"><?php _e('Remove'); ?></a> | <a class="item-close submitclose" id="close-<?php echo $item_id; ?>" href=""><?php _e('Close'); ?></a> 166 <input class="button-primary save-menu-item" name="save_menu_item" type="submit" value="<?php esc_attr_e('Save Menu Item'); ?>" /> 167 </span> 141 168 142 169 <input type="hidden" name="menu-item-append[<?php echo $item_id; ?>]" value="<?php echo $item->append; ?>" /> … … 260 287 261 288 /** 262 * Register nav menu metaboxes 289 * Register nav menu metaboxes and advanced menu items 263 290 * 264 291 * @since 3.0.0 265 292 **/ 266 function wp_nav_menu_meta_boxes_setup() { 293 function wp_nav_menu_setup() { 294 // Register meta boxes 267 295 add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' ); 268 296 wp_nav_menu_post_type_meta_boxes(); 269 297 wp_nav_menu_taxonomy_meta_boxes(); 298 299 300 // Register advanced menu items (columns) 301 add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns'); 302 303 add_filter( 'columns_prefs_header', create_function( '', "return __('Show advanced menu properties');" )); 304 305 306 307 // If first time editing, disable advanced items by default. 308 if( false === get_user_option( 'managenav-menuscolumnshidden' ) ) { 309 $user = wp_get_current_user(); 310 update_user_option($user->ID, "managenav-menuscolumnshidden", 311 array ( 0 => 'link-target', 1 => 'css-classes', 2 => 'xfn', 3 => 'description', ), 312 true); 313 } 270 314 } 271 315 … … 374 418 <div class="customlinkdiv"> 375 419 <ul id="customlink-tabs" class="customlink-tabs add-menu-item-tabs"> 376 <li <?php echo ( 'create' == $current_tab ? ' class="tabs"' : '' ); ?>><a class=" menu-tab-link" href="<?php echo add_query_arg('customlink-tab', 'create', remove_query_arg($removed_args)); ?>#tabs-panel-create-custom"><?php _e('Create New'); ?></a></li>420 <li <?php echo ( 'create' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php echo add_query_arg('customlink-tab', 'create', remove_query_arg($removed_args)); ?>#tabs-panel-create-custom"><?php _e('Create New'); ?></a></li> 377 421 </ul> 378 422 … … 391 435 <label class="howto" for="custom-menu-item-name"> 392 436 <span><?php _e('Text'); ?></span> 393 <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox " value="<?php echo esc_attr( __('Menu Item')); ?>" />437 <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox label-with-default-title" title="<?php esc_attr_e('Menu Item'); ?>" /> 394 438 </label> 395 439 </p> … … 509 553 <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv"> 510 554 <ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs"> 511 <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class=" menu-tab-link" href="<?php echo add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args)); ?>#<?php echo $post_type_name; ?>-all"><?php _e('View All'); ?></a></li>512 <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class=" menu-tab-link" href="<?php echo add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args)); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search"><?php _e('Search'); ?></a></li>555 <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php echo add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args)); ?>#<?php echo $post_type_name; ?>-all"><?php _e('View All'); ?></a></li> 556 <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php echo add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args)); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search"><?php _e('Search'); ?></a></li> 513 557 </ul> 514 558 … … 665 709 <div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv"> 666 710 <ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs"> 667 <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>><a class=" menu-tab-link" href="<?php echo add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args)); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop"><?php _e('Most Used'); ?></a></li>668 <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class=" menu-tab-link" href="<?php echo add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args)); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>"><?php _e('Search'); ?></a></li>669 <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class=" menu-tab-link" href="<?php echo add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args)); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all"><?php _e('View All'); ?></a></li>711 <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php echo add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args)); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop"><?php _e('Most Used'); ?></a></li> 712 <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php echo add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args)); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>"><?php _e('Search'); ?></a></li> 713 <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php echo add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args)); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all"><?php _e('View All'); ?></a></li> 670 714 </ul> 671 715 … … 886 930 } 887 931 932 /** 933 * Returns the columns for the nav menus page. 934 * 935 * @since 3.0.0 936 * 937 * @param string $menu_item_id The ID of the menu item to format. 938 * @return string|WP_Error $output The menu formatted to edit or error object on failure. 939 */ 940 function wp_nav_menu_manage_columns() { 941 return array( 942 'cb' => '<input type="checkbox" />', 943 'link-target' => __('Link Target'), 944 'css-classes' => __('CSS Classes'), 945 'xfn' => __('Link Relationship (XFN)'), 946 'description' => __('Description'), 947 ); 948 } 949 888 950 ?>
Note: See TracChangeset
for help on using the changeset viewer.