diff -r be944660c56a -r 3d72ae0968f4 wp/wp-admin/themes.php --- a/wp/wp-admin/themes.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-admin/themes.php Tue Sep 27 16:37:53 2022 +0200 @@ -74,7 +74,7 @@ } $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'] ); @@ -123,7 +123,8 @@ } } -$title = __( 'Manage Themes' ); +// Used in the HTML title tag. +$title = __( 'Themes' ); $parent_file = 'themes.php'; // Help tab: Overview. @@ -132,8 +133,8 @@ '
' . __( 'From this screen you can:' ) . '
' . '' . __( 'The current theme is displayed highlighted as the first theme.' ) . '
' . + '' . __( 'The active theme is displayed highlighted as the first theme.' ) . '
' . '' . __( 'The search for installed themes will search for terms in their name, description, author, or tag.' ) . ' ' . __( 'The search results will be updated as you type.' ) . '
'; get_current_screen()->add_help_tab( @@ -204,6 +205,7 @@ get_current_screen()->set_help_sidebar( '' . __( 'For more information:' ) . '
' . '' . __( 'Documentation on Using Themes' ) . '
' . + '' . __( 'Documentation on Managing Themes' ) . '
' . $help_sidebar_autoupdates . '' . __( 'Support' ) . '
' ); @@ -306,18 +308,31 @@ $current_theme_actions = array(); if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) { + $forbidden_paths = array( + 'themes.php', + 'theme-editor.php', + 'site-editor.php', + 'edit.php?post_type=wp_navigation', + ); + foreach ( (array) $submenu['themes.php'] as $item ) { $class = ''; - if ( 'themes.php' === $item[2] || 'theme-editor.php' === $item[2] || 0 === strpos( $item[2], 'customize.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 { @@ -362,8 +377,8 @@ */ foreach ( $themes as $theme ) : - $aria_action = esc_attr( $theme['id'] . '-action' ); - $aria_name = esc_attr( $theme['id'] . '-name' ); + $aria_action = $theme['id'] . '-action'; + $aria_name = $theme['id'] . '-name'; $active_class = ''; if ( $theme['active'] ) { @@ -373,7 +388,7 @@'; if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) { - _e( 'This theme doesn’t work with your versions of WordPress and PHP.' ); + _e( 'This theme does not work with your versions of WordPress and PHP.' ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { printf( /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ @@ -480,7 +495,7 @@ wp_update_php_annotation( '
', '' ); } } elseif ( ! $theme['compatibleWP'] ) { - _e( 'This theme doesn’t work with your version of WordPress.' ); + _e( 'This theme does not work with your version of WordPress.' ); if ( current_user_can( 'update_core' ) ) { printf( /* translators: %s: URL to WordPress Updates screen. */ @@ -489,7 +504,7 @@ ); } } elseif ( ! $theme['compatiblePHP'] ) { - _e( 'This theme doesn’t work with your version of PHP.' ); + _e( 'This theme does not work with your version of PHP.' ); if ( current_user_can( 'update_php' ) ) { printf( /* translators: %s: URL to Update PHP page. */ @@ -507,7 +522,7 @@ /* translators: %s: Theme name. */ $details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), $theme['name'] ); ?> - +