`$status` shouldn't be loosely compared to `true` in `wp_xmlrpc_server::wp_deleteComment()`.

`$initial` shouldn't be loosely compared to `true` in `get_calendar()`.
`current_user_can()` shouldn't be loosely compared to `false` in `kses_init()`
`$get_all` shouldn't be loosely compared to `true` in `get_blog_details()`.
`is_array()` and `in_array()` shouldn't be loosely compared in `wpmu_validate_user_signup()`.
`$result` should by strictly compared in `check_ajax_referer()`.
`wp_verify_nonce()` should by strictly compared in `_show_post_preview()`.
`is_user_logged_in()` should not be loosly compared against `false` in `wp-signup.php`.

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32733


git-svn-id: http://core.svn.wordpress.org/trunk@32704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-06-12 17:48:26 +00:00
parent 740b92853d
commit f888767c73
9 changed files with 20 additions and 18 deletions

View File

@ -3254,7 +3254,7 @@ class wp_xmlrpc_server extends IXR_Server {
$status = wp_delete_comment( $comment_ID );
if ( true == $status ) {
if ( $status ) {
/**
* Fires after a comment has been successfully deleted via XML-RPC.
*

View File

@ -1645,7 +1645,7 @@ function get_calendar($initial = true, $echo = true) {
}
foreach ( $myweek as $wd ) {
$day_name = (true == $initial) ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd);
$day_name = $initial ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd);
$wd = esc_attr($wd);
$calendar_output .= "\n\t\t<th scope=\"col\" title=\"$wd\">$day_name</th>";
}

View File

@ -1461,8 +1461,9 @@ function kses_remove_filters() {
function kses_init() {
kses_remove_filters();
if (current_user_can('unfiltered_html') == false)
if ( ! current_user_can( 'unfiltered_html' ) ) {
kses_init_filters();
}
}
/**

View File

@ -210,7 +210,7 @@ function get_most_active_blogs( $num = 10, $display = true ) {
$most_active = $t;
}
if ( $display == true ) {
if ( $display ) {
if ( is_array( $most_active ) ) {
reset( $most_active );
foreach ( (array) $most_active as $key => $details ) {
@ -253,7 +253,7 @@ function wpmu_admin_do_redirect( $url = '' ) {
wp_redirect( $ref );
exit();
}
if ( empty( $_SERVER['HTTP_REFERER'] ) == false ) {
if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
wp_redirect( $_SERVER['HTTP_REFERER'] );
exit();
}

View File

@ -481,11 +481,11 @@ function wpmu_validate_user_signup($user_name, $user_email) {
$errors->add('user_name', __( 'Please enter a username.' ) );
$illegal_names = get_site_option( 'illegal_names' );
if ( is_array( $illegal_names ) == false ) {
if ( ! is_array( $illegal_names ) ) {
$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
add_site_option( 'illegal_names', $illegal_names );
}
if ( in_array( $user_name, $illegal_names ) == true )
if ( in_array( $user_name, $illegal_names ) )
$errors->add('user_name', __( 'That username is not allowed.' ) );
if ( is_email_address_unsafe( $user_email ) )
@ -505,11 +505,12 @@ function wpmu_validate_user_signup($user_name, $user_email) {
$errors->add('user_email', __( 'Please enter a valid email address.' ) );
$limited_email_domains = get_site_option( 'limited_email_domains' );
if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) {
if ( is_array( $limited_email_domains ) && ! empty( $limited_email_domains ) ) {
$emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
if ( in_array( $emaildomain, $limited_email_domains ) == false )
if ( ! in_array( $emaildomain, $limited_email_domains ) ) {
$errors->add('user_email', __('Sorry, that email address is not allowed!'));
}
}
// Check if the username has been used already.
if ( username_exists($user_name) )
@ -627,7 +628,7 @@ function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
if ( preg_match( '/[^a-z0-9]+/', $blogname ) )
$errors->add('blogname', __( 'Only lowercase letters (a-z) and numbers are allowed.' ) );
if ( in_array( $blogname, $illegal_names ) == true )
if ( in_array( $blogname, $illegal_names ) )
$errors->add('blogname', __( 'That name is not allowed.' ) );
if ( strlen( $blogname ) < 4 && !is_super_admin() )
@ -673,7 +674,7 @@ function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
$errors->add( 'blogname', __( 'Sorry, that site already exists!' ) );
if ( username_exists( $blogname ) ) {
if ( is_object( $user ) == false || ( is_object($user) && ( $user->user_login != $blogname ) ) )
if ( ! is_object( $user ) || ( is_object($user) && ( $user->user_login != $blogname ) ) )
$errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
}
@ -1689,7 +1690,7 @@ function get_dirsize( $directory ) {
if ( is_array( $dirsize ) && isset( $dirsize[ $directory ][ 'size' ] ) )
return $dirsize[ $directory ][ 'size' ];
if ( false == is_array( $dirsize ) )
if ( ! is_array( $dirsize ) )
$dirsize = array();
$dirsize[ $directory ][ 'size' ] = recurse_dirsize( $directory );

View File

@ -1137,7 +1137,7 @@ function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {
$result = wp_verify_nonce( $nonce, $action );
if ( $die && false == $result ) {
if ( $die && false === $result ) {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
wp_die( -1 );
else

View File

@ -522,7 +522,7 @@ function _show_post_preview() {
if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) {
$id = (int) $_GET['preview_id'];
if ( false == wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) )
if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) )
wp_die( __('You do not have permission to preview drafts.') );
add_filter('the_preview', '_set_preview');

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-alpha-32732';
$wp_version = '4.3-alpha-32733';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -7,7 +7,7 @@ add_action( 'wp_head', 'wp_no_robots' );
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) ) {
wp_redirect( network_home_url() );
die();
}
@ -700,9 +700,9 @@ if ( $active_signup == 'none' ) {
do_action( 'preprocess_signup_form' );
if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
signup_another_blog($newblogname);
elseif ( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) )
elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) )
signup_user( $newblogname, $user_email );
elseif ( is_user_logged_in() == false && ( $active_signup == 'blog' ) )
elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) )
_e( 'Sorry, new registrations are not allowed at this time.' );
else
_e( 'You are logged in already. No need to register again!' );