Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in wp-admin.

See #47632.


Built from https://develop.svn.wordpress.org/trunk@45583


git-svn-id: http://core.svn.wordpress.org/trunk@45394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast
2019-07-01 12:52:01 +00:00
parent b2d5a4216c
commit cf3fa9f7c8
75 changed files with 636 additions and 339 deletions

View File

@@ -136,8 +136,11 @@ function insert_with_markers( $filename, $marker, $insertion ) {
}
// Split out the existing file into the preceding lines, and those that appear after the marker
$pre_lines = $post_lines = $existing_lines = array();
$found_marker = $found_end_marker = false;
$pre_lines = array();
$post_lines = array();
$existing_lines = array();
$found_marker = false;
$found_end_marker = false;
foreach ( $lines as $line ) {
if ( ! $found_marker && false !== strpos( $line, $start_marker ) ) {
$found_marker = true;
@@ -596,7 +599,8 @@ function set_screen_options() {
if ( isset( $_POST['wp_screen_options'] ) && is_array( $_POST['wp_screen_options'] ) ) {
check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
if ( ! $user = wp_get_current_user() ) {
$user = wp_get_current_user();
if ( ! $user ) {
return;
}
$option = $_POST['wp_screen_options']['option'];
@@ -964,18 +968,24 @@ function wp_check_locked_posts( $response, $data, $screen_id ) {
if ( array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) {
foreach ( $data['wp-check-locked-posts'] as $key ) {
if ( ! $post_id = absint( substr( $key, 5 ) ) ) {
$post_id = absint( substr( $key, 5 ) );
if ( ! $post_id ) {
continue;
}
if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) && current_user_can( 'edit_post', $post_id ) ) {
$send = array( 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ) );
$user_id = wp_check_post_lock( $post_id );
if ( $user_id ) {
$user = get_userdata( $user_id );
if ( $user && current_user_can( 'edit_post', $post_id ) ) {
$send = array( 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ) );
if ( ( $avatar = get_avatar( $user->ID, 18 ) ) && preg_match( "|src='([^']+)'|", $avatar, $matches ) ) {
$send['avatar_src'] = $matches[1];
$avatar = get_avatar( $user->ID, 18 );
if ( $avatar && preg_match( "|src='([^']+)'|", $avatar, $matches ) ) {
$send['avatar_src'] = $matches[1];
}
$checked[ $key ] = $send;
}
$checked[ $key ] = $send;
}
}
}
@@ -1002,7 +1012,8 @@ function wp_refresh_post_lock( $response, $data, $screen_id ) {
$received = $data['wp-refresh-post-lock'];
$send = array();
if ( ! $post_id = absint( $received['post_id'] ) ) {
$post_id = absint( $received['post_id'] );
if ( ! $post_id ) {
return $response;
}
@@ -1010,12 +1021,15 @@ function wp_refresh_post_lock( $response, $data, $screen_id ) {
return $response;
}
if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) ) {
$user_id = wp_check_post_lock( $post_id );
$user = get_userdata( $user_id );
if ( $user ) {
$error = array(
'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name ),
);
if ( $avatar = get_avatar( $user->ID, 64 ) ) {
$avatar = get_avatar( $user->ID, 64 );
if ( $avatar ) {
if ( preg_match( "|src='([^']+)'|", $avatar, $matches ) ) {
$error['avatar_src'] = $matches[1];
}
@@ -1023,7 +1037,8 @@ function wp_refresh_post_lock( $response, $data, $screen_id ) {
$send['lock_error'] = $error;
} else {
if ( $new_lock = wp_set_post_lock( $post_id ) ) {
$new_lock = wp_set_post_lock( $post_id );
if ( $new_lock ) {
$send['new_lock'] = implode( ':', $new_lock );
}
}
@@ -1049,7 +1064,8 @@ function wp_refresh_post_nonces( $response, $data, $screen_id ) {
$received = $data['wp-refresh-post-nonces'];
$response['wp-refresh-post-nonces'] = array( 'check' => 1 );
if ( ! $post_id = absint( $received['post_id'] ) ) {
$post_id = absint( $received['post_id'] );
if ( ! $post_id ) {
return $response;
}