WordPress.org

Make WordPress Core

Changeset 50706


Ignore:
Timestamp:
04/13/2021 05:59:45 PM (8 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in wp-admin/includes/class-custom-background.php.

Includes minor code layout fixes for better readability.

See #52627.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-custom-background.php

    r49388 r50706  
    118118        if ( isset( $_POST['reset-background'] ) ) {
    119119            check_admin_referer( 'custom-background-reset', '_wpnonce-custom-background-reset' );
     120
    120121            remove_theme_mod( 'background_image' );
    121122            remove_theme_mod( 'background_image_thumb' );
     123
    122124            $this->updated = true;
    123125            return;
     
    127129            // @todo Uploaded files are not removed here.
    128130            check_admin_referer( 'custom-background-remove', '_wpnonce-custom-background-remove' );
     131
    129132            set_theme_mod( 'background_image', '' );
    130133            set_theme_mod( 'background_image_thumb', '' );
     134
    131135            $this->updated = true;
    132136            wp_safe_redirect( $_POST['_wp_http_referer'] );
     
    205209        if ( isset( $_POST['background-color'] ) ) {
    206210            check_admin_referer( 'custom-background' );
     211
    207212            $color = preg_replace( '/[^0-9a-fA-F]/', '', $_POST['background-color'] );
    208             if ( strlen( $color ) == 6 || strlen( $color ) == 3 ) {
     213
     214            if ( strlen( $color ) === 6 || strlen( $color ) === 3 ) {
    209215                set_theme_mod( 'background_color', $color );
    210216            } else {
     
    309315
    310316        <?php $default_image = get_theme_support( 'custom-background', 'default-image' ); ?>
    311         <?php if ( $default_image && get_background_image() != $default_image ) : ?>
     317        <?php if ( $default_image && get_background_image() !== $default_image ) : ?>
    312318<tr>
    313319<th scope="row"><?php _e( 'Restore Original Image' ); ?></th>
     
    485491
    486492        check_admin_referer( 'custom-background-upload', '_wpnonce-custom-background-upload' );
     493
    487494        $overrides = array( 'test_form' => false );
    488495
Note: See TracChangeset for help on using the changeset viewer.