| 1 | <?php
|
|---|
| 2 | /*
|
|---|
| 3 | Plugin Name: Cloudflare
|
|---|
| 4 | Plugin URI: https://blog.cloudflare.com/new-wordpress-plugin/
|
|---|
| 5 | Description: Cloudflare speeds up and protects your WordPress site.
|
|---|
| 6 | Version: 4.14.4
|
|---|
| 7 | Requires PHP: 7.4
|
|---|
| 8 | Author: Cloudflare, Inc.
|
|---|
| 9 | License: BSD-3-Clause
|
|---|
| 10 | */
|
|---|
| 11 |
|
|---|
| 12 | // The following constants are available. Add them to wp-config.php to enable.
|
|---|
| 13 |
|
|---|
| 14 | // To configure Cloudflare credentials via environment vars (defined elsewhere)
|
|---|
| 15 | // define('CLOUDFLARE_EMAIL', $_ENV['CLOUDFLARE_EMAIL']);
|
|---|
| 16 | // define('CLOUDFLARE_API_KEY', $_ENV['CLOUDFLARE_API_KEY']);
|
|---|
| 17 | // define('CLOUDFLARE_DOMAIN_NAME', $_ENV['CLOUDFLARE_DOMAIN_NAME']);
|
|---|
| 18 |
|
|---|
| 19 | // To enable HTTP/2 Server Push feature:
|
|---|
| 20 | // define('CLOUDFLARE_HTTP2_SERVER_PUSH_ACTIVE', true);
|
|---|
| 21 |
|
|---|
| 22 | // Cloudflare has a limit of how many resources can be pushed by HTTP/2 Server Push
|
|---|
| 23 | // (3 KiB by default). Add the following to change that amount:
|
|---|
| 24 | // define('CLOUDFLARE_HTTP2_SERVER_PUSH_HEADER_SIZE', 3072);
|
|---|
| 25 |
|
|---|
| 26 | // To enable error logging when HTTP/2 Server Push header size is exceeded:
|
|---|
| 27 | // define('CLOUDFLARE_HTTP2_SERVER_PUSH_LOG', true);
|
|---|
| 28 |
|
|---|
| 29 | // Exit if accessed directly
|
|---|
| 30 | if (!defined('ABSPATH')) {
|
|---|
| 31 | exit;
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | define('CLOUDFLARE_MIN_PHP_VERSION', '7.4');
|
|---|
| 35 | define('CLOUDFLARE_MIN_WP_VERSION', '3.4');
|
|---|
| 36 | define('CLOUDFLARE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|---|
| 37 |
|
|---|
| 38 | // PHP version check has to go here because the below code uses namespaces
|
|---|
| 39 | if (version_compare(PHP_VERSION, CLOUDFLARE_MIN_PHP_VERSION, '<')) {
|
|---|
| 40 | // We need to load "plugin.php" manually to call "deactivate_plugins"
|
|---|
| 41 | require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
|---|
| 42 |
|
|---|
| 43 | deactivate_plugins(plugin_basename(__FILE__), true);
|
|---|
| 44 | wp_die('<p>The Cloudflare plugin requires a PHP version of at least ' . CLOUDFLARE_MIN_PHP_VERSION . '; you have ' . PHP_VERSION . '.</p>', 'Plugin Activation Error', array('response' => 200, 'back_link' => true));
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | // Plugin uses namespaces. To support old PHP version which doesn't support
|
|---|
| 48 | // namespaces we load everything in "cloudflare.loader.php"
|
|---|
| 49 | require_once CLOUDFLARE_PLUGIN_DIR . 'cloudflare.loader.php';
|
|---|