diff --git a/simple-local-avatars.php b/simple-local-avatars.php index 15021494..f6baac05 100644 --- a/simple-local-avatars.php +++ b/simple-local-avatars.php @@ -15,6 +15,53 @@ * @package SimpleLocalAvatars */ +/** + * Get the minimum version of PHP required by this plugin. + * + * @since 2.7.6 + * + * @return string Minimum version required. + */ +function minimum_php_requirement(): string { + return '7.4'; +} + +/** + * Whether PHP installation meets the minimum requirements + * + * @since 2.7.6 + * + * @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() { + ?> +
+

+ +

+
+