cloudflare/Cloudflare-WordPress
Publicmirrored fromhttps://github.com/cloudflare/Cloudflare-WordPress
src/Hooks/Activation.php
36lines · modecode
unknown
| 1 | <?php |
| 2 | |
| 3 | namespace CF\Hooks; |
| 4 | |
| 5 | class Activation |
| 6 | { |
| 7 | public static function init() |
| 8 | { |
| 9 | self::checkVersionCompatibility(); |
| 10 | } |
| 11 | |
| 12 | public static function checkVersionCompatibility() |
| 13 | { |
| 14 | global $wp_version; |
| 15 | |
| 16 | if (version_compare(PHP_VERSION, CF_MIN_PHP_VERSION, '<')) { |
| 17 | $flag = 'PHP'; |
| 18 | $version = CF_MIN_PHP_VERSION; |
| 19 | } |
| 20 | |
| 21 | if (version_compare($wp_version, CF_MIN_WP_VERSION, '<')) { |
| 22 | $flag = 'WordPress'; |
| 23 | $version = CF_MIN_WP_VERSION; |
| 24 | } |
| 25 | |
| 26 | if (isset($flag) || isset($version)) { |
| 27 | // Deactivate Plugin |
| 28 | deactivate_plugins(basename(__FILE__)); |
| 29 | |
| 30 | // Kill Execution |
| 31 | wp_die('<p><strong>Cloudflare</strong> plugin requires '.$flag.' version '.$version.' or greater.</p>', 'Plugin Activation Error', array('response' => 200, 'back_link' => true)); |
| 32 | |
| 33 | return; |
| 34 | } |
| 35 | } |
| 36 | } |