From 6dde735e3edb2c7e8fbac324a1090d007ea479dd Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 8 Jan 2022 01:22:02 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `wp-admin/themes.php`. Follow-up to [15646], [30697]. See #54728. Built from https://develop.svn.wordpress.org/trunk@52540 git-svn-id: http://core.svn.wordpress.org/trunk@52130 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/themes.php | 9 +++++++-- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/wp-admin/themes.php b/wp-admin/themes.php index cc18806d28..c98631caa8 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -74,7 +74,7 @@ if ( current_user_can( 'switch_themes' ) && isset( $_GET['action'] ) ) { } $active = wp_get_theme(); - if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) { + if ( $active->get( 'Template' ) === $_GET['stylesheet'] ) { wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) ); } else { delete_theme( $_GET['stylesheet'] ); @@ -320,13 +320,18 @@ if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) { if ( in_array( $item[2], $forbidden_paths, true ) || str_starts_with( $item[2], 'customize.php' ) ) { continue; } + // 0 = name, 1 = capability, 2 = file. - if ( ( strcmp( $self, $item[2] ) == 0 && empty( $parent_file ) ) || ( $parent_file && ( $item[2] == $parent_file ) ) ) { + if ( 0 === strcmp( $self, $item[2] ) && empty( $parent_file ) + || $parent_file && $item[2] === $parent_file + ) { $class = ' current'; } + if ( ! empty( $submenu[ $item[2] ] ) ) { $submenu[ $item[2] ] = array_values( $submenu[ $item[2] ] ); // Re-index. $menu_hook = get_plugin_page_hook( $submenu[ $item[2] ][0][2], $item[2] ); + if ( file_exists( WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}" ) || ! empty( $menu_hook ) ) { $current_theme_actions[] = "{$item[0]}"; } else { diff --git a/wp-includes/version.php b/wp-includes/version.php index 5169623e36..7a2ebbadb8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-52539'; +$wp_version = '6.0-alpha-52540'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.