diff --git a/src/wp-admin/includes/class-plugin-installer-skin.php b/src/wp-admin/includes/class-plugin-installer-skin.php
index 59853c47d3..af95f038e4 100644
--- a/src/wp-admin/includes/class-plugin-installer-skin.php
+++ b/src/wp-admin/includes/class-plugin-installer-skin.php
@@ -214,7 +214,8 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
$table .= '
| ' . esc_html( __( 'Current' ) ) . ' | ';
$table .= '' . esc_html( __( 'Uploaded' ) ) . ' |
';
- $is_same_plugin = true; // Let's consider only these rows
+ $is_same_plugin = true; // Let's consider only these rows.
+
foreach ( $rows as $field => $label ) {
$old_value = ! empty( $current_plugin_data[ $field ] ) ? $current_plugin_data[ $field ] : '-';
$new_value = ! empty( $this->upgrader->new_plugin_data[ $field ] ) ? $this->upgrader->new_plugin_data[ $field ] : '-';
@@ -248,9 +249,8 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
$blocked_message = '' . esc_html( __( 'The plugin cannot be updated due to the following:' ) ) . '
';
$blocked_message .= '';
- if (
- ! empty( $this->upgrader->new_plugin_data['RequiresPHP'] ) &&
- version_compare( phpversion(), $this->upgrader->new_plugin_data['RequiresPHP'], '<' )
+ if ( ! empty( $this->upgrader->new_plugin_data['RequiresPHP'] )
+ && ! is_php_version_compatible( $this->upgrader->new_plugin_data['RequiresPHP'] )
) {
$error = sprintf(
/* translators: 1: Current PHP version, 2: Version required by the uploaded plugin. */
@@ -263,9 +263,8 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
$can_update = false;
}
- if (
- ! empty( $this->upgrader->new_plugin_data['RequiresWP'] ) &&
- version_compare( $GLOBALS['wp_version'], $this->upgrader->new_plugin_data['RequiresWP'], '<' )
+ if ( ! empty( $this->upgrader->new_plugin_data['RequiresWP'] )
+ && ! is_wp_version_compatible( $this->upgrader->new_plugin_data['RequiresWP'] )
) {
$error = sprintf(
/* translators: 1: Current WordPress version, 2: Version required by the uploaded plugin. */
diff --git a/src/wp-admin/includes/class-theme-installer-skin.php b/src/wp-admin/includes/class-theme-installer-skin.php
index 6850e8bbb2..ecbd6a7408 100644
--- a/src/wp-admin/includes/class-theme-installer-skin.php
+++ b/src/wp-admin/includes/class-theme-installer-skin.php
@@ -237,7 +237,8 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
$table = '';
$table .= ' | ' . esc_html( __( 'Current' ) ) . ' | ' . esc_html( __( 'Uploaded' ) ) . ' |
';
- $is_same_theme = true; // Let's consider only these rows
+ $is_same_theme = true; // Let's consider only these rows.
+
foreach ( $rows as $field => $label ) {
$old_value = $current_theme_data->display( $field, false );
$old_value = $old_value ? $old_value : '-';
@@ -283,7 +284,9 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
$blocked_message = '' . esc_html( __( 'The theme cannot be updated due to the following:' ) ) . '
';
$blocked_message .= '';
- if ( ! empty( $this->upgrader->new_theme_data['RequiresPHP'] ) && version_compare( phpversion(), $this->upgrader->new_theme_data['RequiresPHP'], '<' ) ) {
+ if ( ! empty( $this->upgrader->new_theme_data['RequiresPHP'] )
+ && ! is_php_version_compatible( $this->upgrader->new_theme_data['RequiresPHP'] )
+ ) {
$error = sprintf(
/* translators: 1: Current PHP version, 2: Version required by the uploaded theme. */
__( 'The PHP version on your server is %1$s, however the uploaded theme requires %2$s.' ),
@@ -295,7 +298,9 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
$can_update = false;
}
- if ( ! empty( $this->upgrader->new_theme_data['RequiresWP'] ) && version_compare( $GLOBALS['wp_version'], $this->upgrader->new_theme_data['RequiresWP'], '<' ) ) {
+ if ( ! empty( $this->upgrader->new_theme_data['RequiresWP'] )
+ && ! is_wp_version_compatible( $this->upgrader->new_theme_data['RequiresWP'] )
+ ) {
$error = sprintf(
/* translators: 1: Current WordPress version, 2: Version required by the uploaded theme. */
__( 'Your WordPress version is %1$s, however the uploaded theme requires %2$s.' ),