Make WordPress Core

Changeset 32733


Ignore:
Timestamp:
06/12/2015 05:47:16 PM (11 years ago)
Author:
wonderboymusic
Message:

$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.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r32657 r32733  
    32553255                $status = wp_delete_comment( $comment_ID );
    32563256
    3257                 if ( true == $status ) {
     3257                if ( $status ) {
    32583258                        /**
    32593259                         * Fires after a comment has been successfully deleted via XML-RPC.
  • trunk/src/wp-includes/general-template.php

    r32598 r32733  
    16461646
    16471647        foreach ( $myweek as $wd ) {
    1648                 $day_name = (true == $initial) ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd);
     1648                $day_name = $initial ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd);
    16491649                $wd = esc_attr($wd);
    16501650                $calendar_output .= "\n\t\t<th scope=\"col\" title=\"$wd\">$day_name</th>";
  • trunk/src/wp-includes/kses.php

    r32603 r32733  
    14621462        kses_remove_filters();
    14631463
    1464         if (current_user_can('unfiltered_html') == false)
     1464        if ( ! current_user_can( 'unfiltered_html' ) ) {
    14651465                kses_init_filters();
     1466        }
    14661467}
    14671468
  • trunk/src/wp-includes/ms-deprecated.php

    r31211 r32733  
    211211        }
    212212
    213         if ( $display == true ) {
     213        if ( $display ) {
    214214                if ( is_array( $most_active ) ) {
    215215                        reset( $most_active );
     
    254254                exit();
    255255        }
    256         if ( empty( $_SERVER['HTTP_REFERER'] ) == false ) {
     256        if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
    257257                wp_redirect( $_SERVER['HTTP_REFERER'] );
    258258                exit();
  • trunk/src/wp-includes/ms-functions.php

    r32718 r32733  
    482482
    483483        $illegal_names = get_site_option( 'illegal_names' );
    484         if ( is_array( $illegal_names ) == false ) {
     484        if ( ! is_array( $illegal_names ) ) {
    485485                $illegal_names = array(  'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
    486486                add_site_option( 'illegal_names', $illegal_names );
    487487        }
    488         if ( in_array( $user_name, $illegal_names ) == true )
     488        if ( in_array( $user_name, $illegal_names ) )
    489489                $errors->add('user_name',  __( 'That username is not allowed.' ) );
    490490
     
    506506
    507507        $limited_email_domains = get_site_option( 'limited_email_domains' );
    508         if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) {
     508        if ( is_array( $limited_email_domains ) && ! empty( $limited_email_domains ) ) {
    509509                $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
    510                 if ( in_array( $emaildomain, $limited_email_domains ) == false )
     510                if ( ! in_array( $emaildomain, $limited_email_domains ) ) {
    511511                        $errors->add('user_email', __('Sorry, that email address is not allowed!'));
     512                }
    512513        }
    513514
     
    628629                $errors->add('blogname', __( 'Only lowercase letters (a-z) and numbers are allowed.' ) );
    629630
    630         if ( in_array( $blogname, $illegal_names ) == true )
     631        if ( in_array( $blogname, $illegal_names ) )
    631632                $errors->add('blogname',  __( 'That name is not allowed.' ) );
    632633
     
    674675
    675676        if ( username_exists( $blogname ) ) {
    676                 if ( is_object( $user ) == false || ( is_object($user) && ( $user->user_login != $blogname ) ) )
     677                if ( ! is_object( $user ) || ( is_object($user) && ( $user->user_login != $blogname ) ) )
    677678                        $errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
    678679        }
     
    16901691                return $dirsize[ $directory ][ 'size' ];
    16911692
    1692         if ( false == is_array( $dirsize ) )
     1693        if ( ! is_array( $dirsize ) )
    16931694                $dirsize = array();
    16941695
  • trunk/src/wp-includes/pluggable.php

    r32702 r32733  
    11381138        $result = wp_verify_nonce( $nonce, $action );
    11391139
    1140         if ( $die && false == $result ) {
     1140        if ( $die && false === $result ) {
    11411141                if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
    11421142                        wp_die( -1 );
  • trunk/src/wp-includes/revision.php

    r32650 r32733  
    523523                $id = (int) $_GET['preview_id'];
    524524
    525                 if ( false == wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) )
     525                if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) )
    526526                        wp_die( __('You do not have permission to preview drafts.') );
    527527
  • trunk/src/wp-signup.php

    r30662 r32733  
    88require( dirname( __FILE__ ) . '/wp-blog-header.php' );
    99
    10 if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
     10if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) ) {
    1111        wp_redirect( network_home_url() );
    1212        die();
     
    701701                        if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
    702702                                signup_another_blog($newblogname);
    703                         elseif ( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) )
     703                        elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) )
    704704                                signup_user( $newblogname, $user_email );
    705                         elseif ( is_user_logged_in() == false && ( $active_signup == 'blog' ) )
     705                        elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) )
    706706                                _e( 'Sorry, new registrations are not allowed at this time.' );
    707707                        else
  • trunk/tests/phpunit/tests/customize/setting.php

    r31707 r32733  
    380380                $this->manager->set_post_value( $name, $post_value );
    381381                $setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type' ) );
    382                 $this->assertNull( $setting->is_current_blog_previewed() );
     382                $this->assertFalse( $setting->is_current_blog_previewed() );
    383383                $setting->preview();
    384384                $this->assertTrue( $setting->is_current_blog_previewed() );
Note: See TracChangeset for help on using the changeset viewer.