PluginProbe
404 Solution / trunk
404 Solution vtrunk
4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.2.0 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.1.7 4.1.6 4.1.5 4.1.4 4.1.3 trunk 2.30.0 All 109 releases
404-solution / includes / frontend / RequestContext.php

RequestContext.php in 404 Solution trunk, at includes/frontend/RequestContext.php

68 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 /**
50 * Container factory entry point. Materializes the singleton lazily and
51 * returns it so the DI container path and the direct-class-accessor
52 * path share the same per-process message bus instance.
53 *
54 * @return self
55 */
56 public static function resolveForContainer(): ABJ_404_Solution_RequestContext {
57 if (self::$instance === null) {
58 self::$instance = new self();
59 }
60 return self::$instance;
61 }
62
63 /** Reset the singleton (for tests). */
64 public static function reset(): void {
65 self::$instance = null;
66 }
67 }
68