--- a/wp/wp-admin/network/sites.php Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-admin/network/sites.php Tue Dec 15 13:49:49 2020 +0100
@@ -8,7 +8,7 @@
*/
/** Load WordPress Administration Bootstrap */
-require_once( dirname( __FILE__ ) . '/admin.php' );
+require_once __DIR__ . '/admin.php';
if ( ! current_user_can( 'manage_sites' ) ) {
wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
@@ -42,7 +42,7 @@
get_current_screen()->set_help_sidebar(
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
- '<p>' . __( '<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen">Documentation on Site Management</a>' ) . '</p>' .
+ '<p>' . __( '<a href="https://wordpress.org/support/article/network-admin-sites-screen/">Documentation on Site Management</a>' ) . '</p>' .
'<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>' ) . '</p>'
);
@@ -61,14 +61,23 @@
// A list of valid actions and their associated messaging for confirmation output.
$manage_actions = array(
+ /* translators: %s: Site URL. */
'activateblog' => __( 'You are about to activate the site %s.' ),
+ /* translators: %s: Site URL. */
'deactivateblog' => __( 'You are about to deactivate the site %s.' ),
+ /* translators: %s: Site URL. */
'unarchiveblog' => __( 'You are about to unarchive the site %s.' ),
+ /* translators: %s: Site URL. */
'archiveblog' => __( 'You are about to archive the site %s.' ),
+ /* translators: %s: Site URL. */
'unspamblog' => __( 'You are about to unspam the site %s.' ),
+ /* translators: %s: Site URL. */
'spamblog' => __( 'You are about to mark the site %s as spam.' ),
+ /* translators: %s: Site URL. */
'deleteblog' => __( 'You are about to delete the site %s.' ),
+ /* translators: %s: Site URL. */
'unmatureblog' => __( 'You are about to mark the site %s as mature.' ),
+ /* translators: %s: Site URL. */
'matureblog' => __( 'You are about to mark the site %s as not mature.' ),
);
@@ -99,7 +108,7 @@
$site_details = get_site( $id );
$site_address = untrailingslashit( $site_details->domain . $site_details->path );
- require_once( ABSPATH . 'wp-admin/admin-header.php' );
+ require_once ABSPATH . 'wp-admin/admin-header.php';
?>
<div class="wrap">
<h1><?php _e( 'Confirm your action' ); ?></h1>
@@ -108,13 +117,13 @@
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
<input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" />
<?php wp_nonce_field( $site_action . '_' . $id, '_wpnonce', false ); ?>
- <p><?php echo sprintf( $manage_actions[ $site_action ], $site_address ); ?></p>
+ <p><?php printf( $manage_actions[ $site_action ], $site_address ); ?></p>
<?php submit_button( __( 'Confirm' ), 'primary' ); ?>
</form>
</div>
<?php
- require_once( ABSPATH . 'wp-admin/admin-footer.php' );
- exit();
+ require_once ABSPATH . 'wp-admin/admin-footer.php';
+ exit;
} elseif ( array_key_exists( $_GET['action'], $manage_actions ) ) {
$action = $_GET['action'];
check_admin_referer( $action . '_' . $id );
@@ -132,7 +141,7 @@
}
$updated_action = 'not_deleted';
- if ( $id != '0' && $id != get_network()->site_id && current_user_can( 'delete_site', $id ) ) {
+ if ( '0' != $id && get_network()->site_id != $id && current_user_can( 'delete_site', $id ) ) {
wpmu_delete_blog( $id, true );
$updated_action = 'delete';
}
@@ -144,7 +153,7 @@
foreach ( (array) $_POST['site_ids'] as $site_id ) {
$site_id = (int) $site_id;
- if ( $site_id == get_network()->site_id ) {
+ if ( get_network()->site_id == $site_id ) {
continue;
}
@@ -152,7 +161,14 @@
$site = get_site( $site_id );
$site_address = untrailingslashit( $site->domain . $site->path );
- wp_die( sprintf( __( 'Sorry, you are not allowed to delete the site %s.' ), $site_address ), 403 );
+ wp_die(
+ sprintf(
+ /* translators: %s: Site URL. */
+ __( 'Sorry, you are not allowed to delete the site %s.' ),
+ $site_address
+ ),
+ 403
+ );
}
$updated_action = 'all_delete';
@@ -162,13 +178,13 @@
case 'allblogs':
if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) {
- $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
+ $doaction = -1 != $_POST['action'] ? $_POST['action'] : $_POST['action2'];
foreach ( (array) $_POST['allblogs'] as $key => $val ) {
- if ( $val != '0' && $val != get_network()->site_id ) {
+ if ( '0' != $val && get_network()->site_id != $val ) {
switch ( $doaction ) {
case 'delete':
- require_once( ABSPATH . 'wp-admin/admin-header.php' );
+ require_once ABSPATH . 'wp-admin/admin-header.php';
?>
<div class="wrap">
<h1><?php _e( 'Confirm your action' ); ?></h1>
@@ -193,8 +209,8 @@
</form>
</div>
<?php
- require_once( ABSPATH . 'wp-admin/admin-footer.php' );
- exit();
+ require_once ABSPATH . 'wp-admin/admin-footer.php';
+ exit;
break;
case 'spam':
@@ -207,22 +223,28 @@
wp_die( __( 'Sorry, you are not allowed to change the current site.' ) );
}
}
+
if ( ! in_array( $doaction, array( 'delete', 'spam', 'notspam' ), true ) ) {
$redirect_to = wp_get_referer();
$blogs = (array) $_POST['allblogs'];
+
/** This action is documented in wp-admin/network/site-themes.php */
- $redirect_to = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $blogs, $id );
+ $redirect_to = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $blogs, $id ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
+
wp_safe_redirect( $redirect_to );
- exit();
+ exit;
}
} else {
- $location = network_admin_url( 'sites.php' );
- if ( ! empty( $_REQUEST['paged'] ) ) {
- $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
- }
+ // Process query defined by WP_MS_Site_List_Table::extra_table_nav().
+ $location = remove_query_arg(
+ array( '_wp_http_referer', '_wpnonce' ),
+ add_query_arg( $_POST, network_admin_url( 'sites.php' ) )
+ );
+
wp_redirect( $location );
- exit();
+ exit;
}
+
break;
case 'archiveblog':
@@ -252,6 +274,7 @@
* @param string $id The ID of the site being deactivated.
*/
do_action( 'deactivate_blog', $id );
+
update_blog_status( $id, 'deleted', '1' );
break;
@@ -272,7 +295,7 @@
if ( ! empty( $updated_action ) ) {
wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) );
- exit();
+ exit;
}
}
@@ -336,7 +359,7 @@
$wp_list_table->prepare_items();
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
+require_once ABSPATH . 'wp-admin/admin-header.php';
?>
<div class="wrap">
@@ -348,13 +371,15 @@
<?php
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
- /* translators: %s: search keywords */
+ /* translators: %s: Search query. */
printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $s ) );
}
?>
<hr class="wp-header-end">
+<?php $wp_list_table->views(); ?>
+
<?php echo $msg; ?>
<form method="get" id="ms-search" class="wp-clearfix">
@@ -368,4 +393,4 @@
</div>
<?php
-require_once( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
+require_once ABSPATH . 'wp-admin/admin-footer.php'; ?>