From 6f79ff4d1c3a51e1ac465b696b8581b48a00c104 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
@@ -429,14 +429,16 @@ function list_plugin_updates() {
$plugin_data->Version,
$plugin_data->update->new_version
);
+
echo ' ' . $details . $compat . $upgrade_notice;
+
if ( in_array( $plugin_file, $auto_updates, true ) ) {
echo $auto_update_notice;
}
?>
-
@@ -499,18 +501,87 @@ function list_theme_updates() {
}
foreach ( $themes as $stylesheet => $theme ) {
- $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
+ $requires_wp = isset( $theme->update['requires'] ) ? $theme->update['requires'] : null;
+ $requires_php = isset( $theme->update['requires_php'] ) ? $theme->update['requires_php'] : null;
+ $compatible_wp = is_wp_version_compatible( $requires_wp );
+ $compatible_php = is_php_version_compatible( $requires_php );
+
+ $compat = '';
+
+ if ( ! $compatible_wp && ! $compatible_php ) {
+ $compat .= '
-
-
-
-
+
+
+
+
' . __( 'This update doesn’t work with your versions of WordPress and PHP.' ) . ' ';
+ if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
+ $compat .= 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() )
+ );
+
+ $annotation = wp_get_update_php_annotation();
+
+ if ( $annotation ) {
+ $compat .= '
' . $annotation . ''; + } + } elseif ( current_user_can( 'update_core' ) ) { + $compat .= sprintf( + /* translators: %s: URL to WordPress Updates screen. */ + __( 'Please update WordPress.' ), + self_admin_url( 'update-core.php' ) + ); + } elseif ( current_user_can( 'update_php' ) ) { + $compat .= sprintf( + /* translators: %s: URL to Update PHP page. */ + __( 'Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) + ); + + $annotation = wp_get_update_php_annotation(); + + if ( $annotation ) { + $compat .= '
' . $annotation . '';
+ }
+ }
+ } elseif ( ! $compatible_wp ) {
+ $compat .= '
' . __( 'This update doesn’t work with your version of WordPress.' ) . ' ';
+ if ( current_user_can( 'update_core' ) ) {
+ $compat .= sprintf(
+ /* translators: %s: URL to WordPress Updates screen. */
+ __( 'Please update WordPress.' ),
+ self_admin_url( 'update-core.php' )
+ );
+ }
+ } elseif ( ! $compatible_php ) {
+ $compat .= '
' . __( 'This update doesn’t work with your version of PHP.' ) . ' ';
+ if ( current_user_can( 'update_php' ) ) {
+ $compat .= sprintf(
+ /* translators: %s: URL to Update PHP page. */
+ __( 'Learn more about updating PHP.' ),
+ esc_url( wp_get_update_php_url() )
+ );
+
+ $annotation = wp_get_update_php_annotation();
+
+ if ( $annotation ) {
+ $compat .= '
' . $annotation . ''; + } + } + } + + $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); ?>
@@ -522,6 +593,9 @@ function list_theme_updates() { $theme->display( 'Version' ), $theme->update['new_version'] ); + + echo ' ' . $compat; + if ( in_array( $stylesheet, $auto_updates, true ) ) { echo $auto_update_notice; }