Plugins: Introduce is_wp_version_compatible() and is_php_version_compatible() for checking compatibility with the current WordPress or PHP version.

Props afragen.
Fixes #46599.

git-svn-id: https://develop.svn.wordpress.org/trunk@45185 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2019-04-12 23:55:19 +00:00
parent e844945b31
commit 78e868e4c7
7 changed files with 43 additions and 14 deletions
+2 -1
View File
@@ -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 '<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>';