| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Request-scoped context object that replaces $_REQUEST[ABJ404_PP] as an |
| 9 |
* intra-request message bus. |
| 10 |
* |
| 11 |
* Holds debug traces, cached permalink results, timing data, and per-request |
| 12 |
* ignore flags — all state that was previously smuggled through the HTTP |
| 13 |
* superglobal. |
| 14 |
*/ |
| 15 |
class ABJ_404_Solution_RequestContext { |
| 16 |
|
| 17 |
/** @var ABJ_404_Solution_RequestContext|null */ |
| 18 |
private static $instance = null; |
| 19 |
|
| 20 |
/** @var string Debug breadcrumb for error handler context. */ |
| 21 |
public $debug_info = ''; |
| 22 |
|
| 23 |
/** @var string JSON-encoded permalink results (fast-path cache for shortcode). */ |
| 24 |
public $permalinks_found = ''; |
| 25 |
|
| 26 |
/** @var string JSON-encoded kept permalinks (for debug logging). */ |
| 27 |
public $permalinks_kept = ''; |
| 28 |
|
| 29 |
/** @var float|null Process start time for benchmarking. */ |
| 30 |
public $process_start_time = null; |
| 31 |
|
| 32 |
/** @var string|false Reason to ignore this request (do not process). */ |
| 33 |
public $ignore_donotprocess = false; |
| 34 |
|
| 35 |
/** @var string|false Reason to ignore this request (process ok). */ |
| 36 |
public $ignore_doprocess = false; |
| 37 |
|
| 38 |
/** @var string The requested URL stored for the shortcode to read. */ |
| 39 |
public $requested_url = ''; |
| 40 |
|
| 41 |
/** @return ABJ_404_Solution_RequestContext */ |
| 42 |
public static function getInstance(): ABJ_404_Solution_RequestContext { |
| 43 |
if (self::$instance === null) { |
| 44 |
self::$instance = new self(); |
| 45 |
} |
| 46 |
return self::$instance; |
| 47 |
} |
| 48 |
|
| 49 |
/** Reset the singleton (for tests). */ |
| 50 |
public static function reset(): void { |
| 51 |
self::$instance = null; |
| 52 |
} |
| 53 |
} |
| 54 |
|