Coding Standards: Use strict comparison in wp-admin/network where static strings are involved.

Includes minor code layout fixes for better readability.

Follow-up to [47808].

See #49542.

git-svn-id: https://develop.svn.wordpress.org/trunk@47853 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-05-24 09:14:21 +00:00
parent 2919961c18
commit 219acea88f
11 changed files with 53 additions and 24 deletions

View File

@@ -27,7 +27,7 @@ if ( isset( $_GET['action'] ) ) {
check_admin_referer( 'deleteuser' );
$id = intval( $_GET['id'] );
if ( '0' != $id && '1' != $id ) {
if ( $id > 1 ) {
$_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle arrays.
$title = __( 'Users' );
$parent_file = 'users.php';
@@ -116,8 +116,8 @@ if ( isset( $_GET['action'] ) ) {
if ( ! in_array( $doaction, array( 'delete', 'spam', 'notspam' ), true ) ) {
$sendback = wp_get_referer();
$user_ids = (array) $_POST['allusers'];
/** This action is documented in wp-admin/network/site-themes.php */
$sendback = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $user_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
@@ -157,7 +157,7 @@ if ( isset( $_GET['action'] ) ) {
continue;
}
if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][ $blogid ][ $id ] ) {
if ( ! empty( $_POST['delete'] ) && 'reassign' === $_POST['delete'][ $blogid ][ $id ] ) {
remove_user_from_blog( $id, $blogid, (int) $user_id );
} else {
remove_user_from_blog( $id, $blogid );
@@ -165,7 +165,9 @@ if ( isset( $_GET['action'] ) ) {
}
}
}
$i = 0;
if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) ) {
foreach ( $_POST['user'] as $id ) {
if ( ! current_user_can( 'delete_user', $id ) ) {
@@ -176,7 +178,7 @@ if ( isset( $_GET['action'] ) ) {
}
}
if ( 1 == $i ) {
if ( 1 === $i ) {
$deletefunction = 'delete';
} else {
$deletefunction = 'all_delete';