Coding Standards: Use Yoda conditions where appropriate.

See #49222.

git-svn-id: https://develop.svn.wordpress.org/trunk@47219 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-02-09 16:52:28 +00:00
parent 40ffe0ef06
commit 130751cda3
124 changed files with 554 additions and 554 deletions

View File

@@ -768,7 +768,7 @@ function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) {
$base_capabilities_key = $wpdb->base_prefix . 'capabilities';
$site_capabilities_key = $wpdb->base_prefix . $blog_id . '_capabilities';
if ( isset( $keys[ $base_capabilities_key ] ) && $blog_id == 1 ) {
if ( isset( $keys[ $base_capabilities_key ] ) && 1 == $blog_id ) {
return true;
}
@@ -902,7 +902,7 @@ function count_users( $strategy = 'time', $site_id = null ) {
$result = array();
if ( 'time' == $strategy ) {
if ( is_multisite() && $site_id != get_current_blog_id() ) {
if ( is_multisite() && get_current_blog_id() != $site_id ) {
switch_to_blog( $site_id );
$avail_roles = wp_roles()->get_names();
restore_current_blog();
@@ -1872,7 +1872,7 @@ function wp_insert_user( $userdata ) {
do_action( 'profile_update', $user_id, $old_user_data );
if ( isset( $userdata['spam'] ) && $userdata['spam'] != $old_user_data->spam ) {
if ( $userdata['spam'] == 1 ) {
if ( 1 == $userdata['spam'] ) {
/**
* Fires after the user is marked as a SPAM user.
*
@@ -2493,7 +2493,7 @@ function register_new_user( $user_login, $user_email ) {
$user_email = apply_filters( 'user_registration_email', $user_email );
// Check the username.
if ( $sanitized_user_login == '' ) {
if ( '' == $sanitized_user_login ) {
$errors->add( 'empty_username', __( '<strong>Error</strong>: Please enter a username.' ) );
} elseif ( ! validate_username( $user_login ) ) {
$errors->add( 'invalid_username', __( '<strong>Error</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
@@ -2510,7 +2510,7 @@ function register_new_user( $user_login, $user_email ) {
}
// Check the email address.
if ( $user_email == '' ) {
if ( '' == $user_email ) {
$errors->add( 'empty_email', __( '<strong>Error</strong>: Please type your email address.' ) );
} elseif ( ! is_email( $user_email ) ) {
$errors->add( 'invalid_email', __( '<strong>Error</strong>: The email address isn&#8217;t correct.' ) );
@@ -2677,7 +2677,7 @@ function wp_get_users_with_no_role( $site_id = null ) {
$prefix = $wpdb->get_blog_prefix( $site_id );
if ( is_multisite() && $site_id != get_current_blog_id() ) {
if ( is_multisite() && get_current_blog_id() != $site_id ) {
switch_to_blog( $site_id );
$role_names = wp_roles()->get_names();
restore_current_blog();