1 | <?php |
||
26 | trait Route { |
||
27 | /** |
||
28 | * Current mirror according to configuration |
||
29 | * |
||
30 | * @var int |
||
31 | */ |
||
32 | public $mirror_index; |
||
33 | /** |
||
34 | * Normalized processed representation of relative address, may differ from raw, should be used in most cases |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | public $path_normalized; |
||
39 | /** |
||
40 | * Contains parsed route of current page url in form of array without module name and prefixes <i>admin</i>/<i>api</i> |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | public $route; |
||
45 | /** |
||
46 | * Like $route property, but excludes numerical items |
||
47 | * |
||
48 | * @var string[] |
||
49 | */ |
||
50 | public $route_path; |
||
51 | /** |
||
52 | * Like $route property, but only includes numerical items (opposite to route_path property) |
||
53 | * |
||
54 | * @var int[] |
||
55 | */ |
||
56 | public $route_ids; |
||
57 | /** |
||
58 | * Request to administration section |
||
59 | * |
||
60 | * @var bool |
||
61 | */ |
||
62 | public $admin_path; |
||
63 | /** |
||
64 | * Request to api section |
||
65 | * |
||
66 | * @var bool |
||
67 | */ |
||
68 | public $api_path; |
||
69 | /** |
||
70 | * Current module |
||
71 | * |
||
72 | * @var string |
||
73 | */ |
||
74 | public $current_module; |
||
75 | /** |
||
76 | * Home page |
||
77 | * |
||
78 | * @var bool |
||
79 | */ |
||
80 | public $home_page; |
||
81 | /** |
||
82 | * Initialize route based on system configuration, requires `::init_server()` being called first since uses its data |
||
83 | * |
||
84 | * @throws ExitException |
||
85 | */ |
||
86 | function init_route () { |
||
140 | /** |
||
141 | * Process raw relative route. |
||
142 | * |
||
143 | * As result returns current route in system in form of array, corrected page address, detects MODULE, that responsible for processing this url, |
||
144 | * whether this is API call, admin page, or home page |
||
145 | * |
||
146 | * @param string $path |
||
147 | * |
||
148 | * @return array Array contains next elements: `route`, `path_normalized`, `admin_path`, `api_path`, `current_module`, `home_page` |
||
149 | */ |
||
150 | function analyze_route_path ($path) { |
||
201 | /** |
||
202 | * @param Config $Config |
||
203 | * @param string $path_normalized |
||
204 | * |
||
205 | * @throws ExitException |
||
206 | */ |
||
207 | protected function handle_redirect ($Config, $path_normalized) { |
||
223 | /** |
||
224 | * Check whether referer is local |
||
225 | * |
||
226 | * @param Config $Config |
||
227 | * |
||
228 | * @return bool |
||
229 | */ |
||
230 | protected function is_referer_local ($Config) { |
||
248 | /** |
||
249 | * Determine module of current page based on page path and system configuration |
||
250 | * |
||
251 | * @param array $rc |
||
252 | * @param bool $home_page |
||
253 | * @param string $admin_path |
||
254 | * @param string $api_path |
||
255 | * |
||
256 | * @return mixed|string |
||
257 | */ |
||
258 | protected function determine_page_module (&$rc, &$home_page, $admin_path, $api_path) { |
||
276 | /** |
||
277 | * Get array of modules |
||
278 | * |
||
279 | * @param Config $Config |
||
280 | * @param bool $admin_path |
||
281 | * |
||
282 | * @return array Array of form [localized_module_name => module_name] |
||
283 | */ |
||
284 | protected function get_modules ($Config, $admin_path) { |
||
305 | } |
||
306 |