Make WordPress Core


Ignore:
Timestamp:
02/09/2020 04:52:28 PM (4 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/ms-functions.php

    r47177 r47219  
    7272    }
    7373
    74     if ( ( ! is_object( $primary ) ) || ( $primary->archived == 1 || $primary->spam == 1 || $primary->deleted == 1 ) ) {
     74    if ( ( ! is_object( $primary ) ) || ( 1 == $primary->archived || 1 == $primary->spam || 1 == $primary->deleted ) ) {
    7575        $blogs = get_blogs_of_user( $user_id, true ); // If a user's primary blog is shut down, check their other blogs.
    7676        $ret   = false;
    7777        if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
    7878            foreach ( (array) $blogs as $blog_id => $blog ) {
    79                 if ( $blog->site_id != get_current_network_id() ) {
     79                if ( get_current_network_id() != $blog->site_id ) {
    8080                    continue;
    8181                }
    8282                $details = get_site( $blog_id );
    83                 if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) {
     83                if ( is_object( $details ) && 0 == $details->archived && 0 == $details->spam && 0 == $details->deleted ) {
    8484                    $ret = $details;
    8585                    if ( get_user_meta( $user_id, 'primary_blog', true ) != $blog_id ) {
     
    352352    $id     = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
    353353
    354     if ( $id == -1 ) { // Blog does not exist.
     354    if ( -1 == $id ) { // Blog does not exist.
    355355        return 0;
    356356    } elseif ( $id ) {
     
    420420
    421421            $dotted_domain = ".$banned_domain";
    422             if ( $dotted_domain === substr( $normalized_email, -strlen( $dotted_domain ) ) ) {
     422            if ( substr( $normalized_email, -strlen( $dotted_domain ) ) === $dotted_domain ) {
    423423                $is_email_address_unsafe = true;
    424424                break;
     
    540540    // Has someone already signed up for this username?
    541541    $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE user_login = %s", $user_name ) );
    542     if ( $signup != null ) {
     542    if ( null != $signup ) {
    543543        $registered_at = mysql2date( 'U', $signup->registered );
    544544        $now           = time();
     
    553553
    554554    $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email ) );
    555     if ( $signup != null ) {
     555    if ( null != $signup ) {
    556556        $diff = time() - mysql2date( 'U', $signup->registered );
    557557        // If registered more than two days ago, cancel registration and let this signup go through.
     
    633633    $errors        = new WP_Error();
    634634    $illegal_names = get_site_option( 'illegal_names' );
    635     if ( $illegal_names == false ) {
     635    if ( false == $illegal_names ) {
    636636        $illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
    637637        add_site_option( 'illegal_names', $illegal_names );
     
    946946    $activate_url = esc_url( $activate_url );
    947947    $admin_email  = get_site_option( 'admin_email' );
    948     if ( $admin_email == '' ) {
     948    if ( '' == $admin_email ) {
    949949        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    950950    }
     
    10711071    // Send email with activation link.
    10721072    $admin_email = get_site_option( 'admin_email' );
    1073     if ( $admin_email == '' ) {
     1073    if ( '' == $admin_email ) {
    10741074        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    10751075    }
     
    15901590
    15911591    $welcome_email = get_site_option( 'welcome_email' );
    1592     if ( $welcome_email == false ) {
     1592    if ( false == $welcome_email ) {
    15931593        /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
    15941594        $welcome_email = __(
     
    16351635    $admin_email   = get_site_option( 'admin_email' );
    16361636
    1637     if ( $admin_email == '' ) {
     1637    if ( '' == $admin_email ) {
    16381638        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    16391639    }
     
    17271727    $admin_email = get_site_option( 'admin_email' );
    17281728
    1729     if ( $admin_email == '' ) {
     1729    if ( '' == $admin_email ) {
    17301730        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    17311731    }
     
    18501850    foreach ( $site_exts as $ext ) {
    18511851        foreach ( $mimes as $ext_pattern => $mime ) {
    1852             if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false ) {
     1852            if ( '' != $ext && false !== strpos( $ext_pattern, $ext ) ) {
    18531853                $site_mimes[ $ext_pattern ] = $mime;
    18541854            }
     
    19371937    // Prevent a race condition.
    19381938    $recurse_start = false;
    1939     if ( $global_terms_recurse === null ) {
     1939    if ( null === $global_terms_recurse ) {
    19401940        $recurse_start        = true;
    19411941        $global_terms_recurse = 1;
     
    19481948
    19491949    $global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug ) );
    1950     if ( $global_id == null ) {
     1950    if ( null == $global_id ) {
    19511951        $used_global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE cat_ID = %d", $c->term_id ) );
    19521952        if ( null == $used_global_id ) {
     
    20942094        $destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT );
    20952095        if ( $destination ) {
    2096             if ( $destination == '%siteurl%' ) {
     2096            if ( '%siteurl%' === $destination ) {
    20972097                $destination = network_home_url();
    20982098            }
     
    21202120    $key   = array_pop( $parts );
    21212121
    2122     if ( $key == '' ) {
     2122    if ( '' == $key ) {
    21232123        $key = array_pop( $parts );
    21242124    }
     
    22622262function users_can_register_signup_filter() {
    22632263    $registration = get_site_option( 'registration' );
    2264     return ( $registration == 'all' || $registration == 'user' );
     2264    return ( 'all' === $registration || 'user' === $registration );
    22652265}
    22662266
     
    26602660 */
    26612661function update_network_option_new_admin_email( $old_value, $value ) {
    2662     if ( $value == get_site_option( 'admin_email' ) || ! is_email( $value ) ) {
     2662    if ( get_site_option( 'admin_email' ) === $value || ! is_email( $value ) ) {
    26632663        return;
    26642664    }
Note: See TracChangeset for help on using the changeset viewer.