diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index 5738893a9e..2fd6efe513 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -684,27 +684,34 @@ function wp_prepare_themes_for_js( $themes = null ) { ); } + $update_requires_wp = isset( $updates[ $slug ]['requires'] ) ? $updates[ $slug ]['requires'] : null; + $update_requires_php = isset( $updates[ $slug ]['requires_php'] ) ? $updates[ $slug ]['requires_php'] : null; + $auto_update = in_array( $slug, $auto_updates, true ); $auto_update_action = $auto_update ? 'disable-auto-update' : 'enable-auto-update'; $prepared_themes[ $slug ] = array( - 'id' => $slug, - 'name' => $theme->display( 'Name' ), - 'screenshot' => array( $theme->get_screenshot() ), // @todo Multiple screenshots. - 'description' => $theme->display( 'Description' ), - 'author' => $theme->display( 'Author', false, true ), - 'authorAndUri' => $theme->display( 'Author' ), - 'tags' => $theme->display( 'Tags' ), - 'version' => $theme->get( 'Version' ), - 'compatibleWP' => is_wp_version_compatible( $theme->get( 'RequiresWP' ) ), - 'compatiblePHP' => is_php_version_compatible( $theme->get( 'RequiresPHP' ) ), - 'parent' => $parent, - 'active' => $slug === $current_theme, - 'hasUpdate' => isset( $updates[ $slug ] ), - 'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ]['package'] ), - 'update' => get_theme_update_available( $theme ), - 'autoupdate' => $auto_update, - 'actions' => array( + 'id' => $slug, + 'name' => $theme->display( 'Name' ), + 'screenshot' => array( $theme->get_screenshot() ), // @todo Multiple screenshots. + 'description' => $theme->display( 'Description' ), + 'author' => $theme->display( 'Author', false, true ), + 'authorAndUri' => $theme->display( 'Author' ), + 'tags' => $theme->display( 'Tags' ), + 'version' => $theme->get( 'Version' ), + 'compatibleWP' => is_wp_version_compatible( $theme->get( 'RequiresWP' ) ), + 'compatiblePHP' => is_php_version_compatible( $theme->get( 'RequiresPHP' ) ), + 'updateResponse' => array( + 'compatibleWP' => is_wp_version_compatible( $update_requires_wp ), + 'compatiblePHP' => is_php_version_compatible( $update_requires_php ), + ), + 'parent' => $parent, + 'active' => $slug === $current_theme, + 'hasUpdate' => isset( $updates[ $slug ] ), + 'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ]['package'] ), + 'update' => get_theme_update_available( $theme ), + 'autoupdate' => $auto_update, + 'actions' => array( 'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null, 'customize' => $customize_action, 'delete' => current_user_can( 'delete_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null, @@ -793,10 +800,68 @@ function customize_themes_print_templates() { <# } #> <# if ( data.hasUpdate ) { #> -
+ <# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.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.updateResponse.compatibleWP ) { #> + Please update WordPress.' ), + self_admin_url( 'update-core.php' ) + ); + } + ?> + <# } else if ( ! data.updateResponse.compatiblePHP ) { #> + Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) + ); + wp_update_php_annotation( '
', '' ); + } + ?> + <# } #> +
++ <# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.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.updateResponse.compatibleWP ) { #> + Please update WordPress.' ), + self_admin_url( 'update-core.php' ) + ); + } + ?> + <# } else if ( ! data.updateResponse.compatiblePHP ) { #> + Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) + ); + wp_update_php_annotation( '
', '' ); + } + ?> + <# } #> +
+ <# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.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.updateResponse.compatibleWP ) { #> + Please update WordPress.' ), + self_admin_url( 'update-core.php' ) + ); + } + ?> + <# } else if ( ! data.updateResponse.compatiblePHP ) { #> + Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) + ); + wp_update_php_annotation( '
', '' ); + } + ?> + <# } #> +
+{{{ data.description }}}
diff --git a/wp-includes/customize/class-wp-customize-theme-control.php b/wp-includes/customize/class-wp-customize-theme-control.php index 64dc33a3e4..03d9649ff8 100644 --- a/wp-includes/customize/class-wp-customize-theme-control.php +++ b/wp-includes/customize/class-wp-customize-theme-control.php @@ -90,21 +90,78 @@ class WP_Customize_Theme_Control extends WP_Customize_Control { <# if ( 'installed' === data.theme.type && data.theme.hasUpdate ) { #> - + <# if ( data.theme.updateResponse.compatibleWP && data.theme.updateResponse.compatiblePHP ) { #> + + <# } else { #> + + <# } #> <# } #> <# if ( ! data.theme.compatibleWP || ! data.theme.compatiblePHP ) { #> diff --git a/wp-includes/version.php b/wp-includes/version.php index 117519d114..11e9e1f0e5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-beta4-48651'; +$wp_version = '5.5-beta4-48652'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.