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