# xspeed/1.0.2/includes/class-settings.php

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

- Page: https://pluginprobe.com/plugins/xspeed/1.0.2/code/includes/class-settings.php
- Raw: https://pluginprobe.com/plugins/xspeed/1.0.2/raw/includes/class-settings.php
- Modified: 2026-06-01T17:33:22+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.2/code/includes/class-settings.php#L10-L20`.

```php
<?php
/**
 * Settings handling.
 *
 * @package XSpeed
 */

namespace XSpeed;

defined( 'ABSPATH' ) || exit;

class Settings {

	const OPTION_KEY = 'xspeed_options';

	public static function defaults() {
		// Migrated out of this legacy blob (now per-module storage):
		//   - minify_html / minify_css / minify_js → xspeed_module_minify
		//   - gzip_enabled                         → xspeed_module_gzip
		//   - cache_expiry / excluded_urls         → xspeed_module_cache
		// Still here (intentionally, drop-in lifecycle):
		//   - cache_enabled (Cache::toggle owns the .htaccess/wp-config edit)
		return array(
			'cache_enabled' => false,
		);
	}

	public static function get() {
		$saved = get_option( self::OPTION_KEY, array() );
		return wp_parse_args( $saved, self::defaults() );
	}

	public static function update( array $input ) {
		$current = self::get();
		$clean   = $current;

		// Every former field is now in per-module storage:
		//   - minify_* → MinifyModule, gzip_enabled → GzipModule,
		//     cache_expiry / excluded_urls → CacheModule.
		// Only cache_enabled lives on here, owned by Cache::toggle's
		// drop-in lifecycle. All other writes are silently ignored to
		// keep duplicate sources from re-forming.
		if ( isset( $input['cache_enabled'] ) ) {
			$clean['cache_enabled'] = (bool) $input['cache_enabled'];
		}

		update_option( self::OPTION_KEY, $clean );
		return $clean;
	}

	public static function set_defaults() {
		if ( false === get_option( self::OPTION_KEY ) ) {
			add_option( self::OPTION_KEY, self::defaults() );
		}
	}

	// sanitize_urls() removed — excluded_urls now owned by CacheModule
	// and validated by Settings_Manager's typed schema (list / item_type).
}

```
