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