diff --git a/convert-to-blocks.php b/convert-to-blocks.php index 40711c5..4e2a5d6 100644 --- a/convert-to-blocks.php +++ b/convert-to-blocks.php @@ -45,6 +45,52 @@ function convert_to_blocks_get_setting( $name ) { return apply_filters( 'convert_to_blocks_setting_' . $name, constant( $name ), \get_current_blog_id() ); } +/** + * Get the minimum version of PHP required by this plugin. + * + * @since 1.2.1 + * + * @return string Minimum version required. + */ +function convert_to_blocks_minimum_php_requirement() { + return '8.0'; +} + +/** + * Whether PHP installation meets the minimum requirements + * + * @since 1.2.1 + * + * @return bool True if meets minimum requirements, false otherwise. + */ +function convert_to_blocks_site_meets_php_requirements() { + return version_compare( phpversion(), convert_to_blocks_minimum_php_requirement(), '>=' ); +} + +if ( ! convert_to_blocks_site_meets_php_requirements() ) { + add_action( + 'admin_notices', + function() { + ?> +
+ +
+