class-rest.php

PerformanceOptimise\Inc\Rest

Source includes/Admin/class-rest.php18 min readPart of Performance Optimisation

includes/Admin/class-rest.php

PerformanceOptimise\\Inc\\Rest

Namespace: PerformanceOptimise\\Inc · Lines: 3656

Class Rest

Registers REST API routes and handles requests for various performance optimization features.

Source: includes/Admin/class-rest.php, line 26

class Rest

Tags: @since 1.0.0

Constants

ConstantVisibilityValueLine
NAMESPACEpublic\'performance-optimisation/v1\'34

Properties

PropertyVisibilityTypeDefaultLine
$cache_dirprivatestring—42
$rest_cacheprivateRest_Cache—50
$rest_settingsprivateRest_Settings—58

public __construct()

public function __construct()

Constructor.

Tags: @since 1.6.0

Source: includes/Admin/class-rest.php, line 65

public rest_throttle_hit()

public function rest_throttle_hit(string $endpoint, int $limit, int $window): bool

Per-endpoint throttle verdict for the ARCH-011 services.

ParameterTypeDefaultDescription
$endpointstring—Endpoint slug.
$limitint—Max hits per window.
$windowint—Window in seconds.

Return: bool — True when throttled.

Tags: @internal · @since 2.4.0

Source: includes/Admin/class-rest.php, line 85

public rest_send_response()

public function rest_send_response($data, =true $success, =200 $status_code, =null $message)

Response envelope for the ARCH-011 services.

ParameterTypeDefaultDescription
$datamixed—The data to return in the response.
$success=true—Indicates whether the request was successful.
$status_code=200—The HTTP status code.
$message=null—The response message.

Return: \\WP_REST_Response — The response object.

Tags: @internal · @since 2.4.0

Source: includes/Admin/class-rest.php, line 104

public rest_cache_dir()

public function rest_cache_dir(): string

Cache directory for the ARCH-011 cache service.

Return: string — Cache directory path.

Tags: @internal · @since 2.4.0

Source: includes/Admin/class-rest.php, line 118

public register_routes()

public function register_routes()

Registers the REST API routes.

Tags: @since 1.0.0

Source: includes/Admin/class-rest.php, line 127

private get_routes()

private function get_routes()

Provide the REST route definitions used when registering this class\’s endpoints.

Return: array<string, — array> Associative array of route slugs to route configuration arrays.

Source: includes/Admin/class-rest.php, line 143

public get_autoloaded_options()

public function get_autoloaded_options(\\WP_REST_Request $request): \\WP_REST_Response

List the largest autoloaded options.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Source: includes/Admin/class-rest.php, line 457

public handle_autoload_remediate()

public function handle_autoload_remediate(\\WP_REST_Request $request): \\WP_REST_Response

Handle one-click autoload-bloat remediation (dry run, apply, revert, revert_all).

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.0.0

Source: includes/Admin/class-rest.php, line 494

public export_expired_transients()

public function export_expired_transients(\\WP_REST_Request $request): \\WP_REST_Response

Export expired transients for pre-run review (read-only, expired rows only).

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.0.0

Source: includes/Admin/class-rest.php, line 554

public collect_rum()

public function collect_rum(\\WP_REST_Request $request): \\WP_REST_Response

Handle a real-user Web Vitals beacon.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.0.0 Added public-endpoint justification with rate-limit reference.

Source: includes/Admin/class-rest.php, line 583

public get_rum_data()

public function get_rum_data(\\WP_REST_Request $request): \\WP_REST_Response

Retrieve aggregated real-user Web Vitals for the dashboard.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Source: includes/Admin/class-rest.php, line 600

public get_preload_status()

public function get_preload_status(\\WP_REST_Request $request): \\WP_REST_Response

Resumable sitemap preload progress plus bounded-cache cap status.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object. Facade proxy (ARCH-011): logic lives in {@see Rest_Cache::get_preload_status}.

Tags: @since 2.2.0

Source: includes/Admin/class-rest.php, line 614

public get_lcp_preload_candidate()

public function get_lcp_preload_candidate(\\WP_REST_Request $request): \\WP_REST_Response

Retrieve the single LCP preload candidate for the settings UI.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.2.0

Source: includes/Admin/class-rest.php, line 644

public resume_preload()

public function resume_preload(\\WP_REST_Request $request): \\WP_REST_Response

