wp/wp-admin/menu.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
    18  *     5: Icon for top level menu
    18  *     5: Icon for top level menu
    19  *
    19  *
    20  * @global array $menu
    20  * @global array $menu
    21  */
    21  */
    22 
    22 
    23 $menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard' );
    23 $menu[2] = array( __( 'Dashboard' ), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard' );
    24 
    24 
    25 $submenu[ 'index.php' ][0] = array( __('Home'), 'read', 'index.php' );
    25 $submenu['index.php'][0] = array( __( 'Home' ), 'read', 'index.php' );
    26 
    26 
    27 if ( is_multisite() ) {
    27 if ( is_multisite() ) {
    28 	$submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' );
    28 	$submenu['index.php'][5] = array( __( 'My Sites' ), 'read', 'my-sites.php' );
    29 }
    29 }
    30 
    30 
    31 if ( ! is_multisite() || current_user_can( 'update_core' ) ) {
    31 if ( ! is_multisite() || current_user_can( 'update_core' ) ) {
    32 	$update_data = wp_get_update_data();
    32 	$update_data = wp_get_update_data();
    33 }
    33 }
    40 	} elseif ( current_user_can( 'update_themes' ) ) {
    40 	} elseif ( current_user_can( 'update_themes' ) ) {
    41 		$cap = 'update_themes';
    41 		$cap = 'update_themes';
    42 	} else {
    42 	} else {
    43 		$cap = 'update_languages';
    43 		$cap = 'update_languages';
    44 	}
    44 	}
    45 	$submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-{$update_data['counts']['total']}'><span class='update-count'>" . number_format_i18n($update_data['counts']['total']) . "</span></span>" ), $cap, 'update-core.php');
    45 	/* translators: %s: number of pending updates */
       
    46 	$submenu['index.php'][10] = array( sprintf( __( 'Updates %s' ), "<span class='update-plugins count-{$update_data['counts']['total']}'><span class='update-count'>" . number_format_i18n( $update_data['counts']['total'] ) . '</span></span>' ), $cap, 'update-core.php' );
    46 	unset( $cap );
    47 	unset( $cap );
    47 }
    48 }
    48 
    49 
    49 $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
    50 $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
    50 
    51 
    51 // $menu[5] = Posts
    52 // $menu[5] = Posts
    52 
    53 
    53 $menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'dashicons-admin-media' );
    54 $menu[10]                     = array( __( 'Media' ), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'dashicons-admin-media' );
    54 	$submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php');
    55 	$submenu['upload.php'][5] = array( __( 'Library' ), 'upload_files', 'upload.php' );
    55 	/* translators: add new file */
    56 	/* translators: add new file */
    56 	$submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
    57 	$submenu['upload.php'][10] = array( _x( 'Add New', 'file' ), 'upload_files', 'media-new.php' );
    57 	$i = 15;
    58 	$i                         = 15;
    58 	foreach ( get_taxonomies_for_attachments( 'objects' ) as $tax ) {
    59 foreach ( get_taxonomies_for_attachments( 'objects' ) as $tax ) {
    59 		if ( ! $tax->show_ui || ! $tax->show_in_menu )
    60 	if ( ! $tax->show_ui || ! $tax->show_in_menu ) {
    60 			continue;
    61 		continue;
    61 
    62 	}
    62 		$submenu['upload.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&amp;post_type=attachment' );
    63 
    63 	}
    64 	$submenu['upload.php'][ $i++ ] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&amp;post_type=attachment' );
       
    65 }
    64 	unset( $tax, $i );
    66 	unset( $tax, $i );
    65 
    67 
    66 $menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'dashicons-admin-links' );
    68 $menu[15]                           = array( __( 'Links' ), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'dashicons-admin-links' );
    67 	$submenu['link-manager.php'][5] = array( _x('All Links', 'admin menu'), 'manage_links', 'link-manager.php' );
    69 	$submenu['link-manager.php'][5] = array( _x( 'All Links', 'admin menu' ), 'manage_links', 'link-manager.php' );
    68 	/* translators: add new links */
    70 	/* translators: add new links */
    69 	$submenu['link-manager.php'][10] = array( _x('Add New', 'link'), 'manage_links', 'link-add.php' );
    71 	$submenu['link-manager.php'][10] = array( _x( 'Add New', 'link' ), 'manage_links', 'link-add.php' );
    70 	$submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-tags.php?taxonomy=link_category' );
    72 	$submenu['link-manager.php'][15] = array( __( 'Link Categories' ), 'manage_categories', 'edit-tags.php?taxonomy=link_category' );
    71 
    73 
    72 // $menu[20] = Pages
    74 // $menu[20] = Pages
    73 
    75 
    74 // Avoid the comment count query for users who cannot edit_posts.
    76 // Avoid the comment count query for users who cannot edit_posts.
    75 if ( current_user_can( 'edit_posts' ) ) {
    77 if ( current_user_can( 'edit_posts' ) ) {
    76 	$awaiting_mod = wp_count_comments();
    78 	$awaiting_mod      = wp_count_comments();
    77 	$awaiting_mod = $awaiting_mod->moderated;
    79 	$awaiting_mod      = $awaiting_mod->moderated;
       
    80 	$awaiting_mod_i18n = number_format_i18n( $awaiting_mod );
       
    81 	/* translators: %s: number of comments in moderation */
       
    82 	$awaiting_mod_text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $awaiting_mod ), $awaiting_mod_i18n );
       
    83 
    78 	$menu[25] = array(
    84 	$menu[25] = array(
    79 		sprintf( __( 'Comments %s' ), '<span class="awaiting-mod count-' . absint( $awaiting_mod ) . '"><span class="pending-count">' . number_format_i18n( $awaiting_mod ) . '</span></span>' ),
    85 		/* translators: %s: number of comments in moderation */
       
    86 		sprintf( __( 'Comments %s' ), '<span class="awaiting-mod count-' . absint( $awaiting_mod ) . '"><span class="pending-count" aria-hidden="true">' . $awaiting_mod_i18n . '</span><span class="comments-in-moderation-text screen-reader-text">' . $awaiting_mod_text . '</span></span>' ),
    80 		'edit_posts',
    87 		'edit_posts',
    81 		'edit-comments.php',
    88 		'edit-comments.php',
    82 		'',
    89 		'',
    83 		'menu-top menu-icon-comments',
    90 		'menu-top menu-icon-comments',
    84 		'menu-comments',
    91 		'menu-comments',
    85 		'dashicons-admin-comments',
    92 		'dashicons-admin-comments',
    86 	);
    93 	);
    87 	unset( $awaiting_mod );
    94 	unset( $awaiting_mod );
    88 }
    95 }
    89 
    96 
    90 $submenu[ 'edit-comments.php' ][0] = array( __('All Comments'), 'edit_posts', 'edit-comments.php' );
    97 $submenu['edit-comments.php'][0] = array( __( 'All Comments' ), 'edit_posts', 'edit-comments.php' );
    91 
    98 
    92 $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
    99 $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
    93 
   100 
    94 $types = (array) get_post_types( array('show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) );
   101 $types   = (array) get_post_types(
       
   102 	array(
       
   103 		'show_ui'      => true,
       
   104 		'_builtin'     => false,
       
   105 		'show_in_menu' => true,
       
   106 	)
       
   107 );
    95 $builtin = array( 'post', 'page' );
   108 $builtin = array( 'post', 'page' );
    96 foreach ( array_merge( $builtin, $types ) as $ptype ) {
   109 foreach ( array_merge( $builtin, $types ) as $ptype ) {
    97 	$ptype_obj = get_post_type_object( $ptype );
   110 	$ptype_obj = get_post_type_object( $ptype );
    98 	// Check if it should be a submenu.
   111 	// Check if it should be a submenu.
    99 	if ( $ptype_obj->show_in_menu !== true )
   112 	if ( $ptype_obj->show_in_menu !== true ) {
   100 		continue;
   113 		continue;
       
   114 	}
   101 	$ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first.
   115 	$ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first.
   102 	$ptype_for_id = sanitize_html_class( $ptype );
   116 	$ptype_for_id        = sanitize_html_class( $ptype );
   103 
   117 
   104 	$menu_icon = 'dashicons-admin-post';
   118 	$menu_icon = 'dashicons-admin-post';
   105 	if ( is_string( $ptype_obj->menu_icon ) ) {
   119 	if ( is_string( $ptype_obj->menu_icon ) ) {
   106 		// Special handling for data:image/svg+xml and Dashicons.
   120 		// Special handling for data:image/svg+xml and Dashicons.
   107 		if ( 0 === strpos( $ptype_obj->menu_icon, 'data:image/svg+xml;base64,' ) || 0 === strpos( $ptype_obj->menu_icon, 'dashicons-' ) ) {
   121 		if ( 0 === strpos( $ptype_obj->menu_icon, 'data:image/svg+xml;base64,' ) || 0 === strpos( $ptype_obj->menu_icon, 'dashicons-' ) ) {
   114 	}
   128 	}
   115 
   129 
   116 	$menu_class = 'menu-top menu-icon-' . $ptype_for_id;
   130 	$menu_class = 'menu-top menu-icon-' . $ptype_for_id;
   117 	// 'post' special case
   131 	// 'post' special case
   118 	if ( 'post' === $ptype ) {
   132 	if ( 'post' === $ptype ) {
   119 		$menu_class .= ' open-if-no-js';
   133 		$menu_class    .= ' open-if-no-js';
   120 		$ptype_file = "edit.php";
   134 		$ptype_file     = 'edit.php';
   121 		$post_new_file = "post-new.php";
   135 		$post_new_file  = 'post-new.php';
   122 		$edit_tags_file = "edit-tags.php?taxonomy=%s";
   136 		$edit_tags_file = 'edit-tags.php?taxonomy=%s';
   123 	} else {
   137 	} else {
   124 		$ptype_file = "edit.php?post_type=$ptype";
   138 		$ptype_file     = "edit.php?post_type=$ptype";
   125 		$post_new_file = "post-new.php?post_type=$ptype";
   139 		$post_new_file  = "post-new.php?post_type=$ptype";
   126 		$edit_tags_file = "edit-tags.php?taxonomy=%s&amp;post_type=$ptype";
   140 		$edit_tags_file = "edit-tags.php?taxonomy=%s&amp;post_type=$ptype";
   127 	}
   141 	}
   128 
   142 
   129 	if ( in_array( $ptype, $builtin ) ) {
   143 	if ( in_array( $ptype, $builtin ) ) {
   130 		$ptype_menu_id = 'menu-' . $ptype_for_id . 's';
   144 		$ptype_menu_id = 'menu-' . $ptype_for_id . 's';
   133 	}
   147 	}
   134 	/*
   148 	/*
   135 	 * If $ptype_menu_position is already populated or will be populated
   149 	 * If $ptype_menu_position is already populated or will be populated
   136 	 * by a hard-coded value below, increment the position.
   150 	 * by a hard-coded value below, increment the position.
   137 	 */
   151 	 */
   138 	$core_menu_positions = array(59, 60, 65, 70, 75, 80, 85, 99);
   152 	$core_menu_positions = array( 59, 60, 65, 70, 75, 80, 85, 99 );
   139 	while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) )
   153 	while ( isset( $menu[ $ptype_menu_position ] ) || in_array( $ptype_menu_position, $core_menu_positions ) ) {
   140 		$ptype_menu_position++;
   154 		$ptype_menu_position++;
   141 
   155 	}
   142 	$menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, $ptype_file, '', $menu_class, $ptype_menu_id, $menu_icon );
   156 
   143 	$submenu[ $ptype_file ][5]  = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts,  $ptype_file );
   157 	$menu[ $ptype_menu_position ] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, $ptype_file, '', $menu_class, $ptype_menu_id, $menu_icon );
   144 	$submenu[ $ptype_file ][10]  = array( $ptype_obj->labels->add_new, $ptype_obj->cap->create_posts, $post_new_file );
   158 	$submenu[ $ptype_file ][5]    = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, $ptype_file );
       
   159 	$submenu[ $ptype_file ][10]   = array( $ptype_obj->labels->add_new, $ptype_obj->cap->create_posts, $post_new_file );
   145 
   160 
   146 	$i = 15;
   161 	$i = 15;
   147 	foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
   162 	foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
   148 		if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array($ptype, (array) $tax->object_type, true) )
   163 		if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array( $ptype, (array) $tax->object_type, true ) ) {
   149 			continue;
   164 			continue;
   150 
   165 		}
   151 		$submenu[ $ptype_file ][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, sprintf( $edit_tags_file, $tax->name ) );
   166 
       
   167 		$submenu[ $ptype_file ][ $i++ ] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, sprintf( $edit_tags_file, $tax->name ) );
   152 	}
   168 	}
   153 }
   169 }
   154 unset( $ptype, $ptype_obj, $ptype_for_id, $ptype_menu_position, $menu_icon, $i, $tax, $post_new_file );
   170 unset( $ptype, $ptype_obj, $ptype_for_id, $ptype_menu_position, $menu_icon, $i, $tax, $post_new_file );
   155 
   171 
   156 $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
   172 $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
   157 
   173 
   158 $appearance_cap = current_user_can( 'switch_themes') ? 'switch_themes' : 'edit_theme_options';
   174 $appearance_cap = current_user_can( 'switch_themes' ) ? 'switch_themes' : 'edit_theme_options';
   159 
   175 
   160 $menu[60] = array( __( 'Appearance' ), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
   176 $menu[60]                     = array( __( 'Appearance' ), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
   161 	$submenu['themes.php'][5] = array( __( 'Themes' ), $appearance_cap, 'themes.php' );
   177 	$submenu['themes.php'][5] = array( __( 'Themes' ), $appearance_cap, 'themes.php' );
   162 
   178 
   163 	$customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
   179 	$customize_url            = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
   164 	$submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
   180 	$submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
   165 
   181 
   166 	if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
   182 if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
   167 		$submenu['themes.php'][10] = array( __( 'Menus' ), 'edit_theme_options', 'nav-menus.php' );
   183 	$submenu['themes.php'][10] = array( __( 'Menus' ), 'edit_theme_options', 'nav-menus.php' );
   168 	}
   184 }
   169 
   185 
   170 	if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize') ) {
   186 if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize' ) ) {
   171 		$customize_header_url = add_query_arg( array( 'autofocus' => array( 'control' => 'header_image' ) ), $customize_url );
   187 	$customize_header_url      = add_query_arg( array( 'autofocus' => array( 'control' => 'header_image' ) ), $customize_url );
   172 		$submenu['themes.php'][15] = array( __( 'Header' ), $appearance_cap, esc_url( $customize_header_url ), '', 'hide-if-no-customize' );
   188 	$submenu['themes.php'][15] = array( __( 'Header' ), $appearance_cap, esc_url( $customize_header_url ), '', 'hide-if-no-customize' );
   173 	}
   189 }
   174 
   190 
   175 	if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize') ) {
   191 if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize' ) ) {
   176 		$customize_background_url = add_query_arg( array( 'autofocus' => array( 'control' => 'background_image' ) ), $customize_url );
   192 	$customize_background_url  = add_query_arg( array( 'autofocus' => array( 'control' => 'background_image' ) ), $customize_url );
   177 		$submenu['themes.php'][20] = array( __( 'Background' ), $appearance_cap, esc_url( $customize_background_url ), '', 'hide-if-no-customize' );
   193 	$submenu['themes.php'][20] = array( __( 'Background' ), $appearance_cap, esc_url( $customize_background_url ), '', 'hide-if-no-customize' );
   178 	}
   194 }
   179 
   195 
   180 	unset( $customize_url );
   196 	unset( $customize_url );
   181 
   197 
   182 unset( $appearance_cap );
   198 unset( $appearance_cap );
   183 
   199 
   184 // Add 'Editor' to the bottom of the Appearance menu.
   200 // Add 'Editor' to the bottom of the Appearance menu.
   185 if ( ! is_multisite() ) {
   201 if ( ! is_multisite() ) {
   186 	add_action('admin_menu', '_add_themes_utility_last', 101);
   202 	add_action( 'admin_menu', '_add_themes_utility_last', 101 );
   187 }
   203 }
   188 /**
   204 /**
   189  * Adds the (theme) 'Editor' link to the bottom of the Appearance menu.
   205  * Adds the (theme) 'Editor' link to the bottom of the Appearance menu.
   190  *
   206  *
   191  * @access private
   207  * @access private
   192  * @since 3.0.0
   208  * @since 3.0.0
   193  */
   209  */
   194 function _add_themes_utility_last() {
   210 function _add_themes_utility_last() {
   195 	// Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook
   211 	// Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook
   196 	add_submenu_page('themes.php', _x('Editor', 'theme editor'), _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php');
   212 	add_submenu_page( 'themes.php', __( 'Theme Editor' ), __( 'Theme Editor' ), 'edit_themes', 'theme-editor.php' );
   197 }
   213 }
   198 
   214 
   199 $count = '';
   215 $count = '';
   200 if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) {
   216 if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) {
   201 	if ( ! isset( $update_data ) )
   217 	if ( ! isset( $update_data ) ) {
   202 		$update_data = wp_get_update_data();
   218 		$update_data = wp_get_update_data();
   203 	$count = "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n($update_data['counts']['plugins']) . "</span></span>";
   219 	}
   204 }
   220 	$count = "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n( $update_data['counts']['plugins'] ) . '</span></span>';
   205 
   221 }
   206 $menu[65] = array( sprintf( __('Plugins %s'), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' );
   222 
   207 
   223 /* translators: %s: number of pending plugin updates */
   208 $submenu['plugins.php'][5]  = array( __('Installed Plugins'), 'activate_plugins', 'plugins.php' );
   224 $menu[65] = array( sprintf( __( 'Plugins %s' ), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' );
   209 
   225 
   210 	if ( ! is_multisite() ) {
   226 $submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'activate_plugins', 'plugins.php' );
   211 		/* translators: add new plugin */
   227 
   212 		$submenu['plugins.php'][10] = array( _x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php' );
   228 if ( ! is_multisite() ) {
   213 		$submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
   229 	/* translators: add new plugin */
   214 	}
   230 	$submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' );
       
   231 	$submenu['plugins.php'][15] = array( __( 'Plugin Editor' ), 'edit_plugins', 'plugin-editor.php' );
       
   232 }
   215 
   233 
   216 unset( $update_data );
   234 unset( $update_data );
   217 
   235 
   218 if ( current_user_can('list_users') )
   236 if ( current_user_can( 'list_users' ) ) {
   219 	$menu[70] = array( __('Users'), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' );
   237 	$menu[70] = array( __( 'Users' ), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' );
   220 else
   238 } else {
   221 	$menu[70] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' );
   239 	$menu[70] = array( __( 'Profile' ), 'read', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' );
   222 
   240 }
   223 if ( current_user_can('list_users') ) {
   241 
       
   242 if ( current_user_can( 'list_users' ) ) {
   224 	$_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
   243 	$_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
   225 	$submenu['users.php'][5] = array(__('All Users'), 'list_users', 'users.php');
   244 	$submenu['users.php'][5]             = array( __( 'All Users' ), 'list_users', 'users.php' );
   226 	if ( current_user_can( 'create_users' ) ) {
   245 	if ( current_user_can( 'create_users' ) ) {
   227 		$submenu['users.php'][10] = array(_x('Add New', 'user'), 'create_users', 'user-new.php');
   246 		$submenu['users.php'][10] = array( _x( 'Add New', 'user' ), 'create_users', 'user-new.php' );
   228 	} elseif ( is_multisite() ) {
   247 	} elseif ( is_multisite() ) {
   229 		$submenu['users.php'][10] = array(_x('Add New', 'user'), 'promote_users', 'user-new.php');
   248 		$submenu['users.php'][10] = array( _x( 'Add New', 'user' ), 'promote_users', 'user-new.php' );
   230 	}
   249 	}
   231 
   250 
   232 	$submenu['users.php'][15] = array(__('Your Profile'), 'read', 'profile.php');
   251 	$submenu['users.php'][15] = array( __( 'Your Profile' ), 'read', 'profile.php' );
   233 } else {
   252 } else {
   234 	$_wp_real_parent_file['users.php'] = 'profile.php';
   253 	$_wp_real_parent_file['users.php'] = 'profile.php';
   235 	$submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
   254 	$submenu['profile.php'][5]         = array( __( 'Your Profile' ), 'read', 'profile.php' );
   236 	if ( current_user_can( 'create_users' ) ) {
   255 	if ( current_user_can( 'create_users' ) ) {
   237 		$submenu['profile.php'][10] = array(__('Add New User'), 'create_users', 'user-new.php');
   256 		$submenu['profile.php'][10] = array( __( 'Add New User' ), 'create_users', 'user-new.php' );
   238 	} elseif ( is_multisite() ) {
   257 	} elseif ( is_multisite() ) {
   239 		$submenu['profile.php'][10] = array(__('Add New User'), 'promote_users', 'user-new.php');
   258 		$submenu['profile.php'][10] = array( __( 'Add New User' ), 'promote_users', 'user-new.php' );
   240 	}
   259 	}
   241 }
   260 }
   242 
   261 
   243 $menu[75] = array( __('Tools'), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'dashicons-admin-tools' );
   262 $menu[75]                     = array( __( 'Tools' ), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'dashicons-admin-tools' );
   244 	$submenu['tools.php'][5] = array( __('Available Tools'), 'edit_posts', 'tools.php' );
   263 	$submenu['tools.php'][5]  = array( __( 'Available Tools' ), 'edit_posts', 'tools.php' );
   245 	$submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' );
   264 	$submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' );
   246 	$submenu['tools.php'][15] = array( __('Export'), 'export', 'export.php' );
   265 	$submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' );
   247 	if ( is_multisite() && !is_main_site() )
   266 	$submenu['tools.php'][20] = array( __( 'Site Health' ), 'view_site_health_checks', 'site-health.php' );
   248 		$submenu['tools.php'][25] = array( __('Delete Site'), 'delete_site', 'ms-delete-site.php' );
   267 if ( is_multisite() && ! is_main_site() ) {
   249 	if ( ! is_multisite() && defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE )
   268 	$submenu['tools.php'][25] = array( __( 'Delete Site' ), 'delete_site', 'ms-delete-site.php' );
   250 		$submenu['tools.php'][50] = array(__('Network Setup'), 'setup_network', 'network.php');
   269 }
   251 
   270 if ( ! is_multisite() && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) {
   252 $change_notice = '';
   271 	$submenu['tools.php'][50] = array( __( 'Network Setup' ), 'setup_network', 'network.php' );
   253 if ( current_user_can( 'manage_privacy_options' ) && WP_Privacy_Policy_Content::text_change_check() ) {
   272 }
   254 	$change_notice = ' <span class="update-plugins 1"><span class="plugin-count">' . number_format_i18n( 1 ) . '</span></span>';
   273 
   255 }
   274 $menu[80]                               = array( __( 'Settings' ), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
   256 
       
   257 // translators: %s is the update notification bubble, if updates are available.
       
   258 $menu[80]                               = array( sprintf( __( 'Settings %s' ), $change_notice ), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
       
   259 	$submenu['options-general.php'][10] = array( _x( 'General', 'settings screen' ), 'manage_options', 'options-general.php' );
   275 	$submenu['options-general.php'][10] = array( _x( 'General', 'settings screen' ), 'manage_options', 'options-general.php' );
   260 	$submenu['options-general.php'][15] = array( __( 'Writing' ), 'manage_options', 'options-writing.php' );
   276 	$submenu['options-general.php'][15] = array( __( 'Writing' ), 'manage_options', 'options-writing.php' );
   261 	$submenu['options-general.php'][20] = array( __( 'Reading' ), 'manage_options', 'options-reading.php' );
   277 	$submenu['options-general.php'][20] = array( __( 'Reading' ), 'manage_options', 'options-reading.php' );
   262 	$submenu['options-general.php'][25] = array( __( 'Discussion' ), 'manage_options', 'options-discussion.php' );
   278 	$submenu['options-general.php'][25] = array( __( 'Discussion' ), 'manage_options', 'options-discussion.php' );
   263 	$submenu['options-general.php'][30] = array( __( 'Media' ), 'manage_options', 'options-media.php' );
   279 	$submenu['options-general.php'][30] = array( __( 'Media' ), 'manage_options', 'options-media.php' );
   264 	$submenu['options-general.php'][40] = array( __( 'Permalinks' ), 'manage_options', 'options-permalink.php' );
   280 	$submenu['options-general.php'][40] = array( __( 'Permalinks' ), 'manage_options', 'options-permalink.php' );
   265 	// translators: %s is the update notification bubble, if updates are available.
   281 	$submenu['options-general.php'][45] = array( __( 'Privacy' ), 'manage_privacy_options', 'privacy.php' );
   266 	$submenu['options-general.php'][45] = array( sprintf( __( 'Privacy %s' ), $change_notice ), 'manage_privacy_options', 'privacy.php' );
       
   267 
   282 
   268 $_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
   283 $_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
   269 
   284 
   270 $menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator' );
   285 $menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator' );
   271 
   286 
   272 // Back-compat for old top-levels
   287 // Back-compat for old top-levels
   273 $_wp_real_parent_file['post.php'] = 'edit.php';
   288 $_wp_real_parent_file['post.php']       = 'edit.php';
   274 $_wp_real_parent_file['post-new.php'] = 'edit.php';
   289 $_wp_real_parent_file['post-new.php']   = 'edit.php';
   275 $_wp_real_parent_file['edit-pages.php'] = 'edit.php?post_type=page';
   290 $_wp_real_parent_file['edit-pages.php'] = 'edit.php?post_type=page';
   276 $_wp_real_parent_file['page-new.php'] = 'edit.php?post_type=page';
   291 $_wp_real_parent_file['page-new.php']   = 'edit.php?post_type=page';
   277 $_wp_real_parent_file['wpmu-admin.php'] = 'tools.php';
   292 $_wp_real_parent_file['wpmu-admin.php'] = 'tools.php';
   278 $_wp_real_parent_file['ms-admin.php'] = 'tools.php';
   293 $_wp_real_parent_file['ms-admin.php']   = 'tools.php';
   279 
   294 
   280 // Ensure backward compatibility.
   295 // Ensure backward compatibility.
   281 $compat = array(
   296 $compat = array(
   282 	'index' => 'dashboard',
   297 	'index'           => 'dashboard',
   283 	'edit' => 'posts',
   298 	'edit'            => 'posts',
   284 	'post' => 'posts',
   299 	'post'            => 'posts',
   285 	'upload' => 'media',
   300 	'upload'          => 'media',
   286 	'link-manager' => 'links',
   301 	'link-manager'    => 'links',
   287 	'edit-pages' => 'pages',
   302 	'edit-pages'      => 'pages',
   288 	'page' => 'pages',
   303 	'page'            => 'pages',
   289 	'edit-comments' => 'comments',
   304 	'edit-comments'   => 'comments',
   290 	'options-general' => 'settings',
   305 	'options-general' => 'settings',
   291 	'themes' => 'appearance',
   306 	'themes'          => 'appearance',
   292 	);
   307 );
   293 
   308 
   294 require_once(ABSPATH . 'wp-admin/includes/menu.php');
   309 require_once( ABSPATH . 'wp-admin/includes/menu.php' );