From b9353dbf7069a738c9aa5fc59d0fde6e5cb12b62 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 2 Jan 2020 11:37:05 +0000 Subject: [PATCH] Coding Standards: Use strict comparison and Yoda conditions in `wp-includes/widgets.php`. Props jenilk. Fixes #49104. Built from https://develop.svn.wordpress.org/trunk@47027 git-svn-id: http://core.svn.wordpress.org/trunk@46827 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-includes/widgets.php | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index 01cd792f63..815463d881 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-47026'; +$wp_version = '5.4-alpha-47027'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 8bb78d35b1..19503bcecf 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -674,7 +674,7 @@ function dynamic_sidebar( $index = 1 ) { } else { $index = sanitize_title( $index ); foreach ( (array) $wp_registered_sidebars as $key => $value ) { - if ( sanitize_title( $value['name'] ) == $index ) { + if ( sanitize_title( $value['name'] ) === $index ) { $index = $key; break; } @@ -876,8 +876,8 @@ function is_active_widget( $callback = false, $widget_id = false, $id_base = fal if ( is_array( $widgets ) ) { foreach ( $widgets as $widget ) { - if ( ( $callback && isset( $wp_registered_widgets[ $widget ]['callback'] ) && $wp_registered_widgets[ $widget ]['callback'] == $callback ) || ( $id_base && _get_widget_id_base( $widget ) == $id_base ) ) { - if ( ! $widget_id || $widget_id == $wp_registered_widgets[ $widget ]['id'] ) { + if ( ( $callback && isset( $wp_registered_widgets[ $widget ]['callback'] ) && $wp_registered_widgets[ $widget ]['callback'] === $callback ) || ( $id_base && _get_widget_id_base( $widget ) === $id_base ) ) { + if ( ! $widget_id || $widget_id === $wp_registered_widgets[ $widget ]['id'] ) { return $sidebar; } } @@ -966,7 +966,7 @@ function is_active_sidebar( $index ) { * @return array Upgraded list of widgets to version 3 array format when called from the admin. */ function wp_get_sidebars_widgets( $deprecated = true ) { - if ( $deprecated !== true ) { + if ( true !== $deprecated ) { _deprecated_argument( __FUNCTION__, '2.8.1' ); } @@ -1062,7 +1062,7 @@ function wp_convert_widget_settings( $base_name, $option_name, $settings ) { $single = true; } else { foreach ( array_keys( $settings ) as $number ) { - if ( 'number' == $number ) { + if ( 'number' === $number ) { continue; } if ( ! is_numeric( $number ) ) { @@ -1088,7 +1088,7 @@ function wp_convert_widget_settings( $base_name, $option_name, $settings ) { foreach ( (array) $sidebars_widgets as $index => $sidebar ) { if ( is_array( $sidebar ) ) { foreach ( $sidebar as $i => $name ) { - if ( $base_name == $name ) { + if ( $base_name === $name ) { $sidebars_widgets[ $index ][ $i ] = "$name-2"; $changed = true; break 2; @@ -1527,7 +1527,7 @@ function wp_widget_rss_output( $rss, $args = array() ) { echo '