From cf3fa9f7c8038447303eea1fbd3636c5fece28cd Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 1 Jul 2019 12:52:01 +0000 Subject: [PATCH] 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 --- wp-admin/async-upload.php | 6 +- wp-admin/comment.php | 9 +- wp-admin/custom-background.php | 3 +- wp-admin/edit-comments.php | 33 +++-- wp-admin/edit-form-advanced.php | 16 ++- wp-admin/edit.php | 3 +- wp-admin/import.php | 3 +- wp-admin/includes/ajax-actions.php | 121 ++++++++++++------ wp-admin/includes/class-core-upgrader.php | 11 +- .../includes/class-file-upload-upgrader.php | 3 +- .../includes/class-language-pack-upgrader.php | 3 +- .../includes/class-theme-upgrader-skin.php | 3 +- .../includes/class-wp-automatic-updater.php | 3 +- .../includes/class-wp-comments-list-table.php | 12 +- .../includes/class-wp-filesystem-base.php | 9 +- .../includes/class-wp-filesystem-ftpext.php | 83 ++++++------ .../class-wp-filesystem-ftpsockets.php | 8 +- .../includes/class-wp-filesystem-ssh2.php | 3 +- wp-admin/includes/class-wp-importer.php | 5 +- wp-admin/includes/class-wp-list-table.php | 5 +- .../includes/class-wp-media-list-table.php | 6 +- .../includes/class-wp-ms-sites-list-table.php | 6 +- .../class-wp-ms-themes-list-table.php | 3 +- .../includes/class-wp-ms-users-list-table.php | 8 +- .../includes/class-wp-posts-list-table.php | 15 ++- .../class-wp-privacy-policy-content.php | 9 +- wp-admin/includes/class-wp-screen.php | 8 +- .../includes/class-wp-terms-list-table.php | 9 +- .../includes/class-wp-themes-list-table.php | 5 +- wp-admin/includes/class-wp-upgrader.php | 3 +- wp-admin/includes/comment.php | 3 +- wp-admin/includes/dashboard.php | 12 +- wp-admin/includes/edit-tag-messages.php | 3 +- wp-admin/includes/export.php | 7 +- wp-admin/includes/file.php | 19 ++- wp-admin/includes/image-edit.php | 23 ++-- wp-admin/includes/media.php | 69 ++++++---- wp-admin/includes/menu.php | 10 +- wp-admin/includes/misc.php | 46 ++++--- wp-admin/includes/ms.php | 6 +- wp-admin/includes/nav-menu.php | 14 +- wp-admin/includes/network.php | 9 +- wp-admin/includes/plugin-install.php | 8 +- wp-admin/includes/plugin.php | 20 ++- wp-admin/includes/post.php | 51 +++++--- wp-admin/includes/revision.php | 9 +- wp-admin/includes/taxonomy.php | 16 ++- wp-admin/includes/template.php | 3 +- wp-admin/includes/theme-install.php | 3 +- wp-admin/includes/theme.php | 6 +- wp-admin/includes/translation-install.php | 13 +- wp-admin/includes/update.php | 6 +- wp-admin/includes/upgrade.php | 26 ++-- wp-admin/includes/user.php | 10 +- wp-admin/includes/widgets.php | 5 +- wp-admin/install.php | 17 ++- wp-admin/link-manager.php | 5 +- wp-admin/link.php | 3 +- wp-admin/media.php | 3 +- wp-admin/menu-header.php | 15 ++- wp-admin/options-general.php | 3 +- wp-admin/options-permalink.php | 3 +- wp-admin/options.php | 6 +- wp-admin/plugins.php | 6 +- wp-admin/post.php | 10 +- wp-admin/revision.php | 18 ++- wp-admin/setup-config.php | 17 ++- wp-admin/theme-editor.php | 3 +- wp-admin/themes.php | 6 +- wp-admin/update-core.php | 17 ++- wp-admin/upload.php | 18 ++- wp-admin/user-edit.php | 3 +- wp-admin/users.php | 3 +- wp-admin/widgets.php | 6 +- wp-includes/version.php | 2 +- 75 files changed, 636 insertions(+), 339 deletions(-) diff --git a/wp-admin/async-upload.php b/wp-admin/async-upload.php index d29884446d..5e28c1e8e4 100644 --- a/wp-admin/async-upload.php +++ b/wp-admin/async-upload.php @@ -39,7 +39,8 @@ if ( ! current_user_can( 'upload_files' ) ) { } // just fetch the detail form for that attachment -if ( isset( $_REQUEST['attachment_id'] ) && ( $id = intval( $_REQUEST['attachment_id'] ) ) && $_REQUEST['fetch'] ) { +if ( isset( $_REQUEST['attachment_id'] ) && intval( $_REQUEST['attachment_id'] ) && $_REQUEST['fetch'] ) { + $id = intval( $_REQUEST['attachment_id'] ); $post = get_post( $id ); if ( 'attachment' != $post->post_type ) { wp_die( __( 'Invalid post type.' ) ); @@ -50,7 +51,8 @@ if ( isset( $_REQUEST['attachment_id'] ) && ( $id = intval( $_REQUEST['attachmen switch ( $_REQUEST['fetch'] ) { case 3: - if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) ) { + $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ); + if ( $thumb_url ) { echo ''; } echo '' . _x( 'Edit', 'media item' ) . ''; diff --git a/wp-admin/comment.php b/wp-admin/comment.php index 0b405c575b..f83fcf43a0 100644 --- a/wp-admin/comment.php +++ b/wp-admin/comment.php @@ -62,7 +62,8 @@ switch ( $action ) { $comment_id = absint( $_GET['c'] ); - if ( ! $comment = get_comment( $comment_id ) ) { + $comment = get_comment( $comment_id ); + if ( ! $comment ) { comment_footer_die( __( 'Invalid comment ID.' ) . sprintf( ' ' . __( 'Go back' ) . '.', 'javascript:history.go(-1)' ) ); } @@ -88,7 +89,8 @@ switch ( $action ) { $comment_id = absint( $_GET['c'] ); - if ( ! $comment = get_comment( $comment_id ) ) { + $comment = get_comment( $comment_id ); + if ( ! $comment ) { wp_redirect( admin_url( 'edit-comments.php?error=1' ) ); die(); } @@ -260,7 +262,8 @@ switch ( $action ) { $noredir = isset( $_REQUEST['noredir'] ); - if ( ! $comment = get_comment( $comment_id ) ) { + $comment = get_comment( $comment_id ); + if ( ! $comment ) { comment_footer_die( __( 'Invalid comment ID.' ) . sprintf( ' ' . __( 'Go back' ) . '.', 'edit-comments.php' ) ); } if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php index 1975b10b74..547611fa41 100644 --- a/wp-admin/custom-background.php +++ b/wp-admin/custom-background.php @@ -256,7 +256,8 @@ class Custom_Background { call_user_func( $this->admin_image_div_callback ); } else { $background_styles = ''; - if ( $bgcolor = get_background_color() ) { + $bgcolor = get_background_color(); + if ( $bgcolor ) { $background_styles .= 'background-color: #' . $bgcolor . ';'; } diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index d2ef006a82..d3bb7ce068 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -39,7 +39,13 @@ if ( $doaction ) { exit; } - $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; + $approved = 0; + $unapproved = 0; + $spammed = 0; + $unspammed = 0; + $trashed = 0; + $untrashed = 0; + $deleted = 0; $redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() ); $redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to ); @@ -307,17 +313,20 @@ if ( isset( $_REQUEST['approved'] ) || isset( $_REQUEST['deleted'] ) || isset( $ $messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted ); } - if ( $same > 0 && $comment = get_comment( $same ) ) { - switch ( $comment->comment_approved ) { - case '1': - $messages[] = __( 'This comment is already approved.' ) . ' ' . __( 'Edit comment' ) . ''; - break; - case 'trash': - $messages[] = __( 'This comment is already in the Trash.' ) . ' ' . __( 'View Trash' ) . ''; - break; - case 'spam': - $messages[] = __( 'This comment is already marked as spam.' ) . ' ' . __( 'Edit comment' ) . ''; - break; + if ( $same > 0 ) { + $comment = get_comment( $same ); + if ( $comment ) { + switch ( $comment->comment_approved ) { + case '1': + $messages[] = __( 'This comment is already approved.' ) . ' ' . __( 'Edit comment' ) . ''; + break; + case 'trash': + $messages[] = __( 'This comment is already in the Trash.' ) . ' ' . __( 'View Trash' ) . ''; + break; + case 'spam': + $messages[] = __( 'This comment is already marked as spam.' ) . ' ' . __( 'Edit comment' ) . ''; + break; + } } } diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index ba78675924..39d7219ce1 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -40,7 +40,9 @@ if ( is_multisite() ) { } wp_enqueue_script( 'post' ); -$_wp_editor_expand = $_content_editor_dfw = false; + +$_wp_editor_expand = false; +$_content_editor_dfw = false; /** * Filters whether to enable the 'expand' functionality in the post editor. @@ -106,8 +108,13 @@ if ( ! $permalink ) { $messages = array(); -$preview_post_link_html = $scheduled_post_link_html = $view_post_link_html = ''; -$preview_page_link_html = $scheduled_page_link_html = $view_page_link_html = ''; +$preview_post_link_html = ''; +$scheduled_post_link_html = ''; +$view_post_link_html = ''; + +$preview_page_link_html = ''; +$scheduled_page_link_html = ''; +$view_page_link_html = ''; $preview_url = get_preview_post_link( $post ); @@ -576,7 +583,8 @@ if ( post_type_supports( $post_type, 'editor' ) ) { post_status ) { echo ''; - if ( $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ) ) { + $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ); + if ( $last_user ) { /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time */ printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); } else { diff --git a/wp-admin/edit.php b/wp-admin/edit.php index d9333b9778..08f879f0ee 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -103,7 +103,8 @@ if ( $doaction ) { switch ( $doaction ) { case 'trash': - $trashed = $locked = 0; + $trashed = 0; + $locked = 0; foreach ( (array) $post_ids as $post_id ) { if ( ! current_user_can( 'delete_post', $post_id ) ) { diff --git a/wp-admin/import.php b/wp-admin/import.php index 511b000eda..f0c1329bab 100644 --- a/wp-admin/import.php +++ b/wp-admin/import.php @@ -101,7 +101,8 @@ if ( empty( $importers ) ) { $data ) { - $plugin_slug = $action = ''; + $plugin_slug = ''; + $action = ''; $is_plugin_installed = false; if ( isset( $data['install'] ) ) { diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 6c1e404e88..baecfa2c45 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -669,7 +669,8 @@ function _wp_ajax_add_hierarchical_term() { function wp_ajax_delete_comment() { $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; - if ( ! $comment = get_comment( $id ) ) { + $comment = get_comment( $id ); + if ( ! $comment ) { wp_die( time() ); } if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { @@ -778,7 +779,8 @@ function wp_ajax_delete_meta() { $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; check_ajax_referer( "delete-meta_$id" ); - if ( ! $meta = get_metadata_by_mid( 'post', $id ) ) { + $meta = get_metadata_by_mid( 'post', $id ); + if ( ! $meta ) { wp_die( 1 ); } @@ -906,7 +908,8 @@ function wp_ajax_delete_page( $action ) { function wp_ajax_dim_comment() { $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; - if ( ! $comment = get_comment( $id ) ) { + $comment = get_comment( $id ); + if ( ! $comment ) { $x = new WP_Ajax_Response( array( 'what' => 'comment', @@ -1010,7 +1013,11 @@ function wp_ajax_add_tag() { $tag = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); - if ( ! $tag || is_wp_error( $tag ) || ( ! $tag = get_term( $tag['term_id'], $taxonomy ) ) ) { + if ( $tag && ! is_wp_error( $tag ) ) { + $tag = get_term( $tag['term_id'], $taxonomy ); + } + + if ( ! $tag || is_wp_error( $tag ) ) { $message = __( 'An error has occurred. Please reload the page and try again.' ); if ( is_wp_error( $tag ) && $tag->get_error_message() ) { $message = $tag->get_error_message(); @@ -1490,14 +1497,18 @@ function wp_ajax_add_meta() { $x->send(); } - if ( ! $mid = add_meta( $pid ) ) { + $mid = add_meta( $pid ); + if ( ! $mid ) { wp_die( __( 'Please provide a custom field value.' ) ); } } else { wp_die( 0 ); } - } elseif ( ! $mid = add_meta( $pid ) ) { - wp_die( __( 'Please provide a custom field value.' ) ); + } else { + $mid = add_meta( $pid ); + if ( ! $mid ) { + wp_die( __( 'Please provide a custom field value.' ) ); + } } $meta = get_metadata_by_mid( 'post', $mid ); @@ -1519,7 +1530,8 @@ function wp_ajax_add_meta() { if ( '' == trim( $key ) ) { wp_die( __( 'Please provide a custom field name.' ) ); } - if ( ! $meta = get_metadata_by_mid( 'post', $mid ) ) { + $meta = get_metadata_by_mid( 'post', $mid ); + if ( ! $meta ) { wp_die( 0 ); // if meta doesn't exist } if ( is_protected_meta( $meta->meta_key, 'post' ) || is_protected_meta( $key, 'post' ) || @@ -1528,7 +1540,8 @@ function wp_ajax_add_meta() { wp_die( -1 ); } if ( $meta->meta_value != $value || $meta->meta_key != $key ) { - if ( ! $u = update_metadata_by_mid( 'post', $mid, $value, $key ) ) { + $u = update_metadata_by_mid( 'post', $mid, $value, $key ); + if ( ! $u ) { wp_die( 0 ); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems). } } @@ -1570,7 +1583,8 @@ function wp_ajax_add_user( $action ) { if ( ! current_user_can( 'create_users' ) ) { wp_die( -1 ); } - if ( ! $user_id = edit_user() ) { + $user_id = edit_user(); + if ( ! $user_id ) { wp_die( 0 ); } elseif ( is_wp_error( $user_id ) ) { $x = new WP_Ajax_Response( @@ -1624,7 +1638,8 @@ function wp_ajax_closed_postboxes() { wp_die( 0 ); } - if ( ! $user = wp_get_current_user() ) { + $user = wp_get_current_user(); + if ( ! $user ) { wp_die( -1 ); } @@ -1653,7 +1668,8 @@ function wp_ajax_hidden_columns() { wp_die( 0 ); } - if ( ! $user = wp_get_current_user() ) { + $user = wp_get_current_user(); + if ( ! $user ) { wp_die( -1 ); } @@ -1807,7 +1823,8 @@ function wp_ajax_meta_box_order() { wp_die( 0 ); } - if ( ! $user = wp_get_current_user() ) { + $user = wp_get_current_user(); + if ( ! $user ) { wp_die( -1 ); } @@ -1875,10 +1892,12 @@ function wp_ajax_inline_save() { check_ajax_referer( 'inlineeditnonce', '_inline_edit' ); - if ( ! isset( $_POST['post_ID'] ) || ! ( $post_ID = (int) $_POST['post_ID'] ) ) { + if ( ! isset( $_POST['post_ID'] ) || ! (int) $_POST['post_ID'] ) { wp_die(); } + $post_ID = (int) $_POST['post_ID']; + if ( 'page' == $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_ID ) ) { wp_die( __( 'Sorry, you are not allowed to edit this page.' ) ); @@ -1889,7 +1908,8 @@ function wp_ajax_inline_save() { } } - if ( $last = wp_check_post_lock( $post_ID ) ) { + $last = wp_check_post_lock( $post_ID ); + if ( $last ) { $last_user = get_userdata( $last ); $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' ); @@ -1991,10 +2011,12 @@ function wp_ajax_inline_save_tax() { wp_die( 0 ); } - if ( ! isset( $_POST['tax_ID'] ) || ! ( $id = (int) $_POST['tax_ID'] ) ) { + if ( ! isset( $_POST['tax_ID'] ) || ! (int) $_POST['tax_ID'] ) { wp_die( -1 ); } + $id = (int) $_POST['tax_ID']; + if ( ! current_user_can( 'edit_term', $id ) ) { wp_die( -1 ); } @@ -2236,7 +2258,8 @@ function wp_ajax_save_widget() { wp_die(); } - if ( $form = $wp_registered_widget_controls[ $widget_id ] ) { + $form = $wp_registered_widget_controls[ $widget_id ]; + if ( $form ) { call_user_func_array( $form['callback'], $form['params'] ); } @@ -2388,7 +2411,8 @@ function wp_ajax_upload_attachment() { } } - if ( ! $attachment = wp_prepare_attachment_for_js( $attachment_id ) ) { + $attachment = wp_prepare_attachment_for_js( $attachment_id ); + if ( ! $attachment ) { wp_die(); } @@ -2598,7 +2622,8 @@ function wp_ajax_wp_fullscreen_save_post() { $last_time = date_i18n( __( 'g:i a' ) ); } - if ( $last_id = get_post_meta( $post_id, '_edit_last', true ) ) { + $last_id = get_post_meta( $post_id, '_edit_last', true ); + if ( $last_id ) { $last_user = get_userdata( $last_id ); /* translators: 1: display_name of last user, 2: date of last edit, 3: time of last edit. */ $last_edited = sprintf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), $last_date, $last_time ); @@ -2620,7 +2645,8 @@ function wp_ajax_wp_remove_post_lock() { wp_die( 0 ); } $post_id = (int) $_POST['post_ID']; - if ( ! $post = get_post( $post_id ) ) { + $post = get_post( $post_id ); + if ( ! $post ) { wp_die( 0 ); } @@ -2684,11 +2710,13 @@ function wp_ajax_get_attachment() { wp_send_json_error(); } - if ( ! $id = absint( $_REQUEST['id'] ) ) { + $id = absint( $_REQUEST['id'] ); + if ( ! $id ) { wp_send_json_error(); } - if ( ! $post = get_post( $id ) ) { + $post = get_post( $id ); + if ( ! $post ) { wp_send_json_error(); } @@ -2700,7 +2728,8 @@ function wp_ajax_get_attachment() { wp_send_json_error(); } - if ( ! $attachment = wp_prepare_attachment_for_js( $id ) ) { + $attachment = wp_prepare_attachment_for_js( $id ); + if ( ! $attachment ) { wp_send_json_error(); } @@ -2786,7 +2815,8 @@ function wp_ajax_save_attachment() { wp_send_json_error(); } - if ( ! $id = absint( $_REQUEST['id'] ) ) { + $id = absint( $_REQUEST['id'] ); + if ( ! $id ) { wp_send_json_error(); } @@ -2869,7 +2899,8 @@ function wp_ajax_save_attachment_compat() { wp_send_json_error(); } - if ( ! $id = absint( $_REQUEST['id'] ) ) { + $id = absint( $_REQUEST['id'] ); + if ( ! $id ) { wp_send_json_error(); } @@ -2906,7 +2937,8 @@ function wp_ajax_save_attachment_compat() { } } - if ( ! $attachment = wp_prepare_attachment_for_js( $id ) ) { + $attachment = wp_prepare_attachment_for_js( $id ); + if ( ! $attachment ) { wp_send_json_error(); } @@ -2923,7 +2955,8 @@ function wp_ajax_save_attachment_order() { wp_send_json_error(); } - if ( ! $post_id = absint( $_REQUEST['post_id'] ) ) { + $post_id = absint( $_REQUEST['post_id'] ); + if ( ! $post_id ) { wp_send_json_error(); } @@ -2943,7 +2976,8 @@ function wp_ajax_save_attachment_order() { if ( ! current_user_can( 'edit_post', $attachment_id ) ) { continue; } - if ( ! $attachment = get_post( $attachment_id ) ) { + $attachment = get_post( $attachment_id ); + if ( ! $attachment ) { continue; } if ( 'attachment' != $attachment->post_type ) { @@ -2977,7 +3011,8 @@ function wp_ajax_send_attachment_to_editor() { $id = intval( $attachment['id'] ); - if ( ! $post = get_post( $id ) ) { + $post = get_post( $id ); + if ( ! $post ) { wp_send_json_error(); } @@ -2987,7 +3022,8 @@ function wp_ajax_send_attachment_to_editor() { if ( current_user_can( 'edit_post', $id ) ) { // If this attachment is unattached, attach it. Primarily a back compat thing. - if ( 0 == $post->post_parent && $insert_into_post_id = intval( $_POST['post_id'] ) ) { + $insert_into_post_id = intval( $_POST['post_id'] ); + if ( 0 == $post->post_parent && $insert_into_post_id ) { wp_update_post( array( 'ID' => $id, @@ -3052,7 +3088,8 @@ function wp_ajax_send_link_to_editor() { check_ajax_referer( 'media-send-to-editor', 'nonce' ); - if ( ! $src = wp_unslash( $_POST['src'] ) ) { + $src = wp_unslash( $_POST['src'] ); + if ( ! $src ) { wp_send_json_error(); } @@ -3060,11 +3097,13 @@ function wp_ajax_send_link_to_editor() { $src = 'http://' . $src; } - if ( ! $src = esc_url_raw( $src ) ) { + $src = esc_url_raw( $src ); + if ( ! $src ) { wp_send_json_error(); } - if ( ! $link_text = trim( wp_unslash( $_POST['link_text'] ) ) ) { + $link_text = trim( wp_unslash( $_POST['link_text'] ) ); + if ( ! $link_text ) { $link_text = wp_basename( $src ); } @@ -3087,9 +3126,12 @@ function wp_ajax_send_link_to_editor() { // Figure out what filter to run: $type = 'file'; - if ( ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) ) && ( $ext_type = wp_ext2type( $ext ) ) - && ( 'audio' == $ext_type || 'video' == $ext_type ) ) { + $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ); + if ( $ext ) { + $ext_type = wp_ext2type( $ext ); + if ( 'audio' == $ext_type || 'video' == $ext_type ) { $type = $ext_type; + } } /** This filter is documented in wp-admin/includes/media.php */ @@ -3110,7 +3152,8 @@ function wp_ajax_heartbeat() { wp_send_json_error(); } - $response = $data = array(); + $response = array(); + $data = array(); $nonce_state = wp_verify_nonce( $_POST['_nonce'], 'heartbeat-nonce' ); // screen_id is the same as $current_screen->id and the JS global 'pagenow'. @@ -3192,7 +3235,8 @@ function wp_ajax_heartbeat() { function wp_ajax_get_revision_diffs() { require ABSPATH . 'wp-admin/includes/revision.php'; - if ( ! $post = get_post( (int) $_REQUEST['post_id'] ) ) { + $post = get_post( (int) $_REQUEST['post_id'] ); + if ( ! $post ) { wp_send_json_error(); } @@ -3201,7 +3245,8 @@ function wp_ajax_get_revision_diffs() { } // Really just pre-loading the cache here. - if ( ! $revisions = wp_get_post_revisions( $post->ID, array( 'check_enabled' => false ) ) ) { + $revisions = wp_get_post_revisions( $post->ID, array( 'check_enabled' => false ) ); + if ( ! $revisions ) { wp_send_json_error(); } diff --git a/wp-admin/includes/class-core-upgrader.php b/wp-admin/includes/class-core-upgrader.php index 977f6ec9c6..0985cf2e81 100644 --- a/wp-admin/includes/class-core-upgrader.php +++ b/wp-admin/includes/class-core-upgrader.php @@ -284,14 +284,19 @@ class Core_Upgrader extends WP_Upgrader { if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { if ( false === WP_AUTO_UPDATE_CORE ) { // Defaults to turned off, unless a filter allows it - $upgrade_dev = $upgrade_minor = $upgrade_major = false; + $upgrade_dev = false; + $upgrade_minor = false; + $upgrade_major = false; } elseif ( true === WP_AUTO_UPDATE_CORE ) { // ALL updates for core - $upgrade_dev = $upgrade_minor = $upgrade_major = true; + $upgrade_dev = true; + $upgrade_minor = true; + $upgrade_major = true; } elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) { // Only minor updates for core - $upgrade_dev = $upgrade_major = false; + $upgrade_dev = false; $upgrade_minor = true; + $upgrade_major = false; } } diff --git a/wp-admin/includes/class-file-upload-upgrader.php b/wp-admin/includes/class-file-upload-upgrader.php index c3d8a79552..52e103cc79 100644 --- a/wp-admin/includes/class-file-upload-upgrader.php +++ b/wp-admin/includes/class-file-upload-upgrader.php @@ -99,7 +99,8 @@ class File_Upload_Upgrader { $this->package = get_attached_file( $attachment->ID ); } else { // Else, It's set to something, Back compat for plugins using the old (pre-3.3) File_Uploader handler. - if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) { + $uploads = wp_upload_dir(); + if ( ! ( $uploads && false === $uploads['error'] ) ) { wp_die( $uploads['error'] ); } diff --git a/wp-admin/includes/class-language-pack-upgrader.php b/wp-admin/includes/class-language-pack-upgrader.php index 754c303c0b..0bc9c14ddc 100644 --- a/wp-admin/includes/class-language-pack-upgrader.php +++ b/wp-admin/includes/class-language-pack-upgrader.php @@ -332,7 +332,8 @@ class Language_Pack_Upgrader extends WP_Upgrader { $files = $wp_filesystem->dirlist( $remote_source ); // Check to see if a .po and .mo exist in the folder. - $po = $mo = false; + $po = false; + $mo = false; foreach ( (array) $files as $file => $filedata ) { if ( '.po' == substr( $file, -3 ) ) { $po = true; diff --git a/wp-admin/includes/class-theme-upgrader-skin.php b/wp-admin/includes/class-theme-upgrader-skin.php index 062297df74..3dce0fe30b 100644 --- a/wp-admin/includes/class-theme-upgrader-skin.php +++ b/wp-admin/includes/class-theme-upgrader-skin.php @@ -41,7 +41,8 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin { $this->decrement_update_count( 'theme' ); $update_actions = array(); - if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) { + $theme_info = $this->upgrader->theme_info(); + if ( $theme_info ) { $name = $theme_info->display( 'Name' ); $stylesheet = $this->upgrader->result['destination_name']; $template = $theme_info->get_template(); diff --git a/wp-admin/includes/class-wp-automatic-updater.php b/wp-admin/includes/class-wp-automatic-updater.php index 23b2258a90..f06959d69d 100644 --- a/wp-admin/includes/class-wp-automatic-updater.php +++ b/wp-admin/includes/class-wp-automatic-updater.php @@ -99,7 +99,8 @@ class WP_Automatic_Updater { // Search all directories we've found for evidence of version control. foreach ( $vcs_dirs as $vcs_dir ) { foreach ( $check_dirs as $check_dir ) { - if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) ) { + $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ); + if ( $checkout ) { break 2; } } diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index 1c196fcf87..519b647017 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -819,8 +819,9 @@ class WP_Comments_List_Table extends WP_List_Table { if ( isset( $this->pending_count[ $post->ID ] ) ) { $pending_comments = $this->pending_count[ $post->ID ]; } else { - $_pending_count_temp = get_pending_comments_num( array( $post->ID ) ); - $pending_comments = $this->pending_count[ $post->ID ] = $_pending_count_temp[ $post->ID ]; + $_pending_count_temp = get_pending_comments_num( array( $post->ID ) ); + $pending_comments = $_pending_count_temp[ $post->ID ]; + $this->pending_count[ $post->ID ] = $pending_comments; } if ( current_user_can( 'edit_post', $post->ID ) ) { @@ -831,8 +832,11 @@ class WP_Comments_List_Table extends WP_List_Table { } echo '