Ticket #11817: custom-navigation-cleanup.diff
| File custom-navigation-cleanup.diff, 25.1 KB (added by , 16 years ago) |
|---|
-
wp-admin/css/custom-navigation.dev.css
165 165 .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .60;filter:Alpha(Opacity=60); -moz-border-radius: 8px; -webkit-border-radius: 8px; } 166 166 167 167 168 #reset _wp_menu { background:#c77 none !important;color:white!important;text-shadow:0 1px 0 #555 !important;}168 #reset-wp-menu { background:#c77 none !important;color:white!important;text-shadow:0 1px 0 #555 !important;} -
wp-admin/js/custom-navigation-dynamic-functions.dev.js
115 115 jQuery(this).find('dl > dt > span > #remove' + j).attr('onClick', 'removeitem(' + i + ')'); 116 116 jQuery(this).find('dl > dt > span > #remove' + j).attr('id','remove' + i); 117 117 118 jQuery('#li count').attr('value',i);118 jQuery('#li-count').attr('value',i); 119 119 120 120 }); 121 121 -
wp-admin/custom-navigation.php
23 23 wp_enqueue_script( 'jquery-autocomplete' ); 24 24 wp_enqueue_script( 'custom-navigation-php-functions' ); 25 25 26 require_once( 'admin-header.php');27 require_once (ABSPATH . WPINC . '/custom-navigation.php');26 require_once( 'admin-header.php' ); 27 require_once( ABSPATH . WPINC . '/custom-navigation.php' ); 28 28 29 29 wp_custom_navigation(); 30 30 31 31 function wp_custom_nav_reset() { 32 wp_custom_navigation_setup(true); 33 32 wp_custom_navigation_setup( true ); 34 33 return true; 35 36 34 } 37 35 38 /*-----------------------------------------------------------------------------------*/ 39 /* Custom Navigation Admin Interface 40 /* wp_custom_navigation() is the main function for the Custom Navigation 41 /* See functions in admin-functions.php 42 /*-----------------------------------------------------------------------------------*/ 43 36 /** 37 * Custom Navigation Admin Interface 38 * 39 * This function renders the interface for the custom navigation and handels the POST requests 40 */ 44 41 function wp_custom_navigation() { 45 42 global $wpdb, $user_ID; 46 ?>43 ?> 47 44 48 45 <div class="wrap"> 49 46 <div id="no-js"><h3><?php _e('You do not have JavaScript enabled in your browser. Please enable it to access the Custom Menu functionality.'); ?></h3></div> 50 47 51 <?php52 $message sdiv = '';48 <?php 49 $message_div = ''; 53 50 $menu_id_in_edit = 0; 54 51 55 // Get the theme name56 $themename = get_current_theme();57 58 52 // Check which menu is selected and if menu is in edit already 59 if ( isset( $_POST['switch _menu'] ) )60 $menu_selected_id = (int) $_POST['menu _select'];61 elseif ( isset( $_POST['menu _id_in_edit'] ) )62 $menu_selected_id = (int) $_POST['menu _id_in_edit'];53 if ( isset( $_POST['switch-menu'] ) ) 54 $menu_selected_id = (int) $_POST['menu-select']; 55 elseif ( isset( $_POST['menu-id-in-edit'] ) ) 56 $menu_selected_id = (int) $_POST['menu-id-in-edit']; 63 57 else 64 58 $menu_selected_id = 0; 65 59 … … 78 72 } 79 73 } 80 74 81 if ( isset( $_POST['set _wp_menu'] ) ) {82 // @todo validate set _wp_menu83 update_option( 'wp_custom_nav_menu', $_POST['enable _wp_menu'] );84 $message sdiv = '<div id="message" class="updated fade below-h2"><p>' . __('Custom Menu has been updated!') . '</p></div>';75 if ( isset( $_POST['set-wp-menu'] ) ) { 76 // @todo validate set-wp-menu 77 update_option( 'wp_custom_nav_menu', $_POST['enable-wp-menu'] ); 78 $message_div = '<div id="message" class="updated fade below-h2"><p>' . __('Custom Menu has been updated!') . '</p></div>'; 85 79 } 86 80 87 if ( isset( $_POST['licount'] ) ) 88 $postCounter = $_POST['licount']; 89 else 90 $postCounter = 0; 81 $post_counter = isset( $_POST['li-count'] )? $_POST['li-count'] : 0; 91 82 92 83 // Create a new menu. Menus are stored as terms in the 'menu' taxonomy. 93 if ( isset( $_POST['add_menu'] ) ) { 94 $insert_menu_name = $_POST['add_menu_name']; 95 84 if ( isset( $_POST['add-menu'] ) ) { 85 $insert_menu_name = $_POST['add-menu-name']; 96 86 if ( $insert_menu_name != '' ) { 97 87 $existing_term = get_term_by( 'name', $insert_menu_name, 'nav_menu' ); 98 88 if ( $existing_term ) { 99 $message sdiv = '<div id="message" class="error fade below-h2"><p>' . esc_html( sprintf( e__('A menu named "%s" already exists; please try another name.'),$existing_term->name ) ) . '</p></div>';89 $message_div = '<div id="message" class="error fade below-h2"><p>' . sprintf( __('A menu named "%s" already exists; please try another name.'), esc_html( $existing_term->name ) ) . '</p></div>'; 100 90 } else { 101 91 $term = wp_insert_term( $insert_menu_name, 'nav_menu' ); 102 92 if ( !is_wp_error($term) ) { … … 104 94 $custom_menus[$term->term_id] = $term; 105 95 $menu_selected_id = $term->term_id; 106 96 $menu_id_in_edit = $menu_selected_id; 107 $messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . esc_html( sprintf( __('"%s" menu has been created!'), $term->name ) ) . '</p></div>'; 108 109 $postCounter = 0; 110 } 97 $message_div = '<div id="message" class="updated fade below-h2"><p>' . sprintf( __('"%s" menu has been created!'), esc_html( $term->name ) ) . '</p></div>'; 98 $post_counter = 0; 99 } else { 100 $message_div = '<div id="message" class="error fade below-h2"><p>' . sprintf( __('Error creating menu: %s'), $term->get_error_message() ) . '</p></div>'; 101 } 111 102 } 112 103 } else { 113 $message sdiv = '<div id="message" class="error fade below-h2"><p>' . __('Please enter a valid menu name.') . '</p></div>';104 $message_div = '<div id="message" class="error fade below-h2"><p>' . __('Please enter a valid menu name.') . '</p></div>'; 114 105 } 115 106 } 116 107 117 if ( isset($_POST['reset_wp_menu']) ) { 118 $success = wp_custom_nav_reset(); 119 if ( $success ) { 120 // DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly 121 $messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been reset.') . '</p></div>'; 122 // GET reset menu id 108 if ( isset( $_POST['reset-wp-menu'] ) ) { 109 if ( wp_custom_nav_reset() ) { 110 $message_div = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been reset.') . '</p></div>'; 123 111 $custom_menus = array(); 124 112 $menu_selected_id = 0; 125 113 } else { 126 // DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly 127 $messagesdiv = '<div id="message" class="error fade below-h2"><p>' . __('The menu could not be reset. Please try again.') . '</p></div>'; 114 $message_div = '<div id="message" class="error fade below-h2"><p>' . __('The menu could not be reset. Please try again.') . '</p></div>'; 128 115 } 129 } elseif ( $post Counter > 0 && $menu_selected_id > 0 ) {116 } elseif ( $post_counter > 0 && $menu_selected_id > 0 ) { 130 117 $menu_objects = get_objects_in_term( $menu_selected_id, 'nav_menu' ); 131 118 $menu_items = wp_custom_navigation_get_menu_items( $menu_objects ); 132 119 133 120 // Loop through all POST variables 134 for ( $k = 1; $k <= $post Counter; $k++ ) {121 for ( $k = 1; $k <= $post_counter; $k++ ) { 135 122 if (isset($_POST['dbid'.$k])) { $db_id = $_POST['dbid'.$k]; } else { $db_id = 0; } 136 123 if (isset($_POST['postmenu'.$k])) { $object_id = $_POST['postmenu'.$k]; } else { $object_id = 0; } 137 124 if (isset($_POST['parent'.$k])) { $parent_id = $_POST['parent'.$k]; } else { $parent_id = 0; } … … 153 140 $post['post_content_filtered'] = '_blank'; 154 141 else 155 142 $post['post_content_filtered'] = ''; 156 if ( $parent_id > 0 && isset( $_POST[ 'dbid' . $parent_id] ) )157 $post[ 'post_parent' ] = (int) $_POST[ 'dbid' . $parent_id];143 if ( $parent_id > 0 && isset( $_POST['dbid' . $parent_id] ) ) 144 $post[ 'post_parent' ] = (int) $_POST['dbid' . $parent_id]; 158 145 159 146 // New menu item 160 147 if ( $db_id == 0 ) { … … 172 159 wp_delete_post( $menu_id ); 173 160 } 174 161 } 175 // DISPLAY SUCCESS MESSAGE IF POST CORRECT 176 $messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been updated.') . '</p></div>'; 162 $message_div = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been updated.') . '</p></div>'; 177 163 } 178 179 // DISPLAY Custom Navigation 180 ?> 164 ?> 181 165 <div id="pages-left"> 182 166 <div class="inside"> 183 167 <h2 class="maintitle"><?php esc_html_e('Custom Navigation') ?></h2> 184 <?php 185 186 // CHECK if custom menu has been enabled 187 $enabled_menu = get_option('wp_custom_nav_menu'); 188 $checked = strtolower($enabled_menu); 189 190 if ( $checked != 'true' ) 191 echo '<div id="message-enabled" class="error fade below-h2"><p><strong>' . __('The Custom Menu has not been Enabled yet. Please enable it in order to use it -------->') . '</strong></p></div>'; 192 193 ?> 194 <?php echo $messagesdiv; ?> 168 <?php 169 $menu_enabled = strtolower( get_option( 'wp_custom_nav_menu' ) ); 170 if ( !$menu_enabled ) $menu_enabled = 'false'; 171 if ( $menu_enabled != 'true') { 172 echo '<div id="message-enabled" class="error fade below-h2"><p><strong>' . __('The Custom Menu is disabled. Please enable it on the right in order to use it →') . '</strong></p></div>'; 173 } 174 echo $message_div; 175 ?> 195 176 <form onsubmit="updatepostdata()" action="custom-navigation.php" method="post" enctype="multipart/form-data"> 177 178 <input type="hidden" name="li-count" id="li-count" value="0" /> 179 <input type="hidden" name="menu-id-in-edit" id="menu-id-in-edit" value="<?php echo esc_attr( $menu_selected_id ); ?>" /> 196 180 197 <input type="hidden" name="licount" id="licount" value="0" />198 <input type="hidden" name="menu_id_in_edit" id="menu_id_in_edit" value="<?php echo esc_attr($menu_selected_id); ?>" />199 200 181 <div class="sidebar-name"> 201 202 182 <div class="sidebar-name-arrow"> 203 183 <br/> 204 184 </div> 205 <h3><?php echo esc_html($menu_title); ?></h3> 206 185 <h3><?php echo esc_html( $menu_title ); ?></h3> 207 186 </div> 208 187 209 188 <div id="nav-container"> 210 189 <ul id="custom-nav"> 211 190 212 191 <?php 213 //DISPLAY existing menu214 192 if ( $menu_selected_id > 0 ) { 215 // SET output type 216 $output_type = "backend"; 217 // MAIN OUTPUT FUNCTION 218 wp_custom_navigation_output( 'type='.$output_type.'&name='.$menu_title.'&id='.$menu_selected_id ); 193 wp_custom_navigation_output( array( 'type' => 'backend', 'name' => $menu_title, 'id' => $menu_selected_id ) ); 219 194 } 220 195 ?> 221 196 … … 242 217 <h3><?php esc_html_e('Setup Custom Menu'); ?></h3> 243 218 </div> 244 219 <div class="widget-holder"> 220 <span > 221 <input type="radio" name="enable-wp-menu" id="enable-wp-menu-true" value="true" <?php checked( $menu_enabled, 'true' ); ?> /> 222 <label for="enable-wp-menu-true"><?php _e('Enable'); ?></label> 223 224 <input type="radio" name="enable-wp-menu" id="enable-wp-menu-false" value="false" <?php checked( $menu_enabled, 'false' ); ?> /> 225 <label for="enable-wp-menu-false"><?php _e('Disable'); ?></label> 226 </span> 245 227 246 < ?php228 <input id="set-wp-menu" type="submit" value="<?php esc_attr_e('Set Menu'); ?>" name="set-wp-menu" class="button" /><br /> 247 229 248 // Setup custom menu249 250 $enabled_menu = get_option('wp_custom_nav_menu');251 252 $checked = strtolower($enabled_menu);253 254 ?>255 256 <span >257 <label><?php _e('Enable'); ?></label><input type="radio" name="enable_wp_menu" value="true" <?php if ($checked=='true') { echo 'checked="checked"'; } ?> />258 <label><?php _e('Disable'); ?></label><input type="radio" name="enable_wp_menu" value="false" <?php if ($checked=='true') { } else { echo 'checked="checked"'; } ?> />259 </span><!-- /.checkboxes -->260 261 <input id="set_wp_menu" type="submit" value="<?php esc_attr_e('Set Menu'); ?>" name="set_wp_menu" class="button" /><br />262 263 230 <span> 264 231 <label><?php _e('Reset Menu to Default'); ?></label> 265 <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?'); ?>');" />232 <input id="reset-wp-menu" type="submit" value="Reset" name="reset-wp-menu" class="button" onclick="return confirm('<?php echo esc_js( __('Are you sure you want to reset the menu to its default settings?') ); ?>');" /> 266 233 </span> 267 234 268 235 <div class="fix"></div> … … 275 242 <h3><?php esc_html_e('Menu Selector'); ?></h3> 276 243 </div> 277 244 <div class="widget-holder"> 278 <select id="menu_select" name="menu_select"> 279 <?php 280 281 // Display select options 282 foreach ( $custom_menus as $menu ) { 283 $menu_term = get_term( $menu, 'nav_menu' ); 284 if ( ( $menu_id_in_edit == $menu->term_id ) || ( $menu_selected_id == $menu->term_id ) ) 285 $selected_option = 'selected="selected"'; 286 else 287 $selected_option = ''; 288 ?> 289 <option value="<?php echo esc_attr($menu_term->term_id); ?>" <?php echo $selected_option; ?>><?php echo $menu_term->name; ?></option> 290 <?php 291 292 } 293 ?> 245 <select id="menu-select" name="menu-select"> 246 <?php 247 foreach ( $custom_menus as $menu ) { 248 $menu_term = get_term( $menu, 'nav_menu' ); 249 $selected_option = selected( ( $menu_id_in_edit == $menu->term_id ) || ( $menu_selected_id == $menu->term_id ), true, false ); 250 ?> 251 <option value="<?php echo esc_attr( $menu_term->term_id ); ?>" <?php echo $selected_option; ?>><?php echo $menu_term->name; ?></option> 252 <?php 253 } 254 ?> 294 255 </select> 295 256 296 <input id="switch _menu" type="submit" value="<?php esc_attr_e('Switch'); ?>" name="switch_menu" class="button" />297 <input id="add _menu_name" name="add_menu_name" type="text" value="" />298 <input id="add _menu" type="submit" value="<?php esc_attr_e('Add Menu'); ?>" name="add_menu" class="button" />257 <input id="switch-menu" type="submit" value="<?php esc_attr_e('Switch'); ?>" name="switch-menu" class="button" /> 258 <input id="add-menu-name" name="add-menu-name" type="text" value="" /> 259 <input id="add-menu" type="submit" value="<?php esc_attr_e('Add Menu'); ?>" name="add-menu" class="button" /> 299 260 300 261 <div class="fix"></div> 301 262 </div> … … 308 269 </div> 309 270 <div class="widget-holder"> 310 271 <span><?php _e('Display Descriptions in Top Level Menu?'); ?></span> 311 312 <?php 313 272 <?php 314 273 // UPDATE and DISPLAY Menu Description Option 315 if ( isset( $_POST['menu-descriptions']) ) {316 if ( !isset( $_POST['switch_menu']) ) {317 $menu_options_to_edit = $_POST['menu _id_in_edit'];318 update_option( 'wp_settings_custom_nav_'.$menu_options_to_edit.'_descriptions',$_POST['menu-descriptions']);274 if ( isset( $_POST['menu-descriptions'] ) ) { 275 if ( !isset( $_POST['switch-menu'] ) ) { 276 $menu_options_to_edit = $_POST['menu-id-in-edit']; 277 update_option( 'wp_settings_custom_nav_'.$menu_options_to_edit.'_descriptions', $_POST['menu-descriptions'] ); 319 278 } 320 279 } 321 280 322 281 if ( $menu_id_in_edit > 0 ) 323 $ checkedraw= get_option('wp_settings_custom_nav_'.$menu_id_in_edit.'_descriptions');282 $show_descriptions = get_option('wp_settings_custom_nav_'.$menu_id_in_edit.'_descriptions'); 324 283 else 325 $ checkedraw= get_option('wp_settings_custom_nav_'.$menu_selected_id.'_descriptions');284 $show_descriptions = get_option('wp_settings_custom_nav_'.$menu_selected_id.'_descriptions'); 326 285 327 $checked = strtolower($checkedraw); 286 $show_descriptions = strtolower( $show_descriptions ); 287 if ( !$show_descriptions ) 288 $show_descriptions = 'no'; 328 289 329 290 if ( $advanced_option_descriptions == 'no' ) 330 $checked = 'no'; 291 $show_descriptions = 'no'; 292 ?> 331 293 332 ?>333 334 294 <span class="checkboxes"> 335 <label><?php _e('Yes'); ?></label><input type="radio" name="menu-descriptions" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> /> 336 <label><?php _e('No'); ?></label><input type="radio" name="menu-descriptions" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> /> 295 <input type="radio" name="menu-descriptions" id="menu-descriptions-yes" value="yes" <?php checked( $show_descriptions, 'yes' ); ?> /> 296 <label for="menu-descriptions-yes"><?php _e('Yes'); ?></label> 297 298 <input type="radio" name="menu-descriptions" id="menu-descriptions-no" value="no" <?php checked( $show_descriptions, 'no' ); ?> /> 299 <label for="menu-descriptions-no"><?php _e('No'); ?></label> 337 300 </span><!-- /.checkboxes --> 338 301 </form> 339 302 <div class="fix"></div> … … 364 327 'number' => '', 365 328 'offset' => 0 ); 366 329 367 //GET all pages 368 $pages_array = get_pages($pages_args); 330 $pages_array = get_pages( $pages_args ); 369 331 $page_name = ''; 370 //CHECK if pages exist371 332 if ( $pages_array ) { 372 333 foreach ( $pages_array as $post ) { 373 //Add page name to 374 $page_name .= htmlentities($post->post_title).'|'; 334 $page_name .= esc_html( $post->post_title ).'|'; 375 335 } 376 336 } else { 377 337 $page_name = __('No pages available'); 378 338 } 379 380 ?> 381 382 <script> 339 ?> 340 <script type="text/javascript"> 383 341 jQuery(document).ready(function(){ 384 342 385 //GET PHP pages 386 var dataposts = "<?php echo esc_js($page_name); ?>".split("|"); 343 var data_posts = "<?php echo esc_js($page_name); ?>".split("|"); 387 344 388 345 //Set autocomplete 389 jQuery("#page-search").autocomplete(data posts);346 jQuery("#page-search").autocomplete(data_posts); 390 347 391 348 //Handle autocomplete result 392 349 jQuery("#page-search").result(function(event, data, formatted) { … … 404 361 405 362 <input type="text" onfocus="jQuery('#page-search').attr('value','');" id="page-search" value="<?php esc_attr_e('Search Pages'); ?>" /> 406 363 407 <a id="show-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','block');jQuery('#page-search').attr('value','');jQuery('#existing-pages dt').css('display','block');jQuery('#show-pages').hide();jQuery('#hide-pages').show();"> View All</a>408 <a id="hide-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','none');jQuery('#page-search').attr('value','Search Pages');jQuery('#existing-pages dt').css('display','none');jQuery('#show-pages').show();jQuery('#hide-pages').hide();"> Hide All</a>364 <a id="show-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','block');jQuery('#page-search').attr('value','');jQuery('#existing-pages dt').css('display','block');jQuery('#show-pages').hide();jQuery('#hide-pages').show();"><?php _e('View All'); ?></a> 365 <a id="hide-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','none');jQuery('#page-search').attr('value','Search Pages');jQuery('#existing-pages dt').css('display','none');jQuery('#show-pages').show();jQuery('#hide-pages').hide();"><?php _e('Hide All'); ?></a> 409 366 410 367 <script type="text/javascript"> 411 412 368 jQuery('#hide-pages').hide(); 413 414 369 </script> 415 370 416 371 <ul id="existing-pages" class="list"> 417 372 <?php 418 $intCounter = 0; 419 //Get default Pages 420 $intCounter = wp_custom_nav_get_pages($intCounter,'default'); 373 $item_counter = 0; 374 $item_counter = wp_custom_nav_get_pages( $item_counter, 'default' ); 421 375 ?> 422 376 </ul> 423 424 377 <div class="fix"></div> 425 378 426 379 </div> … … 433 386 </div> 434 387 <div class="widget-holder"> 435 388 436 <?php 389 <?php 390 // Custom GET categories query 391 // @todo Use API 392 $categories = $wpdb->get_results("SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'category' ORDER BY term_id ASC"); 393 $cat_name = ''; 394 //CHECK for results 395 if ( $categories ) { 396 foreach ( $categories as $category ) { 397 $cat_id = $category->term_id; 437 398 438 // Custom GET categories query 439 // @todo Use API 440 $categories = $wpdb->get_results("SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'category' ORDER BY term_id ASC"); 441 $cat_name = ''; 442 //CHECK for results 443 if ( $categories ) { 444 foreach ( $categories as $category ) { 445 $cat_id = $category->term_id; 399 $cat_args = array( 400 'orderby' => 'name', 401 'include' => $cat_id, 402 'hierarchical' => 1, 403 'order' => 'ASC' 404 ); 405 $category_names = get_categories( $cat_args ); 446 406 447 $cat_args = array( 448 'orderby' => 'name', 449 'include' => $cat_id, 450 'hierarchical' => 1, 451 'order' => 'ASC' 452 ); 453 454 $category_names=get_categories($cat_args); 455 456 if ( isset($category_names[0]->name) ) { 457 // Add category name to data string 458 $cat_name .= htmlentities($category_names[0]->name).'|'; 459 } 460 } 461 } else { 462 $cat_name = __('No categories available'); 463 } 464 465 ?> 466 467 <script> 407 if ( isset( $category_names[0]->name ) ) { 408 $cat_name .= esc_html( $category_names[0]->name ).'|'; 409 } 410 } 411 } else { 412 $cat_name = __('No categories available'); 413 } 414 ?> 415 <script type="text/javascript"> 468 416 jQuery(document).ready(function(){ 469 470 //GET PHP categories 471 var datacats = "<?php echo esc_js($cat_name); ?>".split("|"); 472 473 //Set autocomplete 474 jQuery("#cat-search").autocomplete(datacats); 475 476 //Handle autocomplete result 417 var data_cats = "<?php echo esc_js($cat_name); ?>".split("|"); 418 jQuery("#cat-search").autocomplete(data_cats); 477 419 jQuery("#cat-search").result(function(event, data, formatted) { 478 420 jQuery('#existing-categories').css('display','block'); 479 421 jQuery("#existing-categories dt:contains('" + data + "')").css("display", "block"); … … 489 431 490 432 <input type="text" onfocus="jQuery('#cat-search').attr('value','');" id="cat-search" value="<?php esc_attr_e('Search Categories'); ?>" /> 491 433 492 <a id="show-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','block');jQuery('#cat-search').attr('value','');jQuery('#existing-categories dt').css('display','block');jQuery('#show-cats').hide();jQuery('#hide-cats').show();"> View All</a>493 <a id="hide-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','none');jQuery('#cat-search').attr('value','Search Categories');jQuery('#existing-categories dt').css('display','none');jQuery('#show-cats').show();jQuery('#hide-cats').hide();"> Hide All</a>434 <a id="show-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','block');jQuery('#cat-search').attr('value','');jQuery('#existing-categories dt').css('display','block');jQuery('#show-cats').hide();jQuery('#hide-cats').show();"><?php _e('View All'); ?></a> 435 <a id="hide-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','none');jQuery('#cat-search').attr('value','Search Categories');jQuery('#existing-categories dt').css('display','none');jQuery('#show-cats').show();jQuery('#hide-cats').hide();"><?php _e('Hide All'); ?></a> 494 436 495 437 <script type="text/javascript"> 496 497 438 jQuery('#hide-cats').hide(); 498 499 439 </script> 500 440 501 441 <ul id="existing-categories" class="list"> 502 <?php 503 // Get default Categories 504 $intCounter = wp_custom_nav_get_categories($intCounter, 'default'); 505 ?> 442 <?php $item_counter = wp_custom_nav_get_categories( $item_counter, 'default' ); ?> 506 443 </ul> 507 508 444 <div class="fix"></div> 509 510 445 </div> 511 446 </div><!-- /.widgets-holder-wrap --> 512 447 … … 518 453 <div class="widget-holder"> 519 454 <input id="custom_menu_item_url" type="text" value="http://" /> 520 455 <label><?php _e('URL'); ?></label><br /> 521 <?php $template dir = get_bloginfo('url'); ?>522 <input type="hidden" id="template dir" value="<?php echo esc_attr($templatedir); ?>" />456 <?php $template_dir = get_bloginfo('url'); ?> 457 <input type="hidden" id="template_dir" value="<?php echo esc_attr($template_dir); ?>" /> 523 458 <input id="custom_menu_item_name" type="text" value="Menu Item" onfocus="jQuery('#custom_menu_item_name').attr('value','');" /> 524 459 <label><?php _e('Menu Text'); ?></label><br /> 525 460 <input id="custom_menu_item_description" type="text" value="<?php esc_attr_e('A description'); ?>" <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> onfocus="jQuery('#custom_menu_item_description').attr('value','');" /> 526 461 <label <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> ><?php _e('Description'); ?></label> 527 <a class="addtomenu" onclick="appendToList('<?php echo $template dir; ?>','Custom','','','','0','');jQuery('#custom_menu_item_name').attr('value','Menu Item');jQuery('#custom_menu_item_description').attr('value','A description');"><?php _e('Add to menu'); ?></a>462 <a class="addtomenu" onclick="appendToList('<?php echo $template_dir; ?>','Custom','','','','0','');jQuery('#custom_menu_item_name').attr('value','Menu Item');jQuery('#custom_menu_item_description').attr('value','A description');"><?php _e('Add to menu'); ?></a> 528 463 <div class="fix"></div> 529 464 </div> 530 465 </div><!-- /.widgets-holder-wrap --> … … 552 487 <?php 553 488 } 554 489 555 include("admin-footer.php"); 490 include("admin-footer.php"); 491 No newline at end of file