cloudflare/Cloudflare-WordPress

Public

mirrored fromhttps://github.com/cloudflare/Cloudflare-WordPress

CodeCommitsIssuesPull requestsActionsInsightsSecurity
215d4045ce51944361fcb9201cbe15ba18114227

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/Hooks/Activation.php

36lines · modecode

1<?php
2
3namespace CF\Hooks;
4
5class 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}