PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.2.8
Yatra – Travel Booking & Tour Operator Software v3.0.2.8
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
yatra / app / Core / Handlers / BasePageHandler.php

BasePageHandler.php in Yatra – Travel Booking & Tour Operator Software 3.0.2.8, at app/Core/Handlers/BasePageHandler.php

93 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Yatra\Core\Handlers;
6
7 /**
8 * Base Page Handler
9 *
10 * Provides common functionality for all page handlers
11 */
12 abstract class BasePageHandler
13 {
14 /**
15 * Handle the page request
16 *
17 * @param array $route_data Route data from RouteMatcher
18 * @return bool True if handled successfully
19 */
20 abstract public function handle(array $route_data): bool;
21
22 /**
23 * Set query vars for backward compatibility
24 *
25 * @param array $vars Query vars to set
26 */
27 protected function setQueryVars(array $vars): void
28 {
29 global $wp_query;
30
31 foreach ($vars as $key => $value) {
32 $wp_query->set($key, $value);
33 }
34 }
35
36 /**
37 * Set 404 status
38 */
39 protected function set404(): void
40 {
41 global $wp_query;
42
43 $wp_query->set_404();
44 status_header(404);
45 }
46
47 /**
48 * Prevent 404 handling and set 200 status
49 */
50 protected function prevent404(): void
51 {
52 global $wp_query;
53
54 $wp_query->is_404 = false;
55 status_header(200);
56 }
57
58 /**
59 * Set global variable
60 *
61 * @param string $name Variable name
62 * @param mixed $value Variable value
63 */
64 protected function setGlobal(string $name, $value): void
65 {
66 $GLOBALS[$name] = $value;
67 }
68
69 /**
70 * Log error message
71 *
72 * @param string $message Error message
73 */
74 protected function logError(string $message): void
75 {
76 if (defined('WP_DEBUG') && WP_DEBUG) {
77 }
78 }
79
80 /**
81 * Exit with optional message
82 *
83 * @param string|null $message Optional exit message
84 */
85 protected function exit(?string $message = null): void
86 {
87 if ($message && defined('WP_DEBUG') && WP_DEBUG) {
88 echo '<!-- ' . esc_html($message) . ' -->';
89 }
90 exit;
91 }
92 }
93