| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Identity and dispatch order for the adaptive AJAX canary ladder. |
| 9 |
* |
| 10 |
* The static-asset probe is a receipt-only browser step. Every other value |
| 11 |
* appears in DISPATCHED in the exact order accepted by the server endpoint. |
| 12 |
*/ |
| 13 |
final class ABJ_404_Solution_CanaryLadderStep { |
| 14 |
|
| 15 |
/** Browser-only probe that is legal on receipts but never dispatched. */ |
| 16 |
const STATIC_ASSET = 'static_asset'; |
| 17 |
const CONCURRENT_CONTROL = 'concurrent_control'; |
| 18 |
const BASELINE_CONTROL = 'baseline_control'; |
| 19 |
const AUTH_ONLY = 'auth_only'; |
| 20 |
const POST_LIMITER = 'post_limiter'; |
| 21 |
const SUMMARY = 'summary'; |
| 22 |
const SIZE_TARGET = 'size_target'; |
| 23 |
const SIZE_PROBE = 'size_probe'; |
| 24 |
const INERT = 'inert'; |
| 25 |
const COMPRESS_ON = 'compress_on'; |
| 26 |
const COMPRESS_OFF = 'compress_off'; |
| 27 |
const STREAM = 'stream'; |
| 28 |
const INTERPRET = 'interpret'; |
| 29 |
|
| 30 |
/** Every server-dispatched step. The browser-only static asset is excluded. */ |
| 31 |
const DISPATCHED = array( |
| 32 |
self::CONCURRENT_CONTROL, self::BASELINE_CONTROL, self::AUTH_ONLY, |
| 33 |
self::POST_LIMITER, self::SUMMARY, self::SIZE_TARGET, self::SIZE_PROBE, |
| 34 |
self::INERT, self::COMPRESS_ON, self::COMPRESS_OFF, self::STREAM, |
| 35 |
self::INTERPRET, |
| 36 |
); |
| 37 |
|
| 38 |
/** |
| 39 |
* Convert an untrusted request value to a dispatchable step ID. |
| 40 |
* |
| 41 |
* @param mixed $raw |
| 42 |
*/ |
| 43 |
public static function normalize($raw): string { |
| 44 |
$candidate = is_scalar($raw) ? (string)$raw : ''; |
| 45 |
return in_array($candidate, self::DISPATCHED, true) ? $candidate : ''; |
| 46 |
} |
| 47 |
} |
| 48 |
|