@@ -19,154 +19,154 @@ |
||
19 | 19 | */ |
20 | 20 | class EspressoLegacyAdmin extends AdminRoute |
21 | 21 | { |
22 | - /** |
|
23 | - * @var LegacyAccountingAssetManager|null $asset_manager |
|
24 | - */ |
|
25 | - protected ?AssetManagerInterface $asset_manager = null; |
|
22 | + /** |
|
23 | + * @var LegacyAccountingAssetManager|null $asset_manager |
|
24 | + */ |
|
25 | + protected ?AssetManagerInterface $asset_manager = null; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * returns true if the current request matches this route |
|
30 | - * |
|
31 | - * @return bool |
|
32 | - * @since 5.0.0.p |
|
33 | - */ |
|
34 | - public function matchesCurrentRequest(): bool |
|
35 | - { |
|
36 | - global $pagenow; |
|
37 | - $page = $this->request->getRequestParam('page'); |
|
38 | - return ($pagenow === 'admin.php' || $pagenow === 'admin-ajax.php') |
|
39 | - && ( |
|
40 | - $page === 'pricing' |
|
41 | - || strpos($page, 'espresso') !== false |
|
42 | - || apply_filters( |
|
43 | - 'FHEE__EspressoLegacyAdmin__matchesCurrentRequest__page', |
|
44 | - false, |
|
45 | - $page |
|
46 | - ) |
|
47 | - ) |
|
48 | - && parent::matchesCurrentRequest(); |
|
49 | - } |
|
28 | + /** |
|
29 | + * returns true if the current request matches this route |
|
30 | + * |
|
31 | + * @return bool |
|
32 | + * @since 5.0.0.p |
|
33 | + */ |
|
34 | + public function matchesCurrentRequest(): bool |
|
35 | + { |
|
36 | + global $pagenow; |
|
37 | + $page = $this->request->getRequestParam('page'); |
|
38 | + return ($pagenow === 'admin.php' || $pagenow === 'admin-ajax.php') |
|
39 | + && ( |
|
40 | + $page === 'pricing' |
|
41 | + || strpos($page, 'espresso') !== false |
|
42 | + || apply_filters( |
|
43 | + 'FHEE__EspressoLegacyAdmin__matchesCurrentRequest__page', |
|
44 | + false, |
|
45 | + $page |
|
46 | + ) |
|
47 | + ) |
|
48 | + && parent::matchesCurrentRequest(); |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * @since 5.0.0.p |
|
54 | - */ |
|
55 | - protected function registerDependencies() |
|
56 | - { |
|
57 | - $asset_manger_dependencies = [ |
|
58 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
59 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object, |
|
60 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
61 | - ]; |
|
62 | - $this->dependency_map->registerDependencies(JqueryAssetManager::class, $asset_manger_dependencies); |
|
63 | - $this->dependency_map->registerDependencies(EspressoLegacyAdminAssetManager::class, $asset_manger_dependencies); |
|
64 | - $this->dependency_map->registerDependencies( |
|
65 | - LegacyAccountingAssetManager::class, |
|
66 | - ['EE_Currency_Config' => EE_Dependency_Map::load_from_cache] + $asset_manger_dependencies |
|
67 | - ); |
|
68 | - $this->dependency_map->registerDependencies( |
|
69 | - 'EE_Admin_Transactions_List_Table', |
|
70 | - [ |
|
71 | - null, |
|
72 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
73 | - ] |
|
74 | - ); |
|
75 | - $this->dependency_map->registerDependencies( |
|
76 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings', |
|
77 | - ['EE_Registration_Config' => EE_Dependency_Map::load_from_cache] |
|
78 | - ); |
|
79 | - $this->dependency_map->registerDependencies( |
|
80 | - 'EventEspresso\admin_pages\general_settings\OrganizationSettings', |
|
81 | - [ |
|
82 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
83 | - 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
84 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
85 | - 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
86 | - 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
87 | - 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => EE_Dependency_Map::load_from_cache, |
|
88 | - ] |
|
89 | - ); |
|
90 | - $this->dependency_map->registerDependencies( |
|
91 | - 'EventEspresso\core\services\address\CountrySubRegionDao', |
|
92 | - [ |
|
93 | - 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
94 | - 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache, |
|
95 | - ] |
|
96 | - ); |
|
97 | - $this->dependency_map->registerDependencies( |
|
98 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder', |
|
99 | - [ |
|
100 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
101 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
102 | - null, |
|
103 | - ] |
|
104 | - ); |
|
105 | - $this->dependency_map->registerDependencies( |
|
106 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader', |
|
107 | - [ |
|
108 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
109 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
110 | - ] |
|
111 | - ); |
|
112 | - $this->dependency_map->registerDependencies( |
|
113 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader', |
|
114 | - [ |
|
115 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
116 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
117 | - ] |
|
118 | - ); |
|
119 | - $this->dependency_map->registerDependencies( |
|
120 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader', |
|
121 | - [ |
|
122 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
123 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
124 | - ] |
|
125 | - ); |
|
126 | - $this->dependency_map->registerDependencies( |
|
127 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader', |
|
128 | - [ |
|
129 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
130 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
131 | - ] |
|
132 | - ); |
|
133 | - $this->dependency_map->registerDependencies( |
|
134 | - 'EventEspresso\core\services\admin\AdminListTableFilters', |
|
135 | - [ |
|
136 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
137 | - ] |
|
138 | - ); |
|
139 | - $this->dependency_map->registerDependencies( |
|
140 | - ServiceChangesManager::class, |
|
141 | - [ |
|
142 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
143 | - 'EventEspresso\core\services\loaders\LoaderInterface' => EE_Dependency_Map::load_from_cache, |
|
144 | - ] |
|
145 | - ); |
|
146 | - } |
|
52 | + /** |
|
53 | + * @since 5.0.0.p |
|
54 | + */ |
|
55 | + protected function registerDependencies() |
|
56 | + { |
|
57 | + $asset_manger_dependencies = [ |
|
58 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
59 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object, |
|
60 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
61 | + ]; |
|
62 | + $this->dependency_map->registerDependencies(JqueryAssetManager::class, $asset_manger_dependencies); |
|
63 | + $this->dependency_map->registerDependencies(EspressoLegacyAdminAssetManager::class, $asset_manger_dependencies); |
|
64 | + $this->dependency_map->registerDependencies( |
|
65 | + LegacyAccountingAssetManager::class, |
|
66 | + ['EE_Currency_Config' => EE_Dependency_Map::load_from_cache] + $asset_manger_dependencies |
|
67 | + ); |
|
68 | + $this->dependency_map->registerDependencies( |
|
69 | + 'EE_Admin_Transactions_List_Table', |
|
70 | + [ |
|
71 | + null, |
|
72 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
73 | + ] |
|
74 | + ); |
|
75 | + $this->dependency_map->registerDependencies( |
|
76 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings', |
|
77 | + ['EE_Registration_Config' => EE_Dependency_Map::load_from_cache] |
|
78 | + ); |
|
79 | + $this->dependency_map->registerDependencies( |
|
80 | + 'EventEspresso\admin_pages\general_settings\OrganizationSettings', |
|
81 | + [ |
|
82 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
83 | + 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
84 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
85 | + 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
86 | + 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
87 | + 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => EE_Dependency_Map::load_from_cache, |
|
88 | + ] |
|
89 | + ); |
|
90 | + $this->dependency_map->registerDependencies( |
|
91 | + 'EventEspresso\core\services\address\CountrySubRegionDao', |
|
92 | + [ |
|
93 | + 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
94 | + 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache, |
|
95 | + ] |
|
96 | + ); |
|
97 | + $this->dependency_map->registerDependencies( |
|
98 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder', |
|
99 | + [ |
|
100 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
101 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
102 | + null, |
|
103 | + ] |
|
104 | + ); |
|
105 | + $this->dependency_map->registerDependencies( |
|
106 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader', |
|
107 | + [ |
|
108 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
109 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
110 | + ] |
|
111 | + ); |
|
112 | + $this->dependency_map->registerDependencies( |
|
113 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader', |
|
114 | + [ |
|
115 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
116 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
117 | + ] |
|
118 | + ); |
|
119 | + $this->dependency_map->registerDependencies( |
|
120 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader', |
|
121 | + [ |
|
122 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
123 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
124 | + ] |
|
125 | + ); |
|
126 | + $this->dependency_map->registerDependencies( |
|
127 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader', |
|
128 | + [ |
|
129 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
130 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
131 | + ] |
|
132 | + ); |
|
133 | + $this->dependency_map->registerDependencies( |
|
134 | + 'EventEspresso\core\services\admin\AdminListTableFilters', |
|
135 | + [ |
|
136 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
137 | + ] |
|
138 | + ); |
|
139 | + $this->dependency_map->registerDependencies( |
|
140 | + ServiceChangesManager::class, |
|
141 | + [ |
|
142 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
143 | + 'EventEspresso\core\services\loaders\LoaderInterface' => EE_Dependency_Map::load_from_cache, |
|
144 | + ] |
|
145 | + ); |
|
146 | + } |
|
147 | 147 | |
148 | 148 | |
149 | - /** |
|
150 | - * implements logic required to run during request |
|
151 | - * |
|
152 | - * @return bool |
|
153 | - * @since 5.0.0.p |
|
154 | - */ |
|
155 | - protected function requestHandler(): bool |
|
156 | - { |
|
157 | - add_filter( |
|
158 | - 'admin_body_class', |
|
159 | - function ($classes) { |
|
160 | - if (strpos($classes, 'espresso-admin') === false) { |
|
161 | - $classes .= ' espresso-admin'; |
|
162 | - } |
|
163 | - return $classes; |
|
164 | - } |
|
165 | - ); |
|
166 | - $this->loader->getShared(JqueryAssetManager::class); |
|
167 | - $this->loader->getShared(EspressoLegacyAdminAssetManager::class); |
|
168 | - $this->loader->getShared(LegacyAccountingAssetManager::class); |
|
169 | - $this->loader->getShared(ServiceChangesManager::class); |
|
170 | - return true; |
|
171 | - } |
|
149 | + /** |
|
150 | + * implements logic required to run during request |
|
151 | + * |
|
152 | + * @return bool |
|
153 | + * @since 5.0.0.p |
|
154 | + */ |
|
155 | + protected function requestHandler(): bool |
|
156 | + { |
|
157 | + add_filter( |
|
158 | + 'admin_body_class', |
|
159 | + function ($classes) { |
|
160 | + if (strpos($classes, 'espresso-admin') === false) { |
|
161 | + $classes .= ' espresso-admin'; |
|
162 | + } |
|
163 | + return $classes; |
|
164 | + } |
|
165 | + ); |
|
166 | + $this->loader->getShared(JqueryAssetManager::class); |
|
167 | + $this->loader->getShared(EspressoLegacyAdminAssetManager::class); |
|
168 | + $this->loader->getShared(LegacyAccountingAssetManager::class); |
|
169 | + $this->loader->getShared(ServiceChangesManager::class); |
|
170 | + return true; |
|
171 | + } |
|
172 | 172 | } |
@@ -24,26 +24,26 @@ |
||
24 | 24 | */ |
25 | 25 | abstract class PublicRoute extends Route |
26 | 26 | { |
27 | - protected EE_Maintenance_Mode $maintenance_mode; |
|
27 | + protected EE_Maintenance_Mode $maintenance_mode; |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @param EE_Maintenance_Mode $maintenance_mode |
|
32 | - * @param EE_Dependency_Map $dependency_map |
|
33 | - * @param LoaderInterface $loader |
|
34 | - * @param RequestInterface $request |
|
35 | - * @param JsonDataNode|null $data_node |
|
36 | - * @param RouteMatchSpecificationInterface|null $specification |
|
37 | - */ |
|
38 | - public function __construct( |
|
39 | - EE_Maintenance_Mode $maintenance_mode, |
|
40 | - EE_Dependency_Map $dependency_map, |
|
41 | - LoaderInterface $loader, |
|
42 | - RequestInterface $request, |
|
43 | - JsonDataNode $data_node = null, |
|
44 | - RouteMatchSpecificationInterface $specification = null |
|
45 | - ) { |
|
46 | - $this->maintenance_mode = $maintenance_mode; |
|
47 | - parent::__construct($dependency_map, $loader, $request, $data_node, $specification); |
|
48 | - } |
|
30 | + /** |
|
31 | + * @param EE_Maintenance_Mode $maintenance_mode |
|
32 | + * @param EE_Dependency_Map $dependency_map |
|
33 | + * @param LoaderInterface $loader |
|
34 | + * @param RequestInterface $request |
|
35 | + * @param JsonDataNode|null $data_node |
|
36 | + * @param RouteMatchSpecificationInterface|null $specification |
|
37 | + */ |
|
38 | + public function __construct( |
|
39 | + EE_Maintenance_Mode $maintenance_mode, |
|
40 | + EE_Dependency_Map $dependency_map, |
|
41 | + LoaderInterface $loader, |
|
42 | + RequestInterface $request, |
|
43 | + JsonDataNode $data_node = null, |
|
44 | + RouteMatchSpecificationInterface $specification = null |
|
45 | + ) { |
|
46 | + $this->maintenance_mode = $maintenance_mode; |
|
47 | + parent::__construct($dependency_map, $loader, $request, $data_node, $specification); |
|
48 | + } |
|
49 | 49 | } |
@@ -14,45 +14,45 @@ |
||
14 | 14 | */ |
15 | 15 | class RegistrationCheckoutRequests extends FrontendRequests |
16 | 16 | { |
17 | - /** |
|
18 | - * returns true if the current request matches this route |
|
19 | - * child classes can override and use Request directly to match route with request |
|
20 | - * or supply a RouteMatchSpecification class and just use the below |
|
21 | - * |
|
22 | - * @return bool |
|
23 | - * @since 5.0.0.p |
|
24 | - */ |
|
25 | - public function matchesCurrentRequest(): bool |
|
26 | - { |
|
27 | - return parent::matchesCurrentRequest() |
|
28 | - && ( |
|
29 | - str_contains($this->request->requestUri(false, true), 'registration-checkout') |
|
30 | - || $this->request->getRequestParam('action', '', DataType::STRING) === 'process_reg_step' |
|
31 | - || $this->request->getRequestParam('action', '', DataType::STRING) === 'display_spco_reg_step' |
|
32 | - ); |
|
33 | - } |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * @since 5.0.0.p |
|
38 | - */ |
|
39 | - protected function registerDependencies() |
|
40 | - { |
|
41 | - |
|
42 | - } |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * implements logic required to run during request |
|
47 | - * |
|
48 | - * @return bool |
|
49 | - * @since 5.0.0.p |
|
50 | - */ |
|
51 | - protected function requestHandler(): bool |
|
52 | - { |
|
53 | - do_action( |
|
54 | - 'AHEE__EventEspresso_core_domain_entities_routing_handlers_frontend_RegistrationCheckoutRequests__requestHandler' |
|
55 | - ); |
|
56 | - return true; |
|
57 | - } |
|
17 | + /** |
|
18 | + * returns true if the current request matches this route |
|
19 | + * child classes can override and use Request directly to match route with request |
|
20 | + * or supply a RouteMatchSpecification class and just use the below |
|
21 | + * |
|
22 | + * @return bool |
|
23 | + * @since 5.0.0.p |
|
24 | + */ |
|
25 | + public function matchesCurrentRequest(): bool |
|
26 | + { |
|
27 | + return parent::matchesCurrentRequest() |
|
28 | + && ( |
|
29 | + str_contains($this->request->requestUri(false, true), 'registration-checkout') |
|
30 | + || $this->request->getRequestParam('action', '', DataType::STRING) === 'process_reg_step' |
|
31 | + || $this->request->getRequestParam('action', '', DataType::STRING) === 'display_spco_reg_step' |
|
32 | + ); |
|
33 | + } |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * @since 5.0.0.p |
|
38 | + */ |
|
39 | + protected function registerDependencies() |
|
40 | + { |
|
41 | + |
|
42 | + } |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * implements logic required to run during request |
|
47 | + * |
|
48 | + * @return bool |
|
49 | + * @since 5.0.0.p |
|
50 | + */ |
|
51 | + protected function requestHandler(): bool |
|
52 | + { |
|
53 | + do_action( |
|
54 | + 'AHEE__EventEspresso_core_domain_entities_routing_handlers_frontend_RegistrationCheckoutRequests__requestHandler' |
|
55 | + ); |
|
56 | + return true; |
|
57 | + } |
|
58 | 58 | } |
@@ -19,229 +19,229 @@ |
||
19 | 19 | */ |
20 | 20 | class GQLRequests extends Route |
21 | 21 | { |
22 | - private AssetManifestFactory $manifest_factory; |
|
22 | + private AssetManifestFactory $manifest_factory; |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * AssetRequests constructor. |
|
27 | - * |
|
28 | - * @param EE_Dependency_Map $dependency_map |
|
29 | - * @param LoaderInterface $loader |
|
30 | - * @param RequestInterface $request |
|
31 | - * @param AssetManifestFactory $manifest_factory |
|
32 | - */ |
|
33 | - public function __construct( |
|
34 | - EE_Dependency_Map $dependency_map, |
|
35 | - LoaderInterface $loader, |
|
36 | - RequestInterface $request, |
|
37 | - AssetManifestFactory $manifest_factory |
|
38 | - ) { |
|
39 | - $this->manifest_factory = $manifest_factory; |
|
40 | - parent::__construct($dependency_map, $loader, $request); |
|
41 | - } |
|
25 | + /** |
|
26 | + * AssetRequests constructor. |
|
27 | + * |
|
28 | + * @param EE_Dependency_Map $dependency_map |
|
29 | + * @param LoaderInterface $loader |
|
30 | + * @param RequestInterface $request |
|
31 | + * @param AssetManifestFactory $manifest_factory |
|
32 | + */ |
|
33 | + public function __construct( |
|
34 | + EE_Dependency_Map $dependency_map, |
|
35 | + LoaderInterface $loader, |
|
36 | + RequestInterface $request, |
|
37 | + AssetManifestFactory $manifest_factory |
|
38 | + ) { |
|
39 | + $this->manifest_factory = $manifest_factory; |
|
40 | + parent::__construct($dependency_map, $loader, $request); |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | - /** |
|
45 | - * returns true if the current request matches this route |
|
46 | - * |
|
47 | - * @return bool |
|
48 | - * @since 5.0.0.p |
|
49 | - */ |
|
50 | - public function matchesCurrentRequest(): bool |
|
51 | - { |
|
52 | - global $pagenow; |
|
53 | - return ( |
|
54 | - $this->request->isGQL() |
|
55 | - || $this->request->isUnitTesting() |
|
56 | - || ( |
|
57 | - $this->request->isAdmin() |
|
58 | - && $this->request->getRequestParam('page') === 'espresso_events' |
|
59 | - && ( |
|
60 | - $this->request->getRequestParam('action') === 'create_new' |
|
61 | - || $this->request->getRequestParam('action') === 'edit' |
|
62 | - ) |
|
63 | - ) || ( |
|
64 | - $pagenow |
|
65 | - && ( |
|
66 | - $pagenow === 'post-new.php' |
|
67 | - || ( |
|
68 | - $pagenow === 'post.php' |
|
69 | - && $this->request->getRequestParam('action') === 'edit' |
|
70 | - ) |
|
71 | - ) |
|
72 | - ) |
|
73 | - ); |
|
74 | - } |
|
44 | + /** |
|
45 | + * returns true if the current request matches this route |
|
46 | + * |
|
47 | + * @return bool |
|
48 | + * @since 5.0.0.p |
|
49 | + */ |
|
50 | + public function matchesCurrentRequest(): bool |
|
51 | + { |
|
52 | + global $pagenow; |
|
53 | + return ( |
|
54 | + $this->request->isGQL() |
|
55 | + || $this->request->isUnitTesting() |
|
56 | + || ( |
|
57 | + $this->request->isAdmin() |
|
58 | + && $this->request->getRequestParam('page') === 'espresso_events' |
|
59 | + && ( |
|
60 | + $this->request->getRequestParam('action') === 'create_new' |
|
61 | + || $this->request->getRequestParam('action') === 'edit' |
|
62 | + ) |
|
63 | + ) || ( |
|
64 | + $pagenow |
|
65 | + && ( |
|
66 | + $pagenow === 'post-new.php' |
|
67 | + || ( |
|
68 | + $pagenow === 'post.php' |
|
69 | + && $this->request->getRequestParam('action') === 'edit' |
|
70 | + ) |
|
71 | + ) |
|
72 | + ) |
|
73 | + ); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | - /** |
|
78 | - * @since 5.0.0.p |
|
79 | - */ |
|
80 | - protected function registerDependencies() |
|
81 | - { |
|
82 | - $this->dependency_map->registerDependencies( |
|
83 | - 'EventEspresso\core\services\graphql\GraphQLManager', |
|
84 | - [ |
|
85 | - 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
86 | - 'EventEspresso\core\services\graphql\DataLoaderManager' => EE_Dependency_Map::load_from_cache, |
|
87 | - 'EventEspresso\core\services\graphql\EnumsManager' => EE_Dependency_Map::load_from_cache, |
|
88 | - 'EventEspresso\core\services\graphql\InputsManager' => EE_Dependency_Map::load_from_cache, |
|
89 | - 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
90 | - 'EventEspresso\core\services\graphql\InterfaceManager' => EE_Dependency_Map::load_from_cache |
|
91 | - ] |
|
92 | - ); |
|
93 | - $this->dependency_map->registerDependencies( |
|
94 | - 'EventEspresso\core\services\graphql\TypesManager', |
|
95 | - [ |
|
96 | - 'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
97 | - ] |
|
98 | - ); |
|
99 | - $this->dependency_map->registerDependencies( |
|
100 | - 'EventEspresso\core\services\graphql\InputsManager', |
|
101 | - [ |
|
102 | - 'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache, |
|
103 | - ] |
|
104 | - ); |
|
105 | - $this->dependency_map->registerDependencies( |
|
106 | - 'EventEspresso\core\services\graphql\EnumsManager', |
|
107 | - [ |
|
108 | - 'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache, |
|
109 | - ] |
|
110 | - ); |
|
111 | - $this->dependency_map->registerDependencies( |
|
112 | - 'EventEspresso\core\services\graphql\ConnectionsManager', |
|
113 | - [ |
|
114 | - 'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
115 | - ] |
|
116 | - ); |
|
117 | - $this->dependency_map->registerDependencies( |
|
118 | - 'EventEspresso\core\services\graphql\DataLoaderManager', |
|
119 | - [ |
|
120 | - 'EventEspresso\core\services\graphql\loaders\DataLoaderCollection' => EE_Dependency_Map::load_from_cache, |
|
121 | - ] |
|
122 | - ); |
|
123 | - $this->dependency_map->registerDependencies( |
|
124 | - 'EventEspresso\core\services\graphql\InterfaceManager', |
|
125 | - ['EventEspresso\core\services\graphql\interfaces\InterfaceCollection' => EE_Dependency_Map::load_from_cache], |
|
126 | - ); |
|
127 | - $this->dependency_map->registerDependencies( |
|
128 | - 'EventEspresso\core\domain\services\graphql\types\Datetime', |
|
129 | - ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
130 | - ); |
|
131 | - $this->dependency_map->registerDependencies( |
|
132 | - 'EventEspresso\core\domain\services\graphql\types\Attendee', |
|
133 | - ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
134 | - ); |
|
135 | - $this->dependency_map->registerDependencies( |
|
136 | - 'EventEspresso\core\domain\services\graphql\types\Event', |
|
137 | - ['EEM_Event' => EE_Dependency_Map::load_from_cache] |
|
138 | - ); |
|
139 | - $this->dependency_map->registerDependencies( |
|
140 | - 'EventEspresso\core\domain\services\graphql\types\FormElement', |
|
141 | - ['EEM_Form_Element' => EE_Dependency_Map::load_from_cache] |
|
142 | - ); |
|
143 | - $this->dependency_map->registerDependencies( |
|
144 | - 'EventEspresso\core\domain\services\graphql\types\FormSection', |
|
145 | - ['EEM_Form_Section' => EE_Dependency_Map::load_from_cache] |
|
146 | - ); |
|
147 | - $this->dependency_map->registerDependencies( |
|
148 | - 'EventEspresso\core\domain\services\graphql\types\Ticket', |
|
149 | - ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
150 | - ); |
|
151 | - $this->dependency_map->registerDependencies( |
|
152 | - 'EventEspresso\core\domain\services\graphql\types\Price', |
|
153 | - ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
154 | - ); |
|
155 | - $this->dependency_map->registerDependencies( |
|
156 | - 'EventEspresso\core\domain\services\graphql\types\PriceType', |
|
157 | - ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
158 | - ); |
|
159 | - $this->dependency_map->registerDependencies( |
|
160 | - 'EventEspresso\core\domain\services\graphql\types\Venue', |
|
161 | - ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
162 | - ); |
|
163 | - $this->dependency_map->registerDependencies( |
|
164 | - 'EventEspresso\core\domain\services\graphql\types\State', |
|
165 | - ['EEM_State' => EE_Dependency_Map::load_from_cache] |
|
166 | - ); |
|
167 | - $this->dependency_map->registerDependencies( |
|
168 | - 'EventEspresso\core\domain\services\graphql\types\Country', |
|
169 | - ['EEM_Country' => EE_Dependency_Map::load_from_cache] |
|
170 | - ); |
|
171 | - $this->dependency_map->registerDependencies( |
|
172 | - 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection', |
|
173 | - ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
174 | - ); |
|
175 | - $this->dependency_map->registerDependencies( |
|
176 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection', |
|
177 | - ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
178 | - ); |
|
179 | - $this->dependency_map->registerDependencies( |
|
180 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryAttendeesConnection', |
|
181 | - ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
182 | - ); |
|
183 | - $this->dependency_map->registerDependencies( |
|
184 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryCountriesConnection', |
|
185 | - ['EEM_Country' => EE_Dependency_Map::load_from_cache] |
|
186 | - ); |
|
187 | - $this->dependency_map->registerDependencies( |
|
188 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryFormElementsConnection', |
|
189 | - ['EEM_Form_Element' => EE_Dependency_Map::load_from_cache] |
|
190 | - ); |
|
191 | - $this->dependency_map->registerDependencies( |
|
192 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryFormSectionsConnection', |
|
193 | - ['EEM_Form_Section' => EE_Dependency_Map::load_from_cache] |
|
194 | - ); |
|
195 | - $this->dependency_map->registerDependencies( |
|
196 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryStatesConnection', |
|
197 | - ['EEM_State' => EE_Dependency_Map::load_from_cache] |
|
198 | - ); |
|
199 | - $this->dependency_map->registerDependencies( |
|
200 | - 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection', |
|
201 | - ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
202 | - ); |
|
203 | - $this->dependency_map->registerDependencies( |
|
204 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection', |
|
205 | - ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
206 | - ); |
|
207 | - $this->dependency_map->registerDependencies( |
|
208 | - 'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection', |
|
209 | - ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
210 | - ); |
|
211 | - $this->dependency_map->registerDependencies( |
|
212 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection', |
|
213 | - ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
214 | - ); |
|
215 | - $this->dependency_map->registerDependencies( |
|
216 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection', |
|
217 | - ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
218 | - ); |
|
219 | - $this->dependency_map->registerDependencies( |
|
220 | - 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection', |
|
221 | - ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
222 | - ); |
|
223 | - $this->dependency_map->registerDependencies( |
|
224 | - 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection', |
|
225 | - ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
226 | - ); |
|
227 | - } |
|
77 | + /** |
|
78 | + * @since 5.0.0.p |
|
79 | + */ |
|
80 | + protected function registerDependencies() |
|
81 | + { |
|
82 | + $this->dependency_map->registerDependencies( |
|
83 | + 'EventEspresso\core\services\graphql\GraphQLManager', |
|
84 | + [ |
|
85 | + 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
86 | + 'EventEspresso\core\services\graphql\DataLoaderManager' => EE_Dependency_Map::load_from_cache, |
|
87 | + 'EventEspresso\core\services\graphql\EnumsManager' => EE_Dependency_Map::load_from_cache, |
|
88 | + 'EventEspresso\core\services\graphql\InputsManager' => EE_Dependency_Map::load_from_cache, |
|
89 | + 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
90 | + 'EventEspresso\core\services\graphql\InterfaceManager' => EE_Dependency_Map::load_from_cache |
|
91 | + ] |
|
92 | + ); |
|
93 | + $this->dependency_map->registerDependencies( |
|
94 | + 'EventEspresso\core\services\graphql\TypesManager', |
|
95 | + [ |
|
96 | + 'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
97 | + ] |
|
98 | + ); |
|
99 | + $this->dependency_map->registerDependencies( |
|
100 | + 'EventEspresso\core\services\graphql\InputsManager', |
|
101 | + [ |
|
102 | + 'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache, |
|
103 | + ] |
|
104 | + ); |
|
105 | + $this->dependency_map->registerDependencies( |
|
106 | + 'EventEspresso\core\services\graphql\EnumsManager', |
|
107 | + [ |
|
108 | + 'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache, |
|
109 | + ] |
|
110 | + ); |
|
111 | + $this->dependency_map->registerDependencies( |
|
112 | + 'EventEspresso\core\services\graphql\ConnectionsManager', |
|
113 | + [ |
|
114 | + 'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
115 | + ] |
|
116 | + ); |
|
117 | + $this->dependency_map->registerDependencies( |
|
118 | + 'EventEspresso\core\services\graphql\DataLoaderManager', |
|
119 | + [ |
|
120 | + 'EventEspresso\core\services\graphql\loaders\DataLoaderCollection' => EE_Dependency_Map::load_from_cache, |
|
121 | + ] |
|
122 | + ); |
|
123 | + $this->dependency_map->registerDependencies( |
|
124 | + 'EventEspresso\core\services\graphql\InterfaceManager', |
|
125 | + ['EventEspresso\core\services\graphql\interfaces\InterfaceCollection' => EE_Dependency_Map::load_from_cache], |
|
126 | + ); |
|
127 | + $this->dependency_map->registerDependencies( |
|
128 | + 'EventEspresso\core\domain\services\graphql\types\Datetime', |
|
129 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
130 | + ); |
|
131 | + $this->dependency_map->registerDependencies( |
|
132 | + 'EventEspresso\core\domain\services\graphql\types\Attendee', |
|
133 | + ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
134 | + ); |
|
135 | + $this->dependency_map->registerDependencies( |
|
136 | + 'EventEspresso\core\domain\services\graphql\types\Event', |
|
137 | + ['EEM_Event' => EE_Dependency_Map::load_from_cache] |
|
138 | + ); |
|
139 | + $this->dependency_map->registerDependencies( |
|
140 | + 'EventEspresso\core\domain\services\graphql\types\FormElement', |
|
141 | + ['EEM_Form_Element' => EE_Dependency_Map::load_from_cache] |
|
142 | + ); |
|
143 | + $this->dependency_map->registerDependencies( |
|
144 | + 'EventEspresso\core\domain\services\graphql\types\FormSection', |
|
145 | + ['EEM_Form_Section' => EE_Dependency_Map::load_from_cache] |
|
146 | + ); |
|
147 | + $this->dependency_map->registerDependencies( |
|
148 | + 'EventEspresso\core\domain\services\graphql\types\Ticket', |
|
149 | + ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
150 | + ); |
|
151 | + $this->dependency_map->registerDependencies( |
|
152 | + 'EventEspresso\core\domain\services\graphql\types\Price', |
|
153 | + ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
154 | + ); |
|
155 | + $this->dependency_map->registerDependencies( |
|
156 | + 'EventEspresso\core\domain\services\graphql\types\PriceType', |
|
157 | + ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
158 | + ); |
|
159 | + $this->dependency_map->registerDependencies( |
|
160 | + 'EventEspresso\core\domain\services\graphql\types\Venue', |
|
161 | + ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
162 | + ); |
|
163 | + $this->dependency_map->registerDependencies( |
|
164 | + 'EventEspresso\core\domain\services\graphql\types\State', |
|
165 | + ['EEM_State' => EE_Dependency_Map::load_from_cache] |
|
166 | + ); |
|
167 | + $this->dependency_map->registerDependencies( |
|
168 | + 'EventEspresso\core\domain\services\graphql\types\Country', |
|
169 | + ['EEM_Country' => EE_Dependency_Map::load_from_cache] |
|
170 | + ); |
|
171 | + $this->dependency_map->registerDependencies( |
|
172 | + 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection', |
|
173 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
174 | + ); |
|
175 | + $this->dependency_map->registerDependencies( |
|
176 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection', |
|
177 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
178 | + ); |
|
179 | + $this->dependency_map->registerDependencies( |
|
180 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryAttendeesConnection', |
|
181 | + ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
182 | + ); |
|
183 | + $this->dependency_map->registerDependencies( |
|
184 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryCountriesConnection', |
|
185 | + ['EEM_Country' => EE_Dependency_Map::load_from_cache] |
|
186 | + ); |
|
187 | + $this->dependency_map->registerDependencies( |
|
188 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryFormElementsConnection', |
|
189 | + ['EEM_Form_Element' => EE_Dependency_Map::load_from_cache] |
|
190 | + ); |
|
191 | + $this->dependency_map->registerDependencies( |
|
192 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryFormSectionsConnection', |
|
193 | + ['EEM_Form_Section' => EE_Dependency_Map::load_from_cache] |
|
194 | + ); |
|
195 | + $this->dependency_map->registerDependencies( |
|
196 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryStatesConnection', |
|
197 | + ['EEM_State' => EE_Dependency_Map::load_from_cache] |
|
198 | + ); |
|
199 | + $this->dependency_map->registerDependencies( |
|
200 | + 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection', |
|
201 | + ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
202 | + ); |
|
203 | + $this->dependency_map->registerDependencies( |
|
204 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection', |
|
205 | + ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
206 | + ); |
|
207 | + $this->dependency_map->registerDependencies( |
|
208 | + 'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection', |
|
209 | + ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
210 | + ); |
|
211 | + $this->dependency_map->registerDependencies( |
|
212 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection', |
|
213 | + ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
214 | + ); |
|
215 | + $this->dependency_map->registerDependencies( |
|
216 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection', |
|
217 | + ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
218 | + ); |
|
219 | + $this->dependency_map->registerDependencies( |
|
220 | + 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection', |
|
221 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
222 | + ); |
|
223 | + $this->dependency_map->registerDependencies( |
|
224 | + 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection', |
|
225 | + ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
226 | + ); |
|
227 | + } |
|
228 | 228 | |
229 | 229 | |
230 | - /** |
|
231 | - * implements logic required to run during request |
|
232 | - * |
|
233 | - * @return bool |
|
234 | - * @since 5.0.0.p |
|
235 | - */ |
|
236 | - protected function requestHandler(): bool |
|
237 | - { |
|
238 | - // load handler for EE GraphQL requests |
|
239 | - $graphQL_manager = $this->loader->getShared( |
|
240 | - 'EventEspresso\core\services\graphql\GraphQLManager' |
|
241 | - ); |
|
242 | - $graphQL_manager->init(); |
|
243 | - $manifest = $this->manifest_factory->createFromDomainObject(DomainFactory::getEventEspressoCoreDomain()); |
|
244 | - $manifest->initialize(); |
|
245 | - return true; |
|
246 | - } |
|
230 | + /** |
|
231 | + * implements logic required to run during request |
|
232 | + * |
|
233 | + * @return bool |
|
234 | + * @since 5.0.0.p |
|
235 | + */ |
|
236 | + protected function requestHandler(): bool |
|
237 | + { |
|
238 | + // load handler for EE GraphQL requests |
|
239 | + $graphQL_manager = $this->loader->getShared( |
|
240 | + 'EventEspresso\core\services\graphql\GraphQLManager' |
|
241 | + ); |
|
242 | + $graphQL_manager->init(); |
|
243 | + $manifest = $this->manifest_factory->createFromDomainObject(DomainFactory::getEventEspressoCoreDomain()); |
|
244 | + $manifest->initialize(); |
|
245 | + return true; |
|
246 | + } |
|
247 | 247 | } |
@@ -22,145 +22,145 @@ |
||
22 | 22 | */ |
23 | 23 | class AssetRequests extends Route |
24 | 24 | { |
25 | - protected BaristaFactory $barista_factory; |
|
25 | + protected BaristaFactory $barista_factory; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * AssetRequests constructor. |
|
30 | - * |
|
31 | - * @param EE_Dependency_Map $dependency_map |
|
32 | - * @param LoaderInterface $loader |
|
33 | - * @param RequestInterface $request |
|
34 | - * @param BaristaFactory $barista_factory |
|
35 | - */ |
|
36 | - public function __construct( |
|
37 | - EE_Dependency_Map $dependency_map, |
|
38 | - LoaderInterface $loader, |
|
39 | - RequestInterface $request, |
|
40 | - BaristaFactory $barista_factory |
|
41 | - ) { |
|
42 | - $this->barista_factory = $barista_factory; |
|
43 | - parent::__construct($dependency_map, $loader, $request); |
|
44 | - } |
|
28 | + /** |
|
29 | + * AssetRequests constructor. |
|
30 | + * |
|
31 | + * @param EE_Dependency_Map $dependency_map |
|
32 | + * @param LoaderInterface $loader |
|
33 | + * @param RequestInterface $request |
|
34 | + * @param BaristaFactory $barista_factory |
|
35 | + */ |
|
36 | + public function __construct( |
|
37 | + EE_Dependency_Map $dependency_map, |
|
38 | + LoaderInterface $loader, |
|
39 | + RequestInterface $request, |
|
40 | + BaristaFactory $barista_factory |
|
41 | + ) { |
|
42 | + $this->barista_factory = $barista_factory; |
|
43 | + parent::__construct($dependency_map, $loader, $request); |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * returns true if the current request matches this route |
|
49 | - * |
|
50 | - * @return bool |
|
51 | - * @since 5.0.0.p |
|
52 | - */ |
|
53 | - public function matchesCurrentRequest(): bool |
|
54 | - { |
|
55 | - return $this->request->isAdmin() |
|
56 | - || $this->request->isFrontend() |
|
57 | - || $this->request->isIframe() |
|
58 | - || $this->request->isWordPressApi(); |
|
59 | - } |
|
47 | + /** |
|
48 | + * returns true if the current request matches this route |
|
49 | + * |
|
50 | + * @return bool |
|
51 | + * @since 5.0.0.p |
|
52 | + */ |
|
53 | + public function matchesCurrentRequest(): bool |
|
54 | + { |
|
55 | + return $this->request->isAdmin() |
|
56 | + || $this->request->isFrontend() |
|
57 | + || $this->request->isIframe() |
|
58 | + || $this->request->isWordPressApi(); |
|
59 | + } |
|
60 | 60 | |
61 | 61 | |
62 | - /** |
|
63 | - * @since 5.0.0.p |
|
64 | - */ |
|
65 | - protected function registerDependencies() |
|
66 | - { |
|
67 | - $default_dependencies = [ |
|
68 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
69 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object, |
|
70 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
71 | - ]; |
|
72 | - $this->dependency_map->registerDependencies(JqueryAssetManager::class, $default_dependencies); |
|
73 | - $this->dependency_map->registerDependencies(ReactAssetManager::class, $default_dependencies); |
|
74 | - $this->dependency_map->registerDependencies( |
|
75 | - CoreAssetManager::class, |
|
76 | - [ |
|
77 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object, |
|
78 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
79 | - 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
80 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
81 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
82 | - ] |
|
83 | - ); |
|
84 | - $this->dependency_map->registerDependencies( |
|
85 | - 'EventEspresso\core\services\editor\BlockRegistrationManager', |
|
86 | - [ |
|
87 | - 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
88 | - 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
89 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
90 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
91 | - ] |
|
92 | - ); |
|
93 | - $this->dependency_map->registerDependencies( |
|
94 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager', |
|
95 | - [ |
|
96 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
97 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object, |
|
98 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
99 | - ] |
|
100 | - ); |
|
101 | - $this->dependency_map->registerDependencies( |
|
102 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer', |
|
103 | - [ |
|
104 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
105 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
106 | - 'EventEspresso\core\domain\services\graphql\enums\RegistrationStatusEnum' => EE_Dependency_Map::load_from_cache, |
|
107 | - ] |
|
108 | - ); |
|
109 | - $this->dependency_map->registerDependencies( |
|
110 | - 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees', |
|
111 | - [ |
|
112 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => EE_Dependency_Map::load_from_cache, |
|
113 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
114 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => EE_Dependency_Map::load_from_cache, |
|
115 | - ] |
|
116 | - ); |
|
117 | - if (apply_filters('FHEE__load_Barista', true)) { |
|
118 | - $this->dependency_map->registerDependencies( |
|
119 | - 'EventEspresso\core\services\assets\Barista', |
|
120 | - ['EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache] |
|
121 | - ); |
|
122 | - } |
|
123 | - } |
|
62 | + /** |
|
63 | + * @since 5.0.0.p |
|
64 | + */ |
|
65 | + protected function registerDependencies() |
|
66 | + { |
|
67 | + $default_dependencies = [ |
|
68 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
69 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object, |
|
70 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
71 | + ]; |
|
72 | + $this->dependency_map->registerDependencies(JqueryAssetManager::class, $default_dependencies); |
|
73 | + $this->dependency_map->registerDependencies(ReactAssetManager::class, $default_dependencies); |
|
74 | + $this->dependency_map->registerDependencies( |
|
75 | + CoreAssetManager::class, |
|
76 | + [ |
|
77 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object, |
|
78 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
79 | + 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
80 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
81 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
82 | + ] |
|
83 | + ); |
|
84 | + $this->dependency_map->registerDependencies( |
|
85 | + 'EventEspresso\core\services\editor\BlockRegistrationManager', |
|
86 | + [ |
|
87 | + 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
88 | + 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
89 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
90 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
91 | + ] |
|
92 | + ); |
|
93 | + $this->dependency_map->registerDependencies( |
|
94 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager', |
|
95 | + [ |
|
96 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
97 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object, |
|
98 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
99 | + ] |
|
100 | + ); |
|
101 | + $this->dependency_map->registerDependencies( |
|
102 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer', |
|
103 | + [ |
|
104 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
105 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
106 | + 'EventEspresso\core\domain\services\graphql\enums\RegistrationStatusEnum' => EE_Dependency_Map::load_from_cache, |
|
107 | + ] |
|
108 | + ); |
|
109 | + $this->dependency_map->registerDependencies( |
|
110 | + 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees', |
|
111 | + [ |
|
112 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => EE_Dependency_Map::load_from_cache, |
|
113 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
114 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => EE_Dependency_Map::load_from_cache, |
|
115 | + ] |
|
116 | + ); |
|
117 | + if (apply_filters('FHEE__load_Barista', true)) { |
|
118 | + $this->dependency_map->registerDependencies( |
|
119 | + 'EventEspresso\core\services\assets\Barista', |
|
120 | + ['EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache] |
|
121 | + ); |
|
122 | + } |
|
123 | + } |
|
124 | 124 | |
125 | 125 | |
126 | - /** |
|
127 | - * implements logic required to run during request |
|
128 | - * |
|
129 | - * @return bool |
|
130 | - * @since 5.0.0.p |
|
131 | - */ |
|
132 | - protected function requestHandler(): bool |
|
133 | - { |
|
134 | - if (apply_filters('FHEE__load_Barista', true)) { |
|
135 | - $barista = $this->barista_factory->create(); |
|
136 | - if ($barista instanceof BaristaInterface) { |
|
137 | - $barista->initialize(); |
|
138 | - $this->loader->getShared('EventEspresso\core\services\assets\Registry'); |
|
139 | - } |
|
140 | - } |
|
141 | - $this->loader->getShared(JqueryAssetManager::class); |
|
142 | - $this->loader->getShared(CoreAssetManager::class); |
|
143 | - if ($this->canLoadBlocks()) { |
|
144 | - $this->loader->getShared( |
|
145 | - 'EventEspresso\core\services\editor\BlockRegistrationManager' |
|
146 | - ); |
|
147 | - } |
|
148 | - return true; |
|
149 | - } |
|
126 | + /** |
|
127 | + * implements logic required to run during request |
|
128 | + * |
|
129 | + * @return bool |
|
130 | + * @since 5.0.0.p |
|
131 | + */ |
|
132 | + protected function requestHandler(): bool |
|
133 | + { |
|
134 | + if (apply_filters('FHEE__load_Barista', true)) { |
|
135 | + $barista = $this->barista_factory->create(); |
|
136 | + if ($barista instanceof BaristaInterface) { |
|
137 | + $barista->initialize(); |
|
138 | + $this->loader->getShared('EventEspresso\core\services\assets\Registry'); |
|
139 | + } |
|
140 | + } |
|
141 | + $this->loader->getShared(JqueryAssetManager::class); |
|
142 | + $this->loader->getShared(CoreAssetManager::class); |
|
143 | + if ($this->canLoadBlocks()) { |
|
144 | + $this->loader->getShared( |
|
145 | + 'EventEspresso\core\services\editor\BlockRegistrationManager' |
|
146 | + ); |
|
147 | + } |
|
148 | + return true; |
|
149 | + } |
|
150 | 150 | |
151 | 151 | |
152 | - /** |
|
153 | - * Return whether blocks can be registered/loaded or not. |
|
154 | - * |
|
155 | - * @return bool |
|
156 | - * @since 5.0.0.p |
|
157 | - */ |
|
158 | - private function canLoadBlocks() |
|
159 | - { |
|
160 | - return apply_filters('FHEE__EE_System__canLoadBlocks', true) |
|
161 | - && function_exists('register_block_type') |
|
162 | - // don't load blocks if in the Divi page builder editor context |
|
163 | - // @see https://github.com/eventespresso/event-espresso-core/issues/814 |
|
164 | - && ! $this->request->getRequestParam('et_fb', false); |
|
165 | - } |
|
152 | + /** |
|
153 | + * Return whether blocks can be registered/loaded or not. |
|
154 | + * |
|
155 | + * @return bool |
|
156 | + * @since 5.0.0.p |
|
157 | + */ |
|
158 | + private function canLoadBlocks() |
|
159 | + { |
|
160 | + return apply_filters('FHEE__EE_System__canLoadBlocks', true) |
|
161 | + && function_exists('register_block_type') |
|
162 | + // don't load blocks if in the Divi page builder editor context |
|
163 | + // @see https://github.com/eventespresso/event-espresso-core/issues/814 |
|
164 | + && ! $this->request->getRequestParam('et_fb', false); |
|
165 | + } |
|
166 | 166 | } |
@@ -32,152 +32,152 @@ |
||
32 | 32 | */ |
33 | 33 | class RegularRequests extends PrimaryRoute |
34 | 34 | { |
35 | - /** |
|
36 | - * called just before matchesCurrentRequest() |
|
37 | - * and allows Route to perform any setup required such as calling setSpecification() |
|
38 | - * |
|
39 | - * @since 5.0.0.p |
|
40 | - */ |
|
41 | - public function initialize() |
|
42 | - { |
|
43 | - $basic_nodes = [ |
|
44 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Api', |
|
45 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Capabilities', |
|
46 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale', |
|
47 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls', |
|
48 | - ]; |
|
49 | - foreach ($basic_nodes as $basic_node) { |
|
50 | - $this->dependency_map->registerDependencies( |
|
51 | - $basic_node, |
|
52 | - ['EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache] |
|
53 | - ); |
|
54 | - } |
|
55 | - $this->dependency_map->registerDependencies( |
|
56 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\SitePermissions', |
|
57 | - [ |
|
58 | - 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => EE_Dependency_Map::load_from_cache, |
|
59 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
60 | - ] |
|
61 | - ); |
|
62 | - $this->dependency_map->registerDependencies( |
|
63 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings', |
|
64 | - [ |
|
65 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
66 | - 'EventEspresso\core\services\converters\date_time_formats\PhpToUnicode' => EE_Dependency_Map::load_from_cache, |
|
67 | - ] |
|
68 | - ); |
|
69 | - $this->dependency_map->registerDependencies( |
|
70 | - 'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData', |
|
71 | - [ |
|
72 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Api' => EE_Dependency_Map::load_from_cache, |
|
73 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Config' => EE_Dependency_Map::load_from_cache, |
|
74 | - 'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache, |
|
75 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
76 | - ] |
|
77 | - ); |
|
78 | - $this->dependency_map->registerDependencies( |
|
79 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Config', |
|
80 | - [ |
|
81 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser' => EE_Dependency_Map::load_from_cache, |
|
82 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain' => EE_Dependency_Map::load_from_cache, |
|
83 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings' => EE_Dependency_Map::load_from_cache, |
|
84 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale' => EE_Dependency_Map::load_from_cache, |
|
85 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency' => EE_Dependency_Map::load_from_cache, |
|
86 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\SitePermissions' => EE_Dependency_Map::load_from_cache, |
|
87 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls' => EE_Dependency_Map::load_from_cache, |
|
88 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
89 | - ] |
|
90 | - ); |
|
91 | - $this->dependency_map->registerDependencies( |
|
92 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser', |
|
93 | - [ |
|
94 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Capabilities' => EE_Dependency_Map::load_from_cache, |
|
95 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
96 | - ] |
|
97 | - ); |
|
98 | - $this->dependency_map->registerDependencies( |
|
99 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain', |
|
100 | - [ |
|
101 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
102 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
103 | - ] |
|
104 | - ); |
|
105 | - $this->dependency_map->registerDependencies( |
|
106 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency', |
|
107 | - [ |
|
108 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
109 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
110 | - ] |
|
111 | - ); |
|
112 | - $this->setDataNode( |
|
113 | - $this->loader->getShared('EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData') |
|
114 | - ); |
|
115 | - } |
|
35 | + /** |
|
36 | + * called just before matchesCurrentRequest() |
|
37 | + * and allows Route to perform any setup required such as calling setSpecification() |
|
38 | + * |
|
39 | + * @since 5.0.0.p |
|
40 | + */ |
|
41 | + public function initialize() |
|
42 | + { |
|
43 | + $basic_nodes = [ |
|
44 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Api', |
|
45 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Capabilities', |
|
46 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale', |
|
47 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls', |
|
48 | + ]; |
|
49 | + foreach ($basic_nodes as $basic_node) { |
|
50 | + $this->dependency_map->registerDependencies( |
|
51 | + $basic_node, |
|
52 | + ['EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache] |
|
53 | + ); |
|
54 | + } |
|
55 | + $this->dependency_map->registerDependencies( |
|
56 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\SitePermissions', |
|
57 | + [ |
|
58 | + 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => EE_Dependency_Map::load_from_cache, |
|
59 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
60 | + ] |
|
61 | + ); |
|
62 | + $this->dependency_map->registerDependencies( |
|
63 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings', |
|
64 | + [ |
|
65 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
66 | + 'EventEspresso\core\services\converters\date_time_formats\PhpToUnicode' => EE_Dependency_Map::load_from_cache, |
|
67 | + ] |
|
68 | + ); |
|
69 | + $this->dependency_map->registerDependencies( |
|
70 | + 'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData', |
|
71 | + [ |
|
72 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Api' => EE_Dependency_Map::load_from_cache, |
|
73 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Config' => EE_Dependency_Map::load_from_cache, |
|
74 | + 'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache, |
|
75 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
76 | + ] |
|
77 | + ); |
|
78 | + $this->dependency_map->registerDependencies( |
|
79 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Config', |
|
80 | + [ |
|
81 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser' => EE_Dependency_Map::load_from_cache, |
|
82 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain' => EE_Dependency_Map::load_from_cache, |
|
83 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings' => EE_Dependency_Map::load_from_cache, |
|
84 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale' => EE_Dependency_Map::load_from_cache, |
|
85 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency' => EE_Dependency_Map::load_from_cache, |
|
86 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\SitePermissions' => EE_Dependency_Map::load_from_cache, |
|
87 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls' => EE_Dependency_Map::load_from_cache, |
|
88 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
89 | + ] |
|
90 | + ); |
|
91 | + $this->dependency_map->registerDependencies( |
|
92 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser', |
|
93 | + [ |
|
94 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Capabilities' => EE_Dependency_Map::load_from_cache, |
|
95 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
96 | + ] |
|
97 | + ); |
|
98 | + $this->dependency_map->registerDependencies( |
|
99 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain', |
|
100 | + [ |
|
101 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
102 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
103 | + ] |
|
104 | + ); |
|
105 | + $this->dependency_map->registerDependencies( |
|
106 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency', |
|
107 | + [ |
|
108 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
109 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
110 | + ] |
|
111 | + ); |
|
112 | + $this->setDataNode( |
|
113 | + $this->loader->getShared('EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData') |
|
114 | + ); |
|
115 | + } |
|
116 | 116 | |
117 | 117 | |
118 | - /** |
|
119 | - * returns true if the current request matches this route |
|
120 | - * |
|
121 | - * @return bool |
|
122 | - * @since 5.0.0.p |
|
123 | - */ |
|
124 | - public function matchesCurrentRequest(): bool |
|
125 | - { |
|
126 | - return ! $this->request->isActivation() || $this->request->isUnitTesting(); |
|
127 | - } |
|
118 | + /** |
|
119 | + * returns true if the current request matches this route |
|
120 | + * |
|
121 | + * @return bool |
|
122 | + * @since 5.0.0.p |
|
123 | + */ |
|
124 | + public function matchesCurrentRequest(): bool |
|
125 | + { |
|
126 | + return ! $this->request->isActivation() || $this->request->isUnitTesting(); |
|
127 | + } |
|
128 | 128 | |
129 | 129 | |
130 | - /** |
|
131 | - * @since 5.0.0.p |
|
132 | - */ |
|
133 | - protected function registerDependencies() |
|
134 | - { |
|
135 | - $public = ['EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache] + Route::getDefaultDependencies(); |
|
130 | + /** |
|
131 | + * @since 5.0.0.p |
|
132 | + */ |
|
133 | + protected function registerDependencies() |
|
134 | + { |
|
135 | + $public = ['EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache] + Route::getDefaultDependencies(); |
|
136 | 136 | |
137 | - $default_with_barista = [BaristaFactory::class => EE_Dependency_Map::load_from_cache] + |
|
138 | - Route::getDefaultDependencies(); |
|
139 | - $default_with_manifest = [AssetManifestFactory::class => EE_Dependency_Map::load_from_cache] + |
|
140 | - Route::getDefaultDependencies(); |
|
137 | + $default_with_barista = [BaristaFactory::class => EE_Dependency_Map::load_from_cache] + |
|
138 | + Route::getDefaultDependencies(); |
|
139 | + $default_with_manifest = [AssetManifestFactory::class => EE_Dependency_Map::load_from_cache] + |
|
140 | + Route::getDefaultDependencies(); |
|
141 | 141 | |
142 | - $default_routes = [ |
|
143 | - // default dependencies |
|
144 | - ShortcodeRequests::class => Route::getDefaultDependencies(), |
|
145 | - RestApiRequests::class => Route::getDefaultDependencies(), |
|
146 | - SessionRequests::class => Route::getDefaultDependencies(), |
|
147 | - WordPressHeartbeat::class => Route::getDefaultDependencies(), |
|
148 | - AssetRequests::class => $default_with_barista, |
|
149 | - GQLRequests::class => $default_with_manifest, |
|
150 | - // admin dependencies |
|
151 | - AdminRoute::class => AdminRoute::getDefaultDependencies(), |
|
152 | - EspressoBatchJob::class => AdminRoute::getDefaultDependencies(), |
|
153 | - EspressoEventsAdmin::class => AdminRoute::getDefaultDependencies(), |
|
154 | - EspressoEventEditor::class => AdminRoute::getDefaultDependencies(), |
|
155 | - EspressoLegacyAdmin::class => AdminRoute::getDefaultDependencies(), |
|
156 | - GutenbergEditor::class => AdminRoute::getDefaultDependencies(), |
|
157 | - NonEspressoAdminAjax::class => AdminRoute::getDefaultDependencies(), |
|
158 | - WordPressPluginsPage::class => AdminRoute::getDefaultDependencies(), |
|
159 | - WordPressPostsPage::class => AdminRoute::getDefaultDependencies(), |
|
160 | - WordPressProfilePage::class => AdminRoute::getDefaultDependencies(), |
|
161 | - // public dependencies |
|
162 | - PersonalDataRequests::class => $public, |
|
163 | - FrontendRequests::class => $public, |
|
164 | - RegistrationCheckoutRequests::class => $public, |
|
165 | - ]; |
|
166 | - foreach ($default_routes as $route => $dependencies) { |
|
167 | - $this->dependency_map->registerDependencies($route, $dependencies); |
|
168 | - } |
|
169 | - } |
|
142 | + $default_routes = [ |
|
143 | + // default dependencies |
|
144 | + ShortcodeRequests::class => Route::getDefaultDependencies(), |
|
145 | + RestApiRequests::class => Route::getDefaultDependencies(), |
|
146 | + SessionRequests::class => Route::getDefaultDependencies(), |
|
147 | + WordPressHeartbeat::class => Route::getDefaultDependencies(), |
|
148 | + AssetRequests::class => $default_with_barista, |
|
149 | + GQLRequests::class => $default_with_manifest, |
|
150 | + // admin dependencies |
|
151 | + AdminRoute::class => AdminRoute::getDefaultDependencies(), |
|
152 | + EspressoBatchJob::class => AdminRoute::getDefaultDependencies(), |
|
153 | + EspressoEventsAdmin::class => AdminRoute::getDefaultDependencies(), |
|
154 | + EspressoEventEditor::class => AdminRoute::getDefaultDependencies(), |
|
155 | + EspressoLegacyAdmin::class => AdminRoute::getDefaultDependencies(), |
|
156 | + GutenbergEditor::class => AdminRoute::getDefaultDependencies(), |
|
157 | + NonEspressoAdminAjax::class => AdminRoute::getDefaultDependencies(), |
|
158 | + WordPressPluginsPage::class => AdminRoute::getDefaultDependencies(), |
|
159 | + WordPressPostsPage::class => AdminRoute::getDefaultDependencies(), |
|
160 | + WordPressProfilePage::class => AdminRoute::getDefaultDependencies(), |
|
161 | + // public dependencies |
|
162 | + PersonalDataRequests::class => $public, |
|
163 | + FrontendRequests::class => $public, |
|
164 | + RegistrationCheckoutRequests::class => $public, |
|
165 | + ]; |
|
166 | + foreach ($default_routes as $route => $dependencies) { |
|
167 | + $this->dependency_map->registerDependencies($route, $dependencies); |
|
168 | + } |
|
169 | + } |
|
170 | 170 | |
171 | 171 | |
172 | - /** |
|
173 | - * implements logic required to run during request |
|
174 | - * |
|
175 | - * @return bool |
|
176 | - * @since 5.0.0.p |
|
177 | - */ |
|
178 | - protected function requestHandler(): bool |
|
179 | - { |
|
180 | - $this->setRouteRequestType(PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR); |
|
181 | - return true; |
|
182 | - } |
|
172 | + /** |
|
173 | + * implements logic required to run during request |
|
174 | + * |
|
175 | + * @return bool |
|
176 | + * @since 5.0.0.p |
|
177 | + */ |
|
178 | + protected function requestHandler(): bool |
|
179 | + { |
|
180 | + $this->setRouteRequestType(PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR); |
|
181 | + return true; |
|
182 | + } |
|
183 | 183 | } |
@@ -16,237 +16,237 @@ |
||
16 | 16 | */ |
17 | 17 | abstract class DomainBase implements DomainInterface |
18 | 18 | { |
19 | - const ASSETS_FOLDER = 'assets/'; |
|
20 | - |
|
21 | - /** |
|
22 | - * Equivalent to `__FILE__` for main plugin file. |
|
23 | - * |
|
24 | - * @var FilePath |
|
25 | - */ |
|
26 | - private FilePath $plugin_file; |
|
27 | - |
|
28 | - /** |
|
29 | - * Value object indicating version for plugin |
|
30 | - * |
|
31 | - * @var Version |
|
32 | - */ |
|
33 | - private Version $version; |
|
34 | - |
|
35 | - private string $plugin_basename = ''; |
|
36 | - |
|
37 | - private string $plugin_path = ''; |
|
38 | - |
|
39 | - private string $plugin_url = ''; |
|
40 | - |
|
41 | - private string $asset_namespace = ''; |
|
42 | - |
|
43 | - private string $assets_path = ''; |
|
44 | - |
|
45 | - private string $assets_url = ''; |
|
46 | - |
|
47 | - protected bool $initialized = false; |
|
48 | - |
|
49 | - |
|
50 | - /** |
|
51 | - * Initializes internal properties. |
|
52 | - * |
|
53 | - * @param FilePath $plugin_file |
|
54 | - * @param Version $version |
|
55 | - * @param string $asset_namespace |
|
56 | - */ |
|
57 | - public function __construct( |
|
58 | - FilePath $plugin_file, |
|
59 | - Version $version, |
|
60 | - string $asset_namespace = Domain::ASSET_NAMESPACE |
|
61 | - ) { |
|
62 | - $this->plugin_file = $plugin_file; |
|
63 | - $this->version = $version; |
|
64 | - $this->initialize($asset_namespace); |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * @param string $asset_namespace |
|
70 | - * @return void |
|
71 | - * @since 5.0.0.p |
|
72 | - */ |
|
73 | - public function initialize(string $asset_namespace = Domain::ASSET_NAMESPACE) |
|
74 | - { |
|
75 | - if (! $this->initialized) { |
|
76 | - $this->plugin_basename = plugin_basename($this->pluginFile()); |
|
77 | - $this->plugin_path = plugin_dir_path($this->pluginFile()); |
|
78 | - $this->plugin_url = plugin_dir_url($this->pluginFile()); |
|
79 | - $this->setAssetNamespace($asset_namespace); |
|
80 | - $this->setDistributionAssetsPath(); |
|
81 | - $this->setDistributionAssetsUrl(); |
|
82 | - $this->initialized = true; |
|
83 | - } |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - /** |
|
88 | - * @param string $asset_namespace |
|
89 | - * @return void |
|
90 | - */ |
|
91 | - public function setAssetNamespace(string $asset_namespace = Domain::ASSET_NAMESPACE) |
|
92 | - { |
|
93 | - if (! $this->asset_namespace) { |
|
94 | - $this->asset_namespace = sanitize_key( |
|
95 | - // convert directory separators to dashes and remove file extension |
|
96 | - str_replace(['/', '.php'], ['-', ''], $asset_namespace) |
|
97 | - ); |
|
98 | - } |
|
99 | - } |
|
100 | - |
|
101 | - |
|
102 | - /** |
|
103 | - * @throws DomainException |
|
104 | - * @since 5.0.0.p |
|
105 | - */ |
|
106 | - private function setDistributionAssetsPath() |
|
107 | - { |
|
108 | - $assets_folder_paths = [ |
|
109 | - $this->plugin_path . DomainBase::ASSETS_FOLDER, |
|
110 | - $this->plugin_path . 'src/' . DomainBase::ASSETS_FOLDER, |
|
111 | - ]; |
|
112 | - foreach ($assets_folder_paths as $assets_folder_path) { |
|
113 | - if (is_readable($assets_folder_path)) { |
|
114 | - $this->assets_path = trailingslashit($assets_folder_path); |
|
115 | - // once we find a valid path, just break out of loop |
|
116 | - break; |
|
117 | - } |
|
118 | - } |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @throws DomainException |
|
124 | - * @since 5.0.0.p |
|
125 | - */ |
|
126 | - private function setDistributionAssetsUrl() |
|
127 | - { |
|
128 | - // $this->assets_path will already include the assets folder, |
|
129 | - // but plugin_dir_url() removes it, so we need to add it again |
|
130 | - $this->assets_url = $this->assets_path ? plugin_dir_url($this->assets_path) . DomainBase::ASSETS_FOLDER : ''; |
|
131 | - } |
|
132 | - |
|
133 | - |
|
134 | - /** |
|
135 | - * @return string |
|
136 | - */ |
|
137 | - public function pluginFile(): string |
|
138 | - { |
|
139 | - return (string) $this->plugin_file; |
|
140 | - } |
|
141 | - |
|
142 | - |
|
143 | - /** |
|
144 | - * @return FilePath |
|
145 | - */ |
|
146 | - public function pluginFileObject(): FilePath |
|
147 | - { |
|
148 | - return $this->plugin_file; |
|
149 | - } |
|
150 | - |
|
151 | - |
|
152 | - /** |
|
153 | - * @return string |
|
154 | - */ |
|
155 | - public function pluginBasename(): string |
|
156 | - { |
|
157 | - return $this->plugin_basename; |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - /** |
|
162 | - * @param string $additional_path |
|
163 | - * @return string |
|
164 | - */ |
|
165 | - public function pluginPath(string $additional_path = ''): string |
|
166 | - { |
|
167 | - return is_string($additional_path) && $additional_path !== '' |
|
168 | - ? $this->plugin_path . $additional_path |
|
169 | - : $this->plugin_path; |
|
170 | - } |
|
171 | - |
|
172 | - |
|
173 | - /** |
|
174 | - * @param string $additional_path |
|
175 | - * @return string |
|
176 | - */ |
|
177 | - public function pluginUrl(string $additional_path = ''): string |
|
178 | - { |
|
179 | - return is_string($additional_path) && $additional_path !== '' |
|
180 | - ? $this->plugin_url . $additional_path |
|
181 | - : $this->plugin_url; |
|
182 | - } |
|
183 | - |
|
184 | - |
|
185 | - /** |
|
186 | - * @return string |
|
187 | - */ |
|
188 | - public function version(): string |
|
189 | - { |
|
190 | - return (string) $this->version; |
|
191 | - } |
|
192 | - |
|
193 | - |
|
194 | - /** |
|
195 | - * @return Version |
|
196 | - */ |
|
197 | - public function versionValueObject(): Version |
|
198 | - { |
|
199 | - return $this->version; |
|
200 | - } |
|
201 | - |
|
202 | - |
|
203 | - /** |
|
204 | - * @return string |
|
205 | - */ |
|
206 | - public function distributionAssetsFolder(): string |
|
207 | - { |
|
208 | - return DomainBase::ASSETS_FOLDER; |
|
209 | - } |
|
210 | - |
|
211 | - |
|
212 | - /** |
|
213 | - * @param string $additional_path |
|
214 | - * @return string |
|
215 | - */ |
|
216 | - public function distributionAssetsPath(string $additional_path = ''): string |
|
217 | - { |
|
218 | - return is_string($additional_path) && $additional_path !== '' |
|
219 | - ? $this->assets_path . $additional_path |
|
220 | - : $this->assets_path; |
|
221 | - } |
|
222 | - |
|
223 | - |
|
224 | - /** |
|
225 | - * @param string $additional_path |
|
226 | - * @return string |
|
227 | - */ |
|
228 | - public function distributionAssetsUrl(string $additional_path = ''): string |
|
229 | - { |
|
230 | - return is_string($additional_path) && $additional_path !== '' |
|
231 | - ? $this->assets_url . $additional_path |
|
232 | - : $this->assets_url; |
|
233 | - } |
|
234 | - |
|
235 | - |
|
236 | - /** |
|
237 | - * @return string |
|
238 | - */ |
|
239 | - public function assetNamespace(): string |
|
240 | - { |
|
241 | - return $this->asset_namespace; |
|
242 | - } |
|
243 | - |
|
244 | - |
|
245 | - /** |
|
246 | - * @return string |
|
247 | - */ |
|
248 | - public function assetVersion(): string |
|
249 | - { |
|
250 | - return wp_get_environment_type() === 'production' ? $this->version() : (string) time(); |
|
251 | - } |
|
19 | + const ASSETS_FOLDER = 'assets/'; |
|
20 | + |
|
21 | + /** |
|
22 | + * Equivalent to `__FILE__` for main plugin file. |
|
23 | + * |
|
24 | + * @var FilePath |
|
25 | + */ |
|
26 | + private FilePath $plugin_file; |
|
27 | + |
|
28 | + /** |
|
29 | + * Value object indicating version for plugin |
|
30 | + * |
|
31 | + * @var Version |
|
32 | + */ |
|
33 | + private Version $version; |
|
34 | + |
|
35 | + private string $plugin_basename = ''; |
|
36 | + |
|
37 | + private string $plugin_path = ''; |
|
38 | + |
|
39 | + private string $plugin_url = ''; |
|
40 | + |
|
41 | + private string $asset_namespace = ''; |
|
42 | + |
|
43 | + private string $assets_path = ''; |
|
44 | + |
|
45 | + private string $assets_url = ''; |
|
46 | + |
|
47 | + protected bool $initialized = false; |
|
48 | + |
|
49 | + |
|
50 | + /** |
|
51 | + * Initializes internal properties. |
|
52 | + * |
|
53 | + * @param FilePath $plugin_file |
|
54 | + * @param Version $version |
|
55 | + * @param string $asset_namespace |
|
56 | + */ |
|
57 | + public function __construct( |
|
58 | + FilePath $plugin_file, |
|
59 | + Version $version, |
|
60 | + string $asset_namespace = Domain::ASSET_NAMESPACE |
|
61 | + ) { |
|
62 | + $this->plugin_file = $plugin_file; |
|
63 | + $this->version = $version; |
|
64 | + $this->initialize($asset_namespace); |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * @param string $asset_namespace |
|
70 | + * @return void |
|
71 | + * @since 5.0.0.p |
|
72 | + */ |
|
73 | + public function initialize(string $asset_namespace = Domain::ASSET_NAMESPACE) |
|
74 | + { |
|
75 | + if (! $this->initialized) { |
|
76 | + $this->plugin_basename = plugin_basename($this->pluginFile()); |
|
77 | + $this->plugin_path = plugin_dir_path($this->pluginFile()); |
|
78 | + $this->plugin_url = plugin_dir_url($this->pluginFile()); |
|
79 | + $this->setAssetNamespace($asset_namespace); |
|
80 | + $this->setDistributionAssetsPath(); |
|
81 | + $this->setDistributionAssetsUrl(); |
|
82 | + $this->initialized = true; |
|
83 | + } |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + /** |
|
88 | + * @param string $asset_namespace |
|
89 | + * @return void |
|
90 | + */ |
|
91 | + public function setAssetNamespace(string $asset_namespace = Domain::ASSET_NAMESPACE) |
|
92 | + { |
|
93 | + if (! $this->asset_namespace) { |
|
94 | + $this->asset_namespace = sanitize_key( |
|
95 | + // convert directory separators to dashes and remove file extension |
|
96 | + str_replace(['/', '.php'], ['-', ''], $asset_namespace) |
|
97 | + ); |
|
98 | + } |
|
99 | + } |
|
100 | + |
|
101 | + |
|
102 | + /** |
|
103 | + * @throws DomainException |
|
104 | + * @since 5.0.0.p |
|
105 | + */ |
|
106 | + private function setDistributionAssetsPath() |
|
107 | + { |
|
108 | + $assets_folder_paths = [ |
|
109 | + $this->plugin_path . DomainBase::ASSETS_FOLDER, |
|
110 | + $this->plugin_path . 'src/' . DomainBase::ASSETS_FOLDER, |
|
111 | + ]; |
|
112 | + foreach ($assets_folder_paths as $assets_folder_path) { |
|
113 | + if (is_readable($assets_folder_path)) { |
|
114 | + $this->assets_path = trailingslashit($assets_folder_path); |
|
115 | + // once we find a valid path, just break out of loop |
|
116 | + break; |
|
117 | + } |
|
118 | + } |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @throws DomainException |
|
124 | + * @since 5.0.0.p |
|
125 | + */ |
|
126 | + private function setDistributionAssetsUrl() |
|
127 | + { |
|
128 | + // $this->assets_path will already include the assets folder, |
|
129 | + // but plugin_dir_url() removes it, so we need to add it again |
|
130 | + $this->assets_url = $this->assets_path ? plugin_dir_url($this->assets_path) . DomainBase::ASSETS_FOLDER : ''; |
|
131 | + } |
|
132 | + |
|
133 | + |
|
134 | + /** |
|
135 | + * @return string |
|
136 | + */ |
|
137 | + public function pluginFile(): string |
|
138 | + { |
|
139 | + return (string) $this->plugin_file; |
|
140 | + } |
|
141 | + |
|
142 | + |
|
143 | + /** |
|
144 | + * @return FilePath |
|
145 | + */ |
|
146 | + public function pluginFileObject(): FilePath |
|
147 | + { |
|
148 | + return $this->plugin_file; |
|
149 | + } |
|
150 | + |
|
151 | + |
|
152 | + /** |
|
153 | + * @return string |
|
154 | + */ |
|
155 | + public function pluginBasename(): string |
|
156 | + { |
|
157 | + return $this->plugin_basename; |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + /** |
|
162 | + * @param string $additional_path |
|
163 | + * @return string |
|
164 | + */ |
|
165 | + public function pluginPath(string $additional_path = ''): string |
|
166 | + { |
|
167 | + return is_string($additional_path) && $additional_path !== '' |
|
168 | + ? $this->plugin_path . $additional_path |
|
169 | + : $this->plugin_path; |
|
170 | + } |
|
171 | + |
|
172 | + |
|
173 | + /** |
|
174 | + * @param string $additional_path |
|
175 | + * @return string |
|
176 | + */ |
|
177 | + public function pluginUrl(string $additional_path = ''): string |
|
178 | + { |
|
179 | + return is_string($additional_path) && $additional_path !== '' |
|
180 | + ? $this->plugin_url . $additional_path |
|
181 | + : $this->plugin_url; |
|
182 | + } |
|
183 | + |
|
184 | + |
|
185 | + /** |
|
186 | + * @return string |
|
187 | + */ |
|
188 | + public function version(): string |
|
189 | + { |
|
190 | + return (string) $this->version; |
|
191 | + } |
|
192 | + |
|
193 | + |
|
194 | + /** |
|
195 | + * @return Version |
|
196 | + */ |
|
197 | + public function versionValueObject(): Version |
|
198 | + { |
|
199 | + return $this->version; |
|
200 | + } |
|
201 | + |
|
202 | + |
|
203 | + /** |
|
204 | + * @return string |
|
205 | + */ |
|
206 | + public function distributionAssetsFolder(): string |
|
207 | + { |
|
208 | + return DomainBase::ASSETS_FOLDER; |
|
209 | + } |
|
210 | + |
|
211 | + |
|
212 | + /** |
|
213 | + * @param string $additional_path |
|
214 | + * @return string |
|
215 | + */ |
|
216 | + public function distributionAssetsPath(string $additional_path = ''): string |
|
217 | + { |
|
218 | + return is_string($additional_path) && $additional_path !== '' |
|
219 | + ? $this->assets_path . $additional_path |
|
220 | + : $this->assets_path; |
|
221 | + } |
|
222 | + |
|
223 | + |
|
224 | + /** |
|
225 | + * @param string $additional_path |
|
226 | + * @return string |
|
227 | + */ |
|
228 | + public function distributionAssetsUrl(string $additional_path = ''): string |
|
229 | + { |
|
230 | + return is_string($additional_path) && $additional_path !== '' |
|
231 | + ? $this->assets_url . $additional_path |
|
232 | + : $this->assets_url; |
|
233 | + } |
|
234 | + |
|
235 | + |
|
236 | + /** |
|
237 | + * @return string |
|
238 | + */ |
|
239 | + public function assetNamespace(): string |
|
240 | + { |
|
241 | + return $this->asset_namespace; |
|
242 | + } |
|
243 | + |
|
244 | + |
|
245 | + /** |
|
246 | + * @return string |
|
247 | + */ |
|
248 | + public function assetVersion(): string |
|
249 | + { |
|
250 | + return wp_get_environment_type() === 'production' ? $this->version() : (string) time(); |
|
251 | + } |
|
252 | 252 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function initialize(string $asset_namespace = Domain::ASSET_NAMESPACE) |
74 | 74 | { |
75 | - if (! $this->initialized) { |
|
75 | + if ( ! $this->initialized) { |
|
76 | 76 | $this->plugin_basename = plugin_basename($this->pluginFile()); |
77 | 77 | $this->plugin_path = plugin_dir_path($this->pluginFile()); |
78 | 78 | $this->plugin_url = plugin_dir_url($this->pluginFile()); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function setAssetNamespace(string $asset_namespace = Domain::ASSET_NAMESPACE) |
92 | 92 | { |
93 | - if (! $this->asset_namespace) { |
|
93 | + if ( ! $this->asset_namespace) { |
|
94 | 94 | $this->asset_namespace = sanitize_key( |
95 | 95 | // convert directory separators to dashes and remove file extension |
96 | 96 | str_replace(['/', '.php'], ['-', ''], $asset_namespace) |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | private function setDistributionAssetsPath() |
107 | 107 | { |
108 | 108 | $assets_folder_paths = [ |
109 | - $this->plugin_path . DomainBase::ASSETS_FOLDER, |
|
110 | - $this->plugin_path . 'src/' . DomainBase::ASSETS_FOLDER, |
|
109 | + $this->plugin_path.DomainBase::ASSETS_FOLDER, |
|
110 | + $this->plugin_path.'src/'.DomainBase::ASSETS_FOLDER, |
|
111 | 111 | ]; |
112 | 112 | foreach ($assets_folder_paths as $assets_folder_path) { |
113 | 113 | if (is_readable($assets_folder_path)) { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | // $this->assets_path will already include the assets folder, |
129 | 129 | // but plugin_dir_url() removes it, so we need to add it again |
130 | - $this->assets_url = $this->assets_path ? plugin_dir_url($this->assets_path) . DomainBase::ASSETS_FOLDER : ''; |
|
130 | + $this->assets_url = $this->assets_path ? plugin_dir_url($this->assets_path).DomainBase::ASSETS_FOLDER : ''; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function pluginPath(string $additional_path = ''): string |
166 | 166 | { |
167 | 167 | return is_string($additional_path) && $additional_path !== '' |
168 | - ? $this->plugin_path . $additional_path |
|
168 | + ? $this->plugin_path.$additional_path |
|
169 | 169 | : $this->plugin_path; |
170 | 170 | } |
171 | 171 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | public function pluginUrl(string $additional_path = ''): string |
178 | 178 | { |
179 | 179 | return is_string($additional_path) && $additional_path !== '' |
180 | - ? $this->plugin_url . $additional_path |
|
180 | + ? $this->plugin_url.$additional_path |
|
181 | 181 | : $this->plugin_url; |
182 | 182 | } |
183 | 183 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | public function distributionAssetsPath(string $additional_path = ''): string |
217 | 217 | { |
218 | 218 | return is_string($additional_path) && $additional_path !== '' |
219 | - ? $this->assets_path . $additional_path |
|
219 | + ? $this->assets_path.$additional_path |
|
220 | 220 | : $this->assets_path; |
221 | 221 | } |
222 | 222 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | public function distributionAssetsUrl(string $additional_path = ''): string |
229 | 229 | { |
230 | 230 | return is_string($additional_path) && $additional_path !== '' |
231 | - ? $this->assets_url . $additional_path |
|
231 | + ? $this->assets_url.$additional_path |
|
232 | 232 | : $this->assets_url; |
233 | 233 | } |
234 | 234 |
@@ -22,101 +22,101 @@ |
||
22 | 22 | */ |
23 | 23 | class DomainFactory |
24 | 24 | { |
25 | - /** |
|
26 | - * @var DomainInterface[] |
|
27 | - */ |
|
28 | - protected static array $domains = []; |
|
25 | + /** |
|
26 | + * @var DomainInterface[] |
|
27 | + */ |
|
28 | + protected static array $domains = []; |
|
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * @param string $domain_fqcn [required] Fully Qualified Class Name for the Domain class |
|
33 | - * @param string $main_file [required] path to the main plugin file |
|
34 | - * @param string $version [required] version string for the plugin |
|
35 | - * @return DomainInterface |
|
36 | - * @throws DomainException |
|
37 | - * @throws InvalidArgumentException |
|
38 | - * @throws InvalidDataTypeException |
|
39 | - * @throws InvalidInterfaceException |
|
40 | - */ |
|
41 | - public static function create(string $domain_fqcn, string $main_file, string $version): DomainInterface |
|
42 | - { |
|
43 | - $fqcn = new FullyQualifiedName($domain_fqcn); |
|
44 | - return DomainFactory::getDomain($fqcn->string(), [$main_file, $version]); |
|
45 | - } |
|
31 | + /** |
|
32 | + * @param string $domain_fqcn [required] Fully Qualified Class Name for the Domain class |
|
33 | + * @param string $main_file [required] path to the main plugin file |
|
34 | + * @param string $version [required] version string for the plugin |
|
35 | + * @return DomainInterface |
|
36 | + * @throws DomainException |
|
37 | + * @throws InvalidArgumentException |
|
38 | + * @throws InvalidDataTypeException |
|
39 | + * @throws InvalidInterfaceException |
|
40 | + */ |
|
41 | + public static function create(string $domain_fqcn, string $main_file, string $version): DomainInterface |
|
42 | + { |
|
43 | + $fqcn = new FullyQualifiedName($domain_fqcn); |
|
44 | + return DomainFactory::getDomain($fqcn->string(), [$main_file, $version]); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param FullyQualifiedName $domain_fqcn [required] Fully Qualified Class Name for the Domain class |
|
50 | - * @param array $arguments [required] array of arguments to be passed to the Domain class |
|
51 | - * constructor. Must at least include the following two value objects: |
|
52 | - * [ |
|
53 | - * EventEspresso\core\domain\values\FilePath $plugin_file |
|
54 | - * EventEspresso\core\domain\values\Version $version |
|
55 | - * ] |
|
56 | - * @return DomainInterface |
|
57 | - * @throws DomainException |
|
58 | - * @throws InvalidArgumentException |
|
59 | - * @throws InvalidDataTypeException |
|
60 | - * @throws InvalidInterfaceException |
|
61 | - */ |
|
62 | - public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments): DomainInterface |
|
63 | - { |
|
64 | - return DomainFactory::getDomain($domain_fqcn->string(), $arguments); |
|
65 | - } |
|
48 | + /** |
|
49 | + * @param FullyQualifiedName $domain_fqcn [required] Fully Qualified Class Name for the Domain class |
|
50 | + * @param array $arguments [required] array of arguments to be passed to the Domain class |
|
51 | + * constructor. Must at least include the following two value objects: |
|
52 | + * [ |
|
53 | + * EventEspresso\core\domain\values\FilePath $plugin_file |
|
54 | + * EventEspresso\core\domain\values\Version $version |
|
55 | + * ] |
|
56 | + * @return DomainInterface |
|
57 | + * @throws DomainException |
|
58 | + * @throws InvalidArgumentException |
|
59 | + * @throws InvalidDataTypeException |
|
60 | + * @throws InvalidInterfaceException |
|
61 | + */ |
|
62 | + public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments): DomainInterface |
|
63 | + { |
|
64 | + return DomainFactory::getDomain($domain_fqcn->string(), $arguments); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * @return DomainInterface |
|
70 | - * @throws DomainException |
|
71 | - * @throws InvalidArgumentException |
|
72 | - * @throws InvalidDataTypeException |
|
73 | - * @throws InvalidFilePathException |
|
74 | - * @throws InvalidInterfaceException |
|
75 | - */ |
|
76 | - public static function getEventEspressoCoreDomain(): DomainInterface |
|
77 | - { |
|
78 | - $fqcn = 'EventEspresso\core\domain\Domain'; |
|
79 | - if (! isset(DomainFactory::$domains[ $fqcn ])) { |
|
80 | - DomainFactory::getDomain($fqcn, [EVENT_ESPRESSO_MAIN_FILE, espresso_version()]); |
|
81 | - } |
|
82 | - return DomainFactory::$domains[ $fqcn ]; |
|
83 | - } |
|
68 | + /** |
|
69 | + * @return DomainInterface |
|
70 | + * @throws DomainException |
|
71 | + * @throws InvalidArgumentException |
|
72 | + * @throws InvalidDataTypeException |
|
73 | + * @throws InvalidFilePathException |
|
74 | + * @throws InvalidInterfaceException |
|
75 | + */ |
|
76 | + public static function getEventEspressoCoreDomain(): DomainInterface |
|
77 | + { |
|
78 | + $fqcn = 'EventEspresso\core\domain\Domain'; |
|
79 | + if (! isset(DomainFactory::$domains[ $fqcn ])) { |
|
80 | + DomainFactory::getDomain($fqcn, [EVENT_ESPRESSO_MAIN_FILE, espresso_version()]); |
|
81 | + } |
|
82 | + return DomainFactory::$domains[ $fqcn ]; |
|
83 | + } |
|
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * @param string $fqcn |
|
88 | - * @param array $arguments |
|
89 | - * @return DomainInterface |
|
90 | - */ |
|
91 | - private static function getDomain(string $fqcn, array $arguments): DomainInterface |
|
92 | - { |
|
93 | - if (! isset(DomainFactory::$domains[ $fqcn ])) { |
|
94 | - if (! isset($arguments[0], $arguments[1])) { |
|
95 | - throw new InvalidArgumentException( |
|
96 | - esc_html__( |
|
97 | - 'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class', |
|
98 | - 'event_espresso' |
|
99 | - ) |
|
100 | - ); |
|
101 | - } |
|
102 | - $filepath = $arguments[0] instanceof FilePath ? $arguments[0] : new FilePath($arguments[0]); |
|
103 | - $version = $arguments[1] instanceof Version ? $arguments[1] : Version::fromString($arguments[1]); |
|
104 | - $domain = new $fqcn($filepath, $version); |
|
105 | - if (! $domain instanceof DomainBase || ! $domain instanceof $fqcn) { |
|
106 | - throw new DomainException( |
|
107 | - sprintf( |
|
108 | - esc_html__( |
|
109 | - 'The requested Domain class "%1$s" could not be loaded.', |
|
110 | - 'event_espresso' |
|
111 | - ), |
|
112 | - $fqcn |
|
113 | - ) |
|
114 | - ); |
|
115 | - } |
|
116 | - DomainFactory::$domains[ $fqcn ] = $domain; |
|
117 | - // we still need to share this with the core loader to facilitate automatic dependency injection |
|
118 | - LoaderFactory::getLoader()->share($fqcn, $domain, [$filepath, $version, $domain->assetNamespace()]); |
|
119 | - } |
|
120 | - return DomainFactory::$domains[ $fqcn ]; |
|
121 | - } |
|
86 | + /** |
|
87 | + * @param string $fqcn |
|
88 | + * @param array $arguments |
|
89 | + * @return DomainInterface |
|
90 | + */ |
|
91 | + private static function getDomain(string $fqcn, array $arguments): DomainInterface |
|
92 | + { |
|
93 | + if (! isset(DomainFactory::$domains[ $fqcn ])) { |
|
94 | + if (! isset($arguments[0], $arguments[1])) { |
|
95 | + throw new InvalidArgumentException( |
|
96 | + esc_html__( |
|
97 | + 'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class', |
|
98 | + 'event_espresso' |
|
99 | + ) |
|
100 | + ); |
|
101 | + } |
|
102 | + $filepath = $arguments[0] instanceof FilePath ? $arguments[0] : new FilePath($arguments[0]); |
|
103 | + $version = $arguments[1] instanceof Version ? $arguments[1] : Version::fromString($arguments[1]); |
|
104 | + $domain = new $fqcn($filepath, $version); |
|
105 | + if (! $domain instanceof DomainBase || ! $domain instanceof $fqcn) { |
|
106 | + throw new DomainException( |
|
107 | + sprintf( |
|
108 | + esc_html__( |
|
109 | + 'The requested Domain class "%1$s" could not be loaded.', |
|
110 | + 'event_espresso' |
|
111 | + ), |
|
112 | + $fqcn |
|
113 | + ) |
|
114 | + ); |
|
115 | + } |
|
116 | + DomainFactory::$domains[ $fqcn ] = $domain; |
|
117 | + // we still need to share this with the core loader to facilitate automatic dependency injection |
|
118 | + LoaderFactory::getLoader()->share($fqcn, $domain, [$filepath, $version, $domain->assetNamespace()]); |
|
119 | + } |
|
120 | + return DomainFactory::$domains[ $fqcn ]; |
|
121 | + } |
|
122 | 122 | } |
@@ -15,30 +15,30 @@ |
||
15 | 15 | */ |
16 | 16 | class FilePath |
17 | 17 | { |
18 | - private string $file_path; |
|
18 | + private string $file_path; |
|
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * FilePath constructor. |
|
23 | - * |
|
24 | - * @param string $file_path |
|
25 | - * @throws InvalidDataTypeException |
|
26 | - * @throws InvalidFilePathException |
|
27 | - */ |
|
28 | - public function __construct(string $file_path) |
|
29 | - { |
|
30 | - if (! is_readable($file_path)) { |
|
31 | - throw new InvalidFilePathException($file_path); |
|
32 | - } |
|
33 | - $this->file_path = $file_path; |
|
34 | - } |
|
21 | + /** |
|
22 | + * FilePath constructor. |
|
23 | + * |
|
24 | + * @param string $file_path |
|
25 | + * @throws InvalidDataTypeException |
|
26 | + * @throws InvalidFilePathException |
|
27 | + */ |
|
28 | + public function __construct(string $file_path) |
|
29 | + { |
|
30 | + if (! is_readable($file_path)) { |
|
31 | + throw new InvalidFilePathException($file_path); |
|
32 | + } |
|
33 | + $this->file_path = $file_path; |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - public function __toString(): string |
|
41 | - { |
|
42 | - return $this->file_path; |
|
43 | - } |
|
37 | + /** |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + public function __toString(): string |
|
41 | + { |
|
42 | + return $this->file_path; |
|
43 | + } |
|
44 | 44 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | */ |
28 | 28 | public function __construct(string $file_path) |
29 | 29 | { |
30 | - if (! is_readable($file_path)) { |
|
30 | + if ( ! is_readable($file_path)) { |
|
31 | 31 | throw new InvalidFilePathException($file_path); |
32 | 32 | } |
33 | 33 | $this->file_path = $file_path; |