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

Includes minor code layout fixes for better readability.

See #52627.
Built from https://develop.svn.wordpress.org/trunk@50706


git-svn-id: http://core.svn.wordpress.org/trunk@50315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-04-13 18:01:04 +00:00
parent d6a1170c70
commit 35de0a48fb
2 changed files with 10 additions and 3 deletions

View File

@ -117,8 +117,10 @@ class Custom_Background {
if ( isset( $_POST['reset-background'] ) ) {
check_admin_referer( 'custom-background-reset', '_wpnonce-custom-background-reset' );
remove_theme_mod( 'background_image' );
remove_theme_mod( 'background_image_thumb' );
$this->updated = true;
return;
}
@ -126,8 +128,10 @@ class Custom_Background {
if ( isset( $_POST['remove-background'] ) ) {
// @todo Uploaded files are not removed here.
check_admin_referer( 'custom-background-remove', '_wpnonce-custom-background-remove' );
set_theme_mod( 'background_image', '' );
set_theme_mod( 'background_image_thumb', '' );
$this->updated = true;
wp_safe_redirect( $_POST['_wp_http_referer'] );
return;
@ -204,8 +208,10 @@ class Custom_Background {
if ( isset( $_POST['background-color'] ) ) {
check_admin_referer( 'custom-background' );
$color = preg_replace( '/[^0-9a-fA-F]/', '', $_POST['background-color'] );
if ( strlen( $color ) == 6 || strlen( $color ) == 3 ) {
if ( strlen( $color ) === 6 || strlen( $color ) === 3 ) {
set_theme_mod( 'background_color', $color );
} else {
set_theme_mod( 'background_color', '' );
@ -308,7 +314,7 @@ class Custom_Background {
<?php endif; ?>
<?php $default_image = get_theme_support( 'custom-background', 'default-image' ); ?>
<?php if ( $default_image && get_background_image() != $default_image ) : ?>
<?php if ( $default_image && get_background_image() !== $default_image ) : ?>
<tr>
<th scope="row"><?php _e( 'Restore Original Image' ); ?></th>
<td>
@ -484,6 +490,7 @@ class Custom_Background {
}
check_admin_referer( 'custom-background-upload', '_wpnonce-custom-background-upload' );
$overrides = array( 'test_form' => false );
$uploaded_file = $_FILES['import'];

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-alpha-50705';
$wp_version = '5.8-alpha-50706';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.