1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace EventEspresso\core\domain\entities\routing\handlers\shared; |
4
|
|
|
|
5
|
|
|
use EE_Dependency_Map; |
6
|
|
|
use EventEspresso\core\domain\entities\routing\handlers\Route; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class RoutingRequests |
10
|
|
|
* registers dependencies for all other Routes as long as this is not an activation request |
11
|
|
|
* |
12
|
|
|
* @package EventEspresso\core\domain\entities\routing\handlers\shared |
13
|
|
|
* @author Brent Christensen |
14
|
|
|
* @since \$VID:$ |
15
|
|
|
*/ |
16
|
|
|
class RoutingRequests extends Route |
17
|
|
|
{ |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* returns true if the current request matches this route |
21
|
|
|
* |
22
|
|
|
* @return bool |
23
|
|
|
* @since $VID:$ |
24
|
|
|
*/ |
25
|
|
|
public function matchesCurrentRequest() |
26
|
|
|
{ |
27
|
|
|
return ! $this->request->isActivation() || $this->request->isUnitTesting(); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @since $VID:$ |
33
|
|
|
*/ |
34
|
|
|
protected function registerDependencies() |
35
|
|
|
{ |
36
|
|
|
$default = [ |
37
|
|
|
'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
38
|
|
|
'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
39
|
|
|
'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
40
|
|
|
]; |
41
|
|
|
$admin = [ |
42
|
|
|
'EE_Admin_Config' => EE_Dependency_Map::load_from_cache, |
43
|
|
|
'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
44
|
|
|
'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
45
|
|
|
'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
46
|
|
|
'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
47
|
|
|
]; |
48
|
|
|
$frontend = [ |
49
|
|
|
'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
50
|
|
|
'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
51
|
|
|
'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
52
|
|
|
'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
53
|
|
|
]; |
54
|
|
|
$default_routes = [ |
55
|
|
|
// admin dependencies |
56
|
|
|
'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventsAdmin' => $admin, |
57
|
|
|
'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventEditor' => $admin, |
58
|
|
|
'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoLegacyAdmin' => $admin, |
59
|
|
|
// default dependencies |
60
|
|
|
'EventEspresso\core\domain\entities\routing\handlers\admin\PueRequests' => $default, |
61
|
|
|
'EventEspresso\core\domain\entities\routing\handlers\admin\WordPressPluginsPage' => $default, |
62
|
|
|
'EventEspresso\core\domain\entities\routing\handlers\frontend\ShortcodeRequests' => $default, |
63
|
|
|
'EventEspresso\core\domain\entities\routing\handlers\shared\AssetRequests' => $default, |
64
|
|
|
'EventEspresso\core\domain\entities\routing\handlers\shared\GQLRequests' => $default, |
65
|
|
|
'EventEspresso\core\domain\entities\routing\handlers\shared\RestApiRequests' => $default, |
66
|
|
|
'EventEspresso\core\domain\entities\routing\handlers\shared\SessionRequests' => $default, |
67
|
|
|
'EventEspresso\core\domain\entities\routing\handlers\shared\WordPressHeartbeat' => $default, |
68
|
|
|
// frontend dependencies |
69
|
|
|
'EventEspresso\core\domain\entities\routing\handlers\admin\PersonalDataRequests' => $frontend, |
70
|
|
|
'EventEspresso\core\domain\entities\routing\handlers\frontend\FrontendRequests' => $frontend, |
71
|
|
|
]; |
72
|
|
|
foreach ($default_routes as $route => $dependencies) { |
73
|
|
|
$this->dependency_map->registerDependencies($route, $dependencies); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* implements logic required to run during request |
80
|
|
|
* |
81
|
|
|
* @return bool |
82
|
|
|
* @since $VID:$ |
83
|
|
|
*/ |
84
|
|
|
protected function requestHandler() |
85
|
|
|
{ |
86
|
|
|
return true; |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|