includes/Settings/class-sandbox-preview.php
Safe-mode sandbox preview for asset optimization.
Class Sandbox_Preview
Class Sandbox_Preview
final class Sandbox_PreviewConstants
| Constant | Visibility | Value | Line |
|---|---|---|---|
QUERY_VAR | public | \'wppo_preview\' | 36 |
PREVIEW_VALUE | public | \'assets\' | 44 |
NONCE_ACTION | public | \'wppo_preview_assets\' | 52 |
NONCE_VAR | public | \'_wppo_preview_nonce\' | 60 |
STAGED_KEY | public | \'sandboxStaged\' | 68 |
ALLOWED_STAGED_KEYS | public | array( \'delayJS\', \'deferJS\', \'combineCSS\', \'elementorSafeMode\', \'delayJSExternalOnly\', \'minifyInlineJS\', \'excludeDelayJS\', \'excludeDeferJS\', \'excludeCombineCSS\', \'delayJSThirdParty\', \'delayJSThirdPartyAuto\', \'delayJSThirdPartyDenylist\', \'delayJSThirdPartyAllowlist\', ) | 85 |
Properties
| Property | Visibility | Type | Default | Line |
|---|---|---|---|---|
$preview_memo | private static | bool|null | null | 107 |
publicstatic reset_memo()
public static function reset_memo(): voidReset per-request memo (for tests).
Return: void.
publicstatic is_preview_request()
public static function is_preview_request(): boolWhether the current request is a valid admin asset-preview request.
Return: bool — True when experimental output may render for this request.
publicstatic enforce_no_cache()
public static function enforce_no_cache(): voidEnforce no-cache semantics for preview requests.
Return: void.
publicstatic get_staged_settings()
public static function get_staged_settings(): arrayGet staged experimental settings.
Return: array — Staged file_optimisation slice (possibly empty).
publicstatic is_staged_available()
public static function is_staged_available(): boolWhether staged experimental values exist.
Return: bool — True when at least one staged key is stored.
publicstatic get_effective_file_optimisation()
public static function get_effective_file_optimisation(array=array() $production): arrayCompute effective file_optimisation settings for this request. Parameter Type Default Description $productionarray=array()— Production file_optimisation slice.
Return: array — Effective slice to render with.
publicstatic sanitize_staged()
public static function sanitize_staged(array $staged): arraySanitize a staged payload down to the allowlisted asset keys. Parameter Type Default Description $stagedarray— Raw staged payload.
Return: array — Sanitized staged payload.
publicstatic save_staged()
public static function save_staged(array $staged): boolPersist staged experimental settings (admin only). Parameter Type Default Description $stagedarray— Raw staged payload.
Return: bool — True on success.
publicstatic promote_staged()
public static function promote_staged(): boolPromote staged settings to production (admin only).
Return: bool — True on success.
publicstatic discard_staged()
public static function discard_staged(): boolDiscard staged settings (admin only).
Return: bool — True on success.
publicstatic get_preview_url()
public static function get_preview_url(string=\'\' $url): stringBuild an admin-only preview URL for a frontend URL. Parameter Type Default Description $urlstring=\'\'— Frontend URL to preview.
Return: string — Preview URL with query var + nonce.