Make WordPress Core


Ignore:
Timestamp:
05/16/2020 06:40:52 PM (5 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-functions.php

    r47754 r47808  
    945945
    946946    $activate_url = esc_url( $activate_url );
    947     $admin_email  = get_site_option( 'admin_email' );
    948     if ( '' == $admin_email ) {
     947
     948    $admin_email = get_site_option( 'admin_email' );
     949
     950    if ( '' === $admin_email ) {
    949951        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    950952    }
    951     $from_name       = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
     953
     954    $from_name       = ( '' !== get_site_option( 'site_name' ) ) ? esc_html( get_site_option( 'site_name' ) ) : 'WordPress';
    952955    $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";
    953956
     
    10711074    // Send email with activation link.
    10721075    $admin_email = get_site_option( 'admin_email' );
    1073     if ( '' == $admin_email ) {
     1076
     1077    if ( '' === $admin_email ) {
    10741078        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    10751079    }
    1076     $from_name       = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
     1080
     1081    $from_name       = ( '' !== get_site_option( 'site_name' ) ) ? esc_html( get_site_option( 'site_name' ) ) : 'WordPress';
    10771082    $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";
    10781083    $message         = sprintf(
     
    12251230         * Let's just set the active flag and instruct the user to reset their password.
    12261231         */
    1227         if ( 'blog_taken' == $blog_id->get_error_code() ) {
     1232        if ( 'blog_taken' === $blog_id->get_error_code() ) {
    12281233            $blog_id->add_data( $signup );
    12291234            $wpdb->update(
     
    13991404    }
    14001405
    1401     if ( get_site_option( 'registrationnotification' ) != 'yes' ) {
     1406    if ( 'yes' !== get_site_option( 'registrationnotification' ) ) {
    14021407        return false;
    14031408    }
    14041409
    14051410    $email = get_site_option( 'admin_email' );
     1411
    14061412    if ( is_email( $email ) == false ) {
    14071413        return false;
     
    14591465 */
    14601466function newuser_notify_siteadmin( $user_id ) {
    1461     if ( get_site_option( 'registrationnotification' ) != 'yes' ) {
     1467    if ( 'yes' !== get_site_option( 'registrationnotification' ) ) {
    14621468        return false;
    14631469    }
     
    16331639     */
    16341640    $welcome_email = apply_filters( 'update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta );
    1635     $admin_email   = get_site_option( 'admin_email' );
    1636 
    1637     if ( '' == $admin_email ) {
     1641
     1642    $admin_email = get_site_option( 'admin_email' );
     1643
     1644    if ( '' === $admin_email ) {
    16381645        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    16391646    }
    16401647
    1641     $from_name       = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
     1648    $from_name       = ( '' !== get_site_option( 'site_name' ) ) ? esc_html( get_site_option( 'site_name' ) ) : 'WordPress';
    16421649    $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";
    16431650    $message         = $welcome_email;
     
    17271734    $admin_email = get_site_option( 'admin_email' );
    17281735
    1729     if ( '' == $admin_email ) {
     1736    if ( '' === $admin_email ) {
    17301737        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    17311738    }
    17321739
    1733     $from_name       = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
     1740    $from_name       = ( '' !== get_site_option( 'site_name' ) ) ? esc_html( get_site_option( 'site_name' ) ) : 'WordPress';
    17341741    $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";
    17351742    $message         = $welcome_email;
     
    18501857    foreach ( $site_exts as $ext ) {
    18511858        foreach ( $mimes as $ext_pattern => $mime ) {
    1852             if ( '' != $ext && false !== strpos( $ext_pattern, $ext ) ) {
     1859            if ( '' !== $ext && false !== strpos( $ext_pattern, $ext ) ) {
    18531860                $site_mimes[ $ext_pattern ] = $mime;
    18541861            }
     
    21202127    $key   = array_pop( $parts );
    21212128
    2122     if ( '' == $key ) {
     2129    if ( '' === $key ) {
    21232130        $key = array_pop( $parts );
    21242131    }
     
    23102317    static $forced_content = false;
    23112318
    2312     if ( '' != $force ) {
     2319    if ( ! $force ) {
    23132320        $old_forced     = $forced_content;
    23142321        $forced_content = $force;
     
    25952602    }
    25962603
    2597     if ( 'users' == $using ) {
     2604    if ( 'users' === $using ) {
    25982605        $count = get_user_count( $network_id );
    25992606        /**
     
    26122619
    26132620    $count = get_blog_count( $network_id );
     2621
    26142622    /** This filter is documented in wp-includes/ms-functions.php */
    26152623    return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count, $network_id );
Note: See TracChangeset for help on using the changeset viewer.