diff --git a/wp-admin/includes/class-wp-plugin-install-list-table.php b/wp-admin/includes/class-wp-plugin-install-list-table.php index d47b388466..0b2de90613 100644 --- a/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -502,11 +502,12 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { $author = ' ' . sprintf( __( 'By %s' ), $author ) . ''; } - $wp_version = get_bloginfo( 'version' ); + $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null; + $requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null; - $compatible_php = ( empty( $plugin['requires_php'] ) || version_compare( phpversion(), $plugin['requires_php'], '>=' ) ); - $tested_wp = ( empty( $plugin['tested'] ) || version_compare( $wp_version, $plugin['tested'], '<=' ) ); - $compatible_wp = ( empty( $plugin['requires'] ) || version_compare( $wp_version, $plugin['requires'], '>=' ) ); + $compatible_php = is_php_version_compatible( $requires_php ); + $compatible_wp = is_wp_version_compatible( $requires_wp ); + $tested_wp = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) ); $action_links = array(); diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php index 79c0590f0b..90dec9dae5 100644 --- a/wp-admin/includes/class-wp-plugins-list-table.php +++ b/wp-admin/includes/class-wp-plugins-list-table.php @@ -761,7 +761,8 @@ class WP_Plugins_List_Table extends WP_List_Table { } - $compatible_php = ( empty( $plugin_data['requires_php'] ) || version_compare( phpversion(), $plugin_data['requires_php'], '>=' ) ); + $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null; + $compatible_php = is_php_version_compatible( $requires_php ); $class = $is_active ? 'active' : 'inactive'; $checkbox_id = 'checkbox_' . md5( $plugin_data['Name'] ); if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ) ) || ! $compatible_php ) { diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php index 99939b04b9..b5f770d65a 100644 --- a/wp-admin/includes/plugin-install.php +++ b/wp-admin/includes/plugin-install.php @@ -754,11 +754,12 @@ function install_plugin_information() {
'; diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index b8dcdbe53b..7a1b038518 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -1099,8 +1099,8 @@ function validate_plugin_requirements( $plugin ) { return true; } - $plugin_data['wp_compatible'] = version_compare( get_bloginfo( 'version' ), $plugin_data['requires'], '>=' ); - $plugin_data['php_compatible'] = version_compare( phpversion(), $plugin_data['requires_php'], '>=' ); + $plugin_data['wp_compatible'] = is_wp_version_compatible( $plugin_data['requires'] ); + $plugin_data['php_compatible'] = is_php_version_compatible( $plugin_data['requires_php'] ); $plugin_data = array_merge( $plugin_data, get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ); diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php index 9c365ff423..1a4bee003a 100644 --- a/wp-admin/includes/update.php +++ b/wp-admin/includes/update.php @@ -400,7 +400,8 @@ function wp_plugin_update_row( $file, $plugin_data ) { $active_class = is_plugin_active( $file ) ? ' active' : ''; } - $compatible_php = ( empty( $response->requires_php ) || version_compare( phpversion(), $response->requires_php, '>=' ) ); + $requires_php = isset( $response->requires_php ) ? $response->requires_php : null; + $compatible_php = is_php_version_compatible( $requires_php ); $notice_type = $compatible_php ? 'notice-warning' : 'notice-error'; echo '