author | ymh <ymh.work@gmail.com> |
Tue, 27 Sep 2022 16:37:53 +0200 | |
changeset 19 | 3d72ae0968f4 |
parent 16 | a86126ab1dd4 |
child 21 | 48c4eec2b7e6 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* Build Network Administration Menu. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Multisite |
|
7 |
* @since 3.1.0 |
|
8 |
*/ |
|
9 |
||
16 | 10 |
/* translators: Network menu item. */ |
9 | 11 |
$menu[2] = array( __( 'Dashboard' ), 'manage_network', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard' ); |
0 | 12 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
13 |
$submenu['index.php'][0] = array( __( 'Home' ), 'read', 'index.php' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
14 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
15 |
if ( current_user_can( 'update_core' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
16 |
$cap = 'update_core'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
17 |
} elseif ( current_user_can( 'update_plugins' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
18 |
$cap = 'update_plugins'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
19 |
} elseif ( current_user_can( 'update_themes' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
20 |
$cap = 'update_themes'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
21 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
22 |
$cap = 'update_languages'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
23 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
24 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
25 |
$update_data = wp_get_update_data(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
26 |
if ( $update_data['counts']['total'] ) { |
16 | 27 |
$submenu['index.php'][10] = array( |
28 |
sprintf( |
|
29 |
/* translators: %s: Number of available updates. */ |
|
30 |
__( 'Updates %s' ), |
|
31 |
sprintf( |
|
32 |
'<span class="update-plugins count-%s"><span class="update-count">%s</span></span>', |
|
33 |
$update_data['counts']['total'], |
|
34 |
number_format_i18n( $update_data['counts']['total'] ) |
|
35 |
) |
|
36 |
), |
|
37 |
$cap, |
|
38 |
'update-core.php', |
|
39 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
40 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
41 |
$submenu['index.php'][10] = array( __( 'Updates' ), $cap, 'update-core.php' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
42 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
43 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
44 |
unset( $cap ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
45 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
46 |
$submenu['index.php'][15] = array( __( 'Upgrade Network' ), 'upgrade_network', 'upgrade.php' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
47 |
|
0 | 48 |
$menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' ); |
49 |
||
16 | 50 |
/* translators: Sites menu item. */ |
9 | 51 |
$menu[5] = array( __( 'Sites' ), 'manage_sites', 'sites.php', '', 'menu-top menu-icon-site', 'menu-site', 'dashicons-admin-multisite' ); |
52 |
$submenu['sites.php'][5] = array( __( 'All Sites' ), 'manage_sites', 'sites.php' ); |
|
53 |
$submenu['sites.php'][10] = array( _x( 'Add New', 'site' ), 'create_sites', 'site-new.php' ); |
|
0 | 54 |
|
9 | 55 |
$menu[10] = array( __( 'Users' ), 'manage_network_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' ); |
56 |
$submenu['users.php'][5] = array( __( 'All Users' ), 'manage_network_users', 'users.php' ); |
|
57 |
$submenu['users.php'][10] = array( _x( 'Add New', 'user' ), 'create_users', 'user-new.php' ); |
|
0 | 58 |
|
5 | 59 |
if ( current_user_can( 'update_themes' ) && $update_data['counts']['themes'] ) { |
16 | 60 |
$menu[15] = array( |
61 |
sprintf( |
|
62 |
/* translators: %s: Number of available theme updates. */ |
|
63 |
__( 'Themes %s' ), |
|
64 |
sprintf( |
|
65 |
'<span class="update-plugins count-%s"><span class="theme-count">%s</span></span>', |
|
66 |
$update_data['counts']['themes'], |
|
67 |
number_format_i18n( $update_data['counts']['themes'] ) |
|
68 |
) |
|
69 |
), |
|
70 |
'manage_network_themes', |
|
71 |
'themes.php', |
|
72 |
'', |
|
73 |
'menu-top menu-icon-appearance', |
|
74 |
'menu-appearance', |
|
75 |
'dashicons-admin-appearance', |
|
76 |
); |
|
0 | 77 |
} else { |
5 | 78 |
$menu[15] = array( __( 'Themes' ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' ); |
0 | 79 |
} |
9 | 80 |
$submenu['themes.php'][5] = array( __( 'Installed Themes' ), 'manage_network_themes', 'themes.php' ); |
81 |
$submenu['themes.php'][10] = array( _x( 'Add New', 'theme' ), 'install_themes', 'theme-install.php' ); |
|
19 | 82 |
$submenu['themes.php'][15] = array( __( 'Theme File Editor' ), 'edit_themes', 'theme-editor.php' ); |
0 | 83 |
|
5 | 84 |
if ( current_user_can( 'update_plugins' ) && $update_data['counts']['plugins'] ) { |
16 | 85 |
$menu[20] = array( |
86 |
sprintf( |
|
87 |
/* translators: %s: Number of available plugin updates. */ |
|
88 |
__( 'Plugins %s' ), |
|
89 |
sprintf( |
|
90 |
'<span class="update-plugins count-%s"><span class="plugin-count">%s</span></span>', |
|
91 |
$update_data['counts']['plugins'], |
|
92 |
number_format_i18n( $update_data['counts']['plugins'] ) |
|
93 |
) |
|
94 |
), |
|
95 |
'manage_network_plugins', |
|
96 |
'plugins.php', |
|
97 |
'', |
|
98 |
'menu-top menu-icon-plugins', |
|
99 |
'menu-plugins', |
|
100 |
'dashicons-admin-plugins', |
|
101 |
); |
|
0 | 102 |
} else { |
9 | 103 |
$menu[20] = array( __( 'Plugins' ), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' ); |
0 | 104 |
} |
9 | 105 |
$submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'manage_network_plugins', 'plugins.php' ); |
106 |
$submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' ); |
|
19 | 107 |
$submenu['plugins.php'][15] = array( __( 'Plugin File Editor' ), 'edit_plugins', 'plugin-editor.php' ); |
0 | 108 |
|
9 | 109 |
$menu[25] = array( __( 'Settings' ), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' ); |
0 | 110 |
if ( defined( 'MULTISITE' ) && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) { |
9 | 111 |
$submenu['settings.php'][5] = array( __( 'Network Settings' ), 'manage_network_options', 'settings.php' ); |
112 |
$submenu['settings.php'][10] = array( __( 'Network Setup' ), 'setup_network', 'setup.php' ); |
|
0 | 113 |
} |
9 | 114 |
unset( $update_data ); |
0 | 115 |
|
5 | 116 |
$menu[99] = array( '', 'exist', 'separator-last', '', 'wp-menu-separator' ); |
0 | 117 |
|
16 | 118 |
require_once ABSPATH . 'wp-admin/includes/menu.php'; |