| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: xSpeed |
| 4 |
* Description: Minimal, ultra-fast caching plugin for WordPress. |
| 5 |
* Version: 1.0.0 |
| 6 |
* Requires at least: 6.0 |
| 7 |
* Tested up to: 6.9 |
| 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.0.0' ); |
| 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 |
spl_autoload_register( |
| 29 |
function ( $class ) { |
| 30 |
if ( strpos( $class, 'XSpeed\\' ) !== 0 ) { |
| 31 |
return; |
| 32 |
} |
| 33 |
$relative = str_replace( 'XSpeed\\', '', $class ); |
| 34 |
$file = XSPEED_DIR . 'includes/class-' . strtolower( str_replace( '_', '-', $relative ) ) . '.php'; |
| 35 |
if ( file_exists( $file ) ) { |
| 36 |
require_once $file; |
| 37 |
} |
| 38 |
} |
| 39 |
); |
| 40 |
|
| 41 |
if ( file_exists( XSPEED_DIR . 'vendor/autoload.php' ) ) { |
| 42 |
require_once XSPEED_DIR . 'vendor/autoload.php'; |
| 43 |
} |
| 44 |
|
| 45 |
register_activation_hook( __FILE__, array( 'XSpeed\\Plugin', 'activate' ) ); |
| 46 |
register_deactivation_hook( __FILE__, array( 'XSpeed\\Plugin', 'deactivate' ) ); |
| 47 |
|
| 48 |
add_action( |
| 49 |
'plugins_loaded', |
| 50 |
function () { |
| 51 |
\XSpeed\Plugin::instance()->init(); |
| 52 |
} |
| 53 |
); |
| 54 |
|