Make WordPress Core


Ignore:
Timestamp:
02/09/2020 04:52:28 PM (6 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/general-template.php

    r47210 r47219  
    857857    $switched_blog = false;
    858858
    859     if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) {
     859    if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) {
    860860        switch_to_blog( $blog_id );
    861861        $switched_blog = true;
     
    925925    $switched_blog = false;
    926926
    927     if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) {
     927    if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) {
    928928        switch_to_blog( $blog_id );
    929929        $switched_blog = true;
     
    951951    $switched_blog = false;
    952952
    953     if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) {
     953    if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) {
    954954        switch_to_blog( $blog_id );
    955955        $switched_blog = true;
     
    18471847
    18481848    $order = strtoupper( $parsed_args['order'] );
    1849     if ( $order !== 'ASC' ) {
     1849    if ( 'ASC' !== $order ) {
    18501850        $order = 'DESC';
    18511851    }
     
    20072007        if ( $results ) {
    20082008            foreach ( (array) $results as $result ) {
    2009                 if ( $result->post_date != '0000-00-00 00:00:00' ) {
     2009                if ( '0000-00-00 00:00:00' !== $result->post_date ) {
    20102010                    $url = get_permalink( $result );
    20112011                    if ( $result->post_title ) {
     
    20152015                        $text = $result->ID;
    20162016                    }
    2017                     $selected = $result->ID === get_the_ID();
     2017                    $selected = get_the_ID() === $result->ID;
    20182018                    $output  .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected );
    20192019                }
     
    22282228        $newrow = false;
    22292229
    2230         if ( $day == current_time( 'j' ) &&
    2231             $thismonth == current_time( 'm' ) &&
    2232             $thisyear == current_time( 'Y' ) ) {
     2230        if ( current_time( 'j' ) == $day &&
     2231            current_time( 'm' ) == $thismonth &&
     2232            current_time( 'Y' ) == $thisyear ) {
    22332233            $calendar_output .= '<td id="today">';
    22342234        } else {
     
    22582258
    22592259    $pad = 7 - calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins );
    2260     if ( $pad != 0 && $pad != 7 ) {
     2260    if ( 0 != $pad && 7 != $pad ) {
    22612261        $calendar_output .= "\n\t\t" . '<td class="pad" colspan="' . esc_attr( $pad ) . '">&nbsp;</td>';
    22622262    }
     
    39613961    $lang = get_bloginfo( 'language' );
    39623962    if ( $lang ) {
    3963         if ( get_option( 'html_type' ) == 'text/html' || $doctype == 'html' ) {
     3963        if ( 'text/html' === get_option( 'html_type' ) || 'html' === $doctype ) {
    39643964            $attributes[] = 'lang="' . esc_attr( $lang ) . '"';
    39653965        }
    39663966
    3967         if ( get_option( 'html_type' ) != 'text/html' || $doctype == 'xhtml' ) {
     3967        if ( 'text/html' !== get_option( 'html_type' ) || 'xhtml' === $doctype ) {
    39683968            $attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"';
    39693969        }
Note: See TracChangeset for help on using the changeset viewer.