From 782454b39c29bd9f375ef9677d85b0600a2fb940 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 27 Jul 2020 15:02:19 +0000 Subject: [PATCH] Themes: Display a message in theme grid if a theme requires a higher version of PHP or WordPress. This applies to the Themes screen, Add Themes screen, and the Customizer theme browser. Props afragen, desrosj, SergeyBiryukov. See #48491. git-svn-id: https://develop.svn.wordpress.org/trunk@48638 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/theme-install.php | 64 +++++++++++++++++-- src/wp-admin/themes.php | 55 ++++++++++++++++ .../class-wp-customize-theme-control.php | 55 ++++++++++++++++ 3 files changed, 170 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/theme-install.php b/src/wp-admin/theme-install.php index 2fbdc4ef64..8f9d3c6137 100644 --- a/src/wp-admin/theme-install.php +++ b/src/wp-admin/theme-install.php @@ -271,6 +271,66 @@ if ( $tab ) { <# } else { #>
<# } #> + + <# if ( data.installed ) { #> +

+ <# } #> + + <# if ( ! data.compatible_wp || ! data.compatible_php ) { #> +

+ <# if ( ! data.compatible_wp && ! data.compatible_php ) { #> + 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( '

', '' ); + } + ?> + <# } else if ( ! data.compatible_wp ) { #> + Please update WordPress.' ), + self_admin_url( 'update-core.php' ) + ); + } + ?> + <# } else if ( ! data.compatible_php ) { #> + Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) + ); + wp_update_php_annotation( '

', '' ); + } + ?> + <# } #> +

+ <# } #> +
- - <# if ( data.installed ) { #> -

- <# } #>