PluginProbe
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN / 1.1.2
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN v1.1.2
1.3.3 1.3.2 1.3.1 1.3.0 1.2.4 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 All 29 releases
xspeed / includes / modules / Settings / SettingsModule.php

SettingsModule.php in xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN 1.1.2, at includes/modules/Settings/SettingsModule.php

82 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Settings module — the host page for account + platform settings
4 * (FBS-83633 restructure).
5 *
6 * A thin Free container: it owns no settings of its own. Its custom
7 * panel (SettingsPanel) renders four tabs, each embedding the module
8 * that actually owns the settings:
9 *
10 * AI & Agents — AI Provider (Pro) + AI Privacy (Free) + MCP Server (Free)
11 * License — xSpeed Pro license (Pro)
12 * Branding — White Label (Pro)
13 * Multisite — network-wide settings (Pro)
14 *
15 * This gives the reachable-but-homeless AI Privacy off-switch a stable
16 * home, and folds the old "AI" + "Pro Add-ons" sidebar groups into one
17 * Settings destination — the sidebar no longer changes on upgrade;
18 * tabs unlock in place.
19 *
20 * Tier: Free. The container is always present; individual tabs unlock
21 * with Pro (via the in-panel LockedSection), so the Settings row itself
22 * is never a locked dead-end.
23 *
24 * @package XSpeed
25 */
26
27 declare(strict_types=1);
28
29 namespace XSpeed\Modules\Settings;
30
31 defined( 'ABSPATH' ) || exit;
32
33 use XSpeed\Module;
34
35 final class SettingsModule extends Module {
36
37 public const SLUG = 'settings';
38 public const TIER = self::TIER_FREE;
39 public const VERSION = '1.0.0';
40
41 public function ui_metadata(): array {
42 return array(
43 'label' => 'Settings',
44 'icon' => 'Settings',
45 'description' => 'License, branding, and network settings.',
46 'custom_panel' => 'SettingsPanel',
47 );
48 }
49
50 /**
51 * The container owns no settings — each tab persists through the
52 * module it embeds. Empty schema so the base class doesn't register
53 * generic settings routes.
54 */
55 public function settings_schema(): array {
56 return array();
57 }
58
59 public function cli_commands(): array {
60 return array(
61 array(
62 'name' => 'xspeed settings',
63 'callback' => array( $this, 'cli_handler' ),
64 'shortdesc' => 'Show which Settings tabs are available (License / Branding / Multisite).',
65 'synopsis' => array(),
66 ),
67 );
68 }
69
70 public function cli_handler( array $args, array $assoc ): void {
71 $tabs = array(
72 'license' => 'License',
73 'white-label' => 'Branding',
74 'multisite' => 'Multisite',
75 );
76 foreach ( $tabs as $slug => $label ) {
77 $present = \XSpeed\Module_Registry::has( $slug ) ? 'available' : 'locked';
78 \WP_CLI::log( sprintf( '%-14s %-14s %s', $slug, $present, $label ) );
79 }
80 }
81 }
82