author | ymh <ymh.work@gmail.com> |
Tue, 27 Sep 2022 16:37:53 +0200 | |
changeset 19 | 3d72ae0968f4 |
parent 18 | be944660c56a |
child 21 | 48c4eec2b7e6 |
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' => |
|
31 |
'<p>' . __( 'Add New takes you to the Add New Site screen. 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>' . |
|
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>' . |
|
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>' . |
|
37 |
'<li>' . __( 'Delete which is a permanent action after the confirmation screens.' ) . '</li>' . |
|
38 |
'<li>' . __( 'Visit to go to the front-end site live.' ) . '</li></ul>' . |
|
39 |
'<p>' . __( 'The site ID is used internally, and is not shown on the front end of the site or to users/viewers.' ) . '</p>' . |
|
40 |
'<p>' . __( 'Clicking on bold headings can re-sort this table.' ) . '</p>', |
|
41 |
) |
|
42 |
); |
|
0 | 43 |
|
44 |
get_current_screen()->set_help_sidebar( |
|
9 | 45 |
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
16 | 46 |
'<p>' . __( '<a href="https://wordpress.org/support/article/network-admin-sites-screen/">Documentation on Site Management</a>' ) . '</p>' . |
9 | 47 |
'<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>' ) . '</p>' |
0 | 48 |
); |
49 |
||
9 | 50 |
get_current_screen()->set_screen_reader_content( |
51 |
array( |
|
52 |
'heading_pagination' => __( 'Sites list navigation' ), |
|
53 |
'heading_list' => __( 'Sites list' ), |
|
54 |
) |
|
55 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
56 |
|
18 | 57 |
$id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; |
0 | 58 |
|
59 |
if ( isset( $_GET['action'] ) ) { |
|
5 | 60 |
/** This action is documented in wp-admin/network/edit.php */ |
61 |
do_action( 'wpmuadminedit' ); |
|
0 | 62 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
63 |
// 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
|
64 |
$manage_actions = array( |
16 | 65 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
66 |
'activateblog' => __( 'You are about to activate 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 |
'deactivateblog' => __( 'You are about to deactivate 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 |
'unarchiveblog' => __( 'You are about to unarchive 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 |
'archiveblog' => __( 'You are about to archive 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 |
'unspamblog' => __( 'You are about to unspam the site %s.' ), |
16 | 75 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
76 |
'spamblog' => __( 'You are about to mark the site %s as spam.' ), |
16 | 77 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
78 |
'deleteblog' => __( 'You are about to delete the site %s.' ), |
16 | 79 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
80 |
'unmatureblog' => __( 'You are about to mark the site %s as mature.' ), |
16 | 81 |
/* translators: %s: Site URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
82 |
'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
|
83 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
84 |
|
0 | 85 |
if ( 'confirm' === $_GET['action'] ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
86 |
// 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
|
87 |
$site_action = $_GET['action2']; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
88 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
89 |
if ( ! array_key_exists( $site_action, $manage_actions ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
90 |
wp_die( __( 'The requested action is not valid.' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
91 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
92 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
93 |
// 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
|
94 |
if ( 'matureblog' === $site_action || 'unmatureblog' === $site_action ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
95 |
check_admin_referer( 'confirm' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
96 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
97 |
check_admin_referer( $site_action . '_' . $id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
98 |
} |
0 | 99 |
|
100 |
if ( ! headers_sent() ) { |
|
101 |
nocache_headers(); |
|
102 |
header( 'Content-Type: text/html; charset=utf-8' ); |
|
103 |
} |
|
5 | 104 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
105 |
if ( get_network()->site_id == $id ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
106 |
wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); |
5 | 107 |
} |
0 | 108 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
109 |
$site_details = get_site( $id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
110 |
$site_address = untrailingslashit( $site_details->domain . $site_details->path ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
111 |
|
16 | 112 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
5 | 113 |
?> |
114 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
115 |
<h1><?php _e( 'Confirm your action' ); ?></h1> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
116 |
<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
|
117 |
<input type="hidden" name="action" value="<?php echo esc_attr( $site_action ); ?>" /> |
0 | 118 |
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> |
119 |
<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
|
120 |
<?php wp_nonce_field( $site_action . '_' . $id, '_wpnonce', false ); ?> |
16 | 121 |
<p><?php printf( $manage_actions[ $site_action ], $site_address ); ?></p> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
122 |
<?php submit_button( __( 'Confirm' ), 'primary' ); ?> |
0 | 123 |
</form> |
5 | 124 |
</div> |
0 | 125 |
<?php |
16 | 126 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |
127 |
exit; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
128 |
} elseif ( array_key_exists( $_GET['action'], $manage_actions ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
129 |
$action = $_GET['action']; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
130 |
check_admin_referer( $action . '_' . $id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
131 |
} elseif ( 'allblogs' === $_GET['action'] ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
132 |
check_admin_referer( 'bulk-sites' ); |
0 | 133 |
} |
134 |
||
135 |
$updated_action = ''; |
|
136 |
||
137 |
switch ( $_GET['action'] ) { |
|
138 |
||
139 |
case 'deleteblog': |
|
9 | 140 |
if ( ! current_user_can( 'delete_sites' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
141 |
wp_die( __( 'Sorry, you are not allowed to access this page.' ), '', array( 'response' => 403 ) ); |
9 | 142 |
} |
0 | 143 |
|
144 |
$updated_action = 'not_deleted'; |
|
16 | 145 |
if ( '0' != $id && get_network()->site_id != $id && current_user_can( 'delete_site', $id ) ) { |
0 | 146 |
wpmu_delete_blog( $id, true ); |
147 |
$updated_action = 'delete'; |
|
148 |
} |
|
9 | 149 |
break; |
0 | 150 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
151 |
case 'delete_sites': |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
152 |
check_admin_referer( 'ms-delete-sites' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
153 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
154 |
foreach ( (array) $_POST['site_ids'] as $site_id ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
155 |
$site_id = (int) $site_id; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
156 |
|
16 | 157 |
if ( get_network()->site_id == $site_id ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
158 |
continue; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
159 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
160 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
161 |
if ( ! current_user_can( 'delete_site', $site_id ) ) { |
9 | 162 |
$site = get_site( $site_id ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
163 |
$site_address = untrailingslashit( $site->domain . $site->path ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
164 |
|
16 | 165 |
wp_die( |
166 |
sprintf( |
|
167 |
/* translators: %s: Site URL. */ |
|
168 |
__( 'Sorry, you are not allowed to delete the site %s.' ), |
|
169 |
$site_address |
|
170 |
), |
|
171 |
403 |
|
172 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
173 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
174 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
175 |
$updated_action = 'all_delete'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
176 |
wpmu_delete_blog( $site_id, true ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
177 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
178 |
break; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
179 |
|
0 | 180 |
case 'allblogs': |
18 | 181 |
if ( isset( $_POST['action'] ) && isset( $_POST['allblogs'] ) ) { |
182 |
$doaction = $_POST['action']; |
|
0 | 183 |
|
184 |
foreach ( (array) $_POST['allblogs'] as $key => $val ) { |
|
16 | 185 |
if ( '0' != $val && get_network()->site_id != $val ) { |
0 | 186 |
switch ( $doaction ) { |
187 |
case 'delete': |
|
16 | 188 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
189 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
190 |
<div class="wrap"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
191 |
<h1><?php _e( 'Confirm your action' ); ?></h1> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
192 |
<form action="sites.php?action=delete_sites" method="post"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
193 |
<input type="hidden" name="action" value="delete_sites" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
194 |
<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
|
195 |
<?php wp_nonce_field( 'ms-delete-sites', '_wpnonce', false ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
196 |
<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
|
197 |
<ul class="ul-disc"> |
9 | 198 |
<?php |
199 |
foreach ( $_POST['allblogs'] as $site_id ) : |
|
200 |
$site = get_site( $site_id ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
201 |
$site_address = untrailingslashit( $site->domain . $site->path ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
202 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
203 |
<li> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
204 |
<?php echo $site_address; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
205 |
<input type="hidden" name="site_ids[]" value="<?php echo (int) $site_id; ?>" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
206 |
</li> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
207 |
<?php endforeach; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
208 |
</ul> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
209 |
<?php submit_button( __( 'Confirm' ), 'primary' ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
210 |
</form> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
211 |
</div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
212 |
<?php |
16 | 213 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |
214 |
exit; |
|
0 | 215 |
break; |
216 |
||
217 |
case 'spam': |
|
218 |
case 'notspam': |
|
219 |
$updated_action = ( 'spam' === $doaction ) ? 'all_spam' : 'all_notspam'; |
|
220 |
update_blog_status( $val, 'spam', ( 'spam' === $doaction ) ? '1' : '0' ); |
|
9 | 221 |
break; |
0 | 222 |
} |
223 |
} else { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
224 |
wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); |
0 | 225 |
} |
226 |
} |
|
16 | 227 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
228 |
if ( ! in_array( $doaction, array( 'delete', 'spam', 'notspam' ), true ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
229 |
$redirect_to = wp_get_referer(); |
9 | 230 |
$blogs = (array) $_POST['allblogs']; |
16 | 231 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
232 |
/** This action is documented in wp-admin/network/site-themes.php */ |
16 | 233 |
$redirect_to = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $blogs, $id ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
234 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
235 |
wp_safe_redirect( $redirect_to ); |
16 | 236 |
exit; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
237 |
} |
0 | 238 |
} else { |
16 | 239 |
// Process query defined by WP_MS_Site_List_Table::extra_table_nav(). |
240 |
$location = remove_query_arg( |
|
241 |
array( '_wp_http_referer', '_wpnonce' ), |
|
242 |
add_query_arg( $_POST, network_admin_url( 'sites.php' ) ) |
|
243 |
); |
|
244 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
245 |
wp_redirect( $location ); |
16 | 246 |
exit; |
0 | 247 |
} |
16 | 248 |
|
9 | 249 |
break; |
0 | 250 |
|
251 |
case 'archiveblog': |
|
252 |
case 'unarchiveblog': |
|
253 |
update_blog_status( $id, 'archived', ( 'archiveblog' === $_GET['action'] ) ? '1' : '0' ); |
|
9 | 254 |
break; |
0 | 255 |
|
256 |
case 'activateblog': |
|
257 |
update_blog_status( $id, 'deleted', '0' ); |
|
5 | 258 |
|
259 |
/** |
|
260 |
* Fires after a network site is activated. |
|
261 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
262 |
* @since MU (3.0.0) |
5 | 263 |
* |
19 | 264 |
* @param int $id The ID of the activated site. |
5 | 265 |
*/ |
0 | 266 |
do_action( 'activate_blog', $id ); |
9 | 267 |
break; |
0 | 268 |
|
269 |
case 'deactivateblog': |
|
5 | 270 |
/** |
271 |
* Fires before a network site is deactivated. |
|
272 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
273 |
* @since MU (3.0.0) |
5 | 274 |
* |
19 | 275 |
* @param int $id The ID of the site being deactivated. |
5 | 276 |
*/ |
0 | 277 |
do_action( 'deactivate_blog', $id ); |
16 | 278 |
|
0 | 279 |
update_blog_status( $id, 'deleted', '1' ); |
9 | 280 |
break; |
0 | 281 |
|
282 |
case 'unspamblog': |
|
283 |
case 'spamblog': |
|
284 |
update_blog_status( $id, 'spam', ( 'spamblog' === $_GET['action'] ) ? '1' : '0' ); |
|
9 | 285 |
break; |
0 | 286 |
|
287 |
case 'unmatureblog': |
|
288 |
case 'matureblog': |
|
289 |
update_blog_status( $id, 'mature', ( 'matureblog' === $_GET['action'] ) ? '1' : '0' ); |
|
9 | 290 |
break; |
0 | 291 |
} |
292 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
293 |
if ( empty( $updated_action ) && array_key_exists( $_GET['action'], $manage_actions ) ) { |
0 | 294 |
$updated_action = $_GET['action']; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
295 |
} |
0 | 296 |
|
297 |
if ( ! empty( $updated_action ) ) { |
|
298 |
wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) ); |
|
16 | 299 |
exit; |
0 | 300 |
} |
301 |
} |
|
302 |
||
303 |
$msg = ''; |
|
304 |
if ( isset( $_GET['updated'] ) ) { |
|
9 | 305 |
$action = $_GET['updated']; |
306 |
||
307 |
switch ( $action ) { |
|
0 | 308 |
case 'all_notspam': |
309 |
$msg = __( 'Sites removed from spam.' ); |
|
9 | 310 |
break; |
0 | 311 |
case 'all_spam': |
312 |
$msg = __( 'Sites marked as spam.' ); |
|
9 | 313 |
break; |
0 | 314 |
case 'all_delete': |
315 |
$msg = __( 'Sites deleted.' ); |
|
9 | 316 |
break; |
0 | 317 |
case 'delete': |
318 |
$msg = __( 'Site deleted.' ); |
|
9 | 319 |
break; |
0 | 320 |
case 'not_deleted': |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
321 |
$msg = __( 'Sorry, you are not allowed to delete that site.' ); |
9 | 322 |
break; |
0 | 323 |
case 'archiveblog': |
324 |
$msg = __( 'Site archived.' ); |
|
9 | 325 |
break; |
0 | 326 |
case 'unarchiveblog': |
327 |
$msg = __( 'Site unarchived.' ); |
|
9 | 328 |
break; |
0 | 329 |
case 'activateblog': |
330 |
$msg = __( 'Site activated.' ); |
|
9 | 331 |
break; |
0 | 332 |
case 'deactivateblog': |
333 |
$msg = __( 'Site deactivated.' ); |
|
9 | 334 |
break; |
0 | 335 |
case 'unspamblog': |
336 |
$msg = __( 'Site removed from spam.' ); |
|
9 | 337 |
break; |
0 | 338 |
case 'spamblog': |
339 |
$msg = __( 'Site marked as spam.' ); |
|
9 | 340 |
break; |
0 | 341 |
default: |
5 | 342 |
/** |
9 | 343 |
* Filters a specific, non-default, site-updated message in the Network admin. |
5 | 344 |
* |
9 | 345 |
* The dynamic portion of the hook name, `$action`, refers to the non-default |
346 |
* site update action. |
|
5 | 347 |
* |
348 |
* @since 3.1.0 |
|
349 |
* |
|
350 |
* @param string $msg The update message. Default 'Settings saved'. |
|
351 |
*/ |
|
9 | 352 |
$msg = apply_filters( "network_sites_updated_message_{$action}", __( 'Settings saved.' ) ); |
353 |
break; |
|
0 | 354 |
} |
355 |
||
9 | 356 |
if ( ! empty( $msg ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
357 |
$msg = '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
9 | 358 |
} |
0 | 359 |
} |
360 |
||
361 |
$wp_list_table->prepare_items(); |
|
362 |
||
16 | 363 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
0 | 364 |
?> |
365 |
||
366 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
367 |
<h1 class="wp-heading-inline"><?php _e( 'Sites' ); ?></h1> |
0 | 368 |
|
9 | 369 |
<?php if ( current_user_can( 'create_sites' ) ) : ?> |
18 | 370 |
<a href="<?php echo esc_url( network_admin_url( 'site-new.php' ) ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'site' ); ?></a> |
0 | 371 |
<?php endif; ?> |
372 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
373 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
374 |
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
18 | 375 |
echo '<span class="subtitle">'; |
376 |
printf( |
|
377 |
/* translators: %s: Search query. */ |
|
378 |
__( 'Search results for: %s' ), |
|
379 |
'<strong>' . esc_html( $s ) . '</strong>' |
|
380 |
); |
|
381 |
echo '</span>'; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
382 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
383 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
384 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
385 |
<hr class="wp-header-end"> |
0 | 386 |
|
16 | 387 |
<?php $wp_list_table->views(); ?> |
388 |
||
0 | 389 |
<?php echo $msg; ?> |
390 |
||
9 | 391 |
<form method="get" id="ms-search" class="wp-clearfix"> |
0 | 392 |
<?php $wp_list_table->search_box( __( 'Search Sites' ), 'site' ); ?> |
393 |
<input type="hidden" name="action" value="blogs" /> |
|
394 |
</form> |
|
395 |
||
396 |
<form id="form-site-list" action="sites.php?action=allblogs" method="post"> |
|
397 |
<?php $wp_list_table->display(); ?> |
|
398 |
</form> |
|
399 |
</div> |
|
400 |
<?php |
|
401 |
||
16 | 402 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; ?> |