Changeset 14295 for trunk/wp-admin/nav-menus.php
- Timestamp:
- 04/29/2010 07:33:56 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/nav-menus.php
r14288 r14295 39 39 40 40 // Container for any messages displayed to the user 41 $messages _div = '';41 $messages = array(); 42 42 43 43 // Container that stores the name of the active menu … … 170 170 if ( wp_delete_post( $menu_item_id, true ) ) { 171 171 172 $messages _div= '<div id="message" class="updated"><p>' . __('The menu item has been successfully deleted.') . '</p></div>';172 $messages[] = '<div id="message" class="updated"><p>' . __('The menu item has been successfully deleted.') . '</p></div>'; 173 173 } 174 174 } … … 181 181 182 182 if ( is_wp_error($delete_nav_menu) ) { 183 $messages _div= '<div id="message" class="error"><p>' . $delete_nav_menu->get_error_message() . '</p></div>';183 $messages[] = '<div id="message" class="error"><p>' . $delete_nav_menu->get_error_message() . '</p></div>'; 184 184 } else { 185 $messages _div= '<div id="message" class="updated"><p>' . __('The menu has been successfully deleted.') . '</p></div>';185 $messages[] = '<div id="message" class="updated"><p>' . __('The menu has been successfully deleted.') . '</p></div>'; 186 186 $nav_menu_selected_id = 0; // Reset the selected menu 187 187 } … … 202 202 203 203 if ( is_wp_error( $_nav_menu_selected_id ) ) { 204 $messages _div= '<div id="message" class="error"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>';204 $messages[] = '<div id="message" class="error"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>'; 205 205 } else { 206 206 $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id ); 207 207 $nav_menu_selected_id = $_nav_menu_selected_id; 208 208 $nav_menu_selected_title = $_menu_object->name; 209 $messages _div= '<div id="message" class="updated"><p>' . sprintf( __('The <strong>%s</strong> menu has been successfully created.'), $nav_menu_selected_title ) . '</p></div>';209 $messages[] = '<div id="message" class="updated"><p>' . sprintf( __('The <strong>%s</strong> menu has been successfully created.'), $nav_menu_selected_title ) . '</p></div>'; 210 210 } 211 211 } else { 212 $messages _div= '<div id="message" class="error"><p>' . __('Please enter a valid menu name.') . '</p></div>';212 $messages[] = '<div id="message" class="error"><p>' . __('Please enter a valid menu name.') . '</p></div>'; 213 213 } 214 214 } … … 223 223 if ( is_wp_error( $_nav_menu_selected_id ) ) { 224 224 $_menu_object = $_nav_menu_selected_id; 225 $messages _div= '<div id="message" class="error"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>';225 $messages[] = '<div id="message" class="error"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>'; 226 226 } else { 227 227 $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id ); … … 249 249 $menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args ); 250 250 251 if ( ! is_wp_error( $menu_item_db_id ) && isset( $menu_items[$menu_item_db_id] ) ) { 251 if ( is_wp_error( $menu_item_db_id ) ) 252 $messages[] = '<div id="message" class="error"><p>' . $menu_item_db_id->get_error_message() . '</p></div>'; 253 elseif ( isset( $menu_items[$menu_item_db_id] ) ) 252 254 unset( $menu_items[$menu_item_db_id] ); 253 }254 255 } 255 256 } … … 266 267 do_action( 'wp_update_nav_menu', $nav_menu_selected_id ); 267 268 268 $messages _div= '<div id="message" class="updated"><p>' . sprintf( __('The <strong>%s</strong> menu has been updated.'), $nav_menu_selected_title ) . '</p></div>';269 $messages[] = '<div id="message" class="updated"><p>' . sprintf( __('The <strong>%s</strong> menu has been updated.'), $nav_menu_selected_title ) . '</p></div>'; 269 270 unset( $menu_items ); 270 271 } … … 311 312 // Set up nav menu 312 313 wp_nav_menu_setup(); 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>';314 $messages[] = '<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>'; 314 315 315 316 // The theme supports neither menus nor widgets. 316 317 } else { 317 318 remove_meta_box( 'create-menu', 'nav-menus', 'side' ); 318 $messages _div= '<div id="message" class="error"><p>' . __('The current theme does not support menus.') . '</p></div>';319 $messages[] = '<div id="message" class="error"><p>' . __('The current theme does not support menus.') . '</p></div>'; 319 320 } 320 321 … … 325 326 <?php screen_icon(); ?> 326 327 <h2><?php esc_html_e('Menus'); ?></h2> 327 <?php echo $messages_div; ?> 328 <?php 329 foreach( $messages as $message ) : 330 echo $message . "\n"; 331 endforeach; 332 ?> 328 333 329 334 <?php if ( current_theme_supports('nav-menus') || current_theme_supports('widgets') ) : ?>
Note: See TracChangeset
for help on using the changeset viewer.