]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/menu.php
Wordpress 3.7
[autoinstalls/wordpress.git] / wp-admin / menu.php
index 90c585dbd9d909881e306596cc7564a5c96ce9fc..b0f7b51e3ad3252826fb6a5a9cc99382f01768b1 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 /**
- * Constructs the admin menu bar.
+ * Constructs the admin menu.
  *
  * The elements in the array are :
  *     0: Menu item name
@@ -53,7 +53,7 @@ $menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu
 
        $i = 15;
        foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
-               if ( ! $tax->show_ui || ! in_array('post', (array) $tax->object_type, true) )
+               if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array('post', (array) $tax->object_type, true) )
                        continue;
 
                $submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );
@@ -65,7 +65,7 @@ $menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu
        /* translators: add new file */
        $submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
        foreach ( get_taxonomies_for_attachments( 'objects' ) as $tax ) {
-               if ( ! $tax->show_ui )
+               if ( ! $tax->show_ui || ! $tax->show_in_menu )
                        continue;
 
                $submenu['upload.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&post_type=attachment' );
@@ -84,7 +84,7 @@ $menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'me
        $submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), get_post_type_object( 'page' )->cap->create_posts, 'post-new.php?post_type=page' );
        $i = 15;
        foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
-               if ( ! $tax->show_ui || ! in_array('page', (array) $tax->object_type, true) )
+               if ( ! $tax->show_ui || ! $tax->show_in_menu  || ! in_array('page', (array) $tax->object_type, true) )
                        continue;
 
                $submenu['edit.php?post_type=page'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&post_type=page' );
@@ -126,7 +126,7 @@ foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false,
 
        $i = 15;
        foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
-               if ( ! $tax->show_ui || ! in_array($ptype, (array) $tax->object_type, true) )
+               if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array($ptype, (array) $tax->object_type, true) )
                        continue;
 
                $submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" );
@@ -136,17 +136,15 @@ unset($ptype, $ptype_obj, $ptype_class, $ptype_for_id, $ptype_menu_position, $me
 
 $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
 
-if ( current_user_can( 'switch_themes') ) {
-       $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'none' );
-               $submenu['themes.php'][5]  = array(__('Themes'), 'switch_themes', 'themes.php');
-               if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
-                       $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php');
-} else {
-       $menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'none' );
-               $submenu['themes.php'][5]  = array(__('Themes'), 'edit_theme_options', 'themes.php');
-               if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
-                       $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php' );
-}
+$appearance_cap = current_user_can( 'switch_themes') ? 'switch_themes' : 'edit_theme_options';
+
+$menu[60] = array( __('Appearance'), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
+       $submenu['themes.php'][5] = array( __( 'Themes' ), $appearance_cap, 'themes.php' );
+       $submenu['themes.php'][6] = array( __( 'Customize' ), 'edit_theme_options', 'customize.php', 'hide-if-no-customize' );
+       if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
+               $submenu['themes.php'][10] = array(__( 'Menus' ), 'edit_theme_options', 'nav-menus.php');
+
+unset( $appearance_cap );
 
 // Add 'Editor' to the bottom of the Appearance menu.
 if ( ! is_multisite() )