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-includes/comment.php

    r47198 r47219  
    128128     */
    129129    if ( 1 == get_option( 'comment_whitelist' ) ) {
    130         if ( 'trackback' != $comment_type && 'pingback' != $comment_type && $author != '' && $email != '' ) {
     130        if ( 'trackback' !== $comment_type && 'pingback' !== $comment_type && '' != $author && '' != $email ) {
    131131            $comment_user = get_user_by( 'email', wp_unslash( $email ) );
    132132            if ( ! empty( $comment_user->ID ) ) {
     
    218218    $_comment = apply_filters( 'get_comment', $_comment );
    219219
    220     if ( $output == OBJECT ) {
     220    if ( OBJECT == $output ) {
    221221        return $_comment;
    222     } elseif ( $output == ARRAY_A ) {
     222    } elseif ( ARRAY_A == $output ) {
    223223        return $_comment->to_array();
    224     } elseif ( $output == ARRAY_N ) {
     224    } elseif ( ARRAY_N == $output ) {
    225225        return array_values( $_comment->to_array() );
    226226    }
     
    14301430
    14311431    $post_id = $comment->comment_post_ID;
    1432     if ( $post_id && $comment->comment_approved == 1 ) {
     1432    if ( $post_id && 1 == $comment->comment_approved ) {
    14331433        wp_update_comment_count( $post_id );
    14341434    }
     
    16561656    $approved = $comment->comment_approved;
    16571657
    1658     if ( $approved == null ) {
     1658    if ( null == $approved ) {
    16591659        return false;
    1660     } elseif ( $approved == '1' ) {
     1660    } elseif ( '1' == $approved ) {
    16611661        return 'approved';
    1662     } elseif ( $approved == '0' ) {
     1662    } elseif ( '0' == $approved ) {
    16631663        return 'unapproved';
    1664     } elseif ( $approved == 'spam' ) {
     1664    } elseif ( 'spam' == $approved ) {
    16651665        return 'spam';
    1666     } elseif ( $approved == 'trash' ) {
     1666    } elseif ( 'trash' == $approved ) {
    16671667        return 'trash';
    16681668    } else {
     
    19141914    $id = (int) $wpdb->insert_id;
    19151915
    1916     if ( $comment_approved == 1 ) {
     1916    if ( 1 == $comment_approved ) {
    19171917        wp_update_comment_count( $comment_post_ID );
    19181918
     
    26332633    if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) {
    26342634        $quote                   = ( $pingback_link_offset_dquote ) ? '"' : '\'';
    2635         $pingback_link_offset    = ( $quote == '"' ) ? $pingback_link_offset_dquote : $pingback_link_offset_squote;
     2635        $pingback_link_offset    = ( '"' === $quote ) ? $pingback_link_offset_dquote : $pingback_link_offset_squote;
    26362636        $pingback_href_pos       = strpos( $contents, 'href=', $pingback_link_offset );
    26372637        $pingback_href_start     = $pingback_href_pos + 6;
     
    28442844                if ( isset( $test['query'] ) ) {
    28452845                    $post_links[] = $link_test;
    2846                 } elseif ( isset( $test['path'] ) && ( $test['path'] != '/' ) && ( $test['path'] != '' ) ) {
     2846                } elseif ( isset( $test['path'] ) && ( '/' !== $test['path'] ) && ( '' !== $test['path'] ) ) {
    28472847                    $post_links[] = $link_test;
    28482848                }
     
    30063006 */
    30073007function xmlrpc_pingback_error( $ixr_error ) {
    3008     if ( $ixr_error->code === 48 ) {
     3008    if ( 48 === $ixr_error->code ) {
    30093009        return $ixr_error;
    30103010    }
Note: See TracChangeset for help on using the changeset viewer.