Resume the sitemap preload queue (re-schedule queued + failed URLs).

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object. Facade proxy (ARCH-011): logic lives in {@see Rest_Cache::resume_preload}.

Tags: @since 2.2.0

Source: includes/Admin/class-rest.php, line 764

private is_image_candidate_url()

private function is_image_candidate_url(string $url): bool

Whether a candidate URL is a plausible LCP image (text-LCP guard).

ParameterTypeDefaultDescription
$urlstring—The candidate URL.

Return: bool — True when the URL may be preloaded as an image.

Tags: @since 2.2.0

Source: includes/Admin/class-rest.php, line 782

private is_same_origin_candidate_url()

private function is_same_origin_candidate_url(string $url): bool

Whether a REST LCP candidate URL is same-origin with this site.

ParameterTypeDefaultDescription
$urlstring—The candidate URL.

Return: bool — True when the URL may surface as a candidate.

Tags: @since 2.2.0

Source: includes/Admin/class-rest.php, line 838

public get_schema_for_route()

public function get_schema_for_route(): array

Returns the JSON schema for a given REST route.

Return: array — The JSON schema definition.

Tags: @since 2.0.0

Source: includes/Admin/class-rest.php, line 864

public permission_callback()

public function permission_callback(?\\WP_REST_Request=null $request): bool

Checks if the user has permission to access the route.

ParameterTypeDefaultDescription
$request?\\WP_REST_Request=null—The REST request object.

Return: bool — True if the user has permission, false otherwise.

Tags: @since 1.0.0 · @since 2.0.0 Added $request parameter for header canonicalization. · @since NEXT Delegates capability and nonce decisions to Admin_Auth.

Source: includes/Admin/class-rest.php, line 906

privatestatic static_throttle_hit()

private static function static_throttle_hit(string $endpoint, int $limit, int $window): bool

