Cleanups. see #11817
git-svn-id: http://svn.automattic.com/wordpress/trunk@13342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cc6e217d1d
commit
1f79e523b2
|
@ -12,6 +12,9 @@
|
|||
|
||||
require_once('admin.php');
|
||||
|
||||
if ( ! current_user_can('switch_themes') )
|
||||
wp_die( __( 'Cheatin’ uh?' ));
|
||||
|
||||
wp_admin_css( 'custom-navigation' );
|
||||
wp_enqueue_script( 'jquery' );
|
||||
wp_enqueue_script( 'jquery-ui-draggable' );
|
||||
|
@ -26,35 +29,15 @@ wp_enqueue_script( 'custom-navigation-php-functions' );
|
|||
require_once('admin-header.php');
|
||||
require_once (ABSPATH . WPINC . '/custom-navigation.php');
|
||||
|
||||
wp_custom_navigation();
|
||||
|
||||
function wp_custom_nav_reset() {
|
||||
wp_custom_navigation_setup(true);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Custom Navigation Admin Interface
|
||||
/* wp_custom_navigation() is the main function for the Custom Navigation
|
||||
/* See functions in admin-functions.php
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
function wp_custom_navigation() {
|
||||
global $wpdb, $user_ID;
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<div id="no-js"><h3><?php _e('You do not have JavaScript enabled in your browser. Please enable it to access the Menus functionality.'); ?></h3></div>
|
||||
|
||||
<?php
|
||||
$messagesdiv = '';
|
||||
$menu_id_in_edit = 0;
|
||||
|
||||
// Get the theme name
|
||||
$themename = get_current_theme();
|
||||
|
||||
// Check which menu is selected and if menu is in edit already
|
||||
if ( isset( $_POST['switch_menu'] ) )
|
||||
$menu_selected_id = (int) $_POST['menu_select'];
|
||||
|
@ -176,21 +159,21 @@ function wp_custom_navigation() {
|
|||
$messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been updated.') . '</p></div>';
|
||||
}
|
||||
|
||||
// DISPLAY Custom Navigation
|
||||
?>
|
||||
<div class="wrap">
|
||||
<?php screen_icon(); ?>
|
||||
<h2 class="maintitle"><?php esc_html_e('Menus') ?></h2>
|
||||
|
||||
<div id="no-js"><h3><?php _e('You do not have JavaScript enabled in your browser. Please enable it to access the Menus functionality.'); ?></h3></div>
|
||||
<div id="pages-left">
|
||||
<div class="inside">
|
||||
<?php
|
||||
|
||||
// CHECK if custom menu has been enabled
|
||||
$enabled_menu = get_option('wp_custom_nav_menu');
|
||||
$checked = strtolower($enabled_menu);
|
||||
|
||||
if ( $checked != 'true' )
|
||||
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>';
|
||||
|
||||
?>
|
||||
<?php echo $messagesdiv; ?>
|
||||
<form onsubmit="updatepostdata()" action="custom-navigation.php" method="post" enctype="multipart/form-data">
|
||||
|
@ -242,13 +225,9 @@ function wp_custom_navigation() {
|
|||
<div class="widget-holder">
|
||||
|
||||
<?php
|
||||
|
||||
// Setup custom menu
|
||||
|
||||
$enabled_menu = get_option('wp_custom_nav_menu');
|
||||
|
||||
$checked = strtolower($enabled_menu);
|
||||
|
||||
?>
|
||||
|
||||
<span >
|
||||
|
@ -275,7 +254,6 @@ function wp_custom_navigation() {
|
|||
<div class="widget-holder">
|
||||
<select id="menu_select" name="menu_select">
|
||||
<?php
|
||||
|
||||
// Display select options
|
||||
foreach ( $custom_menus as $menu ) {
|
||||
$menu_term = get_term( $menu, 'nav_menu' );
|
||||
|
@ -286,7 +264,6 @@ function wp_custom_navigation() {
|
|||
?>
|
||||
<option value="<?php echo esc_attr($menu_term->term_id); ?>" <?php echo $selected_option; ?>><?php echo $menu_term->name; ?></option>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
@ -308,7 +285,6 @@ function wp_custom_navigation() {
|
|||
<span><?php _e('Display Descriptions in Top Level Menu?'); ?></span>
|
||||
|
||||
<?php
|
||||
|
||||
// UPDATE and DISPLAY Menu Description Option
|
||||
if ( isset($_POST['menu-descriptions']) ) {
|
||||
if ( !isset($_POST['switch_menu']) ) {
|
||||
|
@ -326,7 +302,6 @@ function wp_custom_navigation() {
|
|||
|
||||
if ( $advanced_option_descriptions == 'no' )
|
||||
$checked = 'no';
|
||||
|
||||
?>
|
||||
|
||||
<span class="checkboxes">
|
||||
|
@ -346,7 +321,6 @@ function wp_custom_navigation() {
|
|||
<div class="widget-holder">
|
||||
|
||||
<?php
|
||||
|
||||
$pages_args = array(
|
||||
'child_of' => 0,
|
||||
'sort_order' => 'ASC',
|
||||
|
@ -374,7 +348,6 @@ function wp_custom_navigation() {
|
|||
} else {
|
||||
$page_name = __('No pages available');
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<script>
|
||||
|
@ -399,16 +372,13 @@ function wp_custom_navigation() {
|
|||
});
|
||||
</script>
|
||||
|
||||
|
||||
<input type="text" onfocus="jQuery('#page-search').attr('value','');" id="page-search" value="<?php esc_attr_e('Search Pages'); ?>" />
|
||||
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery('#hide-pages').hide();
|
||||
|
||||
</script>
|
||||
|
||||
<ul id="existing-pages" class="list">
|
||||
|
@ -432,7 +402,6 @@ function wp_custom_navigation() {
|
|||
<div class="widget-holder">
|
||||
|
||||
<?php
|
||||
|
||||
// Custom GET categories query
|
||||
// @todo Use API
|
||||
$categories = $wpdb->get_results("SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'category' ORDER BY term_id ASC");
|
||||
|
@ -459,7 +428,6 @@ function wp_custom_navigation() {
|
|||
} else {
|
||||
$cat_name = __('No categories available');
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<script>
|
||||
|
@ -491,9 +459,7 @@ function wp_custom_navigation() {
|
|||
<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>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery('#hide-cats').hide();
|
||||
|
||||
</script>
|
||||
|
||||
<ul id="existing-categories" class="list">
|
||||
|
@ -548,6 +514,5 @@ function wp_custom_navigation() {
|
|||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
include("admin-footer.php");
|
||||
|
|
Loading…
Reference in New Issue