Make WordPress Core


Ignore:
Timestamp:
02/09/2020 04:52:28 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use Yoda conditions where appropriate.

See #49222.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r47198 r47219  
    162162                if ( global_terms_enabled() ) {
    163163                        $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
    164                         if ( $cat_id == null ) {
     164                        if ( null == $cat_id ) {
    165165                                $wpdb->insert(
    166166                                        $wpdb->sitecategories,
     
    496496                        // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.)
    497497                        // TODO: Get previous_blog_id.
    498                         if ( ! is_super_admin( $user_id ) && $user_id != 1 ) {
     498                        if ( ! is_super_admin( $user_id ) && 1 != $user_id ) {
    499499                                $wpdb->delete(
    500500                                        $wpdb->usermeta,
     
    567567                $response          = wp_remote_get( $test_url, array( 'timeout' => 5 ) );
    568568                $x_pingback_header = wp_remote_retrieve_header( $response, 'x-pingback' );
    569                 $pretty_permalinks = $x_pingback_header && $x_pingback_header === get_bloginfo( 'pingback_url' );
     569                $pretty_permalinks = $x_pingback_header && get_bloginfo( 'pingback_url' ) === $x_pingback_header;
    570570
    571571                if ( $pretty_permalinks ) {
     
    11281128                if ( isset( $user->user_idmode ) ) :
    11291129                        $idmode = $user->user_idmode;
    1130                         if ( $idmode == 'nickname' ) {
     1130                        if ( 'nickname' === $idmode ) {
    11311131                                $id = $user->user_nickname;
    11321132                        }
    1133                         if ( $idmode == 'login' ) {
     1133                        if ( 'login' === $idmode ) {
    11341134                                $id = $user->user_login;
    11351135                        }
    1136                         if ( $idmode == 'firstname' ) {
     1136                        if ( 'firstname' === $idmode ) {
    11371137                                $id = $user->user_firstname;
    11381138                        }
    1139                         if ( $idmode == 'lastname' ) {
     1139                        if ( 'lastname' === $idmode ) {
    11401140                                $id = $user->user_lastname;
    11411141                        }
    1142                         if ( $idmode == 'namefl' ) {
     1142                        if ( 'namefl' === $idmode ) {
    11431143                                $id = $user->user_firstname . ' ' . $user->user_lastname;
    11441144                        }
    1145                         if ( $idmode == 'namelf' ) {
     1145                        if ( 'namelf' === $idmode ) {
    11461146                                $id = $user->user_lastname . ' ' . $user->user_firstname;
    11471147                        }
     
    22502250
    22512251        // 4.2
    2252         if ( $wp_current_db_version < 31351 && $wpdb->charset === 'utf8mb4' ) {
     2252        if ( $wp_current_db_version < 31351 && 'utf8mb4' === $wpdb->charset ) {
    22532253                if ( wp_should_upgrade_global_tables() ) {
    22542254                        $wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
     
    25002500        global $wpdb;
    25012501
    2502         if ( $setting == 'home' && defined( 'WP_HOME' ) ) {
     2502        if ( 'home' === $setting && defined( 'WP_HOME' ) ) {
    25032503                return untrailingslashit( WP_HOME );
    25042504        }
    25052505
    2506         if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) {
     2506        if ( 'siteurl' === $setting && defined( 'WP_SITEURL' ) ) {
    25072507                return untrailingslashit( WP_SITEURL );
    25082508        }
     
    25102510        $option = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting ) );
    25112511
    2512         if ( 'home' == $setting && '' == $option ) {
     2512        if ( 'home' === $setting && '' == $option ) {
    25132513                return __get_option( 'siteurl' );
    25142514        }
    25152515
    2516         if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting || 'tag_base' == $setting ) {
     2516        if ( 'siteurl' === $setting || 'home' === $setting || 'category_base' === $setting || 'tag_base' === $setting ) {
    25172517                $option = untrailingslashit( $option );
    25182518        }
     
    28622862                                        'subpart'   => $tableindex->Sub_part,
    28632863                                );
    2864                                 $index_ary[ $keyname ]['unique']     = ( $tableindex->Non_unique == 0 ) ? true : false;
     2864                                $index_ary[ $keyname ]['unique']     = ( 0 == $tableindex->Non_unique ) ? true : false;
    28652865                                $index_ary[ $keyname ]['index_type'] = $tableindex->Index_type;
    28662866                        }
     
    28712871                                // Build a create string to compare to the query.
    28722872                                $index_string = '';
    2873                                 if ( $index_name == 'primary' ) {
     2873                                if ( 'primary' === $index_name ) {
    28742874                                        $index_string .= 'PRIMARY ';
    28752875                                } elseif ( $index_data['unique'] ) {
     
    28902890                                // For each column in the index.
    28912891                                foreach ( $index_data['columns'] as $column_data ) {
    2892                                         if ( $index_columns != '' ) {
     2892                                        if ( '' != $index_columns ) {
    28932893                                                $index_columns .= ',';
    28942894                                        }
     
    30013001
    30023002        foreach ( $files as $oldfile => $newfile ) {
    3003                 if ( $oldfile == 'index.php' ) {
     3003                if ( 'index.php' === $oldfile ) {
    30043004                        $oldpath = $home_path;
    30053005                } else {
     
    30083008
    30093009                // Check to make sure it's not a new index.
    3010                 if ( $oldfile == 'index.php' ) {
     3010                if ( 'index.php' === $oldfile ) {
    30113011                        $index = implode( '', file( "$oldpath/$oldfile" ) );
    30123012                        if ( strpos( $index, 'WP_USE_THEMES' ) !== false ) {
     
    31843184        // Make the new site theme active.
    31853185        $current_template = __get_option( 'template' );
    3186         if ( $current_template == WP_DEFAULT_THEME ) {
     3186        if ( WP_DEFAULT_THEME == $current_template ) {
    31873187                update_option( 'template', $template );
    31883188                update_option( 'stylesheet', $template );
Note: See TracChangeset for help on using the changeset viewer.