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..c759f01b44 100644
a
|
b
|
class WP_Plugin_Install_List_Table extends WP_List_Table { |
502 | 502 | $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>'; |
503 | 503 | } |
504 | 504 | |
505 | | $wp_version = get_bloginfo( 'version' ); |
| 505 | $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null; |
| 506 | $requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null; |
| 507 | |
| 508 | $compatible_php = is_php_compatible( $requires_php ); |
| 509 | $compatible_wp = is_wp_compatible( $requires_wp ); |
| 510 | $tested_wp = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) ); |
506 | 511 | |
507 | | $compatible_php = ( empty( $plugin['requires_php'] ) || version_compare( phpversion(), $plugin['requires_php'], '>=' ) ); |
508 | | $tested_wp = ( empty( $plugin['tested'] ) || version_compare( $wp_version, $plugin['tested'], '<=' ) ); |
509 | | $compatible_wp = ( empty( $plugin['requires'] ) || version_compare( $wp_version, $plugin['requires'], '>=' ) ); |
510 | 512 | |
511 | 513 | $action_links = array(); |
512 | 514 | |
diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php
index 79c0590f0b..47fcc57573 100644
a
|
b
|
class WP_Plugins_List_Table extends WP_List_Table { |
761 | 761 | |
762 | 762 | } |
763 | 763 | |
764 | | $compatible_php = ( empty( $plugin_data['requires_php'] ) || version_compare( phpversion(), $plugin_data['requires_php'], '>=' ) ); |
| 764 | $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null; |
| 765 | $compatible_php = is_php_compatible( $requires_php ); |
765 | 766 | $class = $is_active ? 'active' : 'inactive'; |
766 | 767 | $checkbox_id = 'checkbox_' . md5( $plugin_data['Name'] ); |
767 | 768 | 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..805c793882 100644
a
|
b
|
function install_plugin_information() { |
754 | 754 | </div> |
755 | 755 | <div id="section-holder" class="wrap"> |
756 | 756 | <?php |
757 | | $wp_version = get_bloginfo( 'version' ); |
| 757 | $requires_php = isset( $api->requires_php ) ? $api->requires_php : null; |
| 758 | $requires_wp = isset( $api->requires ) ? $api->requires : null; |
758 | 759 | |
759 | | $compatible_php = ( empty( $api->requires_php ) || version_compare( phpversion(), $api->requires_php, '>=' ) ); |
760 | | $tested_wp = ( empty( $api->tested ) || version_compare( $wp_version, $api->tested, '<=' ) ); |
761 | | $compatible_wp = ( empty( $api->requires ) || version_compare( $wp_version, $api->requires, '>=' ) ); |
| 760 | $compatible_php = is_php_compatible( $requires_php ); |
| 761 | $compatible_wp = is_wp_compatible( $requires_wp ); |
| 762 | $tested_wp = ( empty( $api->tested ) || version_compare( get_bloginfo( 'version' ), $api->tested, '<=' ) ); |
762 | 763 | |
763 | 764 | if ( ! $compatible_php ) { |
764 | 765 | echo '<div class="notice notice-error notice-alt"><p>'; |
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index 23bc994749..cdfb9832dc 100644
a
|
b
|
function validate_plugin_requirements( $plugin ) { |
1090 | 1090 | return true; |
1091 | 1091 | } |
1092 | 1092 | |
1093 | | $plugin_data['wp_compatible'] = version_compare( get_bloginfo( 'version' ), $plugin_data['requires'], '>=' ); |
1094 | | $plugin_data['php_compatible'] = version_compare( phpversion(), $plugin_data['requires_php'], '>=' ); |
| 1093 | $plugin_data['wp_compatible'] = is_wp_compatible( $plugin_data['requires'] ); |
| 1094 | $plugin_data['php_compatible'] = is_php_compatible( $plugin_data['requires_php'] ); |
1095 | 1095 | |
1096 | 1096 | $plugin_data = array_merge( $plugin_data, get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ); |
1097 | 1097 | |
diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php
index 6c7d3b58ce..e535eac932 100644
a
|
b
|
function wp_plugin_update_row( $file, $plugin_data ) { |
400 | 400 | $active_class = is_plugin_active( $file ) ? ' active' : ''; |
401 | 401 | } |
402 | 402 | |
403 | | $compatible_php = ( empty( $response->requires_php ) || version_compare( phpversion(), $response->requires_php, '>=' ) ); |
| 403 | $requires_php = isset( $response->requires_php ) ? $response->requires_php : null; |
| 404 | $compatible_php = is_php_compatible( $requires_php ); |
404 | 405 | $notice_type = $compatible_php ? 'notice-warning' : 'notice-error'; |
405 | 406 | |
406 | 407 | echo '<tr class="plugin-update-tr' . $active_class . '" id="' . esc_attr( $response->slug . '-update' ) . '" data-slug="' . esc_attr( $response->slug ) . '" data-plugin="' . esc_attr( $file ) . '"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message notice inline ' . $notice_type . ' notice-alt"><p>'; |
diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php
index 7239243333..225b485d0e 100644
a
|
b
|
function list_plugin_updates() { |
295 | 295 | } |
296 | 296 | } |
297 | 297 | |
298 | | $compatible_php = ( empty( $plugin_data->update->requires_php ) || version_compare( phpversion(), $plugin_data->update->requires_php, '>=' ) ); |
| 298 | $requires_php = isset( $plugin_data->update->requires_php ) ? $plugin_data->update->requires_php : null; |
| 299 | $compatible_php = is_php_compatible( $requires_php ); |
299 | 300 | |
300 | 301 | if ( ! $compatible_php && current_user_can( 'update_php' ) ) { |
301 | 302 | $compat .= '<br>' . __( 'This update doesn’t work with your version of PHP.' ) . ' '; |
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index ff7841aba8..054104a6b6 100644
a
|
b
|
function wp_direct_php_update_button() { |
7006 | 7006 | ); |
7007 | 7007 | echo '</p>'; |
7008 | 7008 | } |
| 7009 | |
| 7010 | /** |
| 7011 | * Checks compatibility with the current WordPress version. |
| 7012 | * |
| 7013 | * @since 5.2.0 |
| 7014 | * |
| 7015 | * @param string $required Minimum required WordPress version. |
| 7016 | * @return bool True if required version is compatible or empty, false if not. |
| 7017 | */ |
| 7018 | function is_wp_compatible( $required ) { |
| 7019 | return empty( $required ) || version_compare( get_bloginfo( 'version' ), $required, '>=' ); |
| 7020 | } |
| 7021 | |
| 7022 | /** |
| 7023 | * Checks compatibility with the current PHP version. |
| 7024 | * |
| 7025 | * @since 5.2.0 |
| 7026 | * |
| 7027 | * @param string $required Minimum required PHP version. |
| 7028 | * @return bool True if required version is compatible or empty, false if not. |
| 7029 | */ |
| 7030 | function is_php_compatible( $required ) { |
| 7031 | return empty( $required ) || version_compare( phpversion(), $required, '>=' ); |
| 7032 | } |