| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: xSpeed Cache |
| 4 |
* Description: Minimal, ultra-fast caching plugin for WordPress. |
| 5 |
* Version: 1.1.7 |
| 6 |
* Requires at least: 6.0 |
| 7 |
* Tested up to: 7.0 |
| 8 |
* Requires PHP: 7.4 |
| 9 |
* Author: WPDeveloper |
| 10 |
* Author URI: https://wpdeveloper.com |
| 11 |
* License: GPLv2 or later |
| 12 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 13 |
* Text Domain: xspeed |
| 14 |
* |
| 15 |
* @package XSpeed |
| 16 |
*/ |
| 17 |
|
| 18 |
if ( ! defined( 'ABSPATH' ) ) { |
| 19 |
exit; |
| 20 |
} |
| 21 |
|
| 22 |
define( 'XSPEED_VERSION', '1.1.7' ); |
| 23 |
define( 'XSPEED_FILE', __FILE__ ); |
| 24 |
define( 'XSPEED_DIR', plugin_dir_path( __FILE__ ) ); |
| 25 |
define( 'XSPEED_URL', plugin_dir_url( __FILE__ ) ); |
| 26 |
define( 'XSPEED_CACHE_DIR', WP_CONTENT_DIR . '/cache/xspeed' ); |
| 27 |
|
| 28 |
/** |
| 29 |
* Static-cache tree. Files written here are served directly by the |
| 30 |
* web server via the rewrite block in .htaccess, bypassing PHP for |
| 31 |
* every cache hit. Layout: `xspeed-static/{host}{request_uri}/index.html`. |
| 32 |
* Separate from XSPEED_CACHE_DIR so the PHP drop-in's flat-hash cache |
| 33 |
* stays intact as a fallback for cookied / query-string / nginx hosts. |
| 34 |
*/ |
| 35 |
define( 'XSPEED_CACHE_STATIC_DIR', WP_CONTENT_DIR . '/cache/xspeed-static' ); |
| 36 |
|
| 37 |
/** |
| 38 |
* Free-API version. xspeed-pro reads this to decide if it speaks the |
| 39 |
* current Module / Module_Registry / Settings_Manager / Rest_Manager |
| 40 |
* contract. Bump on any breaking change to those interfaces โ never on |
| 41 |
* additive change. See IMPLEMENTATION.md ยง1 and class-tier-registry.php. |
| 42 |
*/ |
| 43 |
define( 'XSPEED_API_VERSION', 1 ); |
| 44 |
|
| 45 |
/** |
| 46 |
* WP Insights project token for opt-in usage analytics (Usage_Tracker). Routes |
| 47 |
* this plugin's anonymous diagnostics to its project on send.wpinsight.com. |
| 48 |
* Overridable via wp-config.php for staging/QA. Nothing is ever sent unless the |
| 49 |
* admin explicitly opts in during the setup wizard โ see class-usage-tracker.php. |
| 50 |
* |
| 51 |
* The WP Insights item_id for xSpeed โ the project hash send.wpinsight.com |
| 52 |
* keys this plugin's telemetry on. The tracker only sends after explicit |
| 53 |
* user opt-in (require_optin is forced true); this just identifies the |
| 54 |
* project on the initial registration handshake. |
| 55 |
*/ |
| 56 |
if ( ! defined( 'XSPEED_INSIGHTS_ITEM_ID' ) ) { |
| 57 |
define( 'XSPEED_INSIGHTS_ITEM_ID', 'd2268aeacaa69d9f6d2f' ); |
| 58 |
} |
| 59 |
|
| 60 |
spl_autoload_register( |
| 61 |
function ( $class ) { |
| 62 |
if ( strpos( $class, 'XSpeed\\' ) !== 0 ) { |
| 63 |
return; |
| 64 |
} |
| 65 |
$relative = str_replace( 'XSpeed\\', '', $class ); |
| 66 |
$file = XSPEED_DIR . 'includes/class-' . strtolower( str_replace( '_', '-', $relative ) ) . '.php'; |
| 67 |
if ( file_exists( $file ) ) { |
| 68 |
require_once $file; |
| 69 |
} |
| 70 |
} |
| 71 |
); |
| 72 |
|
| 73 |
if ( file_exists( XSPEED_DIR . 'vendor/autoload.php' ) ) { |
| 74 |
require_once XSPEED_DIR . 'vendor/autoload.php'; |
| 75 |
} |
| 76 |
|
| 77 |
register_activation_hook( __FILE__, array( 'XSpeed\\Plugin', 'activate' ) ); |
| 78 |
register_deactivation_hook( __FILE__, array( 'XSpeed\\Plugin', 'deactivate' ) ); |
| 79 |
|
| 80 |
add_action( |
| 81 |
'plugins_loaded', |
| 82 |
function () { |
| 83 |
\XSpeed\Plugin::instance()->init(); |
| 84 |
} |
| 85 |
); |
| 86 |
|