diff --git a/retro-webamp-block.php b/retro-webamp-block.php index 929550a..50619d6 100644 --- a/retro-webamp-block.php +++ b/retro-webamp-block.php @@ -15,6 +15,55 @@ * @package tenup\Winamp_Block */ +namespace RetroWinampBlock; + +/** + * Get the minimum version of PHP required by this plugin. + * + * @since 1.3.1 + * + * @return string Minimum version required. + */ +function minimum_php_requirement(): string { + return '7.4'; +} + +/** + * Whether PHP installation meets the minimum requirements + * + * @since 1.3.1 + * + * @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() { + ?> +
+

+ +

+
+