Make WordPress Core


Ignore:
Timestamp:
05/16/2020 06:40:52 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison where static strings are involved.

This reduces the number of WordPress.PHP.StrictComparisons.LooseComparison issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.

File:
1 edited

Legend:

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

    r47550 r47808  
    138138                                return $blog;
    139139                        }
    140                         if ( substr( $fields['domain'], 0, 4 ) == 'www.' ) {
     140                        if ( 'www.' === substr( $fields['domain'], 0, 4 ) ) {
    141141                                $nowww = substr( $fields['domain'], 4 );
    142142                                $blog  = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) AND path = %s ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'], $fields['path'] ) );
     
    156156                                return $blog;
    157157                        }
    158                         if ( substr( $fields['domain'], 0, 4 ) == 'www.' ) {
     158                        if ( 'www.' === substr( $fields['domain'], 0, 4 ) ) {
    159159                                $nowww = substr( $fields['domain'], 4 );
    160160                                $blog  = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'] ) );
     
    785785        }
    786786
    787         if ( 'publish' != $new_status && 'publish' != $old_status ) {
     787        if ( 'publish' !== $new_status && 'publish' !== $old_status ) {
    788788                return;
    789789        }
     
    810810        }
    811811
    812         if ( 'publish' != $post->post_status ) {
     812        if ( 'publish' !== $post->post_status ) {
    813813                return;
    814814        }
Note: See TracChangeset for help on using the changeset viewer.