Per-request static throttle buckets (audit #1453).

ParameterTypeDefaultDescription
$endpointstring—Endpoint slug.
$limitint—Max hits per window.
$windowint—Window in seconds.

Return: bool — True when throttled.

Tags: @since 2.2.0

Source: includes/Admin/class-rest.php, line 923

private is_endpoint_throttled()

private function is_endpoint_throttled(string $endpoint, int=10 $limit, int=60 $window): bool

Per-endpoint transient throttle for heavy admin endpoints.

ParameterTypeDefaultDescription
$endpointstring—Endpoint slug.
$limitint=10—Max hits per window.
$windowint=60—Window in seconds.

Return: bool — True when throttled.

Tags: @since 2.2.0

Source: includes/Admin/class-rest.php, line 946

privatestatic throttle_client_suffix()

private static function throttle_client_suffix(): string

Client suffix for the anonymous endpoint-throttle bucket.

Return: string — Anon throttle suffix.

Tags: @since 2.2.0

Source: includes/Admin/class-rest.php, line 1025

private is_same_site_url()

private function is_same_site_url(string $url): bool

Same-site URL gate shared by readers and writers.

ParameterTypeDefaultDescription
$urlstring—URL to check.

Return: bool.

Tags: @since 2.2.0

Source: includes/Admin/class-rest.php, line 1037

public clear_cache()

public function clear_cache(\\WP_REST_Request $request)

Clears the cache based on the given action.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object. Facade proxy (ARCH-011): logic lives in {@see Rest_Cache::clear_cache}.

Tags: @since 1.0.0

Source: includes/Admin/class-rest.php, line 1058

public update_settings()

public function update_settings(\\WP_REST_Request $request)

Updates the settings for the plugin.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object. Facade proxy (ARCH-011): logic lives in {@see Rest_Settings::update_settings}.

Tags: @since 1.0.0

Source: includes/Admin/class-rest.php, line 1070

private sanitize_settings_recursively()

private function sanitize_settings_recursively(array $settings): array

Sanitizes the settings array recursively.

ParameterTypeDefaultDescription
$settingsarray—The settings array.

Return: array — The sanitized settings array.

Tags: @since 1.1.1

Source: includes/Admin/class-rest.php, line 1085

private remove_sensitive_settings_from_response()

private function remove_sensitive_settings_from_response(array& $settings): void

Removes sensitive settings from the response array.

ParameterTypeDefaultDescription
$settingsarray&—The settings array passed by reference.

Return: void.

Source: includes/Admin/class-rest.php, line 1099

public get_recent_activities()

public function get_recent_activities(\\WP_REST_Request $request)

Retrieves the recent activities.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 1.0.0

Source: includes/Admin/class-rest.php, line 1110

private resolve_optimise_source_path()

private function resolve_optimise_source_path(string $img_path, string $normalized_abspath): string

Resolve a client- or DB-supplied image path to an absolute source path.

ParameterTypeDefaultDescription
$img_pathstring—Raw path from the request or DB queue.
$normalized_abspathstring—Trailingslashed `ABSPATH`.

Return: string — Absolute candidate source path.

Tags: @since 2.0.0

Source: includes/Admin/class-rest.php, line 1135

public optimise_image()

public function optimise_image(\\WP_REST_Request $request)

Optimizes the images and converts them to WebP or AVIF format.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 1.0.0

Source: includes/Admin/class-rest.php, line 1153

public delete_optimised_image()

public function delete_optimised_image(): \\WP_REST_Response

Deletes the optimized images from the filesystem.

Return: \\WP_REST_Response — The response object.

Tags: @since 1.0.0

Source: includes/Admin/class-rest.php, line 1470

public import_settings()

public function import_settings(\\WP_REST_Request $request)

Imports settings via the REST API.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object. Facade proxy (ARCH-011): logic lives in {@see Rest_Settings::import_settings}.

Tags: @since 1.0.0

Source: includes/Admin/class-rest.php, line 1530

public get_settings_snapshot()

public function get_settings_snapshot(\\WP_REST_Request $request): \\WP_REST_Response

Report whether a prior-settings snapshot exists for one-click undo.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.2.0 Facade proxy (ARCH-011): logic lives in {@see Rest_Settings::get_settings_snapshot}.

Source: includes/Admin/class-rest.php, line 1545

public restore_settings()

public function restore_settings(\\WP_REST_Request $request): \\WP_REST_Response

Restore `wppo_settings` from the prior-settings snapshot (one-click undo).

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.2.0 Facade proxy (ARCH-011): logic lives in {@see Rest_Settings::restore_settings}.

Source: includes/Admin/class-rest.php, line 1561

public get_optimization_presets()

public function get_optimization_presets(\\WP_REST_Request $request): \\WP_REST_Response

List the Safe / Balanced / Aggressive preset definitions plus the diff preview of each against the current settings.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.3.0

Source: includes/Admin/class-rest.php, line 1576

public apply_optimization_preset()

public function apply_optimization_preset(\\WP_REST_Request $request): \\WP_REST_Response

Apply a Safe / Balanced / Aggressive preset in one click.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.3.0

Source: includes/Admin/class-rest.php, line 1619

public database_cleanup()

public function database_cleanup(\\WP_REST_Request $request)

Perform database cleanup for the requested cleanup type.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—REST request containing the `type` parameter.

Return: \\WP_REST_Response — On success: – For `all`: response with `results` (per-cleanup results) and `deleted` (total deleted). – For specific types: response with `type` and `deleted` (number deleted). On invalid `type`: 400 response with an error message. On partial or total failure when `type` is `all`: 500 response with `failures` and `deleted`. On failure of a specific cleanup method: 500 response with the error message.

Tags: @since 1.4.0

Source: includes/Admin/class-rest.php, line 1672

public get_database_cleanup_counts()

public function get_database_cleanup_counts(\\WP_REST_Request $_request)

Returns counts for all database cleanup types.

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 1.1.0

Source: includes/Admin/class-rest.php, line 1741

public get_image_job_status()

public function get_image_job_status(\\WP_REST_Request $_request)

Returns the status of background image optimization jobs.

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 1.1.0

Source: includes/Admin/class-rest.php, line 1757

public handle_object_cache()

public function handle_object_cache(\\WP_REST_Request $request)

Handles object cache requests (status, ping, enable, disable, flush).

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 1.4.0 · @since 2.2.0 Flush action uses Object_Cache::flush_scoped() for multisite scoping.

Source: includes/Admin/class-rest.php, line 1834

private build_redis_config()

private function build_redis_config($params, =array() $defaults)

Builds a sanitized Redis configuration array from request parameters.

ParameterTypeDefaultDescription
$paramsarray—Request parameters.
$defaults=array()—Optional stored config (e.g. from Object_Cache::get_redis_config()) filling keys the request does not explicitly carry. Defaults to array() (historic behaviour: hardcoded host/port/mode fallbacks).

Return: array — Sanitized Redis config.

Tags: @since 1.4.0 · @since 2.0.0 Request-supplied passwords are ignored when WPPO_REDIS_PASSWORD is defined, unless the `wppo_redis_allow_request_password` filter returns true. · @since 2.0.0 Added the $defaults parameter for circuit-breaker recovery. · @since NEXT Delegates value normalization to Redis_Config_Policy.

Source: includes/Admin/class-rest.php, line 1962

private sanitize_redis_config_value()

private function sanitize_redis_config_value($key, $value)

Sanitize a single Redis configuration value by key.

ParameterTypeDefaultDescription
$keystring—Config key (one of the build_redis_config() allowlist).
$valuemixed—Raw value.

Return: mixed — Sanitized value.

Tags: @since 2.0.0 · @since NEXT Delegates to Redis_Config_Policy::sanitize_value().

Source: includes/Admin/class-rest.php, line 1979

private sanitize_nodes()

private function sanitize_nodes($nodes)

Normalize and sanitize Redis node entries into an indexed array of non-empty strings.

ParameterTypeDefaultDescription
$nodesstring|array—Node or list of nodes to sanitize and normalize.

Return: string[] — An indexed array of sanitized, non-empty node strings.

Tags: @since 1.4.0 · @since NEXT Delegates to Redis_Config_Policy::sanitize_nodes().

Source: includes/Admin/class-rest.php, line 1994

private sanitize_flush_error()

private function sanitize_flush_error($error): \\WP_Error

Strip local paths from a flush WP_Error before REST surfacing.

ParameterTypeDefaultDescription
$error\\WP_Error—Failing result.

Return: \\WP_Error — Sanitized clone (same code, scrubbed message and data).

Tags: @since 2.2.0

Source: includes/Admin/class-rest.php, line 2012

private scrub_flush_error_data()

private function scrub_flush_error_data($data)

Recursively strip local paths from flush error data.

ParameterTypeDefaultDescription
$datamixed—Raw error data.

Return: mixed — Scrubbed error data.

Tags: @since 2.2.0

Source: includes/Admin/class-rest.php, line 2039

private redis_error_payload()

private function redis_error_payload($error, string=\'error\' $notice): array

Build a useNotice-compatible error payload for Redis failures.

ParameterTypeDefaultDescription
$error\\WP_Error—Failing result.
$noticestring=\'error\'—Notice severity: \’error\’, \’warning\’, \’info\’.

Return: array — Shape { code: string, notice: array{ type: string, message: string } }.

Tags: @since 2.0.0

Source: includes/Admin/class-rest.php, line 2074

public ajax_get_nonce()

public function ajax_get_nonce()

Refreshes the REST API nonce via AJAX to bypass stale X-WP-Nonce issues.

Return: void.

Tags: @since 1.4.0

Source: includes/Admin/class-rest.php, line 2119

public get_system_info()

public function get_system_info(\\WP_REST_Request $_request): \\WP_REST_Response

Returns all system information groups (PHP, DB, WordPress, server, cache).

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object (unused).

Return: \\WP_REST_Response — The response object.

Tags: @since 1.5.0

Source: includes/Admin/class-rest.php, line 2142

public run_performance_scan()

public function run_performance_scan(\\WP_REST_Request $request): \\WP_REST_Response

Runs a local telemetry scan on the provided URL.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 1.5.0

Source: includes/Admin/class-rest.php, line 2156

public queue_pagespeed_scan()

public function queue_pagespeed_scan(\\WP_REST_Request $request): \\WP_REST_Response

Queues a Google PageSpeed Insights scan as a background Action Scheduler job.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 1.6.0

Source: includes/Admin/class-rest.php, line 2226

public get_pagespeed_results()

public function get_pagespeed_results(\\WP_REST_Request $request): \\WP_REST_Response

Returns cached PageSpeed Insights results for a URL and strategy.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 1.6.0 · @since NEXT Reads the augmented PageSpeed model through Insight_Query.

Source: includes/Admin/class-rest.php, line 2306

public function get_web_vitals_trends(\\WP_REST_Request $request): \\WP_REST_Response

Returns the stored Web Vitals trend history.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.0.0

Source: includes/Admin/class-rest.php, line 2367

public get_suggestions()

public function get_suggestions(\\WP_REST_Request $request): \\WP_REST_Response

Returns Suggestion_Engine output for a given telemetry scan result.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 1.6.0 · @since NEXT Reads cached telemetry through Insight_Query.

Source: includes/Admin/class-rest.php, line 2417

private get_rum_next_action()

private function get_rum_next_action(): ?array

Pick the single RUM-driven guided next action.

Return: array|null — Single suggestion object, or null.

Tags: @since 2.3.0

Source: includes/Admin/class-rest.php, line 2470

private get_detected_server_type()

private function get_detected_server_type(): string

Detect the current server software for the guided next-step note.

Return: string — \’apache\’, \’nginx\’, \’litespeed\’, or \’other\’.

Tags: @since 2.3.0

Source: includes/Admin/class-rest.php, line 2489

public get_woo_cache_self_test()

public function get_woo_cache_self_test(\\WP_REST_Request $_request): \\WP_REST_Response

Verifiable WooCommerce cart/checkout cache-exclusion self-test (read-only).

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object (unused).

Return: \\WP_REST_Response — The response object.

Tags: @since 2.0.0 · @since 2.2.0 Added preload_checks, cart_checks and force_exclude to the result (issue #1256).

Source: includes/Admin/class-rest.php, line 2519

public used_css_regenerate()

public function used_css_regenerate(\\WP_REST_Request $request): \\WP_REST_Response

Regenerate used-CSS for all pages or a single post.

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 1.9.0 · @since 2.3.0 Single-post safe-rollout flags.

Source: includes/Admin/class-rest.php, line 2534

private handle_used_css_rollout_action()

private function handle_used_css_rollout_action(string $action, int $post_id): \\WP_REST_Response

Handle a used-CSS safe-rollout action for a single post (issue #1348).

ParameterTypeDefaultDescription
$actionstring—One of dry_run|promote|rollback|health.
$post_idint—Validated post ID.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.3.0

Source: includes/Admin/class-rest.php, line 2699

private handle_ccss_rollout_action()

private function handle_ccss_rollout_action(string $action, string $template, $templates_map): \\WP_REST_Response

Handle a critical-CSS safe-rollout action for a template (issue #1348).

ParameterTypeDefaultDescription
$actionstring—One of dry_run|promote|rollback|health.
$templatestring—Validated template slug or hash.
$templates_maparray|null—Optional template map (avoids a second theme scan).

Return: \\WP_REST_Response — The response object.

Tags: @since 2.3.0

Source: includes/Admin/class-rest.php, line 2790

public purge_used_css_cache()

public function purge_used_css_cache(\\WP_REST_Request $request): \\WP_REST_Response

Purge page cache and used CSS together via a single action (issue #1023).

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.0.0 Facade proxy (ARCH-011): logic lives in {@see Rest_Cache::purge_used_css_cache}.

Source: includes/Admin/class-rest.php, line 2880

public purge_derived_caches()

public function purge_derived_caches(\\WP_REST_Request $_request): \\WP_REST_Response

Manually purge all derived caches (page cache + used-CSS + critical-CSS).

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object (unused).

Return: \\WP_REST_Response — The response object.

Tags: @since 2.2.0

Source: includes/Admin/class-rest.php, line 2899

public get_upgrade_purge_status()

public function get_upgrade_purge_status(\\WP_REST_Request $_request): \\WP_REST_Response

SPA-visible upgrade-purge status: last-purge reason + safe-mode preview link.

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object (unused).

Return: \\WP_REST_Response — The response object.

Tags: @since 2.2.0

Source: includes/Admin/class-rest.php, line 2963

public get_server_rules()

public function get_server_rules(\\WP_REST_Request $_request): \\WP_REST_Response

Returns server-level performance rules (Apache/Nginx).

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object (unused).

Return: \\WP_REST_Response — The response object.

Tags: @since 1.6.0

Source: includes/Admin/class-rest.php, line 2996

public regenerate_ccss()

public function regenerate_ccss(\\WP_REST_Request $_request): \\WP_REST_Response

Regenerate critical CSS for all templates.

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.0.0 · @since 2.3.0 Single-template safe-rollout flags.

Source: includes/Admin/class-rest.php, line 3021

public get_ccss_status()

public function get_ccss_status(\\WP_REST_Request $_request): \\WP_REST_Response

Get critical CSS status per template.

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.0.0

Source: includes/Admin/class-rest.php, line 3192

public get_used_css_status()

public function get_used_css_status(\\WP_REST_Request $request): \\WP_REST_Response

Get used-CSS staleness status (issue #1220).

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.2.0 · @since 2.3.0 Optional post_id rollout detail.

Source: includes/Admin/class-rest.php, line 3213

public get_ai_model()

public function get_ai_model(\\WP_REST_Request $_request): \\WP_REST_Response

Get AI adaptive model.

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.0.0

Source: includes/Admin/class-rest.php, line 3256

public ai_learn()

public function ai_learn(\\WP_REST_Request $_request): \\WP_REST_Response

Trigger AI learning.

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.0.0

Source: includes/Admin/class-rest.php, line 3268

public get_ai_suggestions()

public function get_ai_suggestions(\\WP_REST_Request $_request): \\WP_REST_Response

Get AI suggestions.

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.0.0

Source: includes/Admin/class-rest.php, line 3294

public get_sandbox_preview()

public function get_sandbox_preview(\\WP_REST_Request $_request): \\WP_REST_Response

Get sandbox preview status (issue #1163).

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.2.0 Facade proxy (ARCH-011): logic lives in {@see Rest_Settings::get_sandbox_preview}.

Source: includes/Admin/class-rest.php, line 3313

public save_sandbox_preview()

public function save_sandbox_preview(\\WP_REST_Request $request): \\WP_REST_Response

Save staged sandbox settings (issue #1163).

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.2.0 Facade proxy (ARCH-011): logic lives in {@see Rest_Settings::save_sandbox_preview}.

Source: includes/Admin/class-rest.php, line 3328

public promote_sandbox_preview()

public function promote_sandbox_preview(\\WP_REST_Request $_request): \\WP_REST_Response

Promote staged sandbox settings to production (issue #1163).

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.2.0 Facade proxy (ARCH-011): logic lives in {@see Rest_Settings::promote_sandbox_preview}.

Source: includes/Admin/class-rest.php, line 3340

public discard_sandbox_preview()

public function discard_sandbox_preview(\\WP_REST_Request $_request): \\WP_REST_Response

Discard staged sandbox settings (issue #1163).

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.2.0 Facade proxy (ARCH-011): logic lives in {@see Rest_Settings::discard_sandbox_preview}.

Source: includes/Admin/class-rest.php, line 3352

public detect_safe_mode_excludes()

public function detect_safe_mode_excludes(\\WP_REST_Request $_request): \\WP_REST_Response

Auto-exclude detector for the minify/combine/defer stack (issue #1465).

ParameterTypeDefaultDescription
$_request\\WP_REST_Request—The request object. Optional `handles` param for accuracy.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.3.0

Source: includes/Admin/class-rest.php, line 3380

public handle_safe_mode()

public function handle_safe_mode(\\WP_REST_Request $request): \\WP_REST_Response

One-click safe mode for the minify/combine/defer stack (issue #1465).

ParameterTypeDefaultDescription
$request\\WP_REST_Request—The request object.

Return: \\WP_REST_Response — The response object.

Tags: @since 2.3.0

Source: includes/Admin/class-rest.php, line 3535

public dismiss_welcome()

public function dismiss_welcome(?\\WP_REST_Request=null $request): \\WP_REST_Response

Dismisses the welcome panel for the current user.

ParameterTypeDefaultDescription
$request?\\WP_REST_Request=null—The request object (unused; present for route-callback signature parity).

Return: \\WP_REST_Response — The response object.

Tags: @since 2.0.0

Source: includes/Admin/class-rest.php, line 3628

private send_response()

private function send_response($data, =true $success, =200 $status_code, =null $message)

Sends a REST API response.

ParameterTypeDefaultDescription
$datamixed—The data to return in the response.
$success=true—Indicates whether the request was successful.
$status_code=200—The HTTP status code.
$message=null—The response message.

Return: \\WP_REST_Response — The response object.

Tags: @since 1.0.0

Source: includes/Admin/class-rest.php, line 3645

Hooks

Hooks referenced in includes/Admin/class-rest.php:

HookTypeLineNotes
wppo_optimise_image_capfilter1262—