]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/menu.php
WordPress 4.2.2-scripts
[autoinstalls/wordpress.git] / wp-admin / menu.php
index 4008a0986d6739658a3331346aacd5bf5fea9cfd..f4fee7281f9d4ba2c4f840903a9287a53283a146 100644 (file)
@@ -121,7 +121,10 @@ foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false,
                $ptype_class = 'post';
        }
 
-       // if $ptype_menu_position is already populated or will be populated by a hard-coded value below, increment the position.
+       /*
+        * If $ptype_menu_position is already populated or will be populated
+        * by a hard-coded value below, increment the position.
+        */
        $core_menu_positions = array(59, 60, 65, 70, 75, 80, 85, 99);
        while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) )
                $ptype_menu_position++;
@@ -144,11 +147,27 @@ $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
 
 $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', 'dashicons-admin-appearance' );
+$menu[60] = array( __( 'Appearance' ), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
        $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');
+
+       $customize_url = add_query_arg( 'return', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'customize.php' );
+       $submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', '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' );
+       }
+
+       if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize') ) {
+               $customize_header_url = add_query_arg( array( 'autofocus' => array( 'control' => 'header_image' ) ), $customize_url );
+               $submenu['themes.php'][15] = array( __( 'Header' ), $appearance_cap, esc_url( $customize_header_url ), '', 'hide-if-no-customize' );
+       }
+
+       if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize') ) {
+               $customize_background_url = add_query_arg( array( 'autofocus' => array( 'control' => 'background_image' ) ), $customize_url );
+               $submenu['themes.php'][20] = array( __( 'Background' ), $appearance_cap, esc_url( $customize_background_url ), '', 'hide-if-no-customize' );
+       }
+
+       unset( $customize_url );
 
 unset( $appearance_cap );
 
@@ -187,19 +206,21 @@ else
 if ( current_user_can('list_users') ) {
        $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
        $submenu['users.php'][5] = array(__('All Users'), 'list_users', 'users.php');
-       if ( current_user_can('create_users') )
+       if ( current_user_can( 'create_users' ) ) {
                $submenu['users.php'][10] = array(_x('Add New', 'user'), 'create_users', 'user-new.php');
-       else
+       } elseif ( is_multisite() ) {
                $submenu['users.php'][10] = array(_x('Add New', 'user'), 'promote_users', 'user-new.php');
+       }
 
        $submenu['users.php'][15] = array(__('Your Profile'), 'read', 'profile.php');
 } else {
        $_wp_real_parent_file['users.php'] = 'profile.php';
        $submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
-       if ( current_user_can('create_users') )
+       if ( current_user_can( 'create_users' ) ) {
                $submenu['profile.php'][10] = array(__('Add New User'), 'create_users', 'user-new.php');
-       else
+       } elseif ( is_multisite() ) {
                $submenu['profile.php'][10] = array(__('Add New User'), 'promote_users', 'user-new.php');
+       }
 }
 
 $menu[75] = array( __('Tools'), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'dashicons-admin-tools' );
@@ -207,7 +228,7 @@ $menu[75] = array( __('Tools'), 'edit_posts', 'tools.php', '', 'menu-top menu-ic
        $submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' );
        $submenu['tools.php'][15] = array( __('Export'), 'export', 'export.php' );
        if ( is_multisite() && !is_main_site() )
-               $submenu['tools.php'][25] = array( __('Delete Site'), 'manage_options', 'ms-delete-site.php' );
+               $submenu['tools.php'][25] = array( __('Delete Site'), 'delete_site', 'ms-delete-site.php' );
        if ( ! is_multisite() && defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE )
                $submenu['tools.php'][50] = array(__('Network Setup'), 'manage_options', 'network.php');