author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:40:08 +0200 | |
changeset 21 | 48c4eec2b7e6 |
parent 19 | 3d72ae0968f4 |
child 22 | 8c2e4d02f4ef |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* Multisite sites administration panel. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Multisite |
|
7 |
* @since 3.0.0 |
|
8 |
*/ |
|
9 |
||
10 |
/** Load WordPress Administration Bootstrap */ |
|
16 | 11 |
require_once __DIR__ . '/admin.php'; |
0 | 12 |
|
9 | 13 |
if ( ! current_user_can( 'manage_sites' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
14 |
wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
9 | 15 |
} |
0 | 16 |
|
17 |
$wp_list_table = _get_list_table( 'WP_MS_Sites_List_Table' ); |
|
9 | 18 |
$pagenum = $wp_list_table->get_pagenum(); |
0 | 19 |
|
19 | 20 |
// Used in the HTML title tag. |
9 | 21 |
$title = __( 'Sites' ); |
0 | 22 |
$parent_file = 'sites.php'; |
23 |
||
5 | 24 |
add_screen_option( 'per_page' ); |
0 | 25 |
|
9 | 26 |
get_current_screen()->add_help_tab( |
27 |
array( |
|
28 |
'id' => 'overview', |
|
29 |
'title' => __( 'Overview' ), |
|
30 |
'content' => |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
31 |
'<p>' . __( 'Add New Site takes you to the screen for adding a new site to the network. You can search for a site by Name, ID number, or IP address. Screen Options allows you to choose how many sites to display on one page.' ) . '</p>' . |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
32 |
'<p>' . __( 'This is the main table of all sites on this network. Switch between list and excerpt views by using the icons above the right side of the table.' ) . '</p>' . |
9 | 33 |
'<p>' . __( 'Hovering over each site reveals seven options (three for the primary site):' ) . '</p>' . |
34 |
'<ul><li>' . __( 'An Edit link to a separate Edit Site screen.' ) . '</li>' . |
|
35 |
'<li>' . __( 'Dashboard leads to the Dashboard for that site.' ) . '</li>' . |
|
36 |
'<li>' . __( 'Deactivate, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.' ) . '</li>' . |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
37 |
'<li>' . __( 'Delete which is a permanent action after the confirmation screen.' ) . '</li>' . |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
38 |
'<li>' . __( 'Visit to go to the front-end of the live site.' ) . '</li></ul>', |
9 | 39 |
) |
40 |
); |
|
0 | 41 |
|
42 |
get_current_screen()->set_help_sidebar( |
|
9 | 43 |
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
44 |
'<p>' . __( '<a href="https://developer.wordpress.org/advanced-administration/multisite/admin/#network-admin-sites-screen">Documentation on Site Management</a>' ) . '</p>' . |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
45 |
'<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support forums</a>' ) . '</p>' |
0 | 46 |
); |
47 |
||
9 | 48 |
get_current_screen()->set_screen_reader_content( |
49 |
array( |
|
50 |
'heading_pagination' => __( 'Sites list navigation' ), |
|
51 |
'heading_list' => __( 'Sites list' ), |
|
52 |
) |
|
53 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
54 |
|
18 | 55 |
$id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; |
0 | 56 |
|
57 |
if ( isset( $_GET['action'] ) ) { |
|
5 | 58 |
/** This action is documented in wp-admin/network/edit.php */ |
59 |
do_action( 'wpmuadminedit' ); |
|
0 | 60 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
61 |
// A list of valid actions and their associated messaging for confirmation output. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
62 |
$manage_actions = array( |
16 | 63 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
64 |
'activateblog' => __( 'You are about to activate the site %s.' ), |
16 | 65 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
66 |
'deactivateblog' => __( 'You are about to deactivate the site %s.' ), |
16 | 67 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
68 |
'unarchiveblog' => __( 'You are about to unarchive the site %s.' ), |
16 | 69 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
70 |
'archiveblog' => __( 'You are about to archive the site %s.' ), |
16 | 71 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
72 |
'unspamblog' => __( 'You are about to unspam the site %s.' ), |
16 | 73 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
74 |
'spamblog' => __( 'You are about to mark the site %s as spam.' ), |
16 | 75 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
76 |
'deleteblog' => __( 'You are about to delete the site %s.' ), |
16 | 77 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
78 |
'unmatureblog' => __( 'You are about to mark the site %s as mature.' ), |
16 | 79 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
80 |
'matureblog' => __( 'You are about to mark the site %s as not mature.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
81 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
82 |
|
0 | 83 |
if ( 'confirm' === $_GET['action'] ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
84 |
// The action2 parameter contains the action being taken on the site. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
85 |
$site_action = $_GET['action2']; |
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 |
if ( ! array_key_exists( $site_action, $manage_actions ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
88 |
wp_die( __( 'The requested action is not valid.' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
89 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
90 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
91 |
// The mature/unmature UI exists only as external code. Check the "confirm" nonce for backward compatibility. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
92 |
if ( 'matureblog' === $site_action || 'unmatureblog' === $site_action ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
93 |
check_admin_referer( 'confirm' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
94 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
95 |
check_admin_referer( $site_action . '_' . $id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
96 |
} |
0 | 97 |
|
98 |
if ( ! headers_sent() ) { |
|
99 |
nocache_headers(); |
|
100 |
header( 'Content-Type: text/html; charset=utf-8' ); |
|
101 |
} |
|
5 | 102 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
103 |
if ( is_main_site( $id ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
104 |
wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); |
5 | 105 |
} |
0 | 106 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
107 |
$site_details = get_site( $id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
108 |
$site_address = untrailingslashit( $site_details->domain . $site_details->path ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
109 |
|
16 | 110 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
5 | 111 |
?> |
112 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
113 |
<h1><?php _e( 'Confirm your action' ); ?></h1> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
114 |
<form action="sites.php?action=<?php echo esc_attr( $site_action ); ?>" method="post"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
115 |
<input type="hidden" name="action" value="<?php echo esc_attr( $site_action ); ?>" /> |
0 | 116 |
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> |
117 |
<input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" /> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
118 |
<?php wp_nonce_field( $site_action . '_' . $id, '_wpnonce', false ); ?> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
119 |
<?php |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
120 |
if ( 'deleteblog' === $site_action ) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
121 |
$submit = __( 'Delete this site permanently' ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
122 |
?> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
123 |
<div class="notice notice-warning inline"> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
124 |
<p><?php _e( 'Deleting a site is a permanent action that cannot be undone. This will delete the entire site and its uploads directory.' ); ?> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
125 |
</div> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
126 |
<?php |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
127 |
} else { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
128 |
$submit = __( 'Confirm' ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
129 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
130 |
?> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
131 |
<p><?php printf( $manage_actions[ $site_action ], "<strong>{$site_address}</strong>" ); ?></p> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
132 |
<?php submit_button( $submit, 'primary' ); ?> |
0 | 133 |
</form> |
5 | 134 |
</div> |
0 | 135 |
<?php |
16 | 136 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |
137 |
exit; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
138 |
} elseif ( array_key_exists( $_GET['action'], $manage_actions ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
139 |
$action = $_GET['action']; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
140 |
check_admin_referer( $action . '_' . $id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
141 |
} elseif ( 'allblogs' === $_GET['action'] ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
142 |
check_admin_referer( 'bulk-sites' ); |
0 | 143 |
} |
144 |
||
145 |
$updated_action = ''; |
|
146 |
||
147 |
switch ( $_GET['action'] ) { |
|
148 |
||
149 |
case 'deleteblog': |
|
9 | 150 |
if ( ! current_user_can( 'delete_sites' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
151 |
wp_die( __( 'Sorry, you are not allowed to access this page.' ), '', array( 'response' => 403 ) ); |
9 | 152 |
} |
0 | 153 |
|
154 |
$updated_action = 'not_deleted'; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
155 |
if ( 0 !== $id && ! is_main_site( $id ) && current_user_can( 'delete_site', $id ) ) { |
0 | 156 |
wpmu_delete_blog( $id, true ); |
157 |
$updated_action = 'delete'; |
|
158 |
} |
|
9 | 159 |
break; |
0 | 160 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
161 |
case 'delete_sites': |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
162 |
check_admin_referer( 'ms-delete-sites' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
163 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
164 |
foreach ( (array) $_POST['site_ids'] as $site_id ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
165 |
$site_id = (int) $site_id; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
166 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
167 |
if ( is_main_site( $site_id ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
168 |
continue; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
169 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
170 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
171 |
if ( ! current_user_can( 'delete_site', $site_id ) ) { |
9 | 172 |
$site = get_site( $site_id ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
173 |
$site_address = untrailingslashit( $site->domain . $site->path ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
174 |
|
16 | 175 |
wp_die( |
176 |
sprintf( |
|
177 |
/* translators: %s: Site URL. */ |
|
178 |
__( 'Sorry, you are not allowed to delete the site %s.' ), |
|
179 |
$site_address |
|
180 |
), |
|
181 |
403 |
|
182 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
183 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
184 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
185 |
$updated_action = 'all_delete'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
186 |
wpmu_delete_blog( $site_id, true ); |
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 |
break; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
189 |
|
0 | 190 |
case 'allblogs': |
18 | 191 |
if ( isset( $_POST['action'] ) && isset( $_POST['allblogs'] ) ) { |
192 |
$doaction = $_POST['action']; |
|
0 | 193 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
194 |
foreach ( (array) $_POST['allblogs'] as $site_id ) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
195 |
$site_id = (int) $site_id; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
196 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
197 |
if ( 0 !== $site_id && ! is_main_site( $site_id ) ) { |
0 | 198 |
switch ( $doaction ) { |
199 |
case 'delete': |
|
16 | 200 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
201 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
202 |
<div class="wrap"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
203 |
<h1><?php _e( 'Confirm your action' ); ?></h1> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
204 |
<form action="sites.php?action=delete_sites" method="post"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
205 |
<input type="hidden" name="action" value="delete_sites" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
206 |
<input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
207 |
<?php wp_nonce_field( 'ms-delete-sites', '_wpnonce', false ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
208 |
<p><?php _e( 'You are about to delete the following sites:' ); ?></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
209 |
<ul class="ul-disc"> |
9 | 210 |
<?php |
211 |
foreach ( $_POST['allblogs'] as $site_id ) : |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
212 |
$site_id = (int) $site_id; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
213 |
|
9 | 214 |
$site = get_site( $site_id ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
215 |
$site_address = untrailingslashit( $site->domain . $site->path ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
216 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
217 |
<li> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
218 |
<?php echo $site_address; ?> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
219 |
<input type="hidden" name="site_ids[]" value="<?php echo esc_attr( $site_id ); ?>" /> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
220 |
</li> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
221 |
<?php endforeach; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
222 |
</ul> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
223 |
<?php submit_button( __( 'Confirm' ), 'primary' ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
224 |
</form> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
225 |
</div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
226 |
<?php |
16 | 227 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |
228 |
exit; |
|
0 | 229 |
break; |
230 |
||
231 |
case 'spam': |
|
232 |
case 'notspam': |
|
233 |
$updated_action = ( 'spam' === $doaction ) ? 'all_spam' : 'all_notspam'; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
234 |
update_blog_status( $site_id, 'spam', ( 'spam' === $doaction ) ? '1' : '0' ); |
9 | 235 |
break; |
0 | 236 |
} |
237 |
} else { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
238 |
wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); |
0 | 239 |
} |
240 |
} |
|
16 | 241 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
242 |
if ( ! in_array( $doaction, array( 'delete', 'spam', 'notspam' ), true ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
243 |
$redirect_to = wp_get_referer(); |
9 | 244 |
$blogs = (array) $_POST['allblogs']; |
16 | 245 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
246 |
/** This action is documented in wp-admin/network/site-themes.php */ |
16 | 247 |
$redirect_to = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $blogs, $id ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
248 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
249 |
wp_safe_redirect( $redirect_to ); |
16 | 250 |
exit; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
251 |
} |
0 | 252 |
} else { |
16 | 253 |
// Process query defined by WP_MS_Site_List_Table::extra_table_nav(). |
254 |
$location = remove_query_arg( |
|
255 |
array( '_wp_http_referer', '_wpnonce' ), |
|
256 |
add_query_arg( $_POST, network_admin_url( 'sites.php' ) ) |
|
257 |
); |
|
258 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
259 |
wp_redirect( $location ); |
16 | 260 |
exit; |
0 | 261 |
} |
16 | 262 |
|
9 | 263 |
break; |
0 | 264 |
|
265 |
case 'archiveblog': |
|
266 |
case 'unarchiveblog': |
|
267 |
update_blog_status( $id, 'archived', ( 'archiveblog' === $_GET['action'] ) ? '1' : '0' ); |
|
9 | 268 |
break; |
0 | 269 |
|
270 |
case 'activateblog': |
|
271 |
update_blog_status( $id, 'deleted', '0' ); |
|
5 | 272 |
|
273 |
/** |
|
274 |
* Fires after a network site is activated. |
|
275 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
276 |
* @since MU (3.0.0) |
5 | 277 |
* |
19 | 278 |
* @param int $id The ID of the activated site. |
5 | 279 |
*/ |
0 | 280 |
do_action( 'activate_blog', $id ); |
9 | 281 |
break; |
0 | 282 |
|
283 |
case 'deactivateblog': |
|
5 | 284 |
/** |
285 |
* Fires before a network site is deactivated. |
|
286 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
287 |
* @since MU (3.0.0) |
5 | 288 |
* |
19 | 289 |
* @param int $id The ID of the site being deactivated. |
5 | 290 |
*/ |
0 | 291 |
do_action( 'deactivate_blog', $id ); |
16 | 292 |
|
0 | 293 |
update_blog_status( $id, 'deleted', '1' ); |
9 | 294 |
break; |
0 | 295 |
|
296 |
case 'unspamblog': |
|
297 |
case 'spamblog': |
|
298 |
update_blog_status( $id, 'spam', ( 'spamblog' === $_GET['action'] ) ? '1' : '0' ); |
|
9 | 299 |
break; |
0 | 300 |
|
301 |
case 'unmatureblog': |
|
302 |
case 'matureblog': |
|
303 |
update_blog_status( $id, 'mature', ( 'matureblog' === $_GET['action'] ) ? '1' : '0' ); |
|
9 | 304 |
break; |
0 | 305 |
} |
306 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
307 |
if ( empty( $updated_action ) && array_key_exists( $_GET['action'], $manage_actions ) ) { |
0 | 308 |
$updated_action = $_GET['action']; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
309 |
} |
0 | 310 |
|
311 |
if ( ! empty( $updated_action ) ) { |
|
312 |
wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) ); |
|
16 | 313 |
exit; |
0 | 314 |
} |
315 |
} |
|
316 |
||
317 |
$msg = ''; |
|
318 |
if ( isset( $_GET['updated'] ) ) { |
|
9 | 319 |
$action = $_GET['updated']; |
320 |
||
321 |
switch ( $action ) { |
|
0 | 322 |
case 'all_notspam': |
323 |
$msg = __( 'Sites removed from spam.' ); |
|
9 | 324 |
break; |
0 | 325 |
case 'all_spam': |
326 |
$msg = __( 'Sites marked as spam.' ); |
|
9 | 327 |
break; |
0 | 328 |
case 'all_delete': |
329 |
$msg = __( 'Sites deleted.' ); |
|
9 | 330 |
break; |
0 | 331 |
case 'delete': |
332 |
$msg = __( 'Site deleted.' ); |
|
9 | 333 |
break; |
0 | 334 |
case 'not_deleted': |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
335 |
$msg = __( 'Sorry, you are not allowed to delete that site.' ); |
9 | 336 |
break; |
0 | 337 |
case 'archiveblog': |
338 |
$msg = __( 'Site archived.' ); |
|
9 | 339 |
break; |
0 | 340 |
case 'unarchiveblog': |
341 |
$msg = __( 'Site unarchived.' ); |
|
9 | 342 |
break; |
0 | 343 |
case 'activateblog': |
344 |
$msg = __( 'Site activated.' ); |
|
9 | 345 |
break; |
0 | 346 |
case 'deactivateblog': |
347 |
$msg = __( 'Site deactivated.' ); |
|
9 | 348 |
break; |
0 | 349 |
case 'unspamblog': |
350 |
$msg = __( 'Site removed from spam.' ); |
|
9 | 351 |
break; |
0 | 352 |
case 'spamblog': |
353 |
$msg = __( 'Site marked as spam.' ); |
|
9 | 354 |
break; |
0 | 355 |
default: |
5 | 356 |
/** |
9 | 357 |
* Filters a specific, non-default, site-updated message in the Network admin. |
5 | 358 |
* |
9 | 359 |
* The dynamic portion of the hook name, `$action`, refers to the non-default |
360 |
* site update action. |
|
5 | 361 |
* |
362 |
* @since 3.1.0 |
|
363 |
* |
|
364 |
* @param string $msg The update message. Default 'Settings saved'. |
|
365 |
*/ |
|
9 | 366 |
$msg = apply_filters( "network_sites_updated_message_{$action}", __( 'Settings saved.' ) ); |
367 |
break; |
|
0 | 368 |
} |
369 |
||
9 | 370 |
if ( ! empty( $msg ) ) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
371 |
$msg = wp_get_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
372 |
$msg, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
373 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
374 |
'type' => 'success', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
375 |
'dismissible' => true, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
376 |
'id' => 'message', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
377 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
378 |
); |
9 | 379 |
} |
0 | 380 |
} |
381 |
||
382 |
$wp_list_table->prepare_items(); |
|
383 |
||
16 | 384 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
0 | 385 |
?> |
386 |
||
387 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
388 |
<h1 class="wp-heading-inline"><?php _e( 'Sites' ); ?></h1> |
0 | 389 |
|
9 | 390 |
<?php if ( current_user_can( 'create_sites' ) ) : ?> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
391 |
<a href="<?php echo esc_url( network_admin_url( 'site-new.php' ) ); ?>" class="page-title-action"><?php echo esc_html__( 'Add New Site' ); ?></a> |
0 | 392 |
<?php endif; ?> |
393 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
394 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
395 |
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
18 | 396 |
echo '<span class="subtitle">'; |
397 |
printf( |
|
398 |
/* translators: %s: Search query. */ |
|
399 |
__( 'Search results for: %s' ), |
|
400 |
'<strong>' . esc_html( $s ) . '</strong>' |
|
401 |
); |
|
402 |
echo '</span>'; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
403 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
404 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
405 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
406 |
<hr class="wp-header-end"> |
0 | 407 |
|
16 | 408 |
<?php $wp_list_table->views(); ?> |
409 |
||
0 | 410 |
<?php echo $msg; ?> |
411 |
||
9 | 412 |
<form method="get" id="ms-search" class="wp-clearfix"> |
0 | 413 |
<?php $wp_list_table->search_box( __( 'Search Sites' ), 'site' ); ?> |
414 |
<input type="hidden" name="action" value="blogs" /> |
|
415 |
</form> |
|
416 |
||
417 |
<form id="form-site-list" action="sites.php?action=allblogs" method="post"> |
|
418 |
<?php $wp_list_table->display(); ?> |
|
419 |
</form> |
|
420 |
</div> |
|
421 |
<?php |
|
422 |
||
16 | 423 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; ?> |