Make WordPress Core


Ignore:
Timestamp:
07/02/2019 11:41:16 PM (5 years ago)
Author:
pento
Message:

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

See #47632.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/revision.php

    r44610 r45590  
    114114    }
    115115
    116     if ( ! $post = get_post( $post_id ) ) {
     116    $post = get_post( $post_id );
     117    if ( ! $post ) {
    117118        return;
    118119    }
     
    133134    // they are different, unless a plugin tells us to always save regardless.
    134135    // If no previous revisions, save one
    135     if ( $revisions = wp_get_post_revisions( $post_id ) ) {
     136    $revisions = wp_get_post_revisions( $post_id );
     137    if ( $revisions ) {
    136138        // grab the last revision, but not an autosave
    137139        foreach ( $revisions as $revision ) {
     
    255257 */
    256258function wp_is_post_revision( $post ) {
    257     if ( ! $post = wp_get_post_revision( $post ) ) {
     259    $post = wp_get_post_revision( $post );
     260    if ( ! $post ) {
    258261        return false;
    259262    }
     
    271274 */
    272275function wp_is_post_autosave( $post ) {
    273     if ( ! $post = wp_get_post_revision( $post ) ) {
     276    $post = wp_get_post_revision( $post );
     277    if ( ! $post ) {
    274278        return false;
    275279    }
     
    341345 */
    342346function wp_get_post_revision( &$post, $output = OBJECT, $filter = 'raw' ) {
    343     if ( ! $revision = get_post( $post, OBJECT, $filter ) ) {
     347    $revision = get_post( $post, OBJECT, $filter );
     348    if ( ! $revision ) {
    344349        return $revision;
    345350    }
     
    373378 */
    374379function wp_restore_post_revision( $revision_id, $fields = null ) {
    375     if ( ! $revision = wp_get_post_revision( $revision_id, ARRAY_A ) ) {
     380    $revision = wp_get_post_revision( $revision_id, ARRAY_A );
     381    if ( ! $revision ) {
    376382        return $revision;
    377383    }
     
    426432 */
    427433function wp_delete_post_revision( $revision_id ) {
    428     if ( ! $revision = wp_get_post_revision( $revision_id ) ) {
     434    $revision = wp_get_post_revision( $revision_id );
     435    if ( ! $revision ) {
    429436        return $revision;
    430437    }
     
    483490    );
    484491
    485     if ( ! $revisions = get_children( $args ) ) {
     492    $revisions = get_children( $args );
     493    if ( ! $revisions ) {
    486494        return array();
    487495    }
     
    602610 */
    603611function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) {
    604     if ( ! $post = get_post() ) {
     612    $post = get_post();
     613    if ( ! $post ) {
    605614        return $terms;
    606615    }
     
    612621    if ( 'standard' == $_REQUEST['post_format'] ) {
    613622        $terms = array();
    614     } elseif ( $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ) ) {
    615         $terms = array( $term ); // Can only have one post format
     623    } else {
     624        $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' );
     625        if ( $term ) {
     626            $terms = array( $term ); // Can only have one post format
     627        }
    616628    }
    617629
     
    631643 */
    632644function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) {
    633     if ( ! $post = get_post() ) {
     645    $post = get_post();
     646    if ( ! $post ) {
    634647        return $value;
    635648    }
Note: See TracChangeset for help on using the changeset viewer.