@@ -3,8 +3,6 @@ |
||
3 | 3 | namespace EventEspresso\core\domain\entities\routing\specifications\admin; |
4 | 4 | |
5 | 5 | use EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecification; |
6 | -use WP_Post; |
|
7 | -use WP_Screen; |
|
8 | 6 | |
9 | 7 | /** |
10 | 8 | * Class WordPressPageEditorEdit |
@@ -16,18 +16,18 @@ |
||
16 | 16 | */ |
17 | 17 | class WordPressPageEditorEdit extends RouteMatchSpecification |
18 | 18 | { |
19 | - /** |
|
20 | - * returns true if current request matches specification |
|
21 | - * |
|
22 | - * @since 4.9.71.p |
|
23 | - * @return boolean |
|
24 | - */ |
|
25 | - public function isMatchingRoute() |
|
26 | - { |
|
27 | - global $pagenow; |
|
28 | - return $pagenow |
|
29 | - && $pagenow === 'plugins.php' |
|
30 | - && $this->request->getRequestParam('post_type', 'post') === 'page' |
|
31 | - && $this->request->getRequestParam('action') === 'edit'; |
|
32 | - } |
|
19 | + /** |
|
20 | + * returns true if current request matches specification |
|
21 | + * |
|
22 | + * @since 4.9.71.p |
|
23 | + * @return boolean |
|
24 | + */ |
|
25 | + public function isMatchingRoute() |
|
26 | + { |
|
27 | + global $pagenow; |
|
28 | + return $pagenow |
|
29 | + && $pagenow === 'plugins.php' |
|
30 | + && $this->request->getRequestParam('post_type', 'post') === 'page' |
|
31 | + && $this->request->getRequestParam('action') === 'edit'; |
|
32 | + } |
|
33 | 33 | } |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace EventEspresso\core\domain\entities\routing\specifications\admin; |
4 | 4 | |
5 | 5 | use EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecification; |
6 | -use WP_Post; |
|
7 | 6 | |
8 | 7 | /** |
9 | 8 | * Class WordPressPostsAddNew |
@@ -15,17 +15,17 @@ |
||
15 | 15 | */ |
16 | 16 | class WordPressPostsEditorAddNew extends RouteMatchSpecification |
17 | 17 | { |
18 | - /** |
|
19 | - * returns true if current request matches specification |
|
20 | - * |
|
21 | - * @since 4.9.71.p |
|
22 | - * @return boolean |
|
23 | - */ |
|
24 | - public function isMatchingRoute() |
|
25 | - { |
|
26 | - global $pagenow; |
|
27 | - return $pagenow |
|
28 | - && $pagenow === 'post-new.php' |
|
29 | - && $this->request->getRequestParam('post_type', 'post') === 'post'; |
|
30 | - } |
|
18 | + /** |
|
19 | + * returns true if current request matches specification |
|
20 | + * |
|
21 | + * @since 4.9.71.p |
|
22 | + * @return boolean |
|
23 | + */ |
|
24 | + public function isMatchingRoute() |
|
25 | + { |
|
26 | + global $pagenow; |
|
27 | + return $pagenow |
|
28 | + && $pagenow === 'post-new.php' |
|
29 | + && $this->request->getRequestParam('post_type', 'post') === 'post'; |
|
30 | + } |
|
31 | 31 | } |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace EventEspresso\core\domain\entities\routing\specifications\admin; |
4 | 4 | |
5 | 5 | use EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecification; |
6 | -use WP_Post; |
|
7 | 6 | |
8 | 7 | /** |
9 | 8 | * Class WordPressPostsEdit |
@@ -16,18 +16,18 @@ |
||
16 | 16 | class WordPressPostsEditorEdit extends RouteMatchSpecification |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * returns true if current request matches specification |
|
21 | - * |
|
22 | - * @return boolean |
|
23 | - * @since 4.9.71.p |
|
24 | - */ |
|
25 | - public function isMatchingRoute() |
|
26 | - { |
|
27 | - global $pagenow; |
|
28 | - return $pagenow |
|
29 | - && $pagenow === 'post.php' |
|
30 | - && $this->request->getRequestParam('post_type', 'post') === 'post' |
|
31 | - && $this->request->getRequestParam('action') === 'edit'; |
|
32 | - } |
|
19 | + /** |
|
20 | + * returns true if current request matches specification |
|
21 | + * |
|
22 | + * @return boolean |
|
23 | + * @since 4.9.71.p |
|
24 | + */ |
|
25 | + public function isMatchingRoute() |
|
26 | + { |
|
27 | + global $pagenow; |
|
28 | + return $pagenow |
|
29 | + && $pagenow === 'post.php' |
|
30 | + && $this->request->getRequestParam('post_type', 'post') === 'post' |
|
31 | + && $this->request->getRequestParam('action') === 'edit'; |
|
32 | + } |
|
33 | 33 | } |
@@ -22,322 +22,322 @@ |
||
22 | 22 | class RouteHandler |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * @var LoaderInterface |
|
27 | - */ |
|
28 | - private $loader; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var EE_Maintenance_Mode $maintenance_mode |
|
32 | - */ |
|
33 | - private $maintenance_mode; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var RequestInterface $request |
|
37 | - */ |
|
38 | - private $request; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var RouteMatchSpecificationManager $route_manager |
|
42 | - */ |
|
43 | - private $route_manager; |
|
44 | - |
|
45 | - /** |
|
46 | - * AdminRouter constructor. |
|
47 | - * |
|
48 | - * @param LoaderInterface $loader |
|
49 | - * @param EE_Maintenance_Mode $maintenance_mode |
|
50 | - * @param RequestInterface $request |
|
51 | - * @param RouteMatchSpecificationManager $route_manager |
|
52 | - */ |
|
53 | - public function __construct( |
|
54 | - LoaderInterface $loader, |
|
55 | - EE_Maintenance_Mode $maintenance_mode, |
|
56 | - RequestInterface $request, |
|
57 | - RouteMatchSpecificationManager $route_manager |
|
58 | - ) { |
|
59 | - $this->loader = $loader; |
|
60 | - $this->maintenance_mode = $maintenance_mode; |
|
61 | - $this->request = $request; |
|
62 | - $this->route_manager = $route_manager; |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * @throws Exception |
|
68 | - * @since $VID:$ |
|
69 | - */ |
|
70 | - public function handleAssetManagerRequest() |
|
71 | - { |
|
72 | - try { |
|
73 | - if (! $this->request->isAdmin() |
|
74 | - && ! $this->request->isFrontend() |
|
75 | - && ! $this->request->isIframe() |
|
76 | - && ! $this->request->isWordPressApi() |
|
77 | - ) { |
|
78 | - return; |
|
79 | - } |
|
80 | - $this->loader->getShared('EventEspresso\core\services\assets\Registry'); |
|
81 | - $this->loader->getShared('EventEspresso\core\domain\services\assets\CoreAssetManager'); |
|
82 | - if ($this->canLoadBlocks()) { |
|
83 | - $this->loader->getShared( |
|
84 | - 'EventEspresso\core\services\editor\BlockRegistrationManager' |
|
85 | - ); |
|
86 | - } |
|
87 | - } catch (Exception $exception) { |
|
88 | - new ExceptionStackTraceDisplay($exception); |
|
89 | - } |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * Return whether blocks can be registered/loaded or not. |
|
95 | - * |
|
96 | - * @return bool |
|
97 | - * @since $VID:$ |
|
98 | - */ |
|
99 | - private function canLoadBlocks() |
|
100 | - { |
|
101 | - return apply_filters('FHEE__EE_System__canLoadBlocks', true) |
|
102 | - && function_exists('register_block_type') |
|
103 | - // don't load blocks if in the Divi page builder editor context |
|
104 | - // @see https://github.com/eventespresso/event-espresso-core/issues/814 |
|
105 | - && ! $this->request->getRequestParam('et_fb', false); |
|
106 | - } |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * @throws Exception |
|
111 | - * @since $VID:$ |
|
112 | - */ |
|
113 | - public function handleControllerRequest() |
|
114 | - { |
|
115 | - try { |
|
116 | - $this->handleAdminRequest(); |
|
117 | - $this->handleFrontendRequest(); |
|
118 | - $this->handleWordPressHeartbeatRequest(); |
|
119 | - $this->handleWordPressPluginsPage(); |
|
120 | - } catch (Exception $exception) { |
|
121 | - new ExceptionStackTraceDisplay($exception); |
|
122 | - } |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * @throws Exception |
|
128 | - * @since $VID:$ |
|
129 | - */ |
|
130 | - private function handleAdminRequest() |
|
131 | - { |
|
132 | - try { |
|
133 | - if (! $this->request->isAdmin() || $this->request->isAdminAjax()) { |
|
134 | - return; |
|
135 | - } |
|
136 | - do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
137 | - $this->loader->getShared('EE_Admin'); |
|
138 | - |
|
139 | - EE_Dependency_Map::register_dependencies( |
|
140 | - 'EventEspresso\core\domain\services\assets\EspressoAdminAssetManager', |
|
141 | - [ |
|
142 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
143 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
144 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
145 | - ] |
|
146 | - ); |
|
147 | - $this->loader->getShared('EventEspresso\core\domain\services\assets\EspressoAdminAssetManager'); |
|
148 | - } catch (Exception $exception) { |
|
149 | - new ExceptionStackTraceDisplay($exception); |
|
150 | - } |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - /** |
|
155 | - * @throws Exception |
|
156 | - * @since $VID:$ |
|
157 | - */ |
|
158 | - private function handleFrontendRequest() |
|
159 | - { |
|
160 | - try { |
|
161 | - // don't load frontend if M-Mode is active or request is not browser HTTP |
|
162 | - if ($this->maintenance_mode->level() || ! $this->request->isFrontend() || ! $this->request->isFrontAjax()) { |
|
163 | - return; |
|
164 | - } |
|
165 | - do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
166 | - $this->loader->getShared('EE_Front_Controller'); |
|
167 | - } catch (Exception $exception) { |
|
168 | - new ExceptionStackTraceDisplay($exception); |
|
169 | - } |
|
170 | - } |
|
171 | - |
|
172 | - |
|
173 | - /** |
|
174 | - * @return bool |
|
175 | - * @since $VID:$ |
|
176 | - */ |
|
177 | - private function isGQLRequest() |
|
178 | - { |
|
179 | - return PHP_VERSION_ID > 70100 |
|
180 | - && ( |
|
181 | - $this->request->isGQL() |
|
182 | - || $this->request->isUnitTesting() |
|
183 | - || $this->route_manager->routeMatchesCurrentRequest( |
|
184 | - 'EventEspresso\core\domain\entities\routing\specifications\admin\EspressoEventEditor' |
|
185 | - ) |
|
186 | - ); |
|
187 | - } |
|
188 | - |
|
189 | - |
|
190 | - /** |
|
191 | - * @throws Exception |
|
192 | - * @since $VID:$ |
|
193 | - */ |
|
194 | - public function handleGQLRequest() |
|
195 | - { |
|
196 | - try { |
|
197 | - if (! $this->isGQLRequest()) { |
|
198 | - return; |
|
199 | - } |
|
200 | - if (! class_exists('WPGraphQL')) { |
|
201 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
202 | - } |
|
203 | - // load handler for EE GraphQL requests |
|
204 | - $graphQL_manager = $this->loader->getShared( |
|
205 | - 'EventEspresso\core\services\graphql\GraphQLManager' |
|
206 | - ); |
|
207 | - $graphQL_manager->init(); |
|
208 | - } catch (Exception $exception) { |
|
209 | - new ExceptionStackTraceDisplay($exception); |
|
210 | - } |
|
211 | - } |
|
212 | - |
|
213 | - |
|
214 | - /** |
|
215 | - * @throws Exception |
|
216 | - * @since $VID:$ |
|
217 | - */ |
|
218 | - public function handlePersonalDataRequest() |
|
219 | - { |
|
220 | - try { |
|
221 | - // don't load frontend if M-Mode is active or request is not browser HTTP |
|
222 | - if (! $this->request->isAdmin() |
|
223 | - || ! $this->request->isAjax() |
|
224 | - || ! $this->maintenance_mode->models_can_query() |
|
225 | - ) { |
|
226 | - return; |
|
227 | - } |
|
228 | - $this->loader->getShared('EventEspresso\core\services\privacy\erasure\PersonalDataEraserManager'); |
|
229 | - $this->loader->getShared('EventEspresso\core\services\privacy\export\PersonalDataExporterManager'); |
|
230 | - } catch (Exception $exception) { |
|
231 | - new ExceptionStackTraceDisplay($exception); |
|
232 | - } |
|
233 | - } |
|
234 | - |
|
235 | - |
|
236 | - /** |
|
237 | - * @throws Exception |
|
238 | - * @since $VID:$ |
|
239 | - */ |
|
240 | - public function handlePueRequest() |
|
241 | - { |
|
242 | - try { |
|
243 | - if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', true)) { |
|
244 | - // pew pew pew |
|
245 | - $this->loader->getShared('EventEspresso\core\services\licensing\LicenseService'); |
|
246 | - do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
247 | - } |
|
248 | - } catch (Exception $exception) { |
|
249 | - new ExceptionStackTraceDisplay($exception); |
|
250 | - } |
|
251 | - } |
|
252 | - |
|
253 | - |
|
254 | - /** |
|
255 | - * @throws Exception |
|
256 | - * @since $VID:$ |
|
257 | - */ |
|
258 | - public function handleSessionRequest() |
|
259 | - { |
|
260 | - try { |
|
261 | - if (! $this->request->isAdmin() && ! $this->request->isEeAjax() && ! $this->request->isFrontend()) { |
|
262 | - return; |
|
263 | - } |
|
264 | - $this->loader->getShared('EE_Session'); |
|
265 | - } catch (Exception $exception) { |
|
266 | - new ExceptionStackTraceDisplay($exception); |
|
267 | - } |
|
268 | - } |
|
269 | - |
|
270 | - |
|
271 | - /** |
|
272 | - * @throws Exception |
|
273 | - * @since $VID:$ |
|
274 | - */ |
|
275 | - public function handleShortcodesRequest() |
|
276 | - { |
|
277 | - try { |
|
278 | - if (! $this->request->isFrontend() && ! $this->request->isIframe() && ! $this->request->isAjax()) { |
|
279 | - return; |
|
280 | - } |
|
281 | - // load, register, and add shortcodes the new way |
|
282 | - $this->loader->getShared( |
|
283 | - 'EventEspresso\core\services\shortcodes\ShortcodesManager', |
|
284 | - [ |
|
285 | - // and the old way, but we'll put it under control of the new system |
|
286 | - EE_Config::getLegacyShortcodesManager(), |
|
287 | - ] |
|
288 | - ); |
|
289 | - } catch (Exception $exception) { |
|
290 | - new ExceptionStackTraceDisplay($exception); |
|
291 | - } |
|
292 | - } |
|
293 | - |
|
294 | - |
|
295 | - /** |
|
296 | - * @throws Exception |
|
297 | - * @since $VID:$ |
|
298 | - */ |
|
299 | - public function handleWordPressHeartbeatRequest() |
|
300 | - { |
|
301 | - try { |
|
302 | - if (! $this->request->isWordPressHeartbeat()) { |
|
303 | - return; |
|
304 | - } |
|
305 | - $this->loader->getShared('EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat'); |
|
306 | - } catch (Exception $exception) { |
|
307 | - new ExceptionStackTraceDisplay($exception); |
|
308 | - } |
|
309 | - } |
|
310 | - |
|
311 | - |
|
312 | - /** |
|
313 | - * @throws Exception |
|
314 | - * @since $VID:$ |
|
315 | - */ |
|
316 | - public function handleWordPressPluginsPage() |
|
317 | - { |
|
318 | - try { |
|
319 | - if (! $this->request->isAdmin() |
|
320 | - || ! $this->route_manager->routeMatchesCurrentRequest( |
|
321 | - 'EventEspresso\core\domain\entities\routing\specifications\admin\WordPressPluginsPage' |
|
322 | - ) |
|
323 | - ) { |
|
324 | - return; |
|
325 | - } |
|
326 | - EE_Dependency_Map::register_dependencies( |
|
327 | - 'EventEspresso\core\domain\services\assets\WordpressPluginsPageAssetManager', |
|
328 | - [ |
|
329 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
330 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
331 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
332 | - 'EventEspresso\core\domain\services\admin\ExitModal' => EE_Dependency_Map::load_from_cache, |
|
333 | - ] |
|
334 | - ); |
|
335 | - $this->loader->getShared('EventEspresso\core\domain\services\assets\WordpressPluginsPageAssetManager'); |
|
336 | - /** @var PluginUpsells $plugin_upsells */ |
|
337 | - $plugin_upsells = $this->loader->getShared('EventEspresso\core\domain\services\admin\PluginUpsells'); |
|
338 | - $plugin_upsells->decafUpsells(); |
|
339 | - } catch (Exception $exception) { |
|
340 | - new ExceptionStackTraceDisplay($exception); |
|
341 | - } |
|
342 | - } |
|
25 | + /** |
|
26 | + * @var LoaderInterface |
|
27 | + */ |
|
28 | + private $loader; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var EE_Maintenance_Mode $maintenance_mode |
|
32 | + */ |
|
33 | + private $maintenance_mode; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var RequestInterface $request |
|
37 | + */ |
|
38 | + private $request; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var RouteMatchSpecificationManager $route_manager |
|
42 | + */ |
|
43 | + private $route_manager; |
|
44 | + |
|
45 | + /** |
|
46 | + * AdminRouter constructor. |
|
47 | + * |
|
48 | + * @param LoaderInterface $loader |
|
49 | + * @param EE_Maintenance_Mode $maintenance_mode |
|
50 | + * @param RequestInterface $request |
|
51 | + * @param RouteMatchSpecificationManager $route_manager |
|
52 | + */ |
|
53 | + public function __construct( |
|
54 | + LoaderInterface $loader, |
|
55 | + EE_Maintenance_Mode $maintenance_mode, |
|
56 | + RequestInterface $request, |
|
57 | + RouteMatchSpecificationManager $route_manager |
|
58 | + ) { |
|
59 | + $this->loader = $loader; |
|
60 | + $this->maintenance_mode = $maintenance_mode; |
|
61 | + $this->request = $request; |
|
62 | + $this->route_manager = $route_manager; |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * @throws Exception |
|
68 | + * @since $VID:$ |
|
69 | + */ |
|
70 | + public function handleAssetManagerRequest() |
|
71 | + { |
|
72 | + try { |
|
73 | + if (! $this->request->isAdmin() |
|
74 | + && ! $this->request->isFrontend() |
|
75 | + && ! $this->request->isIframe() |
|
76 | + && ! $this->request->isWordPressApi() |
|
77 | + ) { |
|
78 | + return; |
|
79 | + } |
|
80 | + $this->loader->getShared('EventEspresso\core\services\assets\Registry'); |
|
81 | + $this->loader->getShared('EventEspresso\core\domain\services\assets\CoreAssetManager'); |
|
82 | + if ($this->canLoadBlocks()) { |
|
83 | + $this->loader->getShared( |
|
84 | + 'EventEspresso\core\services\editor\BlockRegistrationManager' |
|
85 | + ); |
|
86 | + } |
|
87 | + } catch (Exception $exception) { |
|
88 | + new ExceptionStackTraceDisplay($exception); |
|
89 | + } |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * Return whether blocks can be registered/loaded or not. |
|
95 | + * |
|
96 | + * @return bool |
|
97 | + * @since $VID:$ |
|
98 | + */ |
|
99 | + private function canLoadBlocks() |
|
100 | + { |
|
101 | + return apply_filters('FHEE__EE_System__canLoadBlocks', true) |
|
102 | + && function_exists('register_block_type') |
|
103 | + // don't load blocks if in the Divi page builder editor context |
|
104 | + // @see https://github.com/eventespresso/event-espresso-core/issues/814 |
|
105 | + && ! $this->request->getRequestParam('et_fb', false); |
|
106 | + } |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * @throws Exception |
|
111 | + * @since $VID:$ |
|
112 | + */ |
|
113 | + public function handleControllerRequest() |
|
114 | + { |
|
115 | + try { |
|
116 | + $this->handleAdminRequest(); |
|
117 | + $this->handleFrontendRequest(); |
|
118 | + $this->handleWordPressHeartbeatRequest(); |
|
119 | + $this->handleWordPressPluginsPage(); |
|
120 | + } catch (Exception $exception) { |
|
121 | + new ExceptionStackTraceDisplay($exception); |
|
122 | + } |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * @throws Exception |
|
128 | + * @since $VID:$ |
|
129 | + */ |
|
130 | + private function handleAdminRequest() |
|
131 | + { |
|
132 | + try { |
|
133 | + if (! $this->request->isAdmin() || $this->request->isAdminAjax()) { |
|
134 | + return; |
|
135 | + } |
|
136 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
137 | + $this->loader->getShared('EE_Admin'); |
|
138 | + |
|
139 | + EE_Dependency_Map::register_dependencies( |
|
140 | + 'EventEspresso\core\domain\services\assets\EspressoAdminAssetManager', |
|
141 | + [ |
|
142 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
143 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
144 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
145 | + ] |
|
146 | + ); |
|
147 | + $this->loader->getShared('EventEspresso\core\domain\services\assets\EspressoAdminAssetManager'); |
|
148 | + } catch (Exception $exception) { |
|
149 | + new ExceptionStackTraceDisplay($exception); |
|
150 | + } |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + /** |
|
155 | + * @throws Exception |
|
156 | + * @since $VID:$ |
|
157 | + */ |
|
158 | + private function handleFrontendRequest() |
|
159 | + { |
|
160 | + try { |
|
161 | + // don't load frontend if M-Mode is active or request is not browser HTTP |
|
162 | + if ($this->maintenance_mode->level() || ! $this->request->isFrontend() || ! $this->request->isFrontAjax()) { |
|
163 | + return; |
|
164 | + } |
|
165 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
166 | + $this->loader->getShared('EE_Front_Controller'); |
|
167 | + } catch (Exception $exception) { |
|
168 | + new ExceptionStackTraceDisplay($exception); |
|
169 | + } |
|
170 | + } |
|
171 | + |
|
172 | + |
|
173 | + /** |
|
174 | + * @return bool |
|
175 | + * @since $VID:$ |
|
176 | + */ |
|
177 | + private function isGQLRequest() |
|
178 | + { |
|
179 | + return PHP_VERSION_ID > 70100 |
|
180 | + && ( |
|
181 | + $this->request->isGQL() |
|
182 | + || $this->request->isUnitTesting() |
|
183 | + || $this->route_manager->routeMatchesCurrentRequest( |
|
184 | + 'EventEspresso\core\domain\entities\routing\specifications\admin\EspressoEventEditor' |
|
185 | + ) |
|
186 | + ); |
|
187 | + } |
|
188 | + |
|
189 | + |
|
190 | + /** |
|
191 | + * @throws Exception |
|
192 | + * @since $VID:$ |
|
193 | + */ |
|
194 | + public function handleGQLRequest() |
|
195 | + { |
|
196 | + try { |
|
197 | + if (! $this->isGQLRequest()) { |
|
198 | + return; |
|
199 | + } |
|
200 | + if (! class_exists('WPGraphQL')) { |
|
201 | + require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
202 | + } |
|
203 | + // load handler for EE GraphQL requests |
|
204 | + $graphQL_manager = $this->loader->getShared( |
|
205 | + 'EventEspresso\core\services\graphql\GraphQLManager' |
|
206 | + ); |
|
207 | + $graphQL_manager->init(); |
|
208 | + } catch (Exception $exception) { |
|
209 | + new ExceptionStackTraceDisplay($exception); |
|
210 | + } |
|
211 | + } |
|
212 | + |
|
213 | + |
|
214 | + /** |
|
215 | + * @throws Exception |
|
216 | + * @since $VID:$ |
|
217 | + */ |
|
218 | + public function handlePersonalDataRequest() |
|
219 | + { |
|
220 | + try { |
|
221 | + // don't load frontend if M-Mode is active or request is not browser HTTP |
|
222 | + if (! $this->request->isAdmin() |
|
223 | + || ! $this->request->isAjax() |
|
224 | + || ! $this->maintenance_mode->models_can_query() |
|
225 | + ) { |
|
226 | + return; |
|
227 | + } |
|
228 | + $this->loader->getShared('EventEspresso\core\services\privacy\erasure\PersonalDataEraserManager'); |
|
229 | + $this->loader->getShared('EventEspresso\core\services\privacy\export\PersonalDataExporterManager'); |
|
230 | + } catch (Exception $exception) { |
|
231 | + new ExceptionStackTraceDisplay($exception); |
|
232 | + } |
|
233 | + } |
|
234 | + |
|
235 | + |
|
236 | + /** |
|
237 | + * @throws Exception |
|
238 | + * @since $VID:$ |
|
239 | + */ |
|
240 | + public function handlePueRequest() |
|
241 | + { |
|
242 | + try { |
|
243 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', true)) { |
|
244 | + // pew pew pew |
|
245 | + $this->loader->getShared('EventEspresso\core\services\licensing\LicenseService'); |
|
246 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
247 | + } |
|
248 | + } catch (Exception $exception) { |
|
249 | + new ExceptionStackTraceDisplay($exception); |
|
250 | + } |
|
251 | + } |
|
252 | + |
|
253 | + |
|
254 | + /** |
|
255 | + * @throws Exception |
|
256 | + * @since $VID:$ |
|
257 | + */ |
|
258 | + public function handleSessionRequest() |
|
259 | + { |
|
260 | + try { |
|
261 | + if (! $this->request->isAdmin() && ! $this->request->isEeAjax() && ! $this->request->isFrontend()) { |
|
262 | + return; |
|
263 | + } |
|
264 | + $this->loader->getShared('EE_Session'); |
|
265 | + } catch (Exception $exception) { |
|
266 | + new ExceptionStackTraceDisplay($exception); |
|
267 | + } |
|
268 | + } |
|
269 | + |
|
270 | + |
|
271 | + /** |
|
272 | + * @throws Exception |
|
273 | + * @since $VID:$ |
|
274 | + */ |
|
275 | + public function handleShortcodesRequest() |
|
276 | + { |
|
277 | + try { |
|
278 | + if (! $this->request->isFrontend() && ! $this->request->isIframe() && ! $this->request->isAjax()) { |
|
279 | + return; |
|
280 | + } |
|
281 | + // load, register, and add shortcodes the new way |
|
282 | + $this->loader->getShared( |
|
283 | + 'EventEspresso\core\services\shortcodes\ShortcodesManager', |
|
284 | + [ |
|
285 | + // and the old way, but we'll put it under control of the new system |
|
286 | + EE_Config::getLegacyShortcodesManager(), |
|
287 | + ] |
|
288 | + ); |
|
289 | + } catch (Exception $exception) { |
|
290 | + new ExceptionStackTraceDisplay($exception); |
|
291 | + } |
|
292 | + } |
|
293 | + |
|
294 | + |
|
295 | + /** |
|
296 | + * @throws Exception |
|
297 | + * @since $VID:$ |
|
298 | + */ |
|
299 | + public function handleWordPressHeartbeatRequest() |
|
300 | + { |
|
301 | + try { |
|
302 | + if (! $this->request->isWordPressHeartbeat()) { |
|
303 | + return; |
|
304 | + } |
|
305 | + $this->loader->getShared('EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat'); |
|
306 | + } catch (Exception $exception) { |
|
307 | + new ExceptionStackTraceDisplay($exception); |
|
308 | + } |
|
309 | + } |
|
310 | + |
|
311 | + |
|
312 | + /** |
|
313 | + * @throws Exception |
|
314 | + * @since $VID:$ |
|
315 | + */ |
|
316 | + public function handleWordPressPluginsPage() |
|
317 | + { |
|
318 | + try { |
|
319 | + if (! $this->request->isAdmin() |
|
320 | + || ! $this->route_manager->routeMatchesCurrentRequest( |
|
321 | + 'EventEspresso\core\domain\entities\routing\specifications\admin\WordPressPluginsPage' |
|
322 | + ) |
|
323 | + ) { |
|
324 | + return; |
|
325 | + } |
|
326 | + EE_Dependency_Map::register_dependencies( |
|
327 | + 'EventEspresso\core\domain\services\assets\WordpressPluginsPageAssetManager', |
|
328 | + [ |
|
329 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
330 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
331 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
332 | + 'EventEspresso\core\domain\services\admin\ExitModal' => EE_Dependency_Map::load_from_cache, |
|
333 | + ] |
|
334 | + ); |
|
335 | + $this->loader->getShared('EventEspresso\core\domain\services\assets\WordpressPluginsPageAssetManager'); |
|
336 | + /** @var PluginUpsells $plugin_upsells */ |
|
337 | + $plugin_upsells = $this->loader->getShared('EventEspresso\core\domain\services\admin\PluginUpsells'); |
|
338 | + $plugin_upsells->decafUpsells(); |
|
339 | + } catch (Exception $exception) { |
|
340 | + new ExceptionStackTraceDisplay($exception); |
|
341 | + } |
|
342 | + } |
|
343 | 343 | } |
@@ -14,19 +14,19 @@ |
||
14 | 14 | */ |
15 | 15 | class EspressoEventEditorEdit extends RouteMatchSpecification |
16 | 16 | { |
17 | - /** |
|
18 | - * returns true if current request matches specification |
|
19 | - * |
|
20 | - * @since 4.9.71.p |
|
21 | - * @return boolean |
|
22 | - */ |
|
23 | - public function isMatchingRoute() |
|
24 | - { |
|
25 | - global $pagenow; |
|
26 | - return $pagenow |
|
27 | - && $pagenow === 'admin.php' |
|
28 | - && $this->request->isAdmin() |
|
29 | - && $this->request->getRequestParam('page') === 'espresso_events' |
|
30 | - && $this->request->getRequestParam('action', 'edit') === 'edit'; |
|
31 | - } |
|
17 | + /** |
|
18 | + * returns true if current request matches specification |
|
19 | + * |
|
20 | + * @since 4.9.71.p |
|
21 | + * @return boolean |
|
22 | + */ |
|
23 | + public function isMatchingRoute() |
|
24 | + { |
|
25 | + global $pagenow; |
|
26 | + return $pagenow |
|
27 | + && $pagenow === 'admin.php' |
|
28 | + && $this->request->isAdmin() |
|
29 | + && $this->request->getRequestParam('page') === 'espresso_events' |
|
30 | + && $this->request->getRequestParam('action', 'edit') === 'edit'; |
|
31 | + } |
|
32 | 32 | } |
@@ -14,18 +14,18 @@ |
||
14 | 14 | */ |
15 | 15 | class EspressoEventsListTable extends RouteMatchSpecification |
16 | 16 | { |
17 | - /** |
|
18 | - * returns true if current request matches specification |
|
19 | - * |
|
20 | - * @since 4.9.71.p |
|
21 | - * @return boolean |
|
22 | - */ |
|
23 | - public function isMatchingRoute() |
|
24 | - { |
|
25 | - global $pagenow; |
|
26 | - return $pagenow |
|
27 | - && $pagenow === 'admin.php' |
|
28 | - && $this->request->getRequestParam('page') === 'espresso_events' |
|
29 | - && $this->request->getRequestParam('action', 'default') === 'default'; |
|
30 | - } |
|
17 | + /** |
|
18 | + * returns true if current request matches specification |
|
19 | + * |
|
20 | + * @since 4.9.71.p |
|
21 | + * @return boolean |
|
22 | + */ |
|
23 | + public function isMatchingRoute() |
|
24 | + { |
|
25 | + global $pagenow; |
|
26 | + return $pagenow |
|
27 | + && $pagenow === 'admin.php' |
|
28 | + && $this->request->getRequestParam('page') === 'espresso_events' |
|
29 | + && $this->request->getRequestParam('action', 'default') === 'default'; |
|
30 | + } |
|
31 | 31 | } |
@@ -14,18 +14,18 @@ |
||
14 | 14 | */ |
15 | 15 | class EspressoVenueEditorAddNew extends RouteMatchSpecification |
16 | 16 | { |
17 | - /** |
|
18 | - * returns true if current request matches specification |
|
19 | - * |
|
20 | - * @since 4.9.71.p |
|
21 | - * @return boolean |
|
22 | - */ |
|
23 | - public function isMatchingRoute() |
|
24 | - { |
|
25 | - global $pagenow; |
|
26 | - return $pagenow |
|
27 | - && $pagenow === 'admin.php' |
|
28 | - && $this->request->getRequestParam('page') === 'espresso_venues' |
|
29 | - && $this->request->getRequestParam('action') === 'create_new'; |
|
30 | - } |
|
17 | + /** |
|
18 | + * returns true if current request matches specification |
|
19 | + * |
|
20 | + * @since 4.9.71.p |
|
21 | + * @return boolean |
|
22 | + */ |
|
23 | + public function isMatchingRoute() |
|
24 | + { |
|
25 | + global $pagenow; |
|
26 | + return $pagenow |
|
27 | + && $pagenow === 'admin.php' |
|
28 | + && $this->request->getRequestParam('page') === 'espresso_venues' |
|
29 | + && $this->request->getRequestParam('action') === 'create_new'; |
|
30 | + } |
|
31 | 31 | } |
@@ -14,17 +14,17 @@ |
||
14 | 14 | */ |
15 | 15 | class WordPressPostsListTable extends RouteMatchSpecification |
16 | 16 | { |
17 | - /** |
|
18 | - * returns true if current request matches specification |
|
19 | - * |
|
20 | - * @since 4.9.71.p |
|
21 | - * @return boolean |
|
22 | - */ |
|
23 | - public function isMatchingRoute() |
|
24 | - { |
|
25 | - global $pagenow; |
|
26 | - return $pagenow |
|
27 | - && $pagenow === 'edit.php' |
|
28 | - && $this->request->getRequestParam('post_type', 'post') === 'post'; |
|
29 | - } |
|
17 | + /** |
|
18 | + * returns true if current request matches specification |
|
19 | + * |
|
20 | + * @since 4.9.71.p |
|
21 | + * @return boolean |
|
22 | + */ |
|
23 | + public function isMatchingRoute() |
|
24 | + { |
|
25 | + global $pagenow; |
|
26 | + return $pagenow |
|
27 | + && $pagenow === 'edit.php' |
|
28 | + && $this->request->getRequestParam('post_type', 'post') === 'post'; |
|
29 | + } |
|
30 | 30 | } |
@@ -14,19 +14,19 @@ |
||
14 | 14 | */ |
15 | 15 | class EspressoEventEditorAddNew extends RouteMatchSpecification |
16 | 16 | { |
17 | - /** |
|
18 | - * returns true if current request matches specification |
|
19 | - * |
|
20 | - * @since 4.9.71.p |
|
21 | - * @return boolean |
|
22 | - */ |
|
23 | - public function isMatchingRoute() |
|
24 | - { |
|
25 | - global $pagenow; |
|
26 | - return $pagenow |
|
27 | - && $pagenow === 'admin.php' |
|
28 | - && $this->request->isAdmin() |
|
29 | - && $this->request->getRequestParam('page') === 'espresso_events' |
|
30 | - && $this->request->getRequestParam('action') === 'create_new'; |
|
31 | - } |
|
17 | + /** |
|
18 | + * returns true if current request matches specification |
|
19 | + * |
|
20 | + * @since 4.9.71.p |
|
21 | + * @return boolean |
|
22 | + */ |
|
23 | + public function isMatchingRoute() |
|
24 | + { |
|
25 | + global $pagenow; |
|
26 | + return $pagenow |
|
27 | + && $pagenow === 'admin.php' |
|
28 | + && $this->request->isAdmin() |
|
29 | + && $this->request->getRequestParam('page') === 'espresso_events' |
|
30 | + && $this->request->getRequestParam('action') === 'create_new'; |
|
31 | + } |
|
32 | 32 | } |