Changeset 13369
- Timestamp:
- 02/24/2010 09:43:09 AM (15 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/nav-menu.php
r13366 r13369 217 217 return $counter; 218 218 } 219 219 /* 220 220 function wp_nav_menu_setup($override = false) { 221 221 // Custom Navigation Menu Setup … … 233 233 wp_create_nav_menu( __('Main') ); 234 234 } 235 235 /**/ 236 236 ?> -
trunk/wp-admin/nav-menus.php
r13368 r13369 71 71 } 72 72 73 if ( isset( $_POST['set_wp_menu'] ) ) {74 // @todo validate set_wp_menu75 update_option( 'wp_custom_nav_menu', $_POST['enable_wp_menu'] );76 $updated = true;77 $messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . __('Menu has been updated!') . '</p></div>';78 }79 80 73 if ( isset( $_POST['licount'] ) ) 81 74 $postCounter = $_POST['licount']; … … 85 78 // Create a new menu. Menus are stored as terms in the 'menu' taxonomy. 86 79 if ( isset( $_POST['add_menu'] ) && ! $updated ) { 80 update_option( 'wp_custom_nav_menu', $_POST['enable_wp_menu'] ); // Do we need this? 87 81 $insert_menu_name = $_POST['add_menu_name']; 88 82 … … 95 89 $menu_selected_id = $menu->term_id; 96 90 $menu_id_in_edit = $menu_selected_id; 91 $menu_title = $menu->name; 97 92 $messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . esc_html( sprintf( __('"%s" menu has been created!'), $menu->name ) ) . '</p></div>'; 98 93 $postCounter = 0; … … 104 99 } 105 100 106 if ( isset($_POST['reset_wp_menu']) && ! $updated ) { 107 $success = wp_reset_nav_menu(); 108 if ( $success ) { 109 // DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly 110 $messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been reset.') . '</p></div>'; 111 // GET reset menu id 112 $custom_menus = array(); 113 $menu_selected_id = 0; 114 } else { 115 // DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly 116 $messagesdiv = '<div id="message" class="error fade below-h2"><p>' . __('The menu could not be reset. Please try again.') . '</p></div>'; 117 } 118 } elseif ( $postCounter > 0 && $menu_selected_id > 0 && ! $updated ) { 101 if ( $postCounter > 0 && $menu_selected_id > 0 && ! $updated ) { 119 102 $menu_items = wp_get_nav_menu_items( $menu_selected_id, array('orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID') ); 120 103 $parent_menu_ids = array(); … … 175 158 <div class="hide-if-no-js"> 176 159 <div id="pages-left"> 160 <?php if ( ! empty( $custom_menus ) && count( $custom_menus ) > 1 ) { ?> 177 161 <ul class="subsubsub"> 178 <?php if ( ! empty( $custom_menus ) ) {162 <?php 179 163 foreach ( $custom_menus as $menu ) { 180 164 $sep = end($custom_menus) == $menu ? '' : ' | '; … … 186 170 <?php } 187 171 } 188 } else { ?> 189 <li><?php _e( 'Default' ); ?></li> 190 <?php } ?> 172 ?> 191 173 </ul> 192 174 <div class="clear"></div> 175 <?php } ?> 176 <form onsubmit="updatepostdata()" action="nav-menus.php" method="post" enctype="multipart/form-data"> 193 177 <div class="inside"> 194 <?php 195 // CHECK if custom menu has been enabled 196 $enabled_menu = get_option('wp_custom_nav_menu'); 197 $checked = strtolower($enabled_menu); 198 199 if ( $checked != 'true' ) 200 echo '<div id="message-enabled" class="error fade below-h2"><p><strong>' . __('Menu editing has not been Enabled yet. Please enable it in order to use it -------->') . '</strong></p></div>'; 201 ?> 178 <?php if ( ! empty( $custom_menus ) ) : ?> 202 179 <?php echo $messagesdiv; ?> 203 <form onsubmit="updatepostdata()" action="nav-menus.php" method="post" enctype="multipart/form-data">204 180 205 181 <input type="hidden" name="licount" id="licount" value="0" /> … … 207 183 208 184 <div class="sidebar-name"> 209 210 185 <div class="sidebar-name-arrow"> 211 186 <br/> … … 236 211 updatepostdata(); 237 212 </script> 238 <!-- <input id="delete_menu" name="delete_menu" type="submit" value="<?php esc_attr_e('Delete This Menu'); ?>" /> --> 239 <input id="save_bottom" name="save_bottom" type="submit" value="<?php esc_attr_e('Save All Changes'); ?>" /></p> 213 <input id="save_bottom" name="save_bottom" type="submit" value="<?php esc_attr_e('Save All Changes'); ?>" /> 214 <input id="delete_menu" name="delete_menu" type="submit" value="<?php esc_attr_e('Delete This Menu'); ?>" /> 215 </p> 216 217 <?php else : ?> 218 <div class="updated below-h2"><p><?php _e( 'Add a menu to start editing!' ); ?></p></div> 219 <?php endif; ?> 240 220 </div><!-- /.inside --> 241 221 </div> … … 245 225 <div class="sidebar-name"> 246 226 <div class="sidebar-name-arrow"></div> 247 <h3><?php esc_html_e(' Setup Menus'); ?></h3>227 <h3><?php esc_html_e('Add Menu'); ?></h3> 248 228 </div> 249 229 <div class="widget-holder"> 250 230 251 <?php252 // Setup custom menu253 $enabled_menu = get_option('wp_custom_nav_menu');254 $checked = strtolower($enabled_menu);255 ?>256 257 <span >258 <label><?php _e('Enable'); ?></label><input type="radio" name="enable_wp_menu" value="true" <?php if ($checked=='true') { echo 'checked="checked"'; } ?> />259 <label><?php _e('Disable'); ?></label><input type="radio" name="enable_wp_menu" value="false" <?php if ($checked=='true') { } else { echo 'checked="checked"'; } ?> />260 </span><!-- /.checkboxes -->261 262 <input id="set_wp_menu" type="submit" value="<?php esc_attr_e('Set Menu'); ?>" name="set_wp_menu" class="button" /><br />263 264 <span>265 <label><?php _e('Reset Menu to Default'); ?></label>266 <input id="reset_wp_menu" type="submit" value="Reset" name="reset_wp_menu" class="button" onclick="return confirm('<?php _e('Are you sure you want to reset the menu to its default settings?'); ?>');" />267 </span>268 <br /><br />269 231 <span> 270 232 <input id="add_menu_name" name="add_menu_name" type="text" value="" /> … … 273 235 </div> 274 236 </div><!-- /.widgets-holder-wrap --> 237 <?php /* ?> 275 238 <?php $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options'); ?> 276 239 <div class="widgets-holder-wrap" style="display:none;"> … … 310 273 </div> 311 274 </div><!-- /.widgets-holder-wrap --> 312 275 <?php */ ?> 313 276 <div class="widgets-holder-wrap"> 314 277 <div class="sidebar-name">
Note: See TracChangeset
for help on using the changeset viewer.