diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-admin/themes.php --- a/wp/wp-admin/themes.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-admin/themes.php Fri Sep 05 18:40:08 2025 +0200 @@ -153,7 +153,7 @@ } else { $help_install = '

' . sprintf( /* translators: %s: https://wordpress.org/themes/ */ - __( 'If you would like to see more themes to choose from, click on the “Add New” button and you will be able to browse or search for additional themes from the WordPress Theme Directory. Themes in the WordPress Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ), + __( 'If you would like to see more themes to choose from, click on the “Add New Theme” button and you will be able to browse or search for additional themes from the WordPress Theme Directory. Themes in the WordPress Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ), __( 'https://wordpress.org/themes/' ) ) . '

'; } @@ -199,15 +199,15 @@ ) ); - $help_sidebar_autoupdates = '

' . __( 'Learn more: Auto-updates documentation' ) . '

'; + $help_sidebar_autoupdates = '

' . __( 'Documentation on Auto-updates' ) . '

'; } // End if 'update_themes' && 'wp_is_auto_update_enabled_for_type'. get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . - '

' . __( 'Documentation on Using Themes' ) . '

' . - '

' . __( 'Documentation on Managing Themes' ) . '

' . + '

' . __( 'Documentation on Using Themes' ) . '

' . + '

' . __( 'Documentation on Managing Themes' ) . '

' . $help_sidebar_autoupdates . - '

' . __( 'Support' ) . '

' + '

' . __( 'Support forums' ) . '

' ); if ( current_user_can( 'switch_themes' ) ) { @@ -215,7 +215,9 @@ } else { $themes = wp_prepare_themes_for_js( array( wp_get_theme() ) ); } -wp_reset_vars( array( 'theme', 'search' ) ); + +$theme = ! empty( $_REQUEST['theme'] ) ? sanitize_text_field( $_REQUEST['theme'] ) : ''; +$search = ! empty( $_REQUEST['search'] ) ? sanitize_text_field( $_REQUEST['search'] ) : ''; wp_localize_script( 'theme', @@ -229,12 +231,11 @@ 'adminUrl' => parse_url( admin_url(), PHP_URL_PATH ), ), 'l10n' => array( - 'addNew' => __( 'Add New Theme' ), - 'search' => __( 'Search Installed Themes' ), - 'searchPlaceholder' => __( 'Search installed themes...' ), // Placeholder (no ellipsis). + 'addNew' => __( 'Add New Theme' ), + 'search' => __( 'Search installed themes' ), /* translators: %d: Number of themes. */ - 'themesFound' => __( 'Number of Themes found: %d' ), - 'noThemesFound' => __( 'No themes found. Try a different search.' ), + 'themesFound' => __( 'Number of Themes found: %d' ), + 'noThemesFound' => __( 'No themes found. Try a different search.' ), ), ) ); @@ -250,59 +251,105 @@

- - + +
+
-
- -
-

- 'message1', + 'additional_classes' => array( 'updated' ), + 'dismissible' => true, + ) + ); } elseif ( isset( $_GET['activated'] ) ) { if ( isset( $_GET['previewed'] ) ) { - ?> -

- ' . __( 'Visit site' ) . '', + array( + 'id' => 'message2', + 'additional_classes' => array( 'updated' ), + 'dismissible' => true, + ) + ); } else { - ?> -

- ' . __( 'Visit site' ) . '', + array( + 'id' => 'message2', + 'additional_classes' => array( 'updated' ), + 'dismissible' => true, + ) + ); } } elseif ( isset( $_GET['deleted'] ) ) { - ?> -

- 'message3', + 'additional_classes' => array( 'updated' ), + 'dismissible' => true, + ) + ); } elseif ( isset( $_GET['delete-active-child'] ) ) { - ?> -

- 'message4', + 'additional_classes' => array( 'error' ), + ) + ); } elseif ( isset( $_GET['resumed'] ) ) { - ?> -

- 'message5', + 'additional_classes' => array( 'updated' ), + 'dismissible' => true, + ) + ); } elseif ( isset( $_GET['error'] ) && 'resuming' === $_GET['error'] ) { - ?> -

fatal error.' ); ?>

- fatal error.' ), + array( + 'id' => 'message6', + 'additional_classes' => array( 'error' ), + ) + ); } elseif ( isset( $_GET['enabled-auto-update'] ) ) { - ?> -

- 'message7', + 'additional_classes' => array( 'updated' ), + 'dismissible' => true, + ) + ); } elseif ( isset( $_GET['disabled-auto-update'] ) ) { - ?> -

- 'message8', + 'additional_classes' => array( 'updated' ), + 'dismissible' => true, + ) + ); } $current_theme = wp_get_theme(); if ( $current_theme->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) { - echo '

' . __( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message() . '

'; + wp_admin_notice( + __( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message(), + array( + 'additional_classes' => array( 'error' ), + ) + ); } $current_theme_actions = array(); @@ -395,130 +442,144 @@ - -

- - Update now' ); ?> - - - -

- -

- Update now' ); + } else { + $new_version_available = __( 'New version available.' ); + } + wp_admin_notice( + $new_version_available, + array( + 'type' => 'warning', + 'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ), + ) + ); + else : + $theme_update_error = ''; + if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) { + $theme_update_error .= sprintf( + /* translators: %s: Theme name. */ + __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ), + $theme['name'] + ); + if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { + $theme_update_error .= sprintf( + /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ + ' ' . __( 'Please update WordPress, and then learn more about updating PHP.' ), + self_admin_url( 'update-core.php' ), + esc_url( wp_get_update_php_url() ) + ); + wp_update_php_annotation( '

', '', false ); + } elseif ( current_user_can( 'update_core' ) ) { + $theme_update_error .= sprintf( + /* translators: %s: URL to WordPress Updates screen. */ + ' ' . __( 'Please update WordPress.' ), + self_admin_url( 'update-core.php' ) + ); + } elseif ( current_user_can( 'update_php' ) ) { + $theme_update_error .= sprintf( + /* translators: %s: URL to Update PHP page. */ + ' ' . __( 'Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) ); - 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. */ - ' ' . __( 'Please update WordPress, and then learn more about updating PHP.' ), - self_admin_url( 'update-core.php' ), - esc_url( wp_get_update_php_url() ) - ); - wp_update_php_annotation( '

', '' ); - } elseif ( current_user_can( 'update_core' ) ) { - printf( - /* translators: %s: URL to WordPress Updates screen. */ - ' ' . __( 'Please update WordPress.' ), - self_admin_url( 'update-core.php' ) - ); - } elseif ( current_user_can( 'update_php' ) ) { - printf( - /* translators: %s: URL to Update PHP page. */ - ' ' . __( 'Learn more about updating PHP.' ), - esc_url( wp_get_update_php_url() ) - ); - wp_update_php_annotation( '

', '' ); - } - } elseif ( ! $theme['updateResponse']['compatibleWP'] ) { - printf( - /* translators: %s: Theme name. */ - __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ), - $theme['name'] + wp_update_php_annotation( '

', '', false ); + } + } elseif ( ! $theme['updateResponse']['compatibleWP'] ) { + $theme_update_error .= sprintf( + /* translators: %s: Theme name. */ + __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ), + $theme['name'] + ); + if ( current_user_can( 'update_core' ) ) { + $theme_update_error .= sprintf( + /* translators: %s: URL to WordPress Updates screen. */ + ' ' . __( 'Please update WordPress.' ), + self_admin_url( 'update-core.php' ) ); - if ( current_user_can( 'update_core' ) ) { - printf( - /* translators: %s: URL to WordPress Updates screen. */ - ' ' . __( 'Please update WordPress.' ), - self_admin_url( 'update-core.php' ) - ); - } - } elseif ( ! $theme['updateResponse']['compatiblePHP'] ) { - printf( - /* translators: %s: Theme name. */ - __( 'There is a new version of %s available, but it does not work with your version of PHP.' ), - $theme['name'] + } + } elseif ( ! $theme['updateResponse']['compatiblePHP'] ) { + $theme_update_error .= sprintf( + /* translators: %s: Theme name. */ + __( 'There is a new version of %s available, but it does not work with your version of PHP.' ), + $theme['name'] + ); + if ( current_user_can( 'update_php' ) ) { + $theme_update_error .= sprintf( + /* translators: %s: URL to Update PHP page. */ + ' ' . __( 'Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) ); - if ( current_user_can( 'update_php' ) ) { - printf( - /* translators: %s: URL to Update PHP page. */ - ' ' . __( 'Learn more about updating PHP.' ), - esc_url( wp_get_update_php_url() ) - ); - wp_update_php_annotation( '

', '' ); - } + wp_update_php_annotation( '

', '', false ); } - ?> -

- - + } + wp_admin_notice( + $theme_update_error, + array( + 'type' => 'error', + 'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ), + ) + ); + endif; + endif; -

'; + $message = ''; if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) { - _e( 'This theme does not work with your versions of WordPress and PHP.' ); + $message = __( 'This theme does not work with your versions of WordPress and PHP.' ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { - printf( + $message .= sprintf( /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ ' ' . __( 'Please update WordPress, and then learn more about updating PHP.' ), self_admin_url( 'update-core.php' ), esc_url( wp_get_update_php_url() ) ); - wp_update_php_annotation( '

', '' ); + $message .= wp_update_php_annotation( '

', '', false ); } elseif ( current_user_can( 'update_core' ) ) { - printf( + $message .= sprintf( /* translators: %s: URL to WordPress Updates screen. */ ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } elseif ( current_user_can( 'update_php' ) ) { - printf( + $message .= sprintf( /* translators: %s: URL to Update PHP page. */ ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); - wp_update_php_annotation( '

', '' ); + $message .= wp_update_php_annotation( '

', '', false ); } } elseif ( ! $theme['compatibleWP'] ) { - _e( 'This theme does not work with your version of WordPress.' ); + $message .= __( 'This theme does not work with your version of WordPress.' ); if ( current_user_can( 'update_core' ) ) { - printf( + $message .= sprintf( /* translators: %s: URL to WordPress Updates screen. */ ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } } elseif ( ! $theme['compatiblePHP'] ) { - _e( 'This theme does not work with your version of PHP.' ); + $message .= __( 'This theme does not work with your version of PHP.' ); if ( current_user_can( 'update_php' ) ) { - printf( + $message .= sprintf( /* translators: %s: URL to Update PHP page. */ ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); - wp_update_php_annotation( '

', '' ); + $message .= wp_update_php_annotation( '

', '', false ); } } - echo '

'; + + wp_admin_notice( + $message, + array( + 'type' => 'error', + 'additional_classes' => array( 'inline', 'notice-alt' ), + ) + ); } - ?> - @@ -555,7 +616,8 @@ ?> @@ -611,7 +673,9 @@ - + get( 'Name' ) ? $broken_theme->display( 'Name' ) : esc_html( $broken_theme->get_stylesheet() ); ?> errors()->get_error_message(); ?> @@ -672,7 +736,9 @@ } ?> - + @@ -691,6 +757,13 @@ * @return string The template for displaying the auto-update setting link. */ function wp_theme_auto_update_setting_template() { + $notice = wp_get_admin_notice( + '', + array( + 'type' => 'error', + 'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ), + ) + ); $template = '
<# if ( data.autoupdate.supported ) { #> @@ -716,7 +789,7 @@ <# } #>
' . wp_get_auto_update_message() . ' <# } #> - + ' . $notice . '
'; @@ -914,13 +987,11 @@ $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); ?> - <# if ( ! data.blockTheme ) { #> - - - <# } #> + + <# } else { #>
- - - + + +
@@ -1134,23 +1220,23 @@ /* translators: %s: Theme name. */ $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); ?> + <# if ( ! data.blockTheme ) { #> + + <# } #> <# if ( data.actions.activate ) { #> <# } #> - <# if ( ! data.blockTheme ) { #> - - <# } #> <# } else { #> + <# if ( ! data.blockTheme ) { #> + + <# } #> <# if ( data.actions.activate ) { #> <# } #> - <# if ( ! data.blockTheme ) { #> - - <# } #> <# } #>