# xspeed/1.0.0/includes/class-plugin.php

xSpeed Cache: AI-Powered Performance Hub with MCP, Caching &amp; CDN, version 1.0.0. 52 lines.

- Page: https://pluginprobe.com/plugins/xspeed/1.0.0/code/includes/class-plugin.php
- Raw: https://pluginprobe.com/plugins/xspeed/1.0.0/raw/includes/class-plugin.php
- Modified: 2026-05-27T11:31:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/xspeed/1.0.0/code/includes/class-plugin.php#L10-L20`.

```php
<?php
/**
 * Main plugin bootstrap.
 *
 * @package XSpeed
 */

namespace XSpeed;

defined( 'ABSPATH' ) || exit;

class Plugin {

	private static $instance = null;

	public static function instance() {
		if ( null === self::$instance ) {
			self::$instance = new self();
		}
		return self::$instance;
	}

	public function init() {
		new Admin();
		new Rest_Api();
		new Cache();
		new Minifier();
	}

	public static function activate() {
		Settings::set_defaults();

		if ( ! file_exists( XSPEED_CACHE_DIR ) ) {
			wp_mkdir_p( XSPEED_CACHE_DIR );
		}
		Cache::write_silence( XSPEED_CACHE_DIR );

		// Drop-in installation (advanced-cache.php) and the WP_CACHE constant
		// edit happen only when the user explicitly enables caching from the
		// admin UI — never on activation. See Cache::toggle() and
		// Rest_Api::toggle_cache(). This is a WordPress.org review requirement.
	}

	public static function deactivate() {
		Cache::remove_dropin();
		Cache::set_wp_cache_constant( false );
		Cache::purge_all();
		Minifier::purge_minified();
		Gzip::apply( false );
	}
}

```
