Coding Standards: Use strict comparison and Yoda conditions in the root directory files.
Props pikamander2. Fixes #48965. Built from https://develop.svn.wordpress.org/trunk@47054 git-svn-id: http://core.svn.wordpress.org/trunk@46854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a24f5ccd1f
commit
d784ebbcb4
|
@ -37,7 +37,7 @@ if ( isset( $_GET['key'] ) && isset( $_POST['key'] ) && $_GET['key'] !== $_POST[
|
|||
if ( $key ) {
|
||||
$redirect_url = remove_query_arg( 'key' );
|
||||
|
||||
if ( $redirect_url !== remove_query_arg( false ) ) {
|
||||
if ( remove_query_arg( false ) !== $redirect_url ) {
|
||||
setcookie( $activate_cookie, $key, 0, $activate_path, COOKIE_DOMAIN, is_ssl(), true );
|
||||
wp_safe_redirect( $redirect_url );
|
||||
exit;
|
||||
|
@ -46,13 +46,13 @@ if ( $key ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( $result === null && isset( $_COOKIE[ $activate_cookie ] ) ) {
|
||||
if ( null === $result && isset( $_COOKIE[ $activate_cookie ] ) ) {
|
||||
$key = $_COOKIE[ $activate_cookie ];
|
||||
$result = wpmu_activate_signup( $key );
|
||||
setcookie( $activate_cookie, ' ', time() - YEAR_IN_SECONDS, $activate_path, COOKIE_DOMAIN, is_ssl(), true );
|
||||
}
|
||||
|
||||
if ( $result === null || ( is_wp_error( $result ) && 'invalid_key' === $result->get_error_code() ) ) {
|
||||
if ( null === $result || ( is_wp_error( $result ) && 'invalid_key' === $result->get_error_code() ) ) {
|
||||
status_header( 404 );
|
||||
} elseif ( is_wp_error( $result ) ) {
|
||||
$error_code = $result->get_error_code();
|
||||
|
@ -142,7 +142,7 @@ get_header( 'wp-activate' );
|
|||
<h2><?php _e( 'Your account is now active!' ); ?></h2>
|
||||
<?php
|
||||
echo '<p class="lead-in">';
|
||||
if ( $signup->domain . $signup->path == '' ) {
|
||||
if ( '' === $signup->domain . $signup->path ) {
|
||||
printf(
|
||||
/* translators: 1: Login URL, 2: Username, 3: User email address, 4: Lost password URL. */
|
||||
__( 'Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.' ),
|
||||
|
@ -162,7 +162,7 @@ get_header( 'wp-activate' );
|
|||
);
|
||||
}
|
||||
echo '</p>';
|
||||
} elseif ( $result === null || is_wp_error( $result ) ) {
|
||||
} elseif ( null === $result || is_wp_error( $result ) ) {
|
||||
?>
|
||||
<h2><?php _e( 'An error occurred during the activation' ); ?></h2>
|
||||
<?php if ( is_wp_error( $result ) ) : ?>
|
||||
|
@ -181,7 +181,7 @@ get_header( 'wp-activate' );
|
|||
</div>
|
||||
|
||||
<?php
|
||||
if ( $url && $url != network_home_url( '', 'http' ) ) :
|
||||
if ( $url && network_home_url( '', 'http' ) !== $url ) :
|
||||
switch_to_blog( (int) $result['blog_id'] );
|
||||
$login_url = wp_login_url();
|
||||
restore_current_blog();
|
||||
|
|
|
@ -105,7 +105,7 @@ if ( empty( $doing_wp_cron ) ) {
|
|||
* The cron lock (a unix timestamp set when the cron was spawned),
|
||||
* must match $doing_wp_cron (the "key").
|
||||
*/
|
||||
if ( $doing_cron_transient != $doing_wp_cron ) {
|
||||
if ( $doing_cron_transient !== $doing_wp_cron ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -138,14 +138,14 @@ foreach ( $crons as $timestamp => $cronhooks ) {
|
|||
do_action_ref_array( $hook, $v['args'] );
|
||||
|
||||
// If the hook ran too long and another cron process stole the lock, quit.
|
||||
if ( _get_cron_lock() != $doing_wp_cron ) {
|
||||
if ( _get_cron_lock() !== $doing_wp_cron ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( _get_cron_lock() == $doing_wp_cron ) {
|
||||
if ( _get_cron_lock() === $doing_wp_cron ) {
|
||||
delete_transient( 'doing_cron' );
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.4-alpha-47053';
|
||||
$wp_version = '5.4-alpha-47054';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
|
@ -82,7 +82,7 @@ foreach ( (array) $cats as $cat ) :
|
|||
?>
|
||||
<outline text="<?php echo esc_attr( $title ); ?>" type="link" xmlUrl="<?php echo esc_attr( $bookmark->link_rss ); ?>" htmlUrl="<?php echo esc_attr( $bookmark->link_url ); ?>" updated="
|
||||
<?php
|
||||
if ( '0000-00-00 00:00:00' != $bookmark->link_updated ) {
|
||||
if ( '0000-00-00 00:00:00' !== $bookmark->link_updated ) {
|
||||
echo $bookmark->link_updated;}
|
||||
?>
|
||||
" />
|
||||
|
|
|
@ -523,7 +523,7 @@ if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set
|
|||
$secure = ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) );
|
||||
setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure );
|
||||
|
||||
if ( SITECOOKIEPATH != COOKIEPATH ) {
|
||||
if ( SITECOOKIEPATH !== COOKIEPATH ) {
|
||||
setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
|
||||
}
|
||||
|
||||
|
@ -932,7 +932,7 @@ switch ( $action ) {
|
|||
|
||||
$errors = new WP_Error();
|
||||
|
||||
if ( isset( $_POST['pass1'] ) && $_POST['pass1'] != $_POST['pass2'] ) {
|
||||
if ( isset( $_POST['pass1'] ) && $_POST['pass1'] !== $_POST['pass2'] ) {
|
||||
$errors->add( 'password_reset_mismatch', __( 'The passwords do not match.' ) );
|
||||
}
|
||||
|
||||
|
|
12
wp-mail.php
12
wp-mail.php
|
@ -101,7 +101,7 @@ for ( $i = 1; $i <= $count; $i++ ) {
|
|||
$content_transfer_encoding = explode( ';', $content_transfer_encoding );
|
||||
$content_transfer_encoding = $content_transfer_encoding[0];
|
||||
}
|
||||
if ( ( $content_type == 'multipart/alternative' ) && ( false !== strpos( $line, 'boundary="' ) ) && ( '' == $boundary ) ) {
|
||||
if ( ( 'multipart/alternative' === $content_type ) && ( false !== strpos( $line, 'boundary="' ) ) && ( '' === $boundary ) ) {
|
||||
$boundary = trim( $line );
|
||||
$boundary = explode( '"', $boundary );
|
||||
$boundary = $boundary[1];
|
||||
|
@ -144,9 +144,9 @@ for ( $i = 1; $i <= $count; $i++ ) {
|
|||
if ( preg_match( '/Date: /i', $line ) ) { // of the form '20 Mar 2002 20:32:37 +0100'
|
||||
$ddate = str_replace( 'Date: ', '', trim( $line ) );
|
||||
$ddate = preg_replace( '!\s*\(.+\)\s*$!', '', $ddate ); // remove parenthesised timezone string if it exists, as this confuses strtotime
|
||||
$ddate_U = strtotime( $ddate );
|
||||
$post_date = gmdate( 'Y-m-d H:i:s', $ddate_U + $time_difference );
|
||||
$post_date_gmt = gmdate( 'Y-m-d H:i:s', $ddate_U );
|
||||
$ddate_timestamp = strtotime( $ddate );
|
||||
$post_date = gmdate( 'Y-m-d H:i:s', $ddate_timestamp + $time_difference );
|
||||
$post_date_gmt = gmdate( 'Y-m-d H:i:s', $ddate_timestamp );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ for ( $i = 1; $i <= $count; $i++ ) {
|
|||
|
||||
$subject = trim( $subject );
|
||||
|
||||
if ( $content_type == 'multipart/alternative' ) {
|
||||
if ( 'multipart/alternative' === $content_type ) {
|
||||
$content = explode( '--' . $boundary, $content );
|
||||
$content = $content[2];
|
||||
|
||||
|
@ -212,7 +212,7 @@ for ( $i = 1; $i <= $count; $i++ ) {
|
|||
|
||||
$post_title = xmlrpc_getposttitle( $content );
|
||||
|
||||
if ( $post_title == '' ) {
|
||||
if ( '' === $post_title ) {
|
||||
$post_title = $subject;
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
|
|||
|
||||
$blog_public_on_checked = '';
|
||||
$blog_public_off_checked = '';
|
||||
if ( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) {
|
||||
if ( isset( $_POST['blog_public'] ) && '0' === $_POST['blog_public'] ) {
|
||||
$blog_public_off_checked = 'checked="checked"';
|
||||
} else {
|
||||
$blog_public_on_checked = 'checked="checked"';
|
||||
|
@ -641,7 +641,7 @@ function validate_user_signup() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( 'blog' == $_POST['signup_for'] ) {
|
||||
if ( 'blog' === $_POST['signup_for'] ) {
|
||||
signup_blog( $user_name, $user_email );
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue