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