Changeset 14287 for trunk/wp-admin/nav-menus.php
- Timestamp:
- 04/29/2010 03:43:39 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/nav-menus.php
r14285 r14287 234 234 if ( ! is_wp_error( $_menu_object ) ) { 235 235 $menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array('orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID') ); 236 236 $post_fields = array( 'menu-item-db-id', 'menu-item-object-id', 'menu-item-object', 'menu-item-parent-id', 'menu-item-position', 'menu-item-type', 'menu-item-append', 'menu-item-title', 'menu-item-url', 'menu-item-description', 'menu-item-attr-title', 'menu-item-target', 'menu-item-classes', 'menu-item-xfn' ); 237 237 // Loop through all the menu items' POST variables 238 238 if ( ! empty( $_POST['menu-item-db-id'] ) ) { … … 240 240 241 241 // Menu item title can't be blank 242 if ( '' == $_POST['menu-item-title'][$_key])242 if ( empty( $_POST['menu-item-title'][$_key] ) ) 243 243 continue; 244 245 $args = array( 246 'menu-item-db-id' => $_POST['menu-item-db-id'][$_key], 247 'menu-item-object-id' => $_POST['menu-item-object-id'][$_key], 248 'menu-item-object' => $_POST['menu-item-object'][$_key], 249 'menu-item-parent-id' => $_POST['menu-item-parent-id'][$_key], 250 'menu-item-position' => $_POST['menu-item-position'][$_key], 251 'menu-item-type' => $_POST['menu-item-type'][$_key], 252 'menu-item-append' => $_POST['menu-item-append'][$_key], 253 'menu-item-title' => $_POST['menu-item-title'][$_key], 254 'menu-item-url' => $_POST['menu-item-url'][$_key], 255 'menu-item-description' => $_POST['menu-item-description'][$_key], 256 'menu-item-attr-title' => $_POST['menu-item-attr-title'][$_key], 257 'menu-item-target' => $_POST['menu-item-target'][$_key], 258 'menu-item-classes' => $_POST['menu-item-classes'][$_key], 259 'menu-item-xfn' => $_POST['menu-item-xfn'][$_key], 260 ); 244 245 $args = array(); 246 foreach ( $post_fields as $field ) 247 $args[$field] = isset( $_POST[$field][$_key] ) ? $_POST[$field][$_key] : ''; 261 248 262 249 $menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args ); … … 317 304 // The theme supports menus 318 305 if ( current_theme_supports('nav-menus') ) { 319 // Register nav menu metaboxes320 wp_nav_menu_ meta_boxes_setup();306 // Set up nav menu 307 wp_nav_menu_setup(); 321 308 322 309 // The theme does not support menus but supports widgets 323 310 } elseif ( current_theme_supports('widgets') ) { 324 // Register nav menu metaboxes325 wp_nav_menu_ meta_boxes_setup();311 // Set up nav menu 312 wp_nav_menu_setup(); 326 313 $messages_div = '<div id="message" class="error"><p>' . __('The current theme does not natively support menus, but you can use the “Navigation Menu” widget to add any menus you create here to the theme’s sidebar.') . '</p></div>'; 327 314 … … 341 328 342 329 <?php if ( current_theme_supports('nav-menus') || current_theme_supports('widgets') ) : ?> 330 <div id="nav-menus-frame"> 343 331 <div id="menu-settings-column" class="metabox-holder"> 344 332 … … 351 339 352 340 </div><!-- /#menu-settings-column --> 353 354 341 <div id="menu-management-liquid"> 355 <div id="menu-management" class="">356 < h2>342 <div id="menu-management"> 343 <div class="nav-tabs"> 357 344 <?php 358 345 foreach( (array) $nav_menus as $_nav_menu ) : 359 360 ?> 361 <a href="<?php 346 347 ?><a href="<?php 362 348 echo add_query_arg( 363 349 array( … … 367 353 admin_url( 'nav-menus.php' ) 368 354 ); 369 ?>" class="menu-tabs<?php 370 if ( $nav_menu_selected_id != $_nav_menu->term_id ) 371 echo ' menu-tab-inactive'; 372 ?>"><?php echo esc_html( $_nav_menu->name ); ?></a> 373 374 <?php 355 ?>" class="nav-tab<?php 356 if ( $nav_menu_selected_id == $_nav_menu->term_id ) 357 echo ' nav-tab-active'; 358 ?>"><?php echo esc_html( $_nav_menu->name ); ?></a><?php 375 359 endforeach; 376 ?> 377 <a href="<?php 360 ?><a href="<?php 378 361 echo add_query_arg( 379 362 array( … … 383 366 admin_url( 'nav-menus.php' ) 384 367 ); 385 ?>" class=" menu-tabsmenu-add-new<?php386 if ( 0 != $nav_menu_selected_id )387 echo ' menu-tab-inactive';368 ?>" class="nav-tab menu-add-new<?php 369 if ( 0 == $nav_menu_selected_id ) 370 echo ' nav-tab-active'; 388 371 ?>"><?php printf( '<abbr title="%s">+</abbr>', esc_html__( 'Add menu' ) ); ?></a> 389 </ h2>372 </div> 390 373 <div class="menu-edit"> 391 374 <form id="update-nav-menu" action="<?php echo admin_url( 'nav-menus.php' ); ?>" method="post" enctype="multipart/form-data"> 392 <div id=" submitpost" class="submitbox">393 <div id=" minor-publishing">394 <div class="m isc-pub-section misc-pub-section-last">395 <label class=" howto" for="menu-name">396 <span><?php _e(' Name'); ?></span>397 <input id="menu-name" name="menu-name" type="text" class="regular-text menu-item-textbox" value="<?php echo esc_attr( $nav_menu_selected_title ); ?>" />375 <div id="nav-menu-header"> 376 <div id="submitpost" class="submitbox"> 377 <div class="major-publishing-actions"> 378 <label class="menu-name-label howto open-label" for="menu-name"> 379 <span><?php _e('Menu Name'); ?></span> 380 <input name="menu-name" type="text" class="menu-name regular-text menu-item-textbox label-with-default-title" title="Enter menu name here." value="<?php echo esc_attr( $nav_menu_selected_title ); ?>" /> 398 381 <br class="clear" /> 399 382 </label> 400 </div><!--END .misc-pub-section misc-pub-section-last--> 401 <br class="clear" /> 402 </div><!--END #misc-publishing-actions--> 403 <div id="major-publishing-actions"> 404 405 <?php if ( ! empty( $nav_menu_selected_id ) ) : ?> 406 <div id="delete-action"> 407 <a class="submitdelete deletion menu-delete" href="<?php echo wp_nonce_url( admin_url('nav-menus.php?action=delete&menu=' . $nav_menu_selected_id), 'delete-nav_menu-' . $nav_menu_selected_id ); ?>"><?php _e('Delete Menu'); ?></a> 408 </div><!--END #delete-action--> 409 <?php endif; ?> 410 411 <div id="publishing-action"> 412 <input class="button-primary" name="save_menu" type="submit" value="<?php esc_attr_e('Save Menu'); ?>" /> 413 </div><!--END #publishing-action--> 414 <br class="clear" /> 415 </div><!--END #major-publishing-actions--> 416 </div><!--END #submitpost .submitbox--> 417 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> 418 <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> 419 <?php wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' ); ?> 420 <input type="hidden" name="action" value="update" /> 421 <input type="hidden" name="menu" id="menu" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> 422 <input type="hidden" id="hidden-metaboxes" value="<?php echo wp_initial_nav_menu_meta_boxes(); ?>" /> 383 384 <div class="publishing-action"> 385 <input class="button-primary" name="save_menu" type="submit" value="<?php esc_attr_e('Save Menu'); ?>" /> 386 </div><!--END .publishing-action--> 387 388 <?php if ( ! empty( $nav_menu_selected_id ) ) : ?> 389 <div class="delete-action"> 390 <a class="submitdelete deletion menu-delete" href="<?php echo wp_nonce_url( admin_url('nav-menus.php?action=delete&menu=' . $nav_menu_selected_id), 'delete-nav_menu-' . $nav_menu_selected_id ); ?>"><?php _e('Delete Menu'); ?></a> 391 </div><!--END .delete-action--> 392 <?php endif; ?> 393 <br class="clear" /> 394 </div><!--END .major-publishing-actions--> 395 </div><!--END #submitpost .submitbox--> 396 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> 397 <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> 398 <?php wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' ); ?> 399 <input type="hidden" name="action" value="update" /> 400 <input type="hidden" name="menu" id="menu" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> 401 <input type="hidden" id="hidden-metaboxes" value="<?php echo wp_initial_nav_menu_meta_boxes(); ?>" /> 402 </div><!--END #nav-menu-header--> 423 403 <div id="post-body"> 424 404 <div id="post-body-content"> … … 446 426 </div><!-- /#menu-management --> 447 427 </div><!-- /#menu-management-liquid --> 428 </div><!-- /#nav-menus-frame--> 448 429 <?php endif; // if menus supported in current theme ?> 449 430 </div><!-- /.wrap-->
Note: See TracChangeset
for help on using the changeset viewer.