mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-13 05:10:18 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@47808 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+10
-10
@@ -910,7 +910,7 @@ function count_users( $strategy = 'time', $site_id = null ) {
|
||||
$blog_prefix = $wpdb->get_blog_prefix( $site_id );
|
||||
$result = array();
|
||||
|
||||
if ( 'time' == $strategy ) {
|
||||
if ( 'time' === $strategy ) {
|
||||
if ( is_multisite() && get_current_blog_id() != $site_id ) {
|
||||
switch_to_blog( $site_id );
|
||||
$avail_roles = wp_roles()->get_names();
|
||||
@@ -1251,7 +1251,7 @@ function sanitize_user_field( $field, $value, $user_id, $context ) {
|
||||
$value = (int) $value;
|
||||
}
|
||||
|
||||
if ( 'raw' == $context ) {
|
||||
if ( 'raw' === $context ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -1261,7 +1261,7 @@ function sanitize_user_field( $field, $value, $user_id, $context ) {
|
||||
|
||||
$prefixed = false !== strpos( $field, 'user_' );
|
||||
|
||||
if ( 'edit' == $context ) {
|
||||
if ( 'edit' === $context ) {
|
||||
if ( $prefixed ) {
|
||||
|
||||
/** This filter is documented in wp-includes/post.php */
|
||||
@@ -1282,12 +1282,12 @@ function sanitize_user_field( $field, $value, $user_id, $context ) {
|
||||
$value = apply_filters( "edit_user_{$field}", $value, $user_id );
|
||||
}
|
||||
|
||||
if ( 'description' == $field ) {
|
||||
if ( 'description' === $field ) {
|
||||
$value = esc_html( $value ); // textarea_escaped?
|
||||
} else {
|
||||
$value = esc_attr( $value );
|
||||
}
|
||||
} elseif ( 'db' == $context ) {
|
||||
} elseif ( 'db' === $context ) {
|
||||
if ( $prefixed ) {
|
||||
/** This filter is documented in wp-includes/post.php */
|
||||
$value = apply_filters( "pre_{$field}", $value );
|
||||
@@ -1329,13 +1329,13 @@ function sanitize_user_field( $field, $value, $user_id, $context ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'user_url' == $field ) {
|
||||
if ( 'user_url' === $field ) {
|
||||
$value = esc_url( $value );
|
||||
}
|
||||
|
||||
if ( 'attribute' == $context ) {
|
||||
if ( 'attribute' === $context ) {
|
||||
$value = esc_attr( $value );
|
||||
} elseif ( 'js' == $context ) {
|
||||
} elseif ( 'js' === $context ) {
|
||||
$value = esc_js( $value );
|
||||
}
|
||||
return $value;
|
||||
@@ -2506,7 +2506,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.' ) );
|
||||
@@ -2523,7 +2523,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’t correct.' ) );
|
||||
|
||||
Reference in New Issue
Block a user