From 3b0b11acc632235345fdba8ba6ab73c1dd373cc9 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 27 Jul 2020 13:10:04 +0000 Subject: [PATCH] Themes: Display a message in Theme Details modal if a theme requires a higher version of PHP or WordPress. Props afragen, desrosj, SergeyBiryukov. See #48491. git-svn-id: https://develop.svn.wordpress.org/trunk@48636 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/theme.php | 55 ++++++++++++++++++++++++++++++++ src/wp-admin/themes.php | 56 +++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) diff --git a/src/wp-admin/includes/theme.php b/src/wp-admin/includes/theme.php index adf642867c..5738893a9e 100644 --- a/src/wp-admin/includes/theme.php +++ b/src/wp-admin/includes/theme.php @@ -811,6 +811,61 @@ function customize_themes_print_templates() {

<# } #> + <# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #> +

+ <# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #> + 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.compatibleWP ) { #> + Please update WordPress.' ), + self_admin_url( 'update-core.php' ) + ); + } + ?> + <# } else if ( ! data.compatiblePHP ) { #> + Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) + ); + wp_update_php_annotation( '

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

+ <# } #> +

{{{ data.description }}}

<# if ( data.tags ) { #> diff --git a/src/wp-admin/themes.php b/src/wp-admin/themes.php index fc858b2c87..7dfb092a27 100644 --- a/src/wp-admin/themes.php +++ b/src/wp-admin/themes.php @@ -692,6 +692,61 @@ function wp_theme_auto_update_setting_template() { ?>

+ <# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #> +

+ <# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #> + 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.compatibleWP ) { #> + Please update WordPress.' ), + self_admin_url( 'update-core.php' ) + ); + } + ?> + <# } else if ( ! data.compatiblePHP ) { #> + Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) + ); + wp_update_php_annotation( '

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

+ <# } #> + <# if ( data.actions.autoupdate ) { #> <# } #> @@ -702,6 +757,7 @@ function wp_theme_auto_update_setting_template() { {{{ data.update }}} <# } #> +

{{{ data.description }}}

<# if ( data.parent ) { #>