PluginProbe
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN / 1.3.3
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN v1.3.3
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
← All changes | includes/modules/Bloat/BloatModule.php +46 -15 1.1.61.3.3 View file →
@@ -34,11 +34,11 @@
34 34 public const VERSION = '1.0.0';
35 35
36 36 public function ui_metadata(): array {
37 37 return array(
38 - 'label' => 'Bloat Control',
38 + 'label' => __( 'Bloat Control', 'xspeed' ),
39 39 'icon' => 'Sliders',
40 - 'description' => 'Turn off WordPress defaults you do not use — saves bytes, requests, and attack surface.',
40 + 'description' => __( 'Turn off WordPress defaults you do not use — saves bytes, requests, and attack surface.', 'xspeed' ),
41 41 );
42 42 }
43 43
44 44 public function settings_schema(): array {
@@ -45,45 +45,64 @@
45 45 return array(
46 46 'disable_dashicons_frontend' => array(
47 47 'type' => 'bool',
48 48 'default' => false,
49 - 'label' => 'Disable Dashicons on Frontend',
50 - 'description' => 'Drop the dashicons stylesheet from non-admin pages. Most themes do not need it. Saves ~45 KB per visitor.',
49 + 'label' => __( 'Disable Dashicons on Frontend', 'xspeed' ),
50 + 'description' => __( 'Drop the dashicons stylesheet from non-admin pages. Most themes do not need it. Saves ~45 KB per visitor.', 'xspeed' ),
51 51 ),
52 52 'disable_oembed' => array(
53 53 'type' => 'bool',
54 54 'default' => false,
55 - 'label' => 'Disable oEmbed Discovery + wp-embed.min.js',
56 - 'description' => 'Strip the auto-embed handlers + the embed script. Posts that paste a YouTube URL will no longer auto-render the player — embed it via a block instead. Saves a request per page.',
55 + 'label' => __( 'Disable oEmbed Discovery + wp-embed.min.js', 'xspeed' ),
56 + 'description' => __( 'Strip the auto-embed handlers + the embed script. Posts that paste a YouTube URL will no longer auto-render the player — embed it via a block instead. Saves a request per page.', 'xspeed' ),
57 57 ),
58 58 'disable_rss_feeds' => array(
59 59 'type' => 'bool',
60 60 'default' => false,
61 - 'label' => 'Disable RSS Feeds',
62 - 'description' => 'Return a 404 on /feed/ and similar endpoints. Useful for sites that do not publish feeds and want to cut feed-fetcher traffic.',
61 + 'label' => __( 'Disable RSS Feeds', 'xspeed' ),
62 + 'description' => __( 'Return a 404 on /feed/ and similar endpoints. Useful for sites that do not publish feeds and want to cut feed-fetcher traffic.', 'xspeed' ),
63 63 ),
64 64 'disable_xmlrpc' => array(
65 65 'type' => 'bool',
66 66 'default' => false,
67 - 'label' => 'Disable XML-RPC',
68 - 'description' => 'Disable the legacy xmlrpc.php endpoint. Cuts pingback brute-force noise; safe to disable unless you use a remote WP client (Jetpack, WordPress mobile app).',
67 + 'label' => __( 'Disable XML-RPC', 'xspeed' ),
68 + 'description' => __( 'Disable the legacy xmlrpc.php endpoint. Cuts pingback brute-force noise; safe to disable unless you use a remote WP client (Jetpack, WordPress mobile app).', 'xspeed' ),
69 69 ),
70 70 'strip_jquery_migrate' => array(
71 71 'type' => 'bool',
72 72 'default' => false,
73 - 'label' => 'Strip jQuery Migrate on Frontend',
74 - 'description' => 'Remove the jquery-migrate compatibility shim from non-admin pages. Saves ~10 KB; safe on modern themes / plugins.',
73 + 'label' => __( 'Strip jQuery Migrate on Frontend', 'xspeed' ),
74 + 'description' => __( 'Remove the jquery-migrate compatibility shim from non-admin pages. Saves ~10 KB; safe on modern themes / plugins.', 'xspeed' ),
75 75 ),
76 76 'restrict_rest_to_authed' => array(
77 77 'type' => 'bool',
78 78 'default' => false,
79 - 'label' => 'Restrict REST API to Logged-In Users',
80 - 'description' => 'Block /wp-json/ for anonymous requests. WooCommerce checkout, contact-form submissions, and many block-editor previews need anonymous REST — keep this off unless you know your site does not depend on it.',
79 + 'label' => __( 'Restrict REST API to Logged-In Users', 'xspeed' ),
80 + 'description' => __( 'Block /wp-json/ for anonymous requests. WooCommerce checkout, contact-form submissions, and many block-editor previews need anonymous REST — keep this off unless you know your site does not depend on it.', 'xspeed' ),
81 81 ),
82 82 );
83 83 }
84 84
85 85 public function boot(): void {
86 + /*
87 + * Deferred to `init` priority 0. This reads the module's settings,
88 + * which builds settings_schema(), whose labels go through __(), and
89 + * boot() runs on `plugins_loaded` — before `after_setup_theme`, the
90 + * earliest point WordPress 6.7+ treats as safe to translate.
91 + *
92 + * Priority 0 (not the default 10) because the body itself registers
93 + * an `init` callback at priority 9: adding a hook to the action that
94 + * is currently running only takes effect if the new priority is still
95 + * ahead of the running position, so we have to be first. Every other
96 + * hook it registers fires later than `init`.
97 + */
98 + add_action( 'init', array( $this, 'boot_on_init' ), 0 );
99 + }
100 +
101 + /**
102 + * The real boot body — see boot() for why it runs on `init`.
103 + */
104 + public function boot_on_init(): void {
86 105 $opts = Settings_Manager::get( self::SLUG );
87 106
88 107 if ( ! empty( $opts['disable_dashicons_frontend'] ) ) {
89 108 add_action( 'wp_enqueue_scripts', array( __CLASS__, 'dequeue_dashicons' ), 100 );
@@ -178,9 +197,12 @@
178 197 /**
179 198 * @param \WP_Scripts $scripts
180 199 */
181 200 public static function strip_jquery_migrate( $scripts ): void {
182 - if ( is_admin() || ! isset( $scripts->registered['jquery'] ) ) {
201 + // Builders and their add-ons still rely on jQuery Migrate shims; a
202 + // builder editing screen is a front-end URL, so is_admin() misses it
203 + // and the editor loses methods it calls. (#281)
204 + if ( is_admin() || \XSpeed\Builder_Editor::is_active() || ! isset( $scripts->registered['jquery'] ) ) {
183 205 return;
184 206 }
185 207 $jquery = $scripts->registered['jquery'];
186 208 if ( is_array( $jquery->deps ?? null ) ) {
@@ -214,8 +236,9 @@
214 236 array(
215 237 'name' => 'xspeed bloat',
216 238 'callback' => array( $this, 'cli_handler' ),
217 239 'shortdesc' => 'Show which bloat-removal toggles are active.',
240 + 'ai_hint' => 'What unnecessary WordPress output is being stripped (emojis, embeds, jQuery Migrate, dashicons)? Use when asked why extra scripts still load on the frontend, or before recommending bloat removal.',
218 241 'synopsis' => array(),
219 242 ),
220 243 );
221 244 }
@@ -224,6 +247,14 @@
224 247 $opts = Settings_Manager::get( self::SLUG );
225 248 foreach ( $opts as $key => $value ) {
226 249 \WP_CLI::log( sprintf( '%-30s %s', $key, $value ? 'on' : 'off' ) );
227 250 }
251 + }
252 +
253 + /**
254 + * Bloat has no master switch -- it is on when any of its disable_* /
255 + * strip_* / restrict_* flags is set. (#363)
256 + */
257 + public function is_active(): ?bool {
258 + return $this->any_bool_flag_on();
228 259 }
229 260 }