diff --git a/simple-page-ordering.php b/simple-page-ordering.php index 282dcdc..59063d2 100644 --- a/simple-page-ordering.php +++ b/simple-page-ordering.php @@ -15,6 +15,55 @@ * @package simple-page-ordering */ +namespace SimplePageOrdering; + +/** + * Get the minimum version of PHP required by this plugin. + * + * @since 2.5.2 + * + * @return string Minimum version required. + */ +function minimum_php_requirement(): string { + return '7.4'; +} + +/** + * Whether PHP installation meets the minimum requirements + * + * @since 2.5.2 + * + * @return bool True if meets minimum requirements, false otherwise. + */ +function site_meets_php_requirements(): bool { + return version_compare( phpversion(), minimum_php_requirement(), '>=' ); +} + +// Try to load the plugin files, ensuring our PHP version is met first. +if ( ! site_meets_php_requirements() ) { + add_action( + 'admin_notices', + function() { + ?> +
+

+ +

+
+