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