| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Powered Cache |
| 4 |
* Plugin URI: https://poweredcache.com |
| 5 |
* Description: The most powerful caching and performance suite for WordPress. Easily Improve PageSpeed & Web Vitals Score. |
| 6 |
* Version: 2.1.1 |
| 7 |
* Requires at least: 5.1 |
| 8 |
* Requires PHP: 5.6 |
| 9 |
* Author: PoweredCache |
| 10 |
* Author URI: https://poweredcache.com |
| 11 |
* License: GPL v2 or later |
| 12 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 13 |
* Text Domain: powered-cache |
| 14 |
* Domain Path: /languages |
| 15 |
* |
| 16 |
* @package PoweredCache |
| 17 |
*/ |
| 18 |
|
| 19 |
namespace PoweredCache; |
| 20 |
|
| 21 |
use PoweredCache\Extensions\Extensions; |
| 22 |
|
| 23 |
if ( ! defined( 'ABSPATH' ) ) { |
| 24 |
exit; // Exit if accessed directly. |
| 25 |
} |
| 26 |
|
| 27 |
// Useful global constants. |
| 28 |
define( 'POWERED_CACHE_VERSION', '2.1.1' ); |
| 29 |
define( 'POWERED_CACHE_DB_VERSION', '2.0' ); |
| 30 |
define( 'POWERED_CACHE_PLUGIN_FILE', __FILE__ ); |
| 31 |
define( 'POWERED_CACHE_URL', plugin_dir_url( __FILE__ ) ); |
| 32 |
define( 'POWERED_CACHE_PATH', plugin_dir_path( __FILE__ ) ); |
| 33 |
define( 'POWERED_CACHE_INC', POWERED_CACHE_PATH . 'includes/' ); |
| 34 |
define( 'POWERED_CACHE_DROPIN_DIR', POWERED_CACHE_INC . 'dropins/' ); |
| 35 |
define( 'POWERED_CACHE_COMPAT_DIR', POWERED_CACHE_INC . 'compat/' ); |
| 36 |
define( 'POWERED_CACHE_PACKAGE_DIR', POWERED_CACHE_INC . 'package/' ); |
| 37 |
|
| 38 |
if ( ! defined( 'POWERED_CACHE_CACHE_DIR' ) ) { |
| 39 |
define( 'POWERED_CACHE_CACHE_DIR', WP_CONTENT_DIR . '/cache/' ); |
| 40 |
} |
| 41 |
|
| 42 |
if ( ! defined( 'POWERED_CACHE_FO_CACHE_DIR' ) ) { |
| 43 |
define( 'POWERED_CACHE_FO_CACHE_DIR', POWERED_CACHE_CACHE_DIR . 'min/' ); |
| 44 |
} |
| 45 |
|
| 46 |
// Require Composer autoloader if it exists. |
| 47 |
if ( file_exists( POWERED_CACHE_PATH . 'vendor/autoload.php' ) ) { |
| 48 |
require_once POWERED_CACHE_PATH . 'vendor/autoload.php'; |
| 49 |
} |
| 50 |
|
| 51 |
// load packages |
| 52 |
require_once POWERED_CACHE_PACKAGE_DIR . 'deliciousbrains/wp-background-processing/classes/wp-async-request.php'; |
| 53 |
require_once POWERED_CACHE_PACKAGE_DIR . 'deliciousbrains/wp-background-processing/classes/wp-background-process.php'; |
| 54 |
|
| 55 |
/** |
| 56 |
* PSR-4-ish autoloading |
| 57 |
* |
| 58 |
* @since 2.0 |
| 59 |
*/ |
| 60 |
spl_autoload_register( |
| 61 |
function ( $class ) { |
| 62 |
// project-specific namespace prefix. |
| 63 |
$prefix = 'PoweredCache\\'; |
| 64 |
|
| 65 |
// base directory for the namespace prefix. |
| 66 |
$base_dir = __DIR__ . '/includes/classes/'; |
| 67 |
|
| 68 |
// does the class use the namespace prefix? |
| 69 |
$len = strlen( $prefix ); |
| 70 |
|
| 71 |
if ( strncmp( $prefix, $class, $len ) !== 0 ) { |
| 72 |
return; |
| 73 |
} |
| 74 |
|
| 75 |
$relative_class = substr( $class, $len ); |
| 76 |
|
| 77 |
$file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php'; |
| 78 |
|
| 79 |
// if the file exists, require it. |
| 80 |
if ( file_exists( $file ) ) { |
| 81 |
require $file; |
| 82 |
} |
| 83 |
} |
| 84 |
); |
| 85 |
|
| 86 |
// Include files. |
| 87 |
require_once POWERED_CACHE_INC . 'constants.php'; |
| 88 |
require_once POWERED_CACHE_INC . 'utils.php'; |
| 89 |
require_once POWERED_CACHE_INC . 'core.php'; |
| 90 |
require_once POWERED_CACHE_INC . 'admin/dashboard.php'; |
| 91 |
require_once POWERED_CACHE_INC . 'admin/notices.php'; |
| 92 |
require_once POWERED_CACHE_COMPAT_DIR . 'loader.php'; |
| 93 |
|
| 94 |
$network_activated = Utils\is_network_wide( POWERED_CACHE_PLUGIN_FILE ); |
| 95 |
if ( ! defined( 'POWERED_CACHE_IS_NETWORK' ) ) { |
| 96 |
define( 'POWERED_CACHE_IS_NETWORK', $network_activated ); |
| 97 |
} |
| 98 |
|
| 99 |
// Bootstrap. |
| 100 |
Core\setup(); |
| 101 |
Admin\Dashboard\setup(); |
| 102 |
Admin\Notices\setup(); |
| 103 |
Install::factory(); |
| 104 |
AdvancedCache::factory(); |
| 105 |
ObjectCache::factory(); |
| 106 |
CDN::factory(); |
| 107 |
Cron::factory(); |
| 108 |
Preloader::factory(); |
| 109 |
FileOptimizer::factory(); |
| 110 |
LazyLoad::factory(); |
| 111 |
Preloader::factory(); |
| 112 |
MetaBox::factory(); |
| 113 |
Extensions::factory(); |
| 114 |
|
| 115 |
// Activation/Deactivation. |
| 116 |
register_activation_hook( __FILE__, '\PoweredCache\Core\activate' ); |
| 117 |
register_deactivation_hook( __FILE__, '\PoweredCache\Core\deactivate' ); |
| 118 |
|