| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * TablePress environment compatibility check. |
| 4 | 4 | * |
| 5 | - * Note: This file must not contain PHP code that does not run on PHP < 7.2! | |
| 5 | + * Note: This file must not contain PHP code that does not run on PHP < 7.4! | |
| 6 | 6 | * |
| 7 | 7 | * @package TablePress |
| 8 | 8 | * @author Tobias Bäthge |
| 9 | 9 | * @since 2.2.0 |
| @@ -8,20 +8,26 @@ | ||
| 8 | 8 | * @author Tobias Bäthge |
| 9 | 9 | * @since 2.2.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | +declare(strict_types=1); | |
| 13 | + | |
| 12 | 14 | // Prohibit direct script loading. |
| 13 | 15 | defined( 'ABSPATH' ) || die( 'No direct script access allowed!' ); |
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | - * Check if the site is using WordPress 6.0 or newer. | |
| 18 | + * Check if the site is using WordPress 6.7 or newer. | |
| 19 | + * Do not use `wp_get_wp_version()` here, as it is only available since WP 6.7. | |
| 17 | 20 | */ |
| 18 | -require ABSPATH . WPINC . '/version.php'; // Include an unmodified $wp_version. | |
| 19 | -if ( version_compare( str_replace( '-src', '', $wp_version ), '6.0', '<' ) ) { // @phpstan-ignore-line | |
| 21 | +// Include an unmodified $wp_version. | |
| 22 | +require ABSPATH . WPINC . '/version.php'; | |
| 23 | +if ( version_compare( str_replace( '-src', '', $wp_version ), '6.7', '<' ) ) { // @phpstan-ignore variable.undefined ($wp_version is a global variable, defined in the included file.) | |
| 20 | 24 | /** |
| 21 | 25 | * Show an error notice to admins, if the installed version of WordPress is not supported. |
| 22 | 26 | * |
| 23 | 27 | * @since 2.2.0 |
| 28 | + * | |
| 29 | + * @phpstan-ignore missingType.return | |
| 24 | 30 | */ |
| 25 | 31 | function tablepress_admin_error_notice_minimum_version_wp() /* No return type declaration, due to required PHP compatibility! */ { |
| 26 | 32 | ?> |
| 27 | 33 | <div class="notice notice-error notice-alt notice-large"> |
| @@ -35,11 +41,11 @@ | ||
| 35 | 41 | <p style="font-size:14px"> |
| 36 | 42 | <strong> |
| 37 | 43 | <?php |
| 38 | 44 | if ( current_user_can( 'update_core' ) ) { |
| 39 | - printf( __( 'Please <a href="%1$s">update your WordPress installation</a> to at least version %2$s!', 'tablepress' ), esc_url( self_admin_url( 'update-core.php' ) ), '6.0' ); | |
| 45 | + printf( __( 'Please <a href="%1$s">update your WordPress installation</a> to at least version %2$s!', 'tablepress' ), esc_url( self_admin_url( 'update-core.php' ) ), '6.7' ); | |
| 40 | 46 | } else { |
| 41 | - printf( __( 'Please ask your site’s administrator to update WordPress to at least version %1$s!', 'tablepress' ), '6.0' ); | |
| 47 | + printf( __( 'Please ask your site’s administrator to update WordPress to at least version %1$s!', 'tablepress' ), '6.7' ); | |
| 42 | 48 | } |
| 43 | 49 | ?> |
| 44 | 50 | </strong> |
| 45 | 51 | </p> |
| @@ -52,15 +58,17 @@ | ||
| 52 | 58 | return false; |
| 53 | 59 | } |
| 54 | 60 | |
| 55 | 61 | /** |
| 56 | - * Check if the server is running PHP 7.2 or newer. | |
| 62 | + * Check if the server is running PHP 7.4 or newer. | |
| 57 | 63 | */ |
| 58 | -if ( PHP_VERSION_ID < 70200 ) { | |
| 64 | +if ( PHP_VERSION_ID < 70400 ) { // @phpstan-ignore smaller.alwaysFalse (PHPStan thinks that the Composer minimum version will always be fulfilled.) | |
| 59 | 65 | /** |
| 60 | 66 | * Show an error notice to admins, if the installed version of PHP is not supported. |
| 61 | 67 | * |
| 62 | 68 | * @since 2.2.0 |
| 69 | + * | |
| 70 | + * @phpstan-ignore missingType.return | |
| 63 | 71 | */ |
| 64 | 72 | function tablepress_admin_error_notice_minimum_version_php() /* No return type declaration, due to required PHP compatibility! */ { |
| 65 | 73 | ?> |
| 66 | 74 | <div class="notice notice-error notice-alt notice-large"> |
| @@ -68,9 +76,9 @@ | ||
| 68 | 76 | <span aria-hidden="true" class="dashicons dashicons-warning" style="color:#d63638;vertical-align:bottom"></span> |
| 69 | 77 | <?php _e( 'Attention: Unfortunately, there is a problem!', 'tablepress' ); ?> |
| 70 | 78 | </em></h3> |
| 71 | 79 | <p style="font-size:14px"> |
| 72 | - <?php printf( __( 'Your server is running a version of PHP that is too old for the TablePress plugin to work. TablePress requires PHP %s or newer, where newer versions are recommended.', 'tablepress' ), '7.2' ); ?> | |
| 80 | + <?php printf( __( 'Your server is running a version of PHP that is too old for the TablePress plugin to work. TablePress requires PHP %s or newer, where newer versions are recommended.', 'tablepress' ), '7.4' ); ?> | |
| 73 | 81 | </p> |
| 74 | 82 | <p style="font-size:14px"> |
| 75 | 83 | <strong><?php printf( __( '<a href="%s">Learn more about updating PHP</a> or contact your server administrator.', 'tablepress' ), esc_url( wp_get_update_php_url() ) ); ?></strong> |
| 76 | 84 | </p> |