author | ymh <ymh.work@gmail.com> |
Tue, 15 Oct 2019 15:48:13 +0200 | |
changeset 13 | d255fe9cd479 |
parent 9 | 177826044cd9 |
child 16 | a86126ab1dd4 |
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 */ |
|
11 |
require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
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>' . |
45 |
'<p>' . __( '<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen">Documentation on Site Management</a>' ) . '</p>' . |
|
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( |
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.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
65 |
'deactivateblog' => __( 'You are about to deactivate the site %s.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
66 |
'unarchiveblog' => __( 'You are about to unarchive the site %s.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
67 |
'archiveblog' => __( 'You are about to archive the site %s.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
68 |
'unspamblog' => __( 'You are about to unspam the site %s.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
69 |
'spamblog' => __( 'You are about to mark the site %s as spam.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
70 |
'deleteblog' => __( 'You are about to delete the site %s.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
71 |
'unmatureblog' => __( 'You are about to mark the site %s as mature.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
72 |
'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
|
73 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
74 |
|
0 | 75 |
if ( 'confirm' === $_GET['action'] ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
76 |
// 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
|
77 |
$site_action = $_GET['action2']; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
78 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
79 |
if ( ! array_key_exists( $site_action, $manage_actions ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
80 |
wp_die( __( 'The requested action is not valid.' ) ); |
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 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
83 |
// 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
|
84 |
if ( 'matureblog' === $site_action || 'unmatureblog' === $site_action ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
85 |
check_admin_referer( 'confirm' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
86 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
87 |
check_admin_referer( $site_action . '_' . $id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
88 |
} |
0 | 89 |
|
90 |
if ( ! headers_sent() ) { |
|
91 |
nocache_headers(); |
|
92 |
header( 'Content-Type: text/html; charset=utf-8' ); |
|
93 |
} |
|
5 | 94 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
95 |
if ( get_network()->site_id == $id ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
96 |
wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); |
5 | 97 |
} |
0 | 98 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
99 |
$site_details = get_site( $id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
100 |
$site_address = untrailingslashit( $site_details->domain . $site_details->path ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
101 |
|
5 | 102 |
require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
103 |
?> |
|
104 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
105 |
<h1><?php _e( 'Confirm your action' ); ?></h1> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
106 |
<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
|
107 |
<input type="hidden" name="action" value="<?php echo esc_attr( $site_action ); ?>" /> |
0 | 108 |
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> |
109 |
<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
|
110 |
<?php wp_nonce_field( $site_action . '_' . $id, '_wpnonce', false ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
111 |
<p><?php echo sprintf( $manage_actions[ $site_action ], $site_address ); ?></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
112 |
<?php submit_button( __( 'Confirm' ), 'primary' ); ?> |
0 | 113 |
</form> |
5 | 114 |
</div> |
0 | 115 |
<?php |
5 | 116 |
require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
0 | 117 |
exit(); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
118 |
} elseif ( array_key_exists( $_GET['action'], $manage_actions ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
119 |
$action = $_GET['action']; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
120 |
check_admin_referer( $action . '_' . $id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
121 |
} elseif ( 'allblogs' === $_GET['action'] ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
122 |
check_admin_referer( 'bulk-sites' ); |
0 | 123 |
} |
124 |
||
125 |
$updated_action = ''; |
|
126 |
||
127 |
switch ( $_GET['action'] ) { |
|
128 |
||
129 |
case 'deleteblog': |
|
9 | 130 |
if ( ! current_user_can( 'delete_sites' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
131 |
wp_die( __( 'Sorry, you are not allowed to access this page.' ), '', array( 'response' => 403 ) ); |
9 | 132 |
} |
0 | 133 |
|
134 |
$updated_action = 'not_deleted'; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
135 |
if ( $id != '0' && $id != get_network()->site_id && current_user_can( 'delete_site', $id ) ) { |
0 | 136 |
wpmu_delete_blog( $id, true ); |
137 |
$updated_action = 'delete'; |
|
138 |
} |
|
9 | 139 |
break; |
0 | 140 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
141 |
case 'delete_sites': |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
142 |
check_admin_referer( 'ms-delete-sites' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
143 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
144 |
foreach ( (array) $_POST['site_ids'] as $site_id ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
145 |
$site_id = (int) $site_id; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
146 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
147 |
if ( $site_id == get_network()->site_id ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
148 |
continue; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
149 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
150 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
151 |
if ( ! current_user_can( 'delete_site', $site_id ) ) { |
9 | 152 |
$site = get_site( $site_id ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
153 |
$site_address = untrailingslashit( $site->domain . $site->path ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
154 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
155 |
wp_die( sprintf( __( 'Sorry, you are not allowed to delete the site %s.' ), $site_address ), 403 ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
156 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
157 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
158 |
$updated_action = 'all_delete'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
159 |
wpmu_delete_blog( $site_id, true ); |
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 |
break; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
162 |
|
0 | 163 |
case 'allblogs': |
164 |
if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) { |
|
165 |
$doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; |
|
166 |
||
167 |
foreach ( (array) $_POST['allblogs'] as $key => $val ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
168 |
if ( $val != '0' && $val != get_network()->site_id ) { |
0 | 169 |
switch ( $doaction ) { |
170 |
case 'delete': |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
171 |
require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
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 |
<div class="wrap"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
174 |
<h1><?php _e( 'Confirm your action' ); ?></h1> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
175 |
<form action="sites.php?action=delete_sites" method="post"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
176 |
<input type="hidden" name="action" value="delete_sites" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
177 |
<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
|
178 |
<?php wp_nonce_field( 'ms-delete-sites', '_wpnonce', false ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
179 |
<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
|
180 |
<ul class="ul-disc"> |
9 | 181 |
<?php |
182 |
foreach ( $_POST['allblogs'] as $site_id ) : |
|
183 |
$site = get_site( $site_id ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
184 |
$site_address = untrailingslashit( $site->domain . $site->path ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
185 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
186 |
<li> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
187 |
<?php echo $site_address; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
188 |
<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
|
189 |
</li> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
190 |
<?php endforeach; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
191 |
</ul> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
192 |
<?php submit_button( __( 'Confirm' ), 'primary' ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
193 |
</form> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
194 |
</div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
195 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
196 |
require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
197 |
exit(); |
0 | 198 |
break; |
199 |
||
200 |
case 'spam': |
|
201 |
case 'notspam': |
|
202 |
$updated_action = ( 'spam' === $doaction ) ? 'all_spam' : 'all_notspam'; |
|
203 |
update_blog_status( $val, 'spam', ( 'spam' === $doaction ) ? '1' : '0' ); |
|
9 | 204 |
break; |
0 | 205 |
} |
206 |
} else { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
207 |
wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); |
0 | 208 |
} |
209 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
210 |
if ( ! in_array( $doaction, array( 'delete', 'spam', 'notspam' ), true ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
211 |
$redirect_to = wp_get_referer(); |
9 | 212 |
$blogs = (array) $_POST['allblogs']; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
213 |
/** This action is documented in wp-admin/network/site-themes.php */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
214 |
$redirect_to = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $blogs, $id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
215 |
wp_safe_redirect( $redirect_to ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
216 |
exit(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
217 |
} |
0 | 218 |
} else { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
219 |
$location = network_admin_url( 'sites.php' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
220 |
if ( ! empty( $_REQUEST['paged'] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
221 |
$location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
222 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
223 |
wp_redirect( $location ); |
0 | 224 |
exit(); |
225 |
} |
|
9 | 226 |
break; |
0 | 227 |
|
228 |
case 'archiveblog': |
|
229 |
case 'unarchiveblog': |
|
230 |
update_blog_status( $id, 'archived', ( 'archiveblog' === $_GET['action'] ) ? '1' : '0' ); |
|
9 | 231 |
break; |
0 | 232 |
|
233 |
case 'activateblog': |
|
234 |
update_blog_status( $id, 'deleted', '0' ); |
|
5 | 235 |
|
236 |
/** |
|
237 |
* Fires after a network site is activated. |
|
238 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
239 |
* @since MU (3.0.0) |
5 | 240 |
* |
241 |
* @param string $id The ID of the activated site. |
|
242 |
*/ |
|
0 | 243 |
do_action( 'activate_blog', $id ); |
9 | 244 |
break; |
0 | 245 |
|
246 |
case 'deactivateblog': |
|
5 | 247 |
/** |
248 |
* Fires before a network site is deactivated. |
|
249 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
250 |
* @since MU (3.0.0) |
5 | 251 |
* |
252 |
* @param string $id The ID of the site being deactivated. |
|
253 |
*/ |
|
0 | 254 |
do_action( 'deactivate_blog', $id ); |
255 |
update_blog_status( $id, 'deleted', '1' ); |
|
9 | 256 |
break; |
0 | 257 |
|
258 |
case 'unspamblog': |
|
259 |
case 'spamblog': |
|
260 |
update_blog_status( $id, 'spam', ( 'spamblog' === $_GET['action'] ) ? '1' : '0' ); |
|
9 | 261 |
break; |
0 | 262 |
|
263 |
case 'unmatureblog': |
|
264 |
case 'matureblog': |
|
265 |
update_blog_status( $id, 'mature', ( 'matureblog' === $_GET['action'] ) ? '1' : '0' ); |
|
9 | 266 |
break; |
0 | 267 |
} |
268 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
269 |
if ( empty( $updated_action ) && array_key_exists( $_GET['action'], $manage_actions ) ) { |
0 | 270 |
$updated_action = $_GET['action']; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
271 |
} |
0 | 272 |
|
273 |
if ( ! empty( $updated_action ) ) { |
|
274 |
wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) ); |
|
275 |
exit(); |
|
276 |
} |
|
277 |
} |
|
278 |
||
279 |
$msg = ''; |
|
280 |
if ( isset( $_GET['updated'] ) ) { |
|
9 | 281 |
$action = $_GET['updated']; |
282 |
||
283 |
switch ( $action ) { |
|
0 | 284 |
case 'all_notspam': |
285 |
$msg = __( 'Sites removed from spam.' ); |
|
9 | 286 |
break; |
0 | 287 |
case 'all_spam': |
288 |
$msg = __( 'Sites marked as spam.' ); |
|
9 | 289 |
break; |
0 | 290 |
case 'all_delete': |
291 |
$msg = __( 'Sites deleted.' ); |
|
9 | 292 |
break; |
0 | 293 |
case 'delete': |
294 |
$msg = __( 'Site deleted.' ); |
|
9 | 295 |
break; |
0 | 296 |
case 'not_deleted': |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
297 |
$msg = __( 'Sorry, you are not allowed to delete that site.' ); |
9 | 298 |
break; |
0 | 299 |
case 'archiveblog': |
300 |
$msg = __( 'Site archived.' ); |
|
9 | 301 |
break; |
0 | 302 |
case 'unarchiveblog': |
303 |
$msg = __( 'Site unarchived.' ); |
|
9 | 304 |
break; |
0 | 305 |
case 'activateblog': |
306 |
$msg = __( 'Site activated.' ); |
|
9 | 307 |
break; |
0 | 308 |
case 'deactivateblog': |
309 |
$msg = __( 'Site deactivated.' ); |
|
9 | 310 |
break; |
0 | 311 |
case 'unspamblog': |
312 |
$msg = __( 'Site removed from spam.' ); |
|
9 | 313 |
break; |
0 | 314 |
case 'spamblog': |
315 |
$msg = __( 'Site marked as spam.' ); |
|
9 | 316 |
break; |
0 | 317 |
default: |
5 | 318 |
/** |
9 | 319 |
* Filters a specific, non-default, site-updated message in the Network admin. |
5 | 320 |
* |
9 | 321 |
* The dynamic portion of the hook name, `$action`, refers to the non-default |
322 |
* site update action. |
|
5 | 323 |
* |
324 |
* @since 3.1.0 |
|
325 |
* |
|
326 |
* @param string $msg The update message. Default 'Settings saved'. |
|
327 |
*/ |
|
9 | 328 |
$msg = apply_filters( "network_sites_updated_message_{$action}", __( 'Settings saved.' ) ); |
329 |
break; |
|
0 | 330 |
} |
331 |
||
9 | 332 |
if ( ! empty( $msg ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
333 |
$msg = '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
9 | 334 |
} |
0 | 335 |
} |
336 |
||
337 |
$wp_list_table->prepare_items(); |
|
338 |
||
339 |
require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
340 |
?> |
|
341 |
||
342 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
343 |
<h1 class="wp-heading-inline"><?php _e( 'Sites' ); ?></h1> |
0 | 344 |
|
9 | 345 |
<?php if ( current_user_can( 'create_sites' ) ) : ?> |
346 |
<a href="<?php echo network_admin_url( 'site-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'site' ); ?></a> |
|
0 | 347 |
<?php endif; ?> |
348 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
349 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
350 |
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
351 |
/* translators: %s: search keywords */ |
0 | 352 |
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
|
353 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
354 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
355 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
356 |
<hr class="wp-header-end"> |
0 | 357 |
|
358 |
<?php echo $msg; ?> |
|
359 |
||
9 | 360 |
<form method="get" id="ms-search" class="wp-clearfix"> |
0 | 361 |
<?php $wp_list_table->search_box( __( 'Search Sites' ), 'site' ); ?> |
362 |
<input type="hidden" name="action" value="blogs" /> |
|
363 |
</form> |
|
364 |
||
365 |
<form id="form-site-list" action="sites.php?action=allblogs" method="post"> |
|
366 |
<?php $wp_list_table->display(); ?> |
|
367 |
</form> |
|
368 |
</div> |
|
369 |
<?php |
|
370 |
||
371 |
require_once( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |