Make WordPress Core


Ignore:
Timestamp:
07/01/2019 12:50:14 PM (6 years ago)
Author:
pento
Message:

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

See #47632.

File:
1 edited

Legend:

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

    r45424 r45583  
    340340    if ( isset( $post_data['meta'] ) && $post_data['meta'] ) {
    341341        foreach ( $post_data['meta'] as $key => $value ) {
    342             if ( ! $meta = get_post_meta_by_id( $key ) ) {
     342            $meta = get_post_meta_by_id( $key );
     343            if ( ! $meta ) {
    343344                continue;
    344345            }
     
    358359    if ( isset( $post_data['deletemeta'] ) && $post_data['deletemeta'] ) {
    359360        foreach ( $post_data['deletemeta'] as $key => $value ) {
    360             if ( ! $meta = get_post_meta_by_id( $key ) ) {
     361            $meta = get_post_meta_by_id( $key );
     362            if ( ! $meta ) {
    361363                continue;
    362364            }
     
    532534    }
    533535
    534     if ( isset( $post_data['post_parent'] ) && ( $parent = (int) $post_data['post_parent'] ) ) {
     536    if ( isset( $post_data['post_parent'] ) && (int) $post_data['post_parent'] ) {
     537        $parent   = (int) $post_data['post_parent'];
    535538        $pages    = $wpdb->get_results( "SELECT ID, post_parent FROM $wpdb->posts WHERE post_type = 'page'" );
    536539        $children = array();
     
    548551    }
    549552
    550     $updated          = $skipped = $locked = array();
     553    $updated          = array();
     554    $skipped          = array();
     555    $locked           = array();
    551556    $shared_post_data = $post_data;
    552557
     
    12821287    if ( isset( $_GET['edit'] ) && $_GET['edit'] == $box_id ) {
    12831288        $classes = array( '' );
    1284     } elseif ( $closed = get_user_option( 'closedpostboxes_' . $screen_id ) ) {
     1289    } elseif ( get_user_option( 'closedpostboxes_' . $screen_id ) ) {
     1290        $closed = get_user_option( 'closedpostboxes_' . $screen_id );
    12851291        if ( ! is_array( $closed ) ) {
    12861292            $classes = array( '' );
     
    15571563 */
    15581564function wp_check_post_lock( $post_id ) {
    1559     if ( ! $post = get_post( $post_id ) ) {
     1565    $post = get_post( $post_id );
     1566    if ( ! $post ) {
    15601567        return false;
    15611568    }
    15621569
    1563     if ( ! $lock = get_post_meta( $post->ID, '_edit_lock', true ) ) {
     1570    $lock = get_post_meta( $post->ID, '_edit_lock', true );
     1571    if ( ! $lock ) {
    15641572        return false;
    15651573    }
     
    15931601 */
    15941602function wp_set_post_lock( $post_id ) {
    1595     if ( ! $post = get_post( $post_id ) ) {
     1603    $post = get_post( $post_id );
     1604    if ( ! $post ) {
    15961605        return false;
    15971606    }
    15981607
    1599     if ( 0 == ( $user_id = get_current_user_id() ) ) {
     1608    $user_id = get_current_user_id();
     1609    if ( 0 == $user_id ) {
    16001610        return false;
    16011611    }
     
    16161626 */
    16171627function _admin_notice_post_locked() {
    1618     if ( ! $post = get_post() ) {
     1628    $post = get_post();
     1629    if ( ! $post ) {
    16191630        return;
    16201631    }
    16211632
    1622     $user = null;
    1623     if ( $user_id = wp_check_post_lock( $post->ID ) ) {
     1633    $user    = null;
     1634    $user_id = wp_check_post_lock( $post->ID );
     1635    if ( $user_id ) {
    16241636        $user = get_userdata( $user_id );
    16251637    }
     
    16471659    }
    16481660
    1649     if ( $locked && ( $sendback = wp_get_referer() ) &&
    1650         false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) {
     1661    $sendback = wp_get_referer();
     1662    if ( $locked && $sendback && false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) {
    16511663
    16521664        $sendback_text = __( 'Go back' );
     
    17941806
    17951807    // Store one autosave per author. If there is already an autosave, overwrite it.
    1796     if ( $old_autosave = wp_get_post_autosave( $post_id, $post_author ) ) {
     1808    $old_autosave = wp_get_post_autosave( $post_id, $post_author );
     1809    if ( $old_autosave ) {
    17971810        $new_autosave                = _wp_post_revision_data( $post_data, true );
    17981811        $new_autosave['ID']          = $old_autosave->ID;
     
    18451858    $_POST['ID'] = $post_ID;
    18461859
    1847     if ( ! $post = get_post( $post_ID ) ) {
     1860    $post = get_post( $post_ID );
     1861    if ( ! $post ) {
    18481862        wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );
    18491863    }
     
    19061920    }
    19071921
    1908     $post_id         = (int) $post_data['post_id'];
    1909     $post_data['ID'] = $post_data['post_ID'] = $post_id;
     1922    $post_id              = (int) $post_data['post_id'];
     1923    $post_data['ID']      = $post_id;
     1924    $post_data['post_ID'] = $post_id;
    19101925
    19111926    if ( false === wp_verify_nonce( $post_data['_wpnonce'], 'update-post_' . $post_id ) ) {
Note: See TracChangeset for help on using the changeset viewer.