Make WordPress Core


Ignore:
Timestamp:
02/09/2020 04:52:28 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use Yoda conditions where appropriate.

See #49222.

File:
1 edited

Legend:

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

    r47206 r47219  
    110110        $post_data['post_status'] = 'private';
    111111    }
    112     if ( isset( $post_data['publish'] ) && ( '' != $post_data['publish'] ) && ( ! isset( $post_data['post_status'] ) || $post_data['post_status'] != 'private' ) ) {
     112    if ( isset( $post_data['publish'] ) && ( '' != $post_data['publish'] ) && ( ! isset( $post_data['post_status'] ) || 'private' !== $post_data['post_status'] ) ) {
    113113        $post_data['post_status'] = 'publish';
    114114    }
     
    378378            $image_alt = wp_unslash( $post_data['_wp_attachment_image_alt'] );
    379379
    380             if ( $image_alt != get_post_meta( $post_ID, '_wp_attachment_image_alt', true ) ) {
     380            if ( get_post_meta( $post_ID, '_wp_attachment_image_alt', true ) !== $image_alt ) {
    381381                $image_alt = wp_strip_all_tags( $image_alt, true );
    382382
     
    14531453
    14541454        // Encourage a pretty permalink setting.
    1455         if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && ! ( 'page' == get_option( 'show_on_front' ) && $id == get_option( 'page_on_front' ) ) ) {
     1455        if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && ! ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $id ) ) {
    14561456            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __( 'Change Permalinks' ) . "</a></span>\n";
    14571457        }
     
    15971597    $time_window = apply_filters( 'wp_check_post_lock_window', 150 );
    15981598
    1599     if ( $time && $time > time() - $time_window && $user != get_current_user_id() ) {
     1599    if ( $time && $time > time() - $time_window && get_current_user_id() != $user ) {
    16001600        return $user;
    16011601    }
     
    19521952    }
    19531953
    1954     if ( $post_data['post_type'] != 'page' && ! empty( $post_data['catslist'] ) ) {
     1954    if ( 'page' !== $post_data['post_type'] && ! empty( $post_data['catslist'] ) ) {
    19551955        $post_data['post_category'] = explode( ',', $post_data['catslist'] );
    19561956    }
Note: See TracChangeset for help on using the changeset viewer.