Completed
Branch EDTR/master (da238f)
by
unknown
09:58 queued 01:23
created
core/services/routing/RouteHandler.php 2 patches
Indentation   +318 added lines, -318 removed lines patch added patch discarded remove patch
@@ -22,322 +22,322 @@
 block discarded – undo
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 > 70000
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 > 70000
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
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     public function handleAssetManagerRequest()
71 71
     {
72 72
         try {
73
-            if (! $this->request->isAdmin()
73
+            if ( ! $this->request->isAdmin()
74 74
                 && ! $this->request->isFrontend()
75 75
                 && ! $this->request->isIframe()
76 76
                 && ! $this->request->isWordPressApi()
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     private function handleAdminRequest()
131 131
     {
132 132
         try {
133
-            if (! $this->request->isAdmin() || $this->request->isAdminAjax()) {
133
+            if ( ! $this->request->isAdmin() || $this->request->isAdminAjax()) {
134 134
                 return;
135 135
             }
136 136
             do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
     public function handleGQLRequest()
195 195
     {
196 196
         try {
197
-            if (! $this->isGQLRequest()) {
197
+            if ( ! $this->isGQLRequest()) {
198 198
                 return;
199 199
             }
200
-            if (! class_exists('WPGraphQL')) {
201
-                require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php';
200
+            if ( ! class_exists('WPGraphQL')) {
201
+                require_once EE_THIRD_PARTY.'wp-graphql/wp-graphql.php';
202 202
             }
203 203
             // load handler for EE GraphQL requests
204 204
             $graphQL_manager = $this->loader->getShared(
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     {
220 220
         try {
221 221
             // don't load frontend if M-Mode is active or request is not browser HTTP
222
-            if (! $this->request->isAdmin()
222
+            if ( ! $this->request->isAdmin()
223 223
                 || ! $this->request->isAjax()
224 224
                 || ! $this->maintenance_mode->models_can_query()
225 225
             ) {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     public function handleSessionRequest()
259 259
     {
260 260
         try {
261
-            if (! $this->request->isAdmin() && ! $this->request->isEeAjax() && ! $this->request->isFrontend()) {
261
+            if ( ! $this->request->isAdmin() && ! $this->request->isEeAjax() && ! $this->request->isFrontend()) {
262 262
                 return;
263 263
             }
264 264
             $this->loader->getShared('EE_Session');
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     public function handleShortcodesRequest()
276 276
     {
277 277
         try {
278
-            if (! $this->request->isFrontend() && ! $this->request->isIframe() && ! $this->request->isAjax()) {
278
+            if ( ! $this->request->isFrontend() && ! $this->request->isIframe() && ! $this->request->isAjax()) {
279 279
                 return;
280 280
             }
281 281
             // load, register, and add shortcodes the new way
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     public function handleWordPressHeartbeatRequest()
300 300
     {
301 301
         try {
302
-            if (! $this->request->isWordPressHeartbeat()) {
302
+            if ( ! $this->request->isWordPressHeartbeat()) {
303 303
                 return;
304 304
             }
305 305
             $this->loader->getShared('EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat');
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
     public function handleWordPressPluginsPage()
317 317
     {
318 318
         try {
319
-            if (! $this->request->isAdmin()
319
+            if ( ! $this->request->isAdmin()
320 320
                 || ! $this->route_manager->routeMatchesCurrentRequest(
321 321
                     'EventEspresso\core\domain\entities\routing\specifications\admin\WordPressPluginsPage'
322 322
                 )
Please login to merge, or discard this patch.
core/services/routing/RouteMatchSpecificationDependencyResolver.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -22,20 +22,20 @@
 block discarded – undo
22 22
 class RouteMatchSpecificationDependencyResolver extends DependencyResolver
23 23
 {
24 24
 
25
-    /**
26
-     * Used to configure and/or setup any aliases or namespace roots required by the DependencyResolver
27
-     *
28
-     * @since 4.9.71.p
29
-     * @throws InvalidAliasException
30
-     */
31
-    public function initialize()
32
-    {
33
-        $this->addAlias(
34
-            new ClassAlias(
35
-                'EventEspresso\core\services\request\RequestInterface',
36
-                'EventEspresso\core\services\request\Request'
37
-            )
38
-        );
39
-        $this->addNamespaceRoot('EventEspresso\core\domain\entities\routing\specifications');
40
-    }
25
+	/**
26
+	 * Used to configure and/or setup any aliases or namespace roots required by the DependencyResolver
27
+	 *
28
+	 * @since 4.9.71.p
29
+	 * @throws InvalidAliasException
30
+	 */
31
+	public function initialize()
32
+	{
33
+		$this->addAlias(
34
+			new ClassAlias(
35
+				'EventEspresso\core\services\request\RequestInterface',
36
+				'EventEspresso\core\services\request\Request'
37
+			)
38
+		);
39
+		$this->addNamespaceRoot('EventEspresso\core\domain\entities\routing\specifications');
40
+	}
41 41
 }
Please login to merge, or discard this patch.
core/services/routing/RouteMatchSpecificationCollection.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -16,36 +16,36 @@
 block discarded – undo
16 16
 class RouteMatchSpecificationCollection extends Collection
17 17
 {
18 18
 
19
-    const COLLECTION_NAME = 'route_match_specifications';
20
-
21
-
22
-    /**
23
-     * RouteMatchSpecificationCollection constructor
24
-     *
25
-     * @throws InvalidInterfaceException
26
-     */
27
-    public function __construct()
28
-    {
29
-        parent::__construct(
30
-            'EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface',
31
-            RouteMatchSpecificationCollection::COLLECTION_NAME
32
-        );
33
-    }
34
-
35
-
36
-    /**
37
-     * getIdentifier
38
-     * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
39
-     * If no $identifier is supplied, then the  fully qualified class name is used
40
-     *
41
-     * @param        $object
42
-     * @param  mixed $identifier
43
-     * @return bool
44
-     */
45
-    public function getIdentifier($object, $identifier = null)
46
-    {
47
-        return ! empty($identifier)
48
-            ? $identifier
49
-            : get_class($object);
50
-    }
19
+	const COLLECTION_NAME = 'route_match_specifications';
20
+
21
+
22
+	/**
23
+	 * RouteMatchSpecificationCollection constructor
24
+	 *
25
+	 * @throws InvalidInterfaceException
26
+	 */
27
+	public function __construct()
28
+	{
29
+		parent::__construct(
30
+			'EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface',
31
+			RouteMatchSpecificationCollection::COLLECTION_NAME
32
+		);
33
+	}
34
+
35
+
36
+	/**
37
+	 * getIdentifier
38
+	 * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
39
+	 * If no $identifier is supplied, then the  fully qualified class name is used
40
+	 *
41
+	 * @param        $object
42
+	 * @param  mixed $identifier
43
+	 * @return bool
44
+	 */
45
+	public function getIdentifier($object, $identifier = null)
46
+	{
47
+		return ! empty($identifier)
48
+			? $identifier
49
+			: get_class($object);
50
+	}
51 51
 }
Please login to merge, or discard this patch.
core/services/routing/RouteMatchSpecificationFactory.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -24,46 +24,46 @@
 block discarded – undo
24 24
 class RouteMatchSpecificationFactory extends FactoryWithDependencyResolver
25 25
 {
26 26
 
27
-    /**
28
-     * RouteMatchSpecificationFactory constructor
29
-     *
30
-     * @param RouteMatchSpecificationDependencyResolver $dependency_resolver
31
-     * @param LoaderInterface                           $loader
32
-     */
33
-    public function __construct(RouteMatchSpecificationDependencyResolver $dependency_resolver, LoaderInterface $loader)
34
-    {
35
-        parent::__construct($dependency_resolver, $loader);
36
-    }
27
+	/**
28
+	 * RouteMatchSpecificationFactory constructor
29
+	 *
30
+	 * @param RouteMatchSpecificationDependencyResolver $dependency_resolver
31
+	 * @param LoaderInterface                           $loader
32
+	 */
33
+	public function __construct(RouteMatchSpecificationDependencyResolver $dependency_resolver, LoaderInterface $loader)
34
+	{
35
+		parent::__construct($dependency_resolver, $loader);
36
+	}
37 37
 
38
-    /**
39
-     * @param $fqcn
40
-     * @return RouteMatchSpecification
41
-     * @throws InvalidDataTypeException
42
-     * @throws ReflectionException
43
-     * @since 4.9.71.p
44
-     */
45
-    public function createNewRouteMatchSpecification($fqcn)
46
-    {
47
-        $this->dependencyResolver()->resolveDependenciesForClass($fqcn);
48
-        return $this->loader()->getShared($fqcn);
49
-    }
38
+	/**
39
+	 * @param $fqcn
40
+	 * @return RouteMatchSpecification
41
+	 * @throws InvalidDataTypeException
42
+	 * @throws ReflectionException
43
+	 * @since 4.9.71.p
44
+	 */
45
+	public function createNewRouteMatchSpecification($fqcn)
46
+	{
47
+		$this->dependencyResolver()->resolveDependenciesForClass($fqcn);
48
+		return $this->loader()->getShared($fqcn);
49
+	}
50 50
 
51 51
 
52
-    /**
53
-     * @param $fqcn
54
-     * @return RouteMatchSpecification
55
-     * @throws InvalidArgumentException
56
-     * @throws InvalidDataTypeException
57
-     * @throws InvalidInterfaceException
58
-     * @throws ReflectionException
59
-     * @since 4.9.71.p
60
-     */
61
-    public static function create($fqcn)
62
-    {
63
-        /** @var RouteMatchSpecificationFactory $specification_factory */
64
-        $specification_factory = LoaderFactory::getLoader()->getShared(
65
-            'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'
66
-        );
67
-        return $specification_factory->createNewRouteMatchSpecification($fqcn);
68
-    }
52
+	/**
53
+	 * @param $fqcn
54
+	 * @return RouteMatchSpecification
55
+	 * @throws InvalidArgumentException
56
+	 * @throws InvalidDataTypeException
57
+	 * @throws InvalidInterfaceException
58
+	 * @throws ReflectionException
59
+	 * @since 4.9.71.p
60
+	 */
61
+	public static function create($fqcn)
62
+	{
63
+		/** @var RouteMatchSpecificationFactory $specification_factory */
64
+		$specification_factory = LoaderFactory::getLoader()->getShared(
65
+			'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'
66
+		);
67
+		return $specification_factory->createNewRouteMatchSpecification($fqcn);
68
+	}
69 69
 }
Please login to merge, or discard this patch.
core/services/routing/RouteMatchSpecificationManager.php 2 patches
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -25,122 +25,122 @@
 block discarded – undo
25 25
  */
26 26
 class RouteMatchSpecificationManager
27 27
 {
28
-    /**
29
-     * @var CollectionInterface[]|RouteMatchSpecificationInterface[] $specifications
30
-     */
31
-    private $specifications;
28
+	/**
29
+	 * @var CollectionInterface[]|RouteMatchSpecificationInterface[] $specifications
30
+	 */
31
+	private $specifications;
32 32
 
33
-    /**
34
-     * @var RouteMatchSpecificationFactory $specifications_factory
35
-     */
36
-    private $specifications_factory;
33
+	/**
34
+	 * @var RouteMatchSpecificationFactory $specifications_factory
35
+	 */
36
+	private $specifications_factory;
37 37
 
38 38
 
39
-    /**
40
-     * RouteMatchSpecificationManager constructor.
41
-     *
42
-     * @param RouteMatchSpecificationCollection $specifications
43
-     * @param RouteMatchSpecificationFactory    $specifications_factory
44
-     */
45
-    public function __construct(
46
-        RouteMatchSpecificationCollection $specifications,
47
-        RouteMatchSpecificationFactory $specifications_factory
48
-    ) {
49
-        $this->specifications = $specifications;
50
-        $this->specifications_factory = $specifications_factory;
51
-        add_action('AHEE__EE_System__loadRouteMatchSpecifications', array($this, 'initialize'));
52
-    }
39
+	/**
40
+	 * RouteMatchSpecificationManager constructor.
41
+	 *
42
+	 * @param RouteMatchSpecificationCollection $specifications
43
+	 * @param RouteMatchSpecificationFactory    $specifications_factory
44
+	 */
45
+	public function __construct(
46
+		RouteMatchSpecificationCollection $specifications,
47
+		RouteMatchSpecificationFactory $specifications_factory
48
+	) {
49
+		$this->specifications = $specifications;
50
+		$this->specifications_factory = $specifications_factory;
51
+		add_action('AHEE__EE_System__loadRouteMatchSpecifications', array($this, 'initialize'));
52
+	}
53 53
 
54 54
 
55
-    /**
56
-     * Perform any early setup required for block editors to functions
57
-     *
58
-     * @return void
59
-     * @throws CollectionLoaderException
60
-     * @throws CollectionDetailsException
61
-     */
62
-    public function initialize()
63
-    {
64
-        $this->populateSpecificationCollection();
65
-    }
55
+	/**
56
+	 * Perform any early setup required for block editors to functions
57
+	 *
58
+	 * @return void
59
+	 * @throws CollectionLoaderException
60
+	 * @throws CollectionDetailsException
61
+	 */
62
+	public function initialize()
63
+	{
64
+		$this->populateSpecificationCollection();
65
+	}
66 66
 
67 67
 
68
-    /**
69
-     * @return CollectionInterface|\EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface[]
70
-     * @throws CollectionLoaderException
71
-     * @throws CollectionDetailsException
72
-     * @since 4.9.71.p
73
-     */
74
-    private function populateSpecificationCollection()
75
-    {
76
-        $loader = new CollectionLoader(
77
-            new CollectionDetails(
78
-                // collection name
79
-                RouteMatchSpecificationCollection::COLLECTION_NAME,
80
-                // collection interface
81
-                'EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface',
82
-                // FQCNs for classes to add (all classes within each namespace will be loaded)
83
-                apply_filters(
84
-                    'FHEE__EventEspresso_core_services_route_match_RouteMatchSpecificationManager__populateSpecificationCollection__collection_FQCNs',
85
-                    array(
86
-                        'EventEspresso\core\domain\entities\routing\specifications\admin',
87
-                        'EventEspresso\core\domain\entities\routing\specifications\frontend',
88
-                    )
89
-                ),
90
-                // filepaths to classes to add
91
-                array(),
92
-                // file mask to use if parsing folder for files to add
93
-                '',
94
-                // what to use as identifier for collection entities
95
-                // using CLASS NAME prevents duplicates (works like a singleton)
96
-                CollectionDetails::ID_CLASS_NAME
97
-            ),
98
-            $this->specifications,
99
-            null,
100
-            $this->specifications_factory
101
-        );
102
-        return $loader->getCollection();
103
-    }
68
+	/**
69
+	 * @return CollectionInterface|\EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface[]
70
+	 * @throws CollectionLoaderException
71
+	 * @throws CollectionDetailsException
72
+	 * @since 4.9.71.p
73
+	 */
74
+	private function populateSpecificationCollection()
75
+	{
76
+		$loader = new CollectionLoader(
77
+			new CollectionDetails(
78
+				// collection name
79
+				RouteMatchSpecificationCollection::COLLECTION_NAME,
80
+				// collection interface
81
+				'EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface',
82
+				// FQCNs for classes to add (all classes within each namespace will be loaded)
83
+				apply_filters(
84
+					'FHEE__EventEspresso_core_services_route_match_RouteMatchSpecificationManager__populateSpecificationCollection__collection_FQCNs',
85
+					array(
86
+						'EventEspresso\core\domain\entities\routing\specifications\admin',
87
+						'EventEspresso\core\domain\entities\routing\specifications\frontend',
88
+					)
89
+				),
90
+				// filepaths to classes to add
91
+				array(),
92
+				// file mask to use if parsing folder for files to add
93
+				'',
94
+				// what to use as identifier for collection entities
95
+				// using CLASS NAME prevents duplicates (works like a singleton)
96
+				CollectionDetails::ID_CLASS_NAME
97
+			),
98
+			$this->specifications,
99
+			null,
100
+			$this->specifications_factory
101
+		);
102
+		return $loader->getCollection();
103
+	}
104 104
 
105 105
 
106
-    /**
107
-     * Given the FQCN for a RouteMatchSpecification, will return true if the current request matches
108
-     *
109
-     * @param string $routeMatchSpecificationFqcn fully qualified class name
110
-     * @return bool
111
-     * @throws InvalidClassException
112
-     * @since 4.9.71.p
113
-     */
114
-    public function routeMatchesCurrentRequest($routeMatchSpecificationFqcn)
115
-    {
116
-        /** @var \EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface $specification */
117
-        $specification = $this->specifications->get($routeMatchSpecificationFqcn);
118
-        if (! $specification instanceof $routeMatchSpecificationFqcn) {
119
-            throw new InvalidClassException($routeMatchSpecificationFqcn);
120
-        }
121
-        return $specification->isMatchingRoute();
122
-    }
106
+	/**
107
+	 * Given the FQCN for a RouteMatchSpecification, will return true if the current request matches
108
+	 *
109
+	 * @param string $routeMatchSpecificationFqcn fully qualified class name
110
+	 * @return bool
111
+	 * @throws InvalidClassException
112
+	 * @since 4.9.71.p
113
+	 */
114
+	public function routeMatchesCurrentRequest($routeMatchSpecificationFqcn)
115
+	{
116
+		/** @var \EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface $specification */
117
+		$specification = $this->specifications->get($routeMatchSpecificationFqcn);
118
+		if (! $specification instanceof $routeMatchSpecificationFqcn) {
119
+			throw new InvalidClassException($routeMatchSpecificationFqcn);
120
+		}
121
+		return $specification->isMatchingRoute();
122
+	}
123 123
 
124 124
 
125
-    /**
126
-     * Handy method for development that returns
127
-     * a list of existing RouteMatchSpecification classes
128
-     * matching the current request that can be used to identify it.
129
-     * If no matches are returned (or nothing acceptable)
130
-     * then create a new one that better matches your requirements.
131
-     *
132
-     * @return array
133
-     * @since 4.9.71.p
134
-     */
135
-    public function findRouteMatchSpecificationsMatchingCurrentRequest()
136
-    {
137
-        $matches = array();
138
-        foreach ($this->specifications as $specification) {
139
-            /** @var RouteMatchSpecificationInterface $specification */
140
-            if ($specification->isMatchingRoute()) {
141
-                $matches[] = get_class($specification);
142
-            }
143
-        }
144
-        return $matches;
145
-    }
125
+	/**
126
+	 * Handy method for development that returns
127
+	 * a list of existing RouteMatchSpecification classes
128
+	 * matching the current request that can be used to identify it.
129
+	 * If no matches are returned (or nothing acceptable)
130
+	 * then create a new one that better matches your requirements.
131
+	 *
132
+	 * @return array
133
+	 * @since 4.9.71.p
134
+	 */
135
+	public function findRouteMatchSpecificationsMatchingCurrentRequest()
136
+	{
137
+		$matches = array();
138
+		foreach ($this->specifications as $specification) {
139
+			/** @var RouteMatchSpecificationInterface $specification */
140
+			if ($specification->isMatchingRoute()) {
141
+				$matches[] = get_class($specification);
142
+			}
143
+		}
144
+		return $matches;
145
+	}
146 146
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
     {
116 116
         /** @var \EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface $specification */
117 117
         $specification = $this->specifications->get($routeMatchSpecificationFqcn);
118
-        if (! $specification instanceof $routeMatchSpecificationFqcn) {
118
+        if ( ! $specification instanceof $routeMatchSpecificationFqcn) {
119 119
             throw new InvalidClassException($routeMatchSpecificationFqcn);
120 120
         }
121 121
         return $specification->isMatchingRoute();
Please login to merge, or discard this patch.
core/EE_Dependency_Map.core.php 1 patch
Indentation   +1276 added lines, -1276 removed lines patch added patch discarded remove patch
@@ -21,1280 +21,1280 @@
 block discarded – undo
21 21
 class EE_Dependency_Map
22 22
 {
23 23
 
24
-    /**
25
-     * This means that the requested class dependency is not present in the dependency map
26
-     */
27
-    const not_registered = 0;
28
-
29
-    /**
30
-     * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.
31
-     */
32
-    const load_new_object = 1;
33
-
34
-    /**
35
-     * This instructs class loaders to return a previously instantiated and cached object for the requested class.
36
-     * IF a previously instantiated object does not exist, a new one will be created and added to the cache.
37
-     */
38
-    const load_from_cache = 2;
39
-
40
-    /**
41
-     * When registering a dependency,
42
-     * this indicates to keep any existing dependencies that already exist,
43
-     * and simply discard any new dependencies declared in the incoming data
44
-     */
45
-    const KEEP_EXISTING_DEPENDENCIES = 0;
46
-
47
-    /**
48
-     * When registering a dependency,
49
-     * this indicates to overwrite any existing dependencies that already exist using the incoming data
50
-     */
51
-    const OVERWRITE_DEPENDENCIES = 1;
52
-
53
-
54
-    /**
55
-     * @type EE_Dependency_Map $_instance
56
-     */
57
-    protected static $_instance;
58
-
59
-    /**
60
-     * @var ClassInterfaceCache $class_cache
61
-     */
62
-    private $class_cache;
63
-
64
-    /**
65
-     * @type RequestInterface $request
66
-     */
67
-    protected $request;
68
-
69
-    /**
70
-     * @type LegacyRequestInterface $legacy_request
71
-     */
72
-    protected $legacy_request;
73
-
74
-    /**
75
-     * @type ResponseInterface $response
76
-     */
77
-    protected $response;
78
-
79
-    /**
80
-     * @type LoaderInterface $loader
81
-     */
82
-    protected $loader;
83
-
84
-    /**
85
-     * @type array $_dependency_map
86
-     */
87
-    protected $_dependency_map = array();
88
-
89
-    /**
90
-     * @type array $_class_loaders
91
-     */
92
-    protected $_class_loaders = array();
93
-
94
-
95
-    /**
96
-     * EE_Dependency_Map constructor.
97
-     *
98
-     * @param ClassInterfaceCache $class_cache
99
-     */
100
-    protected function __construct(ClassInterfaceCache $class_cache)
101
-    {
102
-        $this->class_cache = $class_cache;
103
-        do_action('EE_Dependency_Map____construct', $this);
104
-    }
105
-
106
-
107
-    /**
108
-     * @return void
109
-     * @throws EE_Error
110
-     * @throws InvalidAliasException
111
-     */
112
-    public function initialize()
113
-    {
114
-        $this->_register_core_dependencies();
115
-        $this->_register_core_class_loaders();
116
-        $this->_register_core_aliases();
117
-    }
118
-
119
-
120
-    /**
121
-     * @singleton method used to instantiate class object
122
-     * @param ClassInterfaceCache|null $class_cache
123
-     * @return EE_Dependency_Map
124
-     */
125
-    public static function instance(ClassInterfaceCache $class_cache = null)
126
-    {
127
-        // check if class object is instantiated, and instantiated properly
128
-        if (! self::$_instance instanceof EE_Dependency_Map
129
-            && $class_cache instanceof ClassInterfaceCache
130
-        ) {
131
-            self::$_instance = new EE_Dependency_Map($class_cache);
132
-        }
133
-        return self::$_instance;
134
-    }
135
-
136
-
137
-    /**
138
-     * @param RequestInterface $request
139
-     */
140
-    public function setRequest(RequestInterface $request)
141
-    {
142
-        $this->request = $request;
143
-    }
144
-
145
-
146
-    /**
147
-     * @param LegacyRequestInterface $legacy_request
148
-     */
149
-    public function setLegacyRequest(LegacyRequestInterface $legacy_request)
150
-    {
151
-        $this->legacy_request = $legacy_request;
152
-    }
153
-
154
-
155
-    /**
156
-     * @param ResponseInterface $response
157
-     */
158
-    public function setResponse(ResponseInterface $response)
159
-    {
160
-        $this->response = $response;
161
-    }
162
-
163
-
164
-    /**
165
-     * @param LoaderInterface $loader
166
-     */
167
-    public function setLoader(LoaderInterface $loader)
168
-    {
169
-        $this->loader = $loader;
170
-    }
171
-
172
-
173
-    /**
174
-     * @param string $class
175
-     * @param array  $dependencies
176
-     * @param int    $overwrite
177
-     * @return bool
178
-     */
179
-    public static function register_dependencies(
180
-        $class,
181
-        array $dependencies,
182
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
183
-    ) {
184
-        return self::$_instance->registerDependencies($class, $dependencies, $overwrite);
185
-    }
186
-
187
-
188
-    /**
189
-     * Assigns an array of class names and corresponding load sources (new or cached)
190
-     * to the class specified by the first parameter.
191
-     * IMPORTANT !!!
192
-     * The order of elements in the incoming $dependencies array MUST match
193
-     * the order of the constructor parameters for the class in question.
194
-     * This is especially important when overriding any existing dependencies that are registered.
195
-     * the third parameter controls whether any duplicate dependencies are overwritten or not.
196
-     *
197
-     * @param string $class
198
-     * @param array  $dependencies
199
-     * @param int    $overwrite
200
-     * @return bool
201
-     */
202
-    public function registerDependencies(
203
-        $class,
204
-        array $dependencies,
205
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
206
-    ) {
207
-        $class = trim($class, '\\');
208
-        $registered = false;
209
-        if (empty(self::$_instance->_dependency_map[ $class ])) {
210
-            self::$_instance->_dependency_map[ $class ] = array();
211
-        }
212
-        // we need to make sure that any aliases used when registering a dependency
213
-        // get resolved to the correct class name
214
-        foreach ($dependencies as $dependency => $load_source) {
215
-            $alias = self::$_instance->getFqnForAlias($dependency);
216
-            if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
217
-                || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])
218
-            ) {
219
-                unset($dependencies[ $dependency ]);
220
-                $dependencies[ $alias ] = $load_source;
221
-                $registered = true;
222
-            }
223
-        }
224
-        // now add our two lists of dependencies together.
225
-        // using Union (+=) favours the arrays in precedence from left to right,
226
-        // so $dependencies is NOT overwritten because it is listed first
227
-        // ie: with A = B + C, entries in B take precedence over duplicate entries in C
228
-        // Union is way faster than array_merge() but should be used with caution...
229
-        // especially with numerically indexed arrays
230
-        $dependencies += self::$_instance->_dependency_map[ $class ];
231
-        // now we need to ensure that the resulting dependencies
232
-        // array only has the entries that are required for the class
233
-        // so first count how many dependencies were originally registered for the class
234
-        $dependency_count = count(self::$_instance->_dependency_map[ $class ]);
235
-        // if that count is non-zero (meaning dependencies were already registered)
236
-        self::$_instance->_dependency_map[ $class ] = $dependency_count
237
-            // then truncate the  final array to match that count
238
-            ? array_slice($dependencies, 0, $dependency_count)
239
-            // otherwise just take the incoming array because nothing previously existed
240
-            : $dependencies;
241
-        return $registered;
242
-    }
243
-
244
-
245
-    /**
246
-     * @param string $class_name
247
-     * @param string $loader
248
-     * @return bool
249
-     * @throws DomainException
250
-     */
251
-    public static function register_class_loader($class_name, $loader = 'load_core')
252
-    {
253
-        if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
254
-            throw new DomainException(
255
-                esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
256
-            );
257
-        }
258
-        // check that loader is callable or method starts with "load_" and exists in EE_Registry
259
-        if (! is_callable($loader)
260
-            && (
261
-                strpos($loader, 'load_') !== 0
262
-                || ! method_exists('EE_Registry', $loader)
263
-            )
264
-        ) {
265
-            throw new DomainException(
266
-                sprintf(
267
-                    esc_html__(
268
-                        '"%1$s" is not a valid loader method on EE_Registry.',
269
-                        'event_espresso'
270
-                    ),
271
-                    $loader
272
-                )
273
-            );
274
-        }
275
-        $class_name = self::$_instance->getFqnForAlias($class_name);
276
-        if (! isset(self::$_instance->_class_loaders[ $class_name ])) {
277
-            self::$_instance->_class_loaders[ $class_name ] = $loader;
278
-            return true;
279
-        }
280
-        return false;
281
-    }
282
-
283
-
284
-    /**
285
-     * @return array
286
-     */
287
-    public function dependency_map()
288
-    {
289
-        return $this->_dependency_map;
290
-    }
291
-
292
-
293
-    /**
294
-     * returns TRUE if dependency map contains a listing for the provided class name
295
-     *
296
-     * @param string $class_name
297
-     * @return boolean
298
-     */
299
-    public function has($class_name = '')
300
-    {
301
-        // all legacy models have the same dependencies
302
-        if (strpos($class_name, 'EEM_') === 0) {
303
-            $class_name = 'LEGACY_MODELS';
304
-        }
305
-        return isset($this->_dependency_map[ $class_name ]) ? true : false;
306
-    }
307
-
308
-
309
-    /**
310
-     * returns TRUE if dependency map contains a listing for the provided class name AND dependency
311
-     *
312
-     * @param string $class_name
313
-     * @param string $dependency
314
-     * @return bool
315
-     */
316
-    public function has_dependency_for_class($class_name = '', $dependency = '')
317
-    {
318
-        // all legacy models have the same dependencies
319
-        if (strpos($class_name, 'EEM_') === 0) {
320
-            $class_name = 'LEGACY_MODELS';
321
-        }
322
-        $dependency = $this->getFqnForAlias($dependency, $class_name);
323
-        return isset($this->_dependency_map[ $class_name ][ $dependency ])
324
-            ? true
325
-            : false;
326
-    }
327
-
328
-
329
-    /**
330
-     * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
331
-     *
332
-     * @param string $class_name
333
-     * @param string $dependency
334
-     * @return int
335
-     */
336
-    public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
337
-    {
338
-        // all legacy models have the same dependencies
339
-        if (strpos($class_name, 'EEM_') === 0) {
340
-            $class_name = 'LEGACY_MODELS';
341
-        }
342
-        $dependency = $this->getFqnForAlias($dependency);
343
-        return $this->has_dependency_for_class($class_name, $dependency)
344
-            ? $this->_dependency_map[ $class_name ][ $dependency ]
345
-            : EE_Dependency_Map::not_registered;
346
-    }
347
-
348
-
349
-    /**
350
-     * @param string $class_name
351
-     * @return string | Closure
352
-     */
353
-    public function class_loader($class_name)
354
-    {
355
-        // all legacy models use load_model()
356
-        if (strpos($class_name, 'EEM_') === 0) {
357
-            return 'load_model';
358
-        }
359
-        // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
360
-        // perform strpos() first to avoid loading regex every time we load a class
361
-        if (strpos($class_name, 'EE_CPT_') === 0
362
-            && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
363
-        ) {
364
-            return 'load_core';
365
-        }
366
-        $class_name = $this->getFqnForAlias($class_name);
367
-        return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
368
-    }
369
-
370
-
371
-    /**
372
-     * @return array
373
-     */
374
-    public function class_loaders()
375
-    {
376
-        return $this->_class_loaders;
377
-    }
378
-
379
-
380
-    /**
381
-     * adds an alias for a classname
382
-     *
383
-     * @param string $fqcn      the class name that should be used (concrete class to replace interface)
384
-     * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
385
-     * @param string $for_class the class that has the dependency (is type hinting for the interface)
386
-     * @throws InvalidAliasException
387
-     */
388
-    public function add_alias($fqcn, $alias, $for_class = '')
389
-    {
390
-        $this->class_cache->addAlias($fqcn, $alias, $for_class);
391
-    }
392
-
393
-
394
-    /**
395
-     * Returns TRUE if the provided fully qualified name IS an alias
396
-     * WHY?
397
-     * Because if a class is type hinting for a concretion,
398
-     * then why would we need to find another class to supply it?
399
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
400
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
401
-     * Don't go looking for some substitute.
402
-     * Whereas if a class is type hinting for an interface...
403
-     * then we need to find an actual class to use.
404
-     * So the interface IS the alias for some other FQN,
405
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
406
-     * represents some other class.
407
-     *
408
-     * @param string $fqn
409
-     * @param string $for_class
410
-     * @return bool
411
-     */
412
-    public function isAlias($fqn = '', $for_class = '')
413
-    {
414
-        return $this->class_cache->isAlias($fqn, $for_class);
415
-    }
416
-
417
-
418
-    /**
419
-     * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
420
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
421
-     *  for example:
422
-     *      if the following two entries were added to the _aliases array:
423
-     *          array(
424
-     *              'interface_alias'           => 'some\namespace\interface'
425
-     *              'some\namespace\interface'  => 'some\namespace\classname'
426
-     *          )
427
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
428
-     *      to load an instance of 'some\namespace\classname'
429
-     *
430
-     * @param string $alias
431
-     * @param string $for_class
432
-     * @return string
433
-     */
434
-    public function getFqnForAlias($alias = '', $for_class = '')
435
-    {
436
-        return (string) $this->class_cache->getFqnForAlias($alias, $for_class);
437
-    }
438
-
439
-
440
-    /**
441
-     * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
442
-     * if one exists, or whether a new object should be generated every time the requested class is loaded.
443
-     * This is done by using the following class constants:
444
-     *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
445
-     *        EE_Dependency_Map::load_new_object - generates a new object every time
446
-     */
447
-    protected function _register_core_dependencies()
448
-    {
449
-        $this->_dependency_map = array(
450
-            'EE_Request_Handler'                                                                                          => array(
451
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
452
-            ),
453
-            'EE_System'                                                                                                   => array(
454
-                'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
455
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
456
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
457
-                'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
458
-            ),
459
-            'EE_Session'                                                                                                  => array(
460
-                'EventEspresso\core\services\cache\TransientCacheStorage'  => EE_Dependency_Map::load_from_cache,
461
-                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
462
-                'EventEspresso\core\services\request\Request'              => EE_Dependency_Map::load_from_cache,
463
-                'EventEspresso\core\services\session\SessionStartHandler'  => EE_Dependency_Map::load_from_cache,
464
-                'EE_Encryption'                                            => EE_Dependency_Map::load_from_cache,
465
-            ),
466
-            'EE_Cart'                                                                                                     => array(
467
-                'EE_Session' => EE_Dependency_Map::load_from_cache,
468
-            ),
469
-            'EE_Front_Controller'                                                                                         => array(
470
-                'EE_Registry'              => EE_Dependency_Map::load_from_cache,
471
-                'EE_Request_Handler'       => EE_Dependency_Map::load_from_cache,
472
-                'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,
473
-            ),
474
-            'EE_Messenger_Collection_Loader'                                                                              => array(
475
-                'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
476
-            ),
477
-            'EE_Message_Type_Collection_Loader'                                                                           => array(
478
-                'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
479
-            ),
480
-            'EE_Message_Resource_Manager'                                                                                 => array(
481
-                'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
482
-                'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
483
-                'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
484
-            ),
485
-            'EE_Message_Factory'                                                                                          => array(
486
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
487
-            ),
488
-            'EE_messages'                                                                                                 => array(
489
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
490
-            ),
491
-            'EE_Messages_Generator'                                                                                       => array(
492
-                'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
493
-                'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
494
-                'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
495
-                'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
496
-            ),
497
-            'EE_Messages_Processor'                                                                                       => array(
498
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
499
-            ),
500
-            'EE_Messages_Queue'                                                                                           => array(
501
-                'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
502
-            ),
503
-            'EE_Messages_Template_Defaults'                                                                               => array(
504
-                'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
505
-                'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
506
-            ),
507
-            'EE_Message_To_Generate_From_Request'                                                                         => array(
508
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
509
-                'EE_Request_Handler'          => EE_Dependency_Map::load_from_cache,
510
-            ),
511
-            'EventEspresso\core\services\commands\CommandBus'                                                             => array(
512
-                'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
513
-            ),
514
-            'EventEspresso\services\commands\CommandHandler'                                                              => array(
515
-                'EE_Registry'         => EE_Dependency_Map::load_from_cache,
516
-                'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
517
-            ),
518
-            'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => array(
519
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
520
-            ),
521
-            'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => array(
522
-                'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
523
-                'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
524
-            ),
525
-            'EventEspresso\core\services\commands\CommandFactory'                                                         => array(
526
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
527
-            ),
528
-            'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => array(
529
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
530
-            ),
531
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => array(
532
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
533
-            ),
534
-            'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => array(
535
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
536
-            ),
537
-            'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => array(
538
-                'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
539
-            ),
540
-            'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => array(
541
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
542
-            ),
543
-            'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => array(
544
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
545
-            ),
546
-            'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => array(
547
-                'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
548
-            ),
549
-            'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array(
550
-                'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
551
-            ),
552
-            'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => array(
553
-                'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
554
-            ),
555
-            'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => array(
556
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
557
-            ),
558
-            'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => array(
559
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
560
-            ),
561
-            'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => array(
562
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
563
-            ),
564
-            'EventEspresso\core\services\database\TableManager'                                                           => array(
565
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
566
-            ),
567
-            'EE_Data_Migration_Class_Base'                                                                                => array(
568
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
569
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
570
-            ),
571
-            'EE_DMS_Core_4_1_0'                                                                                           => array(
572
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
573
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
574
-            ),
575
-            'EE_DMS_Core_4_2_0'                                                                                           => array(
576
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
577
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
578
-            ),
579
-            'EE_DMS_Core_4_3_0'                                                                                           => array(
580
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
581
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
582
-            ),
583
-            'EE_DMS_Core_4_4_0'                                                                                           => array(
584
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
585
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
586
-            ),
587
-            'EE_DMS_Core_4_5_0'                                                                                           => array(
588
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
589
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
590
-            ),
591
-            'EE_DMS_Core_4_6_0'                                                                                           => array(
592
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
593
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
594
-            ),
595
-            'EE_DMS_Core_4_7_0'                                                                                           => array(
596
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
597
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
598
-            ),
599
-            'EE_DMS_Core_4_8_0'                                                                                           => array(
600
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
601
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
602
-            ),
603
-            'EE_DMS_Core_4_9_0' => array(
604
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
605
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
606
-            ),
607
-            'EE_DMS_Core_4_10_0' => array(
608
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
609
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
610
-                'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
611
-            ),
612
-            'EventEspresso\core\services\assets\I18nRegistry'                                                             => array(
613
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
614
-                'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache,
615
-                array(),
616
-            ),
617
-            'EventEspresso\core\services\assets\Registry'                                                                 => array(
618
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
619
-                'EventEspresso\core\services\assets\I18nRegistry'    => EE_Dependency_Map::load_from_cache,
620
-            ),
621
-            'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled'                                             => array(
622
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
623
-            ),
624
-            'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout'                                              => array(
625
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
626
-            ),
627
-            'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees'                                        => array(
628
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
629
-            ),
630
-            'EventEspresso\core\domain\entities\shortcodes\EspressoEvents'                                                => array(
631
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
632
-            ),
633
-            'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou'                                              => array(
634
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
635
-            ),
636
-            'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector'                                        => array(
637
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
638
-            ),
639
-            'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage'                                               => array(
640
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
641
-            ),
642
-            'EventEspresso\core\services\cache\BasicCacheManager'                                                         => array(
643
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
644
-            ),
645
-            'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => array(
646
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
647
-            ),
648
-            'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => array(
649
-                'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
650
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
651
-            ),
652
-            'EventEspresso\core\domain\values\EmailAddress'                                                               => array(
653
-                null,
654
-                'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
655
-            ),
656
-            'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => array(
657
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
658
-            ),
659
-            'LEGACY_MODELS'                                                                                               => array(
660
-                null,
661
-                'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
662
-            ),
663
-            'EE_Module_Request_Router'                                                                                    => array(
664
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
665
-            ),
666
-            'EE_Registration_Processor'                                                                                   => array(
667
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
668
-            ),
669
-            'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => array(
670
-                null,
671
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
672
-                'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
673
-            ),
674
-            'EventEspresso\core\services\licensing\LicenseService'                                                        => array(
675
-                'EventEspresso\core\domain\services\pue\Stats'  => EE_Dependency_Map::load_from_cache,
676
-                'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache,
677
-            ),
678
-            'EE_Admin_Transactions_List_Table'                                                                            => array(
679
-                null,
680
-                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
681
-            ),
682
-            'EventEspresso\core\domain\services\pue\Stats'                                                                => array(
683
-                'EventEspresso\core\domain\services\pue\Config'        => EE_Dependency_Map::load_from_cache,
684
-                'EE_Maintenance_Mode'                                  => EE_Dependency_Map::load_from_cache,
685
-                'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache,
686
-            ),
687
-            'EventEspresso\core\domain\services\pue\Config'                                                               => array(
688
-                'EE_Network_Config' => EE_Dependency_Map::load_from_cache,
689
-                'EE_Config'         => EE_Dependency_Map::load_from_cache,
690
-            ),
691
-            'EventEspresso\core\domain\services\pue\StatsGatherer'                                                        => array(
692
-                'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
693
-                'EEM_Event'          => EE_Dependency_Map::load_from_cache,
694
-                'EEM_Datetime'       => EE_Dependency_Map::load_from_cache,
695
-                'EEM_Ticket'         => EE_Dependency_Map::load_from_cache,
696
-                'EEM_Registration'   => EE_Dependency_Map::load_from_cache,
697
-                'EEM_Transaction'    => EE_Dependency_Map::load_from_cache,
698
-                'EE_Config'          => EE_Dependency_Map::load_from_cache,
699
-            ),
700
-            'EventEspresso\core\domain\services\admin\ExitModal'                                                          => array(
701
-                'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache,
702
-            ),
703
-            'EventEspresso\core\domain\services\admin\PluginUpsells'                                                      => array(
704
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
705
-            ),
706
-            'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => array(
707
-                'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
708
-                'EE_Session'             => EE_Dependency_Map::load_from_cache,
709
-            ),
710
-            'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings'                                => array(
711
-                'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
712
-            ),
713
-            'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => array(
714
-                'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
715
-                'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
716
-                'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
717
-                'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
718
-                'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
719
-            ),
720
-            'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => array(
721
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
722
-            ),
723
-            'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => array(
724
-                'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
725
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
726
-            ),
727
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => array(
728
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
729
-            ),
730
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => array(
731
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
732
-            ),
733
-            'EE_CPT_Strategy'                                                                                             => array(
734
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
735
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
736
-            ),
737
-            'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => array(
738
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
739
-            ),
740
-            'EventEspresso\core\domain\services\assets\CoreAssetManager'                                                  => array(
741
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
742
-                'EE_Currency_Config'                                 => EE_Dependency_Map::load_from_cache,
743
-                'EE_Template_Config'                                 => EE_Dependency_Map::load_from_cache,
744
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
745
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
746
-            ),
747
-            'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => array(
748
-                'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
749
-                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache
750
-            ),
751
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => array(
752
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
753
-            ),
754
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => array(
755
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
756
-                'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache
757
-            ),
758
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => array(
759
-                'EEM_Checkin' => EE_Dependency_Map::load_from_cache,
760
-            ),
761
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => array(
762
-                'EEM_Registration' => EE_Dependency_Map::load_from_cache,
763
-            ),
764
-            'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => array(
765
-                'EEM_Transaction' => EE_Dependency_Map::load_from_cache,
766
-            ),
767
-            'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => array(
768
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
769
-            ),
770
-            'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => array(
771
-                'EEM_Answer' => EE_Dependency_Map::load_from_cache,
772
-                'EEM_Question' => EE_Dependency_Map::load_from_cache,
773
-            ),
774
-            'EventEspresso\core\CPTs\CptQueryModifier' => array(
775
-                null,
776
-                null,
777
-                null,
778
-                'EE_Request_Handler'                          => EE_Dependency_Map::load_from_cache,
779
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
780
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
781
-            ),
782
-            'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => array(
783
-                'EE_Registry' => EE_Dependency_Map::load_from_cache,
784
-                'EE_Config' => EE_Dependency_Map::load_from_cache
785
-            ),
786
-            'EventEspresso\core\services\editor\BlockRegistrationManager'                                                 => array(
787
-                'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache,
788
-                'EventEspresso\core\domain\entities\editor\BlockCollection'      => EE_Dependency_Map::load_from_cache,
789
-                'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache,
790
-                'EventEspresso\core\services\request\Request'                    => EE_Dependency_Map::load_from_cache,
791
-            ),
792
-            'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => array(
793
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
794
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
795
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
796
-            ),
797
-            'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => array(
798
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
799
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
800
-            ),
801
-            'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => array(
802
-                'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache,
803
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
804
-                'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache,
805
-            ),
806
-            'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => array(
807
-                'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache,
808
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
809
-                'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache,
810
-            ),
811
-            'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => array(
812
-                'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
813
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
814
-            ),
815
-            'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => array(
816
-                'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
817
-                'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache,
818
-            ),
819
-            'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => array(
820
-                'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache
821
-            ),
822
-            'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => array(
823
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
824
-            ),
825
-            'EventEspresso\core\libraries\rest_api\controllers\model\Read' => array(
826
-                'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache
827
-            ),
828
-            'EventEspresso\core\libraries\rest_api\calculations\Datetime' => array(
829
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
830
-                'EEM_Registration' => EE_Dependency_Map::load_from_cache
831
-            ),
832
-            'EventEspresso\core\libraries\rest_api\calculations\Event' => array(
833
-                'EEM_Event' => EE_Dependency_Map::load_from_cache,
834
-                'EEM_Registration' => EE_Dependency_Map::load_from_cache
835
-            ),
836
-            'EventEspresso\core\libraries\rest_api\calculations\Registration' => array(
837
-                'EEM_Registration' => EE_Dependency_Map::load_from_cache
838
-            ),
839
-            'EventEspresso\core\services\session\SessionStartHandler' => array(
840
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
841
-            ),
842
-            'EE_URL_Validation_Strategy' => array(
843
-                null,
844
-                null,
845
-                'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache
846
-            ),
847
-            'EventEspresso\admin_pages\general_settings\OrganizationSettings' => array(
848
-                'EE_Registry'                                             => EE_Dependency_Map::load_from_cache,
849
-                'EE_Organization_Config'                                  => EE_Dependency_Map::load_from_cache,
850
-                'EE_Core_Config'                                          => EE_Dependency_Map::load_from_cache,
851
-                'EE_Network_Core_Config'                                  => EE_Dependency_Map::load_from_cache,
852
-                'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache,
853
-            ),
854
-            'EventEspresso\core\services\address\CountrySubRegionDao' => array(
855
-                'EEM_State'                                            => EE_Dependency_Map::load_from_cache,
856
-                'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache
857
-            ),
858
-            'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => array(
859
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
860
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
861
-            ),
862
-            'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => array(
863
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
864
-                'EE_Environment_Config'            => EE_Dependency_Map::load_from_cache,
865
-            ),
866
-            'EventEspresso\core\services\request\files\FilesDataHandler' => array(
867
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
868
-            ),
869
-            'EventEspressoBatchRequest\BatchRequestProcessor'                              => [
870
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
871
-            ],
872
-            'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [
873
-                null,
874
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
875
-                'EEM_Registration'  => EE_Dependency_Map::load_from_cache,
876
-            ],
877
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [
878
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
879
-                'EEM_Attendee'  => EE_Dependency_Map::load_from_cache,
880
-            ],
881
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [
882
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
883
-                'EEM_Datetime'  => EE_Dependency_Map::load_from_cache,
884
-            ],
885
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [
886
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
887
-                'EEM_Event'  => EE_Dependency_Map::load_from_cache,
888
-            ],
889
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [
890
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
891
-                'EEM_Ticket'  => EE_Dependency_Map::load_from_cache,
892
-            ],
893
-            'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [
894
-                'WP_REST_Server' => EE_Dependency_Map::load_from_cache,
895
-                'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache,
896
-                'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,
897
-                null
898
-            ],
899
-            'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection'  => [
900
-                'EE_Admin_Config' => EE_Dependency_Map::load_from_cache
901
-            ],
902
-            'EventEspresso\core\domain\services\admin\events\editor\EventEditor' => [
903
-                'EE_Admin_Config' => EE_Dependency_Map::load_from_cache,
904
-                'EE_Event'        => EE_Dependency_Map::not_registered,
905
-                'EventEspresso\core\domain\entities\admin\GraphQLData\CurrentUser' =>
906
-                    EE_Dependency_Map::not_registered,
907
-                'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' =>
908
-                    EE_Dependency_Map::load_from_cache,
909
-                'EventEspresso\core\domain\entities\admin\GraphQLData\GeneralSettings' =>
910
-                    EE_Dependency_Map::load_from_cache,
911
-                'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache,
912
-            ],
913
-            'EventEspresso\core\services\graphql\GraphQLManager' => [
914
-                'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache,
915
-                'EventEspresso\core\services\graphql\DataLoaderManager'  => EE_Dependency_Map::load_from_cache,
916
-                'EventEspresso\core\services\graphql\EnumsManager'       => EE_Dependency_Map::load_from_cache,
917
-                'EventEspresso\core\services\graphql\InputsManager'      => EE_Dependency_Map::load_from_cache,
918
-                'EventEspresso\core\services\graphql\TypesManager'       => EE_Dependency_Map::load_from_cache,
919
-            ],
920
-            'EventEspresso\core\services\graphql\TypesManager' => [
921
-                'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache,
922
-            ],
923
-            'EventEspresso\core\services\graphql\InputsManager' => [
924
-                'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache,
925
-            ],
926
-            'EventEspresso\core\services\graphql\EnumsManager' => [
927
-                'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache,
928
-            ],
929
-            'EventEspresso\core\services\graphql\ConnectionsManager' => [
930
-                'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache,
931
-            ],
932
-            'EventEspresso\core\domain\services\graphql\types\Datetime' => [
933
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
934
-            ],
935
-            'EventEspresso\core\domain\services\graphql\types\Attendee' => [
936
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
937
-            ],
938
-            'EventEspresso\core\domain\services\graphql\types\Event' => [
939
-                'EEM_Event' => EE_Dependency_Map::load_from_cache,
940
-            ],
941
-            'EventEspresso\core\domain\services\graphql\types\Ticket' => [
942
-                'EEM_Ticket' => EE_Dependency_Map::load_from_cache,
943
-            ],
944
-            'EventEspresso\core\domain\services\graphql\types\Price' => [
945
-                'EEM_Price' => EE_Dependency_Map::load_from_cache,
946
-            ],
947
-            'EventEspresso\core\domain\services\graphql\types\PriceType' => [
948
-                'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
949
-            ],
950
-            'EventEspresso\core\domain\services\graphql\types\Venue' => [
951
-                'EEM_Venue' => EE_Dependency_Map::load_from_cache,
952
-            ],
953
-            'EventEspresso\core\domain\services\graphql\types\State' => [
954
-                'EEM_State' => EE_Dependency_Map::load_from_cache,
955
-            ],
956
-            'EventEspresso\core\domain\services\graphql\types\Country' => [
957
-                'EEM_Country' => EE_Dependency_Map::load_from_cache,
958
-            ],
959
-            'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection' => [
960
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
961
-            ],
962
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection' => [
963
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
964
-            ],
965
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryAttendeesConnection' => [
966
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
967
-            ],
968
-            'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection' => [
969
-                'EEM_Ticket' => EE_Dependency_Map::load_from_cache,
970
-            ],
971
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection' => [
972
-                'EEM_Ticket' => EE_Dependency_Map::load_from_cache,
973
-            ],
974
-            'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection' => [
975
-                'EEM_Price' => EE_Dependency_Map::load_from_cache,
976
-            ],
977
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection' => [
978
-                'EEM_Price' => EE_Dependency_Map::load_from_cache,
979
-            ],
980
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection' => [
981
-                'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
982
-            ],
983
-            'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection' => [
984
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
985
-            ],
986
-            'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection' => [
987
-                'EEM_Venue' => EE_Dependency_Map::load_from_cache,
988
-            ],
989
-            'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => [
990
-                'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes' => EE_Dependency_Map::load_from_cache,
991
-                'EventEspresso\core\domain\entities\admin\GraphQLData\Prices' => EE_Dependency_Map::load_from_cache,
992
-                'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes' => EE_Dependency_Map::load_from_cache,
993
-                'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets' => EE_Dependency_Map::load_from_cache,
994
-                'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache,
995
-                'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => EE_Dependency_Map::load_from_cache,
996
-            ],
997
-            'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => [
998
-                'EEM_Datetime'   => EE_Dependency_Map::load_from_cache,
999
-                'EEM_Event'      => EE_Dependency_Map::load_from_cache,
1000
-                'EEM_Price'      => EE_Dependency_Map::load_from_cache,
1001
-                'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
1002
-                'EEM_Ticket'     => EE_Dependency_Map::load_from_cache,
1003
-            ],
1004
-            'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => [
1005
-                'EEM_Datetime'                                                       => EE_Dependency_Map::load_from_cache,
1006
-                'EEM_Event'                                                          => EE_Dependency_Map::load_from_cache,
1007
-                'EEM_Price'                                                          => EE_Dependency_Map::load_from_cache,
1008
-                'EEM_Price_Type'                                                     => EE_Dependency_Map::load_from_cache,
1009
-                'EEM_Ticket'                                                         => EE_Dependency_Map::load_from_cache,
1010
-                'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => EE_Dependency_Map::load_from_cache,
1011
-            ],
1012
-            'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => [
1013
-                'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache,
1014
-                'EEM_Datetime'                                                     => EE_Dependency_Map::load_from_cache,
1015
-            ],
1016
-            'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => [
1017
-                'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache,
1018
-                'EEM_Ticket'                                                      => EE_Dependency_Map::load_from_cache,
1019
-            ],
1020
-            'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => [
1021
-                'EEM_Price' => EE_Dependency_Map::load_from_cache,
1022
-                'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
1023
-            ],
1024
-            'EventEspresso\core\services\graphql\DataLoaderManager' => [
1025
-                'EventEspresso\core\services\graphql\loaders\DataLoaderCollection' => EE_Dependency_Map::load_from_cache,
1026
-            ],
1027
-            'EventEspresso\core\services\routing\RouteHandler' => [
1028
-                'EventEspresso\core\services\loaders\Loader'                             => EE_Dependency_Map::load_from_cache,
1029
-                'EE_Maintenance_Mode'                                                    => EE_Dependency_Map::load_from_cache,
1030
-                'EventEspresso\core\services\request\Request'                            => EE_Dependency_Map::load_from_cache,
1031
-                'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache,
1032
-            ],
1033
-        );
1034
-    }
1035
-
1036
-
1037
-    /**
1038
-     * Registers how core classes are loaded.
1039
-     * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
1040
-     *        'EE_Request_Handler' => 'load_core'
1041
-     *        'EE_Messages_Queue'  => 'load_lib'
1042
-     *        'EEH_Debug_Tools'    => 'load_helper'
1043
-     * or, if greater control is required, by providing a custom closure. For example:
1044
-     *        'Some_Class' => function () {
1045
-     *            return new Some_Class();
1046
-     *        },
1047
-     * This is required for instantiating dependencies
1048
-     * where an interface has been type hinted in a class constructor. For example:
1049
-     *        'Required_Interface' => function () {
1050
-     *            return new A_Class_That_Implements_Required_Interface();
1051
-     *        },
1052
-     */
1053
-    protected function _register_core_class_loaders()
1054
-    {
1055
-        $this->_class_loaders = array(
1056
-            // load_core
1057
-            'EE_Dependency_Map'                            => function () {
1058
-                return $this;
1059
-            },
1060
-            'EE_Capabilities'                              => 'load_core',
1061
-            'EE_Encryption'                                => 'load_core',
1062
-            'EE_Front_Controller'                          => 'load_core',
1063
-            'EE_Module_Request_Router'                     => 'load_core',
1064
-            'EE_Registry'                                  => 'load_core',
1065
-            'EE_Request'                                   => function () {
1066
-                return $this->legacy_request;
1067
-            },
1068
-            'EventEspresso\core\services\request\Request'  => function () {
1069
-                return $this->request;
1070
-            },
1071
-            'EventEspresso\core\services\request\Response' => function () {
1072
-                return $this->response;
1073
-            },
1074
-            'EE_Base'                                      => 'load_core',
1075
-            'EE_Request_Handler'                           => 'load_core',
1076
-            'EE_Session'                                   => 'load_core',
1077
-            'EE_Cron_Tasks'                                => 'load_core',
1078
-            'EE_System'                                    => 'load_core',
1079
-            'EE_Maintenance_Mode'                          => 'load_core',
1080
-            'EE_Register_CPTs'                             => 'load_core',
1081
-            'EE_Admin'                                     => 'load_core',
1082
-            'EE_CPT_Strategy'                              => 'load_core',
1083
-            // load_class
1084
-            'EE_Registration_Processor'                    => 'load_class',
1085
-            // load_lib
1086
-            'EE_Message_Resource_Manager'                  => 'load_lib',
1087
-            'EE_Message_Type_Collection'                   => 'load_lib',
1088
-            'EE_Message_Type_Collection_Loader'            => 'load_lib',
1089
-            'EE_Messenger_Collection'                      => 'load_lib',
1090
-            'EE_Messenger_Collection_Loader'               => 'load_lib',
1091
-            'EE_Messages_Processor'                        => 'load_lib',
1092
-            'EE_Message_Repository'                        => 'load_lib',
1093
-            'EE_Messages_Queue'                            => 'load_lib',
1094
-            'EE_Messages_Data_Handler_Collection'          => 'load_lib',
1095
-            'EE_Message_Template_Group_Collection'         => 'load_lib',
1096
-            'EE_Payment_Method_Manager'                    => 'load_lib',
1097
-            'EE_DMS_Core_4_1_0'                            => 'load_dms',
1098
-            'EE_DMS_Core_4_2_0'                            => 'load_dms',
1099
-            'EE_DMS_Core_4_3_0'                            => 'load_dms',
1100
-            'EE_DMS_Core_4_5_0'                            => 'load_dms',
1101
-            'EE_DMS_Core_4_6_0'                            => 'load_dms',
1102
-            'EE_DMS_Core_4_7_0'                            => 'load_dms',
1103
-            'EE_DMS_Core_4_8_0'                            => 'load_dms',
1104
-            'EE_DMS_Core_4_9_0'                            => 'load_dms',
1105
-            'EE_DMS_Core_4_10_0'                            => 'load_dms',
1106
-            'EE_Messages_Generator'                        => static function () {
1107
-                return EE_Registry::instance()->load_lib(
1108
-                    'Messages_Generator',
1109
-                    array(),
1110
-                    false,
1111
-                    false
1112
-                );
1113
-            },
1114
-            'EE_Messages_Template_Defaults'                => static function ($arguments = array()) {
1115
-                return EE_Registry::instance()->load_lib(
1116
-                    'Messages_Template_Defaults',
1117
-                    $arguments,
1118
-                    false,
1119
-                    false
1120
-                );
1121
-            },
1122
-            // load_helper
1123
-            'EEH_Parse_Shortcodes'                         => static function () {
1124
-                if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
1125
-                    return new EEH_Parse_Shortcodes();
1126
-                }
1127
-                return null;
1128
-            },
1129
-            'EE_Template_Config'                           => static function () {
1130
-                return EE_Config::instance()->template_settings;
1131
-            },
1132
-            'EE_Currency_Config'                           => static function () {
1133
-                return EE_Config::instance()->currency;
1134
-            },
1135
-            'EE_Registration_Config'                       => static function () {
1136
-                return EE_Config::instance()->registration;
1137
-            },
1138
-            'EE_Core_Config'                               => static function () {
1139
-                return EE_Config::instance()->core;
1140
-            },
1141
-            'EventEspresso\core\services\loaders\Loader'   => static function () {
1142
-                return LoaderFactory::getLoader();
1143
-            },
1144
-            'EE_Network_Config'                            => static function () {
1145
-                return EE_Network_Config::instance();
1146
-            },
1147
-            'EE_Config'                                    => static function () {
1148
-                return EE_Config::instance();
1149
-            },
1150
-            'EventEspresso\core\domain\Domain'             => static function () {
1151
-                return DomainFactory::getEventEspressoCoreDomain();
1152
-            },
1153
-            'EE_Admin_Config'                              => static function () {
1154
-                return EE_Config::instance()->admin;
1155
-            },
1156
-            'EE_Organization_Config'                       => static function () {
1157
-                return EE_Config::instance()->organization;
1158
-            },
1159
-            'EE_Network_Core_Config'                       => static function () {
1160
-                return EE_Network_Config::instance()->core;
1161
-            },
1162
-            'EE_Environment_Config'                        => static function () {
1163
-                return EE_Config::instance()->environment;
1164
-            },
1165
-            'EED_Core_Rest_Api'                            => static function () {
1166
-                return EED_Core_Rest_Api::instance();
1167
-            },
1168
-            'WP_REST_Server'                            => static function () {
1169
-                return rest_get_server();
1170
-            },
1171
-        );
1172
-    }
1173
-
1174
-
1175
-    /**
1176
-     * can be used for supplying alternate names for classes,
1177
-     * or for connecting interface names to instantiable classes
1178
-     *
1179
-     * @throws InvalidAliasException
1180
-     */
1181
-    protected function _register_core_aliases()
1182
-    {
1183
-        $aliases = array(
1184
-            'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
1185
-            'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
1186
-            'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
1187
-            'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
1188
-            'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
1189
-            'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
1190
-            'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1191
-            'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
1192
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1193
-            'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
1194
-            'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
1195
-            'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
1196
-            'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
1197
-            'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
1198
-            'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
1199
-            'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
1200
-            'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
1201
-            'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
1202
-            'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
1203
-            'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
1204
-            'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1205
-            'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
1206
-            'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1207
-            'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
1208
-            'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
1209
-            'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
1210
-            'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
1211
-            'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
1212
-            'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
1213
-            'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
1214
-            'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
1215
-            'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
1216
-            'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
1217
-            'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
1218
-            'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
1219
-            'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
1220
-            'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
1221
-            'Registration_Processor'                                                       => 'EE_Registration_Processor',
1222
-        );
1223
-        foreach ($aliases as $alias => $fqn) {
1224
-            if (is_array($fqn)) {
1225
-                foreach ($fqn as $class => $for_class) {
1226
-                    $this->class_cache->addAlias($class, $alias, $for_class);
1227
-                }
1228
-                continue;
1229
-            }
1230
-            $this->class_cache->addAlias($fqn, $alias);
1231
-        }
1232
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
1233
-            $this->class_cache->addAlias(
1234
-                'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
1235
-                'EventEspresso\core\services\notices\NoticeConverterInterface'
1236
-            );
1237
-        }
1238
-    }
1239
-
1240
-
1241
-    /**
1242
-     * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
1243
-     * request Primarily used by unit tests.
1244
-     */
1245
-    public function reset()
1246
-    {
1247
-        $this->_register_core_class_loaders();
1248
-        $this->_register_core_dependencies();
1249
-    }
1250
-
1251
-
1252
-    /**
1253
-     * PLZ NOTE: a better name for this method would be is_alias()
1254
-     * because it returns TRUE if the provided fully qualified name IS an alias
1255
-     * WHY?
1256
-     * Because if a class is type hinting for a concretion,
1257
-     * then why would we need to find another class to supply it?
1258
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
1259
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
1260
-     * Don't go looking for some substitute.
1261
-     * Whereas if a class is type hinting for an interface...
1262
-     * then we need to find an actual class to use.
1263
-     * So the interface IS the alias for some other FQN,
1264
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
1265
-     * represents some other class.
1266
-     *
1267
-     * @deprecated 4.9.62.p
1268
-     * @param string $fqn
1269
-     * @param string $for_class
1270
-     * @return bool
1271
-     */
1272
-    public function has_alias($fqn = '', $for_class = '')
1273
-    {
1274
-        return $this->isAlias($fqn, $for_class);
1275
-    }
1276
-
1277
-
1278
-    /**
1279
-     * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
1280
-     * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
1281
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
1282
-     *  for example:
1283
-     *      if the following two entries were added to the _aliases array:
1284
-     *          array(
1285
-     *              'interface_alias'           => 'some\namespace\interface'
1286
-     *              'some\namespace\interface'  => 'some\namespace\classname'
1287
-     *          )
1288
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1289
-     *      to load an instance of 'some\namespace\classname'
1290
-     *
1291
-     * @deprecated 4.9.62.p
1292
-     * @param string $alias
1293
-     * @param string $for_class
1294
-     * @return string
1295
-     */
1296
-    public function get_alias($alias = '', $for_class = '')
1297
-    {
1298
-        return $this->getFqnForAlias($alias, $for_class);
1299
-    }
24
+	/**
25
+	 * This means that the requested class dependency is not present in the dependency map
26
+	 */
27
+	const not_registered = 0;
28
+
29
+	/**
30
+	 * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.
31
+	 */
32
+	const load_new_object = 1;
33
+
34
+	/**
35
+	 * This instructs class loaders to return a previously instantiated and cached object for the requested class.
36
+	 * IF a previously instantiated object does not exist, a new one will be created and added to the cache.
37
+	 */
38
+	const load_from_cache = 2;
39
+
40
+	/**
41
+	 * When registering a dependency,
42
+	 * this indicates to keep any existing dependencies that already exist,
43
+	 * and simply discard any new dependencies declared in the incoming data
44
+	 */
45
+	const KEEP_EXISTING_DEPENDENCIES = 0;
46
+
47
+	/**
48
+	 * When registering a dependency,
49
+	 * this indicates to overwrite any existing dependencies that already exist using the incoming data
50
+	 */
51
+	const OVERWRITE_DEPENDENCIES = 1;
52
+
53
+
54
+	/**
55
+	 * @type EE_Dependency_Map $_instance
56
+	 */
57
+	protected static $_instance;
58
+
59
+	/**
60
+	 * @var ClassInterfaceCache $class_cache
61
+	 */
62
+	private $class_cache;
63
+
64
+	/**
65
+	 * @type RequestInterface $request
66
+	 */
67
+	protected $request;
68
+
69
+	/**
70
+	 * @type LegacyRequestInterface $legacy_request
71
+	 */
72
+	protected $legacy_request;
73
+
74
+	/**
75
+	 * @type ResponseInterface $response
76
+	 */
77
+	protected $response;
78
+
79
+	/**
80
+	 * @type LoaderInterface $loader
81
+	 */
82
+	protected $loader;
83
+
84
+	/**
85
+	 * @type array $_dependency_map
86
+	 */
87
+	protected $_dependency_map = array();
88
+
89
+	/**
90
+	 * @type array $_class_loaders
91
+	 */
92
+	protected $_class_loaders = array();
93
+
94
+
95
+	/**
96
+	 * EE_Dependency_Map constructor.
97
+	 *
98
+	 * @param ClassInterfaceCache $class_cache
99
+	 */
100
+	protected function __construct(ClassInterfaceCache $class_cache)
101
+	{
102
+		$this->class_cache = $class_cache;
103
+		do_action('EE_Dependency_Map____construct', $this);
104
+	}
105
+
106
+
107
+	/**
108
+	 * @return void
109
+	 * @throws EE_Error
110
+	 * @throws InvalidAliasException
111
+	 */
112
+	public function initialize()
113
+	{
114
+		$this->_register_core_dependencies();
115
+		$this->_register_core_class_loaders();
116
+		$this->_register_core_aliases();
117
+	}
118
+
119
+
120
+	/**
121
+	 * @singleton method used to instantiate class object
122
+	 * @param ClassInterfaceCache|null $class_cache
123
+	 * @return EE_Dependency_Map
124
+	 */
125
+	public static function instance(ClassInterfaceCache $class_cache = null)
126
+	{
127
+		// check if class object is instantiated, and instantiated properly
128
+		if (! self::$_instance instanceof EE_Dependency_Map
129
+			&& $class_cache instanceof ClassInterfaceCache
130
+		) {
131
+			self::$_instance = new EE_Dependency_Map($class_cache);
132
+		}
133
+		return self::$_instance;
134
+	}
135
+
136
+
137
+	/**
138
+	 * @param RequestInterface $request
139
+	 */
140
+	public function setRequest(RequestInterface $request)
141
+	{
142
+		$this->request = $request;
143
+	}
144
+
145
+
146
+	/**
147
+	 * @param LegacyRequestInterface $legacy_request
148
+	 */
149
+	public function setLegacyRequest(LegacyRequestInterface $legacy_request)
150
+	{
151
+		$this->legacy_request = $legacy_request;
152
+	}
153
+
154
+
155
+	/**
156
+	 * @param ResponseInterface $response
157
+	 */
158
+	public function setResponse(ResponseInterface $response)
159
+	{
160
+		$this->response = $response;
161
+	}
162
+
163
+
164
+	/**
165
+	 * @param LoaderInterface $loader
166
+	 */
167
+	public function setLoader(LoaderInterface $loader)
168
+	{
169
+		$this->loader = $loader;
170
+	}
171
+
172
+
173
+	/**
174
+	 * @param string $class
175
+	 * @param array  $dependencies
176
+	 * @param int    $overwrite
177
+	 * @return bool
178
+	 */
179
+	public static function register_dependencies(
180
+		$class,
181
+		array $dependencies,
182
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
183
+	) {
184
+		return self::$_instance->registerDependencies($class, $dependencies, $overwrite);
185
+	}
186
+
187
+
188
+	/**
189
+	 * Assigns an array of class names and corresponding load sources (new or cached)
190
+	 * to the class specified by the first parameter.
191
+	 * IMPORTANT !!!
192
+	 * The order of elements in the incoming $dependencies array MUST match
193
+	 * the order of the constructor parameters for the class in question.
194
+	 * This is especially important when overriding any existing dependencies that are registered.
195
+	 * the third parameter controls whether any duplicate dependencies are overwritten or not.
196
+	 *
197
+	 * @param string $class
198
+	 * @param array  $dependencies
199
+	 * @param int    $overwrite
200
+	 * @return bool
201
+	 */
202
+	public function registerDependencies(
203
+		$class,
204
+		array $dependencies,
205
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
206
+	) {
207
+		$class = trim($class, '\\');
208
+		$registered = false;
209
+		if (empty(self::$_instance->_dependency_map[ $class ])) {
210
+			self::$_instance->_dependency_map[ $class ] = array();
211
+		}
212
+		// we need to make sure that any aliases used when registering a dependency
213
+		// get resolved to the correct class name
214
+		foreach ($dependencies as $dependency => $load_source) {
215
+			$alias = self::$_instance->getFqnForAlias($dependency);
216
+			if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
217
+				|| ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])
218
+			) {
219
+				unset($dependencies[ $dependency ]);
220
+				$dependencies[ $alias ] = $load_source;
221
+				$registered = true;
222
+			}
223
+		}
224
+		// now add our two lists of dependencies together.
225
+		// using Union (+=) favours the arrays in precedence from left to right,
226
+		// so $dependencies is NOT overwritten because it is listed first
227
+		// ie: with A = B + C, entries in B take precedence over duplicate entries in C
228
+		// Union is way faster than array_merge() but should be used with caution...
229
+		// especially with numerically indexed arrays
230
+		$dependencies += self::$_instance->_dependency_map[ $class ];
231
+		// now we need to ensure that the resulting dependencies
232
+		// array only has the entries that are required for the class
233
+		// so first count how many dependencies were originally registered for the class
234
+		$dependency_count = count(self::$_instance->_dependency_map[ $class ]);
235
+		// if that count is non-zero (meaning dependencies were already registered)
236
+		self::$_instance->_dependency_map[ $class ] = $dependency_count
237
+			// then truncate the  final array to match that count
238
+			? array_slice($dependencies, 0, $dependency_count)
239
+			// otherwise just take the incoming array because nothing previously existed
240
+			: $dependencies;
241
+		return $registered;
242
+	}
243
+
244
+
245
+	/**
246
+	 * @param string $class_name
247
+	 * @param string $loader
248
+	 * @return bool
249
+	 * @throws DomainException
250
+	 */
251
+	public static function register_class_loader($class_name, $loader = 'load_core')
252
+	{
253
+		if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
254
+			throw new DomainException(
255
+				esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
256
+			);
257
+		}
258
+		// check that loader is callable or method starts with "load_" and exists in EE_Registry
259
+		if (! is_callable($loader)
260
+			&& (
261
+				strpos($loader, 'load_') !== 0
262
+				|| ! method_exists('EE_Registry', $loader)
263
+			)
264
+		) {
265
+			throw new DomainException(
266
+				sprintf(
267
+					esc_html__(
268
+						'"%1$s" is not a valid loader method on EE_Registry.',
269
+						'event_espresso'
270
+					),
271
+					$loader
272
+				)
273
+			);
274
+		}
275
+		$class_name = self::$_instance->getFqnForAlias($class_name);
276
+		if (! isset(self::$_instance->_class_loaders[ $class_name ])) {
277
+			self::$_instance->_class_loaders[ $class_name ] = $loader;
278
+			return true;
279
+		}
280
+		return false;
281
+	}
282
+
283
+
284
+	/**
285
+	 * @return array
286
+	 */
287
+	public function dependency_map()
288
+	{
289
+		return $this->_dependency_map;
290
+	}
291
+
292
+
293
+	/**
294
+	 * returns TRUE if dependency map contains a listing for the provided class name
295
+	 *
296
+	 * @param string $class_name
297
+	 * @return boolean
298
+	 */
299
+	public function has($class_name = '')
300
+	{
301
+		// all legacy models have the same dependencies
302
+		if (strpos($class_name, 'EEM_') === 0) {
303
+			$class_name = 'LEGACY_MODELS';
304
+		}
305
+		return isset($this->_dependency_map[ $class_name ]) ? true : false;
306
+	}
307
+
308
+
309
+	/**
310
+	 * returns TRUE if dependency map contains a listing for the provided class name AND dependency
311
+	 *
312
+	 * @param string $class_name
313
+	 * @param string $dependency
314
+	 * @return bool
315
+	 */
316
+	public function has_dependency_for_class($class_name = '', $dependency = '')
317
+	{
318
+		// all legacy models have the same dependencies
319
+		if (strpos($class_name, 'EEM_') === 0) {
320
+			$class_name = 'LEGACY_MODELS';
321
+		}
322
+		$dependency = $this->getFqnForAlias($dependency, $class_name);
323
+		return isset($this->_dependency_map[ $class_name ][ $dependency ])
324
+			? true
325
+			: false;
326
+	}
327
+
328
+
329
+	/**
330
+	 * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
331
+	 *
332
+	 * @param string $class_name
333
+	 * @param string $dependency
334
+	 * @return int
335
+	 */
336
+	public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
337
+	{
338
+		// all legacy models have the same dependencies
339
+		if (strpos($class_name, 'EEM_') === 0) {
340
+			$class_name = 'LEGACY_MODELS';
341
+		}
342
+		$dependency = $this->getFqnForAlias($dependency);
343
+		return $this->has_dependency_for_class($class_name, $dependency)
344
+			? $this->_dependency_map[ $class_name ][ $dependency ]
345
+			: EE_Dependency_Map::not_registered;
346
+	}
347
+
348
+
349
+	/**
350
+	 * @param string $class_name
351
+	 * @return string | Closure
352
+	 */
353
+	public function class_loader($class_name)
354
+	{
355
+		// all legacy models use load_model()
356
+		if (strpos($class_name, 'EEM_') === 0) {
357
+			return 'load_model';
358
+		}
359
+		// EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
360
+		// perform strpos() first to avoid loading regex every time we load a class
361
+		if (strpos($class_name, 'EE_CPT_') === 0
362
+			&& preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
363
+		) {
364
+			return 'load_core';
365
+		}
366
+		$class_name = $this->getFqnForAlias($class_name);
367
+		return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
368
+	}
369
+
370
+
371
+	/**
372
+	 * @return array
373
+	 */
374
+	public function class_loaders()
375
+	{
376
+		return $this->_class_loaders;
377
+	}
378
+
379
+
380
+	/**
381
+	 * adds an alias for a classname
382
+	 *
383
+	 * @param string $fqcn      the class name that should be used (concrete class to replace interface)
384
+	 * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
385
+	 * @param string $for_class the class that has the dependency (is type hinting for the interface)
386
+	 * @throws InvalidAliasException
387
+	 */
388
+	public function add_alias($fqcn, $alias, $for_class = '')
389
+	{
390
+		$this->class_cache->addAlias($fqcn, $alias, $for_class);
391
+	}
392
+
393
+
394
+	/**
395
+	 * Returns TRUE if the provided fully qualified name IS an alias
396
+	 * WHY?
397
+	 * Because if a class is type hinting for a concretion,
398
+	 * then why would we need to find another class to supply it?
399
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
400
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
401
+	 * Don't go looking for some substitute.
402
+	 * Whereas if a class is type hinting for an interface...
403
+	 * then we need to find an actual class to use.
404
+	 * So the interface IS the alias for some other FQN,
405
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
406
+	 * represents some other class.
407
+	 *
408
+	 * @param string $fqn
409
+	 * @param string $for_class
410
+	 * @return bool
411
+	 */
412
+	public function isAlias($fqn = '', $for_class = '')
413
+	{
414
+		return $this->class_cache->isAlias($fqn, $for_class);
415
+	}
416
+
417
+
418
+	/**
419
+	 * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
420
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
421
+	 *  for example:
422
+	 *      if the following two entries were added to the _aliases array:
423
+	 *          array(
424
+	 *              'interface_alias'           => 'some\namespace\interface'
425
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
426
+	 *          )
427
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
428
+	 *      to load an instance of 'some\namespace\classname'
429
+	 *
430
+	 * @param string $alias
431
+	 * @param string $for_class
432
+	 * @return string
433
+	 */
434
+	public function getFqnForAlias($alias = '', $for_class = '')
435
+	{
436
+		return (string) $this->class_cache->getFqnForAlias($alias, $for_class);
437
+	}
438
+
439
+
440
+	/**
441
+	 * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
442
+	 * if one exists, or whether a new object should be generated every time the requested class is loaded.
443
+	 * This is done by using the following class constants:
444
+	 *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
445
+	 *        EE_Dependency_Map::load_new_object - generates a new object every time
446
+	 */
447
+	protected function _register_core_dependencies()
448
+	{
449
+		$this->_dependency_map = array(
450
+			'EE_Request_Handler'                                                                                          => array(
451
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
452
+			),
453
+			'EE_System'                                                                                                   => array(
454
+				'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
455
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
456
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
457
+				'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
458
+			),
459
+			'EE_Session'                                                                                                  => array(
460
+				'EventEspresso\core\services\cache\TransientCacheStorage'  => EE_Dependency_Map::load_from_cache,
461
+				'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
462
+				'EventEspresso\core\services\request\Request'              => EE_Dependency_Map::load_from_cache,
463
+				'EventEspresso\core\services\session\SessionStartHandler'  => EE_Dependency_Map::load_from_cache,
464
+				'EE_Encryption'                                            => EE_Dependency_Map::load_from_cache,
465
+			),
466
+			'EE_Cart'                                                                                                     => array(
467
+				'EE_Session' => EE_Dependency_Map::load_from_cache,
468
+			),
469
+			'EE_Front_Controller'                                                                                         => array(
470
+				'EE_Registry'              => EE_Dependency_Map::load_from_cache,
471
+				'EE_Request_Handler'       => EE_Dependency_Map::load_from_cache,
472
+				'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,
473
+			),
474
+			'EE_Messenger_Collection_Loader'                                                                              => array(
475
+				'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
476
+			),
477
+			'EE_Message_Type_Collection_Loader'                                                                           => array(
478
+				'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
479
+			),
480
+			'EE_Message_Resource_Manager'                                                                                 => array(
481
+				'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
482
+				'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
483
+				'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
484
+			),
485
+			'EE_Message_Factory'                                                                                          => array(
486
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
487
+			),
488
+			'EE_messages'                                                                                                 => array(
489
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
490
+			),
491
+			'EE_Messages_Generator'                                                                                       => array(
492
+				'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
493
+				'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
494
+				'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
495
+				'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
496
+			),
497
+			'EE_Messages_Processor'                                                                                       => array(
498
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
499
+			),
500
+			'EE_Messages_Queue'                                                                                           => array(
501
+				'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
502
+			),
503
+			'EE_Messages_Template_Defaults'                                                                               => array(
504
+				'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
505
+				'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
506
+			),
507
+			'EE_Message_To_Generate_From_Request'                                                                         => array(
508
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
509
+				'EE_Request_Handler'          => EE_Dependency_Map::load_from_cache,
510
+			),
511
+			'EventEspresso\core\services\commands\CommandBus'                                                             => array(
512
+				'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
513
+			),
514
+			'EventEspresso\services\commands\CommandHandler'                                                              => array(
515
+				'EE_Registry'         => EE_Dependency_Map::load_from_cache,
516
+				'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
517
+			),
518
+			'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => array(
519
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
520
+			),
521
+			'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => array(
522
+				'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
523
+				'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
524
+			),
525
+			'EventEspresso\core\services\commands\CommandFactory'                                                         => array(
526
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
527
+			),
528
+			'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => array(
529
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
530
+			),
531
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => array(
532
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
533
+			),
534
+			'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => array(
535
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
536
+			),
537
+			'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => array(
538
+				'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
539
+			),
540
+			'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => array(
541
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
542
+			),
543
+			'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => array(
544
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
545
+			),
546
+			'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => array(
547
+				'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
548
+			),
549
+			'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array(
550
+				'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
551
+			),
552
+			'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => array(
553
+				'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
554
+			),
555
+			'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => array(
556
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
557
+			),
558
+			'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => array(
559
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
560
+			),
561
+			'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => array(
562
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
563
+			),
564
+			'EventEspresso\core\services\database\TableManager'                                                           => array(
565
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
566
+			),
567
+			'EE_Data_Migration_Class_Base'                                                                                => array(
568
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
569
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
570
+			),
571
+			'EE_DMS_Core_4_1_0'                                                                                           => array(
572
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
573
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
574
+			),
575
+			'EE_DMS_Core_4_2_0'                                                                                           => array(
576
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
577
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
578
+			),
579
+			'EE_DMS_Core_4_3_0'                                                                                           => array(
580
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
581
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
582
+			),
583
+			'EE_DMS_Core_4_4_0'                                                                                           => array(
584
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
585
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
586
+			),
587
+			'EE_DMS_Core_4_5_0'                                                                                           => array(
588
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
589
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
590
+			),
591
+			'EE_DMS_Core_4_6_0'                                                                                           => array(
592
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
593
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
594
+			),
595
+			'EE_DMS_Core_4_7_0'                                                                                           => array(
596
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
597
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
598
+			),
599
+			'EE_DMS_Core_4_8_0'                                                                                           => array(
600
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
601
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
602
+			),
603
+			'EE_DMS_Core_4_9_0' => array(
604
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
605
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
606
+			),
607
+			'EE_DMS_Core_4_10_0' => array(
608
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
609
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
610
+				'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
611
+			),
612
+			'EventEspresso\core\services\assets\I18nRegistry'                                                             => array(
613
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
614
+				'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache,
615
+				array(),
616
+			),
617
+			'EventEspresso\core\services\assets\Registry'                                                                 => array(
618
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
619
+				'EventEspresso\core\services\assets\I18nRegistry'    => EE_Dependency_Map::load_from_cache,
620
+			),
621
+			'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled'                                             => array(
622
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
623
+			),
624
+			'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout'                                              => array(
625
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
626
+			),
627
+			'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees'                                        => array(
628
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
629
+			),
630
+			'EventEspresso\core\domain\entities\shortcodes\EspressoEvents'                                                => array(
631
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
632
+			),
633
+			'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou'                                              => array(
634
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
635
+			),
636
+			'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector'                                        => array(
637
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
638
+			),
639
+			'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage'                                               => array(
640
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
641
+			),
642
+			'EventEspresso\core\services\cache\BasicCacheManager'                                                         => array(
643
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
644
+			),
645
+			'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => array(
646
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
647
+			),
648
+			'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => array(
649
+				'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
650
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
651
+			),
652
+			'EventEspresso\core\domain\values\EmailAddress'                                                               => array(
653
+				null,
654
+				'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
655
+			),
656
+			'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => array(
657
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
658
+			),
659
+			'LEGACY_MODELS'                                                                                               => array(
660
+				null,
661
+				'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
662
+			),
663
+			'EE_Module_Request_Router'                                                                                    => array(
664
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
665
+			),
666
+			'EE_Registration_Processor'                                                                                   => array(
667
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
668
+			),
669
+			'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => array(
670
+				null,
671
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
672
+				'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
673
+			),
674
+			'EventEspresso\core\services\licensing\LicenseService'                                                        => array(
675
+				'EventEspresso\core\domain\services\pue\Stats'  => EE_Dependency_Map::load_from_cache,
676
+				'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache,
677
+			),
678
+			'EE_Admin_Transactions_List_Table'                                                                            => array(
679
+				null,
680
+				'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
681
+			),
682
+			'EventEspresso\core\domain\services\pue\Stats'                                                                => array(
683
+				'EventEspresso\core\domain\services\pue\Config'        => EE_Dependency_Map::load_from_cache,
684
+				'EE_Maintenance_Mode'                                  => EE_Dependency_Map::load_from_cache,
685
+				'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache,
686
+			),
687
+			'EventEspresso\core\domain\services\pue\Config'                                                               => array(
688
+				'EE_Network_Config' => EE_Dependency_Map::load_from_cache,
689
+				'EE_Config'         => EE_Dependency_Map::load_from_cache,
690
+			),
691
+			'EventEspresso\core\domain\services\pue\StatsGatherer'                                                        => array(
692
+				'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
693
+				'EEM_Event'          => EE_Dependency_Map::load_from_cache,
694
+				'EEM_Datetime'       => EE_Dependency_Map::load_from_cache,
695
+				'EEM_Ticket'         => EE_Dependency_Map::load_from_cache,
696
+				'EEM_Registration'   => EE_Dependency_Map::load_from_cache,
697
+				'EEM_Transaction'    => EE_Dependency_Map::load_from_cache,
698
+				'EE_Config'          => EE_Dependency_Map::load_from_cache,
699
+			),
700
+			'EventEspresso\core\domain\services\admin\ExitModal'                                                          => array(
701
+				'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache,
702
+			),
703
+			'EventEspresso\core\domain\services\admin\PluginUpsells'                                                      => array(
704
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
705
+			),
706
+			'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => array(
707
+				'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
708
+				'EE_Session'             => EE_Dependency_Map::load_from_cache,
709
+			),
710
+			'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings'                                => array(
711
+				'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
712
+			),
713
+			'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => array(
714
+				'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
715
+				'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
716
+				'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
717
+				'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
718
+				'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
719
+			),
720
+			'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => array(
721
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
722
+			),
723
+			'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => array(
724
+				'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
725
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
726
+			),
727
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => array(
728
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
729
+			),
730
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => array(
731
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
732
+			),
733
+			'EE_CPT_Strategy'                                                                                             => array(
734
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
735
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
736
+			),
737
+			'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => array(
738
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
739
+			),
740
+			'EventEspresso\core\domain\services\assets\CoreAssetManager'                                                  => array(
741
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
742
+				'EE_Currency_Config'                                 => EE_Dependency_Map::load_from_cache,
743
+				'EE_Template_Config'                                 => EE_Dependency_Map::load_from_cache,
744
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
745
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
746
+			),
747
+			'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => array(
748
+				'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
749
+				'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache
750
+			),
751
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => array(
752
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
753
+			),
754
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => array(
755
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
756
+				'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache
757
+			),
758
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => array(
759
+				'EEM_Checkin' => EE_Dependency_Map::load_from_cache,
760
+			),
761
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => array(
762
+				'EEM_Registration' => EE_Dependency_Map::load_from_cache,
763
+			),
764
+			'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => array(
765
+				'EEM_Transaction' => EE_Dependency_Map::load_from_cache,
766
+			),
767
+			'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => array(
768
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
769
+			),
770
+			'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => array(
771
+				'EEM_Answer' => EE_Dependency_Map::load_from_cache,
772
+				'EEM_Question' => EE_Dependency_Map::load_from_cache,
773
+			),
774
+			'EventEspresso\core\CPTs\CptQueryModifier' => array(
775
+				null,
776
+				null,
777
+				null,
778
+				'EE_Request_Handler'                          => EE_Dependency_Map::load_from_cache,
779
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
780
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
781
+			),
782
+			'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => array(
783
+				'EE_Registry' => EE_Dependency_Map::load_from_cache,
784
+				'EE_Config' => EE_Dependency_Map::load_from_cache
785
+			),
786
+			'EventEspresso\core\services\editor\BlockRegistrationManager'                                                 => array(
787
+				'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache,
788
+				'EventEspresso\core\domain\entities\editor\BlockCollection'      => EE_Dependency_Map::load_from_cache,
789
+				'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache,
790
+				'EventEspresso\core\services\request\Request'                    => EE_Dependency_Map::load_from_cache,
791
+			),
792
+			'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => array(
793
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
794
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
795
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
796
+			),
797
+			'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => array(
798
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
799
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
800
+			),
801
+			'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => array(
802
+				'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache,
803
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
804
+				'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache,
805
+			),
806
+			'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => array(
807
+				'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache,
808
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
809
+				'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache,
810
+			),
811
+			'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => array(
812
+				'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
813
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
814
+			),
815
+			'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => array(
816
+				'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
817
+				'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache,
818
+			),
819
+			'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => array(
820
+				'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache
821
+			),
822
+			'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => array(
823
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
824
+			),
825
+			'EventEspresso\core\libraries\rest_api\controllers\model\Read' => array(
826
+				'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache
827
+			),
828
+			'EventEspresso\core\libraries\rest_api\calculations\Datetime' => array(
829
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
830
+				'EEM_Registration' => EE_Dependency_Map::load_from_cache
831
+			),
832
+			'EventEspresso\core\libraries\rest_api\calculations\Event' => array(
833
+				'EEM_Event' => EE_Dependency_Map::load_from_cache,
834
+				'EEM_Registration' => EE_Dependency_Map::load_from_cache
835
+			),
836
+			'EventEspresso\core\libraries\rest_api\calculations\Registration' => array(
837
+				'EEM_Registration' => EE_Dependency_Map::load_from_cache
838
+			),
839
+			'EventEspresso\core\services\session\SessionStartHandler' => array(
840
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
841
+			),
842
+			'EE_URL_Validation_Strategy' => array(
843
+				null,
844
+				null,
845
+				'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache
846
+			),
847
+			'EventEspresso\admin_pages\general_settings\OrganizationSettings' => array(
848
+				'EE_Registry'                                             => EE_Dependency_Map::load_from_cache,
849
+				'EE_Organization_Config'                                  => EE_Dependency_Map::load_from_cache,
850
+				'EE_Core_Config'                                          => EE_Dependency_Map::load_from_cache,
851
+				'EE_Network_Core_Config'                                  => EE_Dependency_Map::load_from_cache,
852
+				'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache,
853
+			),
854
+			'EventEspresso\core\services\address\CountrySubRegionDao' => array(
855
+				'EEM_State'                                            => EE_Dependency_Map::load_from_cache,
856
+				'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache
857
+			),
858
+			'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => array(
859
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
860
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
861
+			),
862
+			'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => array(
863
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
864
+				'EE_Environment_Config'            => EE_Dependency_Map::load_from_cache,
865
+			),
866
+			'EventEspresso\core\services\request\files\FilesDataHandler' => array(
867
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
868
+			),
869
+			'EventEspressoBatchRequest\BatchRequestProcessor'                              => [
870
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
871
+			],
872
+			'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [
873
+				null,
874
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
875
+				'EEM_Registration'  => EE_Dependency_Map::load_from_cache,
876
+			],
877
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [
878
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
879
+				'EEM_Attendee'  => EE_Dependency_Map::load_from_cache,
880
+			],
881
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [
882
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
883
+				'EEM_Datetime'  => EE_Dependency_Map::load_from_cache,
884
+			],
885
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [
886
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
887
+				'EEM_Event'  => EE_Dependency_Map::load_from_cache,
888
+			],
889
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [
890
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
891
+				'EEM_Ticket'  => EE_Dependency_Map::load_from_cache,
892
+			],
893
+			'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [
894
+				'WP_REST_Server' => EE_Dependency_Map::load_from_cache,
895
+				'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache,
896
+				'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,
897
+				null
898
+			],
899
+			'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection'  => [
900
+				'EE_Admin_Config' => EE_Dependency_Map::load_from_cache
901
+			],
902
+			'EventEspresso\core\domain\services\admin\events\editor\EventEditor' => [
903
+				'EE_Admin_Config' => EE_Dependency_Map::load_from_cache,
904
+				'EE_Event'        => EE_Dependency_Map::not_registered,
905
+				'EventEspresso\core\domain\entities\admin\GraphQLData\CurrentUser' =>
906
+					EE_Dependency_Map::not_registered,
907
+				'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' =>
908
+					EE_Dependency_Map::load_from_cache,
909
+				'EventEspresso\core\domain\entities\admin\GraphQLData\GeneralSettings' =>
910
+					EE_Dependency_Map::load_from_cache,
911
+				'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache,
912
+			],
913
+			'EventEspresso\core\services\graphql\GraphQLManager' => [
914
+				'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache,
915
+				'EventEspresso\core\services\graphql\DataLoaderManager'  => EE_Dependency_Map::load_from_cache,
916
+				'EventEspresso\core\services\graphql\EnumsManager'       => EE_Dependency_Map::load_from_cache,
917
+				'EventEspresso\core\services\graphql\InputsManager'      => EE_Dependency_Map::load_from_cache,
918
+				'EventEspresso\core\services\graphql\TypesManager'       => EE_Dependency_Map::load_from_cache,
919
+			],
920
+			'EventEspresso\core\services\graphql\TypesManager' => [
921
+				'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache,
922
+			],
923
+			'EventEspresso\core\services\graphql\InputsManager' => [
924
+				'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache,
925
+			],
926
+			'EventEspresso\core\services\graphql\EnumsManager' => [
927
+				'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache,
928
+			],
929
+			'EventEspresso\core\services\graphql\ConnectionsManager' => [
930
+				'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache,
931
+			],
932
+			'EventEspresso\core\domain\services\graphql\types\Datetime' => [
933
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
934
+			],
935
+			'EventEspresso\core\domain\services\graphql\types\Attendee' => [
936
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
937
+			],
938
+			'EventEspresso\core\domain\services\graphql\types\Event' => [
939
+				'EEM_Event' => EE_Dependency_Map::load_from_cache,
940
+			],
941
+			'EventEspresso\core\domain\services\graphql\types\Ticket' => [
942
+				'EEM_Ticket' => EE_Dependency_Map::load_from_cache,
943
+			],
944
+			'EventEspresso\core\domain\services\graphql\types\Price' => [
945
+				'EEM_Price' => EE_Dependency_Map::load_from_cache,
946
+			],
947
+			'EventEspresso\core\domain\services\graphql\types\PriceType' => [
948
+				'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
949
+			],
950
+			'EventEspresso\core\domain\services\graphql\types\Venue' => [
951
+				'EEM_Venue' => EE_Dependency_Map::load_from_cache,
952
+			],
953
+			'EventEspresso\core\domain\services\graphql\types\State' => [
954
+				'EEM_State' => EE_Dependency_Map::load_from_cache,
955
+			],
956
+			'EventEspresso\core\domain\services\graphql\types\Country' => [
957
+				'EEM_Country' => EE_Dependency_Map::load_from_cache,
958
+			],
959
+			'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection' => [
960
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
961
+			],
962
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection' => [
963
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
964
+			],
965
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryAttendeesConnection' => [
966
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
967
+			],
968
+			'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection' => [
969
+				'EEM_Ticket' => EE_Dependency_Map::load_from_cache,
970
+			],
971
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection' => [
972
+				'EEM_Ticket' => EE_Dependency_Map::load_from_cache,
973
+			],
974
+			'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection' => [
975
+				'EEM_Price' => EE_Dependency_Map::load_from_cache,
976
+			],
977
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection' => [
978
+				'EEM_Price' => EE_Dependency_Map::load_from_cache,
979
+			],
980
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection' => [
981
+				'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
982
+			],
983
+			'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection' => [
984
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
985
+			],
986
+			'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection' => [
987
+				'EEM_Venue' => EE_Dependency_Map::load_from_cache,
988
+			],
989
+			'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => [
990
+				'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes' => EE_Dependency_Map::load_from_cache,
991
+				'EventEspresso\core\domain\entities\admin\GraphQLData\Prices' => EE_Dependency_Map::load_from_cache,
992
+				'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes' => EE_Dependency_Map::load_from_cache,
993
+				'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets' => EE_Dependency_Map::load_from_cache,
994
+				'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache,
995
+				'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => EE_Dependency_Map::load_from_cache,
996
+			],
997
+			'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => [
998
+				'EEM_Datetime'   => EE_Dependency_Map::load_from_cache,
999
+				'EEM_Event'      => EE_Dependency_Map::load_from_cache,
1000
+				'EEM_Price'      => EE_Dependency_Map::load_from_cache,
1001
+				'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
1002
+				'EEM_Ticket'     => EE_Dependency_Map::load_from_cache,
1003
+			],
1004
+			'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => [
1005
+				'EEM_Datetime'                                                       => EE_Dependency_Map::load_from_cache,
1006
+				'EEM_Event'                                                          => EE_Dependency_Map::load_from_cache,
1007
+				'EEM_Price'                                                          => EE_Dependency_Map::load_from_cache,
1008
+				'EEM_Price_Type'                                                     => EE_Dependency_Map::load_from_cache,
1009
+				'EEM_Ticket'                                                         => EE_Dependency_Map::load_from_cache,
1010
+				'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => EE_Dependency_Map::load_from_cache,
1011
+			],
1012
+			'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => [
1013
+				'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache,
1014
+				'EEM_Datetime'                                                     => EE_Dependency_Map::load_from_cache,
1015
+			],
1016
+			'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => [
1017
+				'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache,
1018
+				'EEM_Ticket'                                                      => EE_Dependency_Map::load_from_cache,
1019
+			],
1020
+			'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => [
1021
+				'EEM_Price' => EE_Dependency_Map::load_from_cache,
1022
+				'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
1023
+			],
1024
+			'EventEspresso\core\services\graphql\DataLoaderManager' => [
1025
+				'EventEspresso\core\services\graphql\loaders\DataLoaderCollection' => EE_Dependency_Map::load_from_cache,
1026
+			],
1027
+			'EventEspresso\core\services\routing\RouteHandler' => [
1028
+				'EventEspresso\core\services\loaders\Loader'                             => EE_Dependency_Map::load_from_cache,
1029
+				'EE_Maintenance_Mode'                                                    => EE_Dependency_Map::load_from_cache,
1030
+				'EventEspresso\core\services\request\Request'                            => EE_Dependency_Map::load_from_cache,
1031
+				'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache,
1032
+			],
1033
+		);
1034
+	}
1035
+
1036
+
1037
+	/**
1038
+	 * Registers how core classes are loaded.
1039
+	 * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
1040
+	 *        'EE_Request_Handler' => 'load_core'
1041
+	 *        'EE_Messages_Queue'  => 'load_lib'
1042
+	 *        'EEH_Debug_Tools'    => 'load_helper'
1043
+	 * or, if greater control is required, by providing a custom closure. For example:
1044
+	 *        'Some_Class' => function () {
1045
+	 *            return new Some_Class();
1046
+	 *        },
1047
+	 * This is required for instantiating dependencies
1048
+	 * where an interface has been type hinted in a class constructor. For example:
1049
+	 *        'Required_Interface' => function () {
1050
+	 *            return new A_Class_That_Implements_Required_Interface();
1051
+	 *        },
1052
+	 */
1053
+	protected function _register_core_class_loaders()
1054
+	{
1055
+		$this->_class_loaders = array(
1056
+			// load_core
1057
+			'EE_Dependency_Map'                            => function () {
1058
+				return $this;
1059
+			},
1060
+			'EE_Capabilities'                              => 'load_core',
1061
+			'EE_Encryption'                                => 'load_core',
1062
+			'EE_Front_Controller'                          => 'load_core',
1063
+			'EE_Module_Request_Router'                     => 'load_core',
1064
+			'EE_Registry'                                  => 'load_core',
1065
+			'EE_Request'                                   => function () {
1066
+				return $this->legacy_request;
1067
+			},
1068
+			'EventEspresso\core\services\request\Request'  => function () {
1069
+				return $this->request;
1070
+			},
1071
+			'EventEspresso\core\services\request\Response' => function () {
1072
+				return $this->response;
1073
+			},
1074
+			'EE_Base'                                      => 'load_core',
1075
+			'EE_Request_Handler'                           => 'load_core',
1076
+			'EE_Session'                                   => 'load_core',
1077
+			'EE_Cron_Tasks'                                => 'load_core',
1078
+			'EE_System'                                    => 'load_core',
1079
+			'EE_Maintenance_Mode'                          => 'load_core',
1080
+			'EE_Register_CPTs'                             => 'load_core',
1081
+			'EE_Admin'                                     => 'load_core',
1082
+			'EE_CPT_Strategy'                              => 'load_core',
1083
+			// load_class
1084
+			'EE_Registration_Processor'                    => 'load_class',
1085
+			// load_lib
1086
+			'EE_Message_Resource_Manager'                  => 'load_lib',
1087
+			'EE_Message_Type_Collection'                   => 'load_lib',
1088
+			'EE_Message_Type_Collection_Loader'            => 'load_lib',
1089
+			'EE_Messenger_Collection'                      => 'load_lib',
1090
+			'EE_Messenger_Collection_Loader'               => 'load_lib',
1091
+			'EE_Messages_Processor'                        => 'load_lib',
1092
+			'EE_Message_Repository'                        => 'load_lib',
1093
+			'EE_Messages_Queue'                            => 'load_lib',
1094
+			'EE_Messages_Data_Handler_Collection'          => 'load_lib',
1095
+			'EE_Message_Template_Group_Collection'         => 'load_lib',
1096
+			'EE_Payment_Method_Manager'                    => 'load_lib',
1097
+			'EE_DMS_Core_4_1_0'                            => 'load_dms',
1098
+			'EE_DMS_Core_4_2_0'                            => 'load_dms',
1099
+			'EE_DMS_Core_4_3_0'                            => 'load_dms',
1100
+			'EE_DMS_Core_4_5_0'                            => 'load_dms',
1101
+			'EE_DMS_Core_4_6_0'                            => 'load_dms',
1102
+			'EE_DMS_Core_4_7_0'                            => 'load_dms',
1103
+			'EE_DMS_Core_4_8_0'                            => 'load_dms',
1104
+			'EE_DMS_Core_4_9_0'                            => 'load_dms',
1105
+			'EE_DMS_Core_4_10_0'                            => 'load_dms',
1106
+			'EE_Messages_Generator'                        => static function () {
1107
+				return EE_Registry::instance()->load_lib(
1108
+					'Messages_Generator',
1109
+					array(),
1110
+					false,
1111
+					false
1112
+				);
1113
+			},
1114
+			'EE_Messages_Template_Defaults'                => static function ($arguments = array()) {
1115
+				return EE_Registry::instance()->load_lib(
1116
+					'Messages_Template_Defaults',
1117
+					$arguments,
1118
+					false,
1119
+					false
1120
+				);
1121
+			},
1122
+			// load_helper
1123
+			'EEH_Parse_Shortcodes'                         => static function () {
1124
+				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
1125
+					return new EEH_Parse_Shortcodes();
1126
+				}
1127
+				return null;
1128
+			},
1129
+			'EE_Template_Config'                           => static function () {
1130
+				return EE_Config::instance()->template_settings;
1131
+			},
1132
+			'EE_Currency_Config'                           => static function () {
1133
+				return EE_Config::instance()->currency;
1134
+			},
1135
+			'EE_Registration_Config'                       => static function () {
1136
+				return EE_Config::instance()->registration;
1137
+			},
1138
+			'EE_Core_Config'                               => static function () {
1139
+				return EE_Config::instance()->core;
1140
+			},
1141
+			'EventEspresso\core\services\loaders\Loader'   => static function () {
1142
+				return LoaderFactory::getLoader();
1143
+			},
1144
+			'EE_Network_Config'                            => static function () {
1145
+				return EE_Network_Config::instance();
1146
+			},
1147
+			'EE_Config'                                    => static function () {
1148
+				return EE_Config::instance();
1149
+			},
1150
+			'EventEspresso\core\domain\Domain'             => static function () {
1151
+				return DomainFactory::getEventEspressoCoreDomain();
1152
+			},
1153
+			'EE_Admin_Config'                              => static function () {
1154
+				return EE_Config::instance()->admin;
1155
+			},
1156
+			'EE_Organization_Config'                       => static function () {
1157
+				return EE_Config::instance()->organization;
1158
+			},
1159
+			'EE_Network_Core_Config'                       => static function () {
1160
+				return EE_Network_Config::instance()->core;
1161
+			},
1162
+			'EE_Environment_Config'                        => static function () {
1163
+				return EE_Config::instance()->environment;
1164
+			},
1165
+			'EED_Core_Rest_Api'                            => static function () {
1166
+				return EED_Core_Rest_Api::instance();
1167
+			},
1168
+			'WP_REST_Server'                            => static function () {
1169
+				return rest_get_server();
1170
+			},
1171
+		);
1172
+	}
1173
+
1174
+
1175
+	/**
1176
+	 * can be used for supplying alternate names for classes,
1177
+	 * or for connecting interface names to instantiable classes
1178
+	 *
1179
+	 * @throws InvalidAliasException
1180
+	 */
1181
+	protected function _register_core_aliases()
1182
+	{
1183
+		$aliases = array(
1184
+			'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
1185
+			'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
1186
+			'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
1187
+			'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
1188
+			'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
1189
+			'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
1190
+			'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1191
+			'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
1192
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1193
+			'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
1194
+			'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
1195
+			'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
1196
+			'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
1197
+			'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
1198
+			'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
1199
+			'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
1200
+			'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
1201
+			'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
1202
+			'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
1203
+			'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
1204
+			'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1205
+			'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
1206
+			'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1207
+			'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
1208
+			'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
1209
+			'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
1210
+			'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
1211
+			'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
1212
+			'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
1213
+			'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
1214
+			'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
1215
+			'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
1216
+			'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
1217
+			'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
1218
+			'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
1219
+			'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
1220
+			'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
1221
+			'Registration_Processor'                                                       => 'EE_Registration_Processor',
1222
+		);
1223
+		foreach ($aliases as $alias => $fqn) {
1224
+			if (is_array($fqn)) {
1225
+				foreach ($fqn as $class => $for_class) {
1226
+					$this->class_cache->addAlias($class, $alias, $for_class);
1227
+				}
1228
+				continue;
1229
+			}
1230
+			$this->class_cache->addAlias($fqn, $alias);
1231
+		}
1232
+		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
1233
+			$this->class_cache->addAlias(
1234
+				'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
1235
+				'EventEspresso\core\services\notices\NoticeConverterInterface'
1236
+			);
1237
+		}
1238
+	}
1239
+
1240
+
1241
+	/**
1242
+	 * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
1243
+	 * request Primarily used by unit tests.
1244
+	 */
1245
+	public function reset()
1246
+	{
1247
+		$this->_register_core_class_loaders();
1248
+		$this->_register_core_dependencies();
1249
+	}
1250
+
1251
+
1252
+	/**
1253
+	 * PLZ NOTE: a better name for this method would be is_alias()
1254
+	 * because it returns TRUE if the provided fully qualified name IS an alias
1255
+	 * WHY?
1256
+	 * Because if a class is type hinting for a concretion,
1257
+	 * then why would we need to find another class to supply it?
1258
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
1259
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
1260
+	 * Don't go looking for some substitute.
1261
+	 * Whereas if a class is type hinting for an interface...
1262
+	 * then we need to find an actual class to use.
1263
+	 * So the interface IS the alias for some other FQN,
1264
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
1265
+	 * represents some other class.
1266
+	 *
1267
+	 * @deprecated 4.9.62.p
1268
+	 * @param string $fqn
1269
+	 * @param string $for_class
1270
+	 * @return bool
1271
+	 */
1272
+	public function has_alias($fqn = '', $for_class = '')
1273
+	{
1274
+		return $this->isAlias($fqn, $for_class);
1275
+	}
1276
+
1277
+
1278
+	/**
1279
+	 * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
1280
+	 * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
1281
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
1282
+	 *  for example:
1283
+	 *      if the following two entries were added to the _aliases array:
1284
+	 *          array(
1285
+	 *              'interface_alias'           => 'some\namespace\interface'
1286
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
1287
+	 *          )
1288
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1289
+	 *      to load an instance of 'some\namespace\classname'
1290
+	 *
1291
+	 * @deprecated 4.9.62.p
1292
+	 * @param string $alias
1293
+	 * @param string $for_class
1294
+	 * @return string
1295
+	 */
1296
+	public function get_alias($alias = '', $for_class = '')
1297
+	{
1298
+		return $this->getFqnForAlias($alias, $for_class);
1299
+	}
1300 1300
 }
Please login to merge, or discard this patch.
core/EE_System.core.php 1 patch
Indentation   +1249 added lines, -1249 removed lines patch added patch discarded remove patch
@@ -28,1253 +28,1253 @@
 block discarded – undo
28 28
 final class EE_System implements ResettableInterface
29 29
 {
30 30
 
31
-    /**
32
-     * indicates this is a 'normal' request. Ie, not activation, nor upgrade, nor activation.
33
-     * So examples of this would be a normal GET request on the frontend or backend, or a POST, etc
34
-     */
35
-    const req_type_normal = 0;
36
-
37
-    /**
38
-     * Indicates this is a brand new installation of EE so we should install
39
-     * tables and default data etc
40
-     */
41
-    const req_type_new_activation = 1;
42
-
43
-    /**
44
-     * we've detected that EE has been reactivated (or EE was activated during maintenance mode,
45
-     * and we just exited maintenance mode). We MUST check the database is setup properly
46
-     * and that default data is setup too
47
-     */
48
-    const req_type_reactivation = 2;
49
-
50
-    /**
51
-     * indicates that EE has been upgraded since its previous request.
52
-     * We may have data migration scripts to call and will want to trigger maintenance mode
53
-     */
54
-    const req_type_upgrade = 3;
55
-
56
-    /**
57
-     * TODO  will detect that EE has been DOWNGRADED. We probably don't want to run in this case...
58
-     */
59
-    const req_type_downgrade = 4;
60
-
61
-    /**
62
-     * @deprecated since version 4.6.0.dev.006
63
-     * Now whenever a new_activation is detected the request type is still just
64
-     * new_activation (same for reactivation, upgrade, downgrade etc), but if we'r ein maintenance mode
65
-     * EE_System::initialize_db_if_no_migrations_required and EE_Addon::initialize_db_if_no_migrations_required
66
-     * will instead enqueue that EE plugin's db initialization for when we're taken out of maintenance mode.
67
-     * (Specifically, when the migration manager indicates migrations are finished
68
-     * EE_Data_Migration_Manager::initialize_db_for_enqueued_ee_plugins() will be called)
69
-     */
70
-    const req_type_activation_but_not_installed = 5;
71
-
72
-    /**
73
-     * option prefix for recording the activation history (like core's "espresso_db_update") of addons
74
-     */
75
-    const addon_activation_history_option_prefix = 'ee_addon_activation_history_';
76
-
77
-    /**
78
-     * @var EE_System $_instance
79
-     */
80
-    private static $_instance;
81
-
82
-    /**
83
-     * @var EE_Registry $registry
84
-     */
85
-    private $registry;
86
-
87
-    /**
88
-     * @var LoaderInterface $loader
89
-     */
90
-    private $loader;
91
-
92
-    /**
93
-     * @var EE_Capabilities $capabilities
94
-     */
95
-    private $capabilities;
96
-
97
-    /**
98
-     * @var EE_Maintenance_Mode $maintenance_mode
99
-     */
100
-    private $maintenance_mode;
101
-
102
-    /**
103
-     * @var RequestInterface $request
104
-     */
105
-    private $request;
106
-
107
-    /**
108
-     * Stores which type of request this is, options being one of the constants on EE_System starting with req_type_*.
109
-     * It can be a brand-new activation, a reactivation, an upgrade, a downgrade, or a normal request.
110
-     *
111
-     * @var int $_req_type
112
-     */
113
-    private $_req_type;
114
-
115
-
116
-    /**
117
-     * @var RouteHandler $router
118
-     */
119
-    private $router;
120
-
121
-    /**
122
-     * Whether or not there was a non-micro version change in EE core version during this request
123
-     *
124
-     * @var boolean $_major_version_change
125
-     */
126
-    private $_major_version_change = false;
127
-
128
-    /**
129
-     * A Context DTO dedicated solely to identifying the current request type.
130
-     *
131
-     * @var RequestTypeContextCheckerInterface $request_type
132
-     */
133
-    private $request_type;
134
-
135
-
136
-    /**
137
-     * @singleton method used to instantiate class object
138
-     * @param EE_Registry|null         $registry
139
-     * @param LoaderInterface|null     $loader
140
-     * @param RequestInterface|null    $request
141
-     * @param EE_Maintenance_Mode|null $maintenance_mode
142
-     * @return EE_System
143
-     */
144
-    public static function instance(
145
-        EE_Registry $registry = null,
146
-        LoaderInterface $loader = null,
147
-        RequestInterface $request = null,
148
-        EE_Maintenance_Mode $maintenance_mode = null
149
-    ) {
150
-        // check if class object is instantiated
151
-        if (! self::$_instance instanceof EE_System) {
152
-            self::$_instance = new self($registry, $loader, $request, $maintenance_mode);
153
-        }
154
-        return self::$_instance;
155
-    }
156
-
157
-
158
-    /**
159
-     * resets the instance and returns it
160
-     *
161
-     * @return EE_System
162
-     */
163
-    public static function reset()
164
-    {
165
-        self::$_instance->_req_type = null;
166
-        // make sure none of the old hooks are left hanging around
167
-        remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
168
-        // we need to reset the migration manager in order for it to detect DMSs properly
169
-        EE_Data_Migration_Manager::reset();
170
-        self::instance()->detect_activations_or_upgrades();
171
-        self::instance()->perform_activations_upgrades_and_migrations();
172
-        return self::instance();
173
-    }
174
-
175
-
176
-    /**
177
-     * sets hooks for running rest of system
178
-     * provides "AHEE__EE_System__construct__complete" hook for EE Addons to use as their starting point
179
-     * starting EE Addons from any other point may lead to problems
180
-     *
181
-     * @param EE_Registry         $registry
182
-     * @param LoaderInterface     $loader
183
-     * @param RequestInterface    $request
184
-     * @param EE_Maintenance_Mode $maintenance_mode
185
-     */
186
-    private function __construct(
187
-        EE_Registry $registry,
188
-        LoaderInterface $loader,
189
-        RequestInterface $request,
190
-        EE_Maintenance_Mode $maintenance_mode
191
-    ) {
192
-        $this->registry = $registry;
193
-        $this->loader = $loader;
194
-        $this->request = $request;
195
-        $this->maintenance_mode = $maintenance_mode;
196
-        do_action('AHEE__EE_System__construct__begin', $this);
197
-        add_action(
198
-            'AHEE__EE_Bootstrap__load_espresso_addons',
199
-            array($this, 'loadCapabilities'),
200
-            5
201
-        );
202
-        add_action(
203
-            'AHEE__EE_Bootstrap__load_espresso_addons',
204
-            array($this, 'loadCommandBus'),
205
-            7
206
-        );
207
-        add_action(
208
-            'AHEE__EE_Bootstrap__load_espresso_addons',
209
-            array($this, 'loadPluginApi'),
210
-            9
211
-        );
212
-        // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
213
-        add_action(
214
-            'AHEE__EE_Bootstrap__load_espresso_addons',
215
-            array($this, 'load_espresso_addons')
216
-        );
217
-        // when an ee addon is activated, we want to call the core hook(s) again
218
-        // because the newly-activated addon didn't get a chance to run at all
219
-        add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
220
-        // detect whether install or upgrade
221
-        add_action(
222
-            'AHEE__EE_Bootstrap__detect_activations_or_upgrades',
223
-            array($this, 'detect_activations_or_upgrades'),
224
-            3
225
-        );
226
-        // load EE_Config, EE_Textdomain, etc
227
-        add_action(
228
-            'AHEE__EE_Bootstrap__load_core_configuration',
229
-            array($this, 'load_core_configuration'),
230
-            5
231
-        );
232
-        // load specifications for matching routes to current request
233
-        add_action(
234
-            'AHEE__EE_Bootstrap__load_core_configuration',
235
-            array($this, 'loadRouteMatchSpecifications')
236
-        );
237
-        // load EE_Config, EE_Textdomain, etc
238
-        add_action(
239
-            'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets',
240
-            array($this, 'register_shortcodes_modules_and_widgets'),
241
-            7
242
-        );
243
-        // you wanna get going? I wanna get going... let's get going!
244
-        add_action(
245
-            'AHEE__EE_Bootstrap__brew_espresso',
246
-            array($this, 'brew_espresso'),
247
-            9
248
-        );
249
-        // other housekeeping
250
-        // exclude EE critical pages from wp_list_pages
251
-        add_filter(
252
-            'wp_list_pages_excludes',
253
-            array($this, 'remove_pages_from_wp_list_pages'),
254
-            10
255
-        );
256
-        // ALL EE Addons should use the following hook point to attach their initial setup too
257
-        // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
258
-        do_action('AHEE__EE_System__construct__complete', $this);
259
-    }
260
-
261
-
262
-    /**
263
-     * load and setup EE_Capabilities
264
-     *
265
-     * @return void
266
-     */
267
-    public function loadCapabilities()
268
-    {
269
-        $this->capabilities = $this->loader->getShared('EE_Capabilities');
270
-        add_action(
271
-            'AHEE__EE_Capabilities__init_caps__before_initialization',
272
-            function () {
273
-                LoaderFactory::getLoader()->getShared('EE_Payment_Method_Manager');
274
-            }
275
-        );
276
-    }
277
-
278
-
279
-    /**
280
-     * create and cache the CommandBus, and also add middleware
281
-     * The CapChecker middleware requires the use of EE_Capabilities
282
-     * which is why we need to load the CommandBus after Caps are set up
283
-     *
284
-     * @return void
285
-     */
286
-    public function loadCommandBus()
287
-    {
288
-        $this->loader->getShared(
289
-            'CommandBusInterface',
290
-            array(
291
-                null,
292
-                apply_filters(
293
-                    'FHEE__EE_Load_Espresso_Core__handle_request__CommandBus_middleware',
294
-                    array(
295
-                        $this->loader->getShared('EventEspresso\core\services\commands\middleware\CapChecker'),
296
-                        $this->loader->getShared('EventEspresso\core\services\commands\middleware\AddActionHook'),
297
-                    )
298
-                ),
299
-            )
300
-        );
301
-    }
302
-
303
-
304
-    /**
305
-     * @return void
306
-     * @throws EE_Error
307
-     */
308
-    public function loadPluginApi()
309
-    {
310
-        // set autoloaders for all of the classes implementing EEI_Plugin_API
311
-        // which provide helpers for EE plugin authors to more easily register certain components with EE.
312
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES . 'plugin_api');
313
-        $this->loader->getShared('EE_Request_Handler');
314
-    }
315
-
316
-
317
-    /**
318
-     * @param string $addon_name
319
-     * @param string $version_constant
320
-     * @param string $min_version_required
321
-     * @param string $load_callback
322
-     * @param string $plugin_file_constant
323
-     * @return void
324
-     */
325
-    private function deactivateIncompatibleAddon(
326
-        $addon_name,
327
-        $version_constant,
328
-        $min_version_required,
329
-        $load_callback,
330
-        $plugin_file_constant
331
-    ) {
332
-        if (! defined($version_constant)) {
333
-            return;
334
-        }
335
-        $addon_version = constant($version_constant);
336
-        if ($addon_version && version_compare($addon_version, $min_version_required, '<')) {
337
-            remove_action('AHEE__EE_System__load_espresso_addons', $load_callback);
338
-            if (! function_exists('deactivate_plugins')) {
339
-                require_once ABSPATH . 'wp-admin/includes/plugin.php';
340
-            }
341
-            deactivate_plugins(plugin_basename(constant($plugin_file_constant)));
342
-            unset($_GET['activate'], $_REQUEST['activate'], $_GET['activate-multi'], $_REQUEST['activate-multi']);
343
-            EE_Error::add_error(
344
-                sprintf(
345
-                    esc_html__(
346
-                        'We\'re sorry, but the Event Espresso %1$s addon was deactivated because version %2$s or higher is required with this version of Event Espresso core.',
347
-                        'event_espresso'
348
-                    ),
349
-                    $addon_name,
350
-                    $min_version_required
351
-                ),
352
-                __FILE__,
353
-                __FUNCTION__ . "({$addon_name})",
354
-                __LINE__
355
-            );
356
-            EE_Error::get_notices(false, true);
357
-        }
358
-    }
359
-
360
-
361
-    /**
362
-     * load_espresso_addons
363
-     * allow addons to load first so that they can set hooks for running DMS's, etc
364
-     * this is hooked into both:
365
-     *    'AHEE__EE_Bootstrap__load_core_configuration'
366
-     *        which runs during the WP 'plugins_loaded' action at priority 5
367
-     *    and the WP 'activate_plugin' hook point
368
-     *
369
-     * @access public
370
-     * @return void
371
-     */
372
-    public function load_espresso_addons()
373
-    {
374
-        $this->deactivateIncompatibleAddon(
375
-            'Wait Lists',
376
-            'EE_WAIT_LISTS_VERSION',
377
-            '1.0.0.beta.074',
378
-            'load_espresso_wait_lists',
379
-            'EE_WAIT_LISTS_PLUGIN_FILE'
380
-        );
381
-        $this->deactivateIncompatibleAddon(
382
-            'Automated Upcoming Event Notifications',
383
-            'EE_AUTOMATED_UPCOMING_EVENT_NOTIFICATION_VERSION',
384
-            '1.0.0.beta.091',
385
-            'load_espresso_automated_upcoming_event_notification',
386
-            'EE_AUTOMATED_UPCOMING_EVENT_NOTIFICATION_PLUGIN_FILE'
387
-        );
388
-        do_action('AHEE__EE_System__load_espresso_addons');
389
-        // if the WP API basic auth plugin isn't already loaded, load it now.
390
-        // We want it for mobile apps. Just include the entire plugin
391
-        // also, don't load the basic auth when a plugin is getting activated, because
392
-        // it could be the basic auth plugin, and it doesn't check if its methods are already defined
393
-        // and causes a fatal error
394
-        if (($this->request->isWordPressApi() || $this->request->isApi())
395
-            && $this->request->getRequestParam('activate') !== 'true'
396
-            && ! function_exists('json_basic_auth_handler')
397
-            && ! function_exists('json_basic_auth_error')
398
-            && ! in_array(
399
-                $this->request->getRequestParam('action'),
400
-                array('activate', 'activate-selected'),
401
-                true
402
-            )
403
-        ) {
404
-            include_once EE_THIRD_PARTY . 'wp-api-basic-auth/basic-auth.php';
405
-        }
406
-        do_action('AHEE__EE_System__load_espresso_addons__complete');
407
-    }
408
-
409
-
410
-    /**
411
-     * detect_activations_or_upgrades
412
-     * Checks for activation or upgrade of core first;
413
-     * then also checks if any registered addons have been activated or upgraded
414
-     * This is hooked into 'AHEE__EE_Bootstrap__detect_activations_or_upgrades'
415
-     * which runs during the WP 'plugins_loaded' action at priority 3
416
-     *
417
-     * @access public
418
-     * @return void
419
-     */
420
-    public function detect_activations_or_upgrades()
421
-    {
422
-        // first off: let's make sure to handle core
423
-        $this->detect_if_activation_or_upgrade();
424
-        foreach ($this->registry->addons as $addon) {
425
-            if ($addon instanceof EE_Addon) {
426
-                // detect teh request type for that addon
427
-                $addon->detect_activation_or_upgrade();
428
-            }
429
-        }
430
-    }
431
-
432
-
433
-    /**
434
-     * detect_if_activation_or_upgrade
435
-     * Takes care of detecting whether this is a brand new install or code upgrade,
436
-     * and either setting up the DB or setting up maintenance mode etc.
437
-     *
438
-     * @access public
439
-     * @return void
440
-     */
441
-    public function detect_if_activation_or_upgrade()
442
-    {
443
-        do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
444
-        // check if db has been updated, or if its a brand-new installation
445
-        $espresso_db_update = $this->fix_espresso_db_upgrade_option();
446
-        $request_type = $this->detect_req_type($espresso_db_update);
447
-        // EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
448
-        switch ($request_type) {
449
-            case EE_System::req_type_new_activation:
450
-                do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
451
-                $this->_handle_core_version_change($espresso_db_update);
452
-                break;
453
-            case EE_System::req_type_reactivation:
454
-                do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
455
-                $this->_handle_core_version_change($espresso_db_update);
456
-                break;
457
-            case EE_System::req_type_upgrade:
458
-                do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
459
-                // migrations may be required now that we've upgraded
460
-                $this->maintenance_mode->set_maintenance_mode_if_db_old();
461
-                $this->_handle_core_version_change($espresso_db_update);
462
-                break;
463
-            case EE_System::req_type_downgrade:
464
-                do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
465
-                // its possible migrations are no longer required
466
-                $this->maintenance_mode->set_maintenance_mode_if_db_old();
467
-                $this->_handle_core_version_change($espresso_db_update);
468
-                break;
469
-            case EE_System::req_type_normal:
470
-            default:
471
-                break;
472
-        }
473
-        do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
474
-    }
475
-
476
-
477
-    /**
478
-     * Updates the list of installed versions and sets hooks for
479
-     * initializing the database later during the request
480
-     *
481
-     * @param array $espresso_db_update
482
-     */
483
-    private function _handle_core_version_change($espresso_db_update)
484
-    {
485
-        $this->update_list_of_installed_versions($espresso_db_update);
486
-        // get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
487
-        add_action(
488
-            'AHEE__EE_System__perform_activations_upgrades_and_migrations',
489
-            array($this, 'initialize_db_if_no_migrations_required')
490
-        );
491
-    }
492
-
493
-
494
-    /**
495
-     * standardizes the wp option 'espresso_db_upgrade' which actually stores
496
-     * information about what versions of EE have been installed and activated,
497
-     * NOT necessarily the state of the database
498
-     *
499
-     * @param mixed $espresso_db_update           the value of the WordPress option.
500
-     *                                            If not supplied, fetches it from the options table
501
-     * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
502
-     */
503
-    private function fix_espresso_db_upgrade_option($espresso_db_update = null)
504
-    {
505
-        do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
506
-        if (! $espresso_db_update) {
507
-            $espresso_db_update = get_option('espresso_db_update');
508
-        }
509
-        // check that option is an array
510
-        if (! is_array($espresso_db_update)) {
511
-            // if option is FALSE, then it never existed
512
-            if ($espresso_db_update === false) {
513
-                // make $espresso_db_update an array and save option with autoload OFF
514
-                $espresso_db_update = array();
515
-                add_option('espresso_db_update', $espresso_db_update, '', 'no');
516
-            } else {
517
-                // option is NOT FALSE but also is NOT an array, so make it an array and save it
518
-                $espresso_db_update = array($espresso_db_update => array());
519
-                update_option('espresso_db_update', $espresso_db_update);
520
-            }
521
-        } else {
522
-            $corrected_db_update = array();
523
-            // if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
524
-            foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
525
-                if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
526
-                    // the key is an int, and the value IS NOT an array
527
-                    // so it must be numerically-indexed, where values are versions installed...
528
-                    // fix it!
529
-                    $version_string = $should_be_array;
530
-                    $corrected_db_update[ $version_string ] = array('unknown-date');
531
-                } else {
532
-                    // ok it checks out
533
-                    $corrected_db_update[ $should_be_version_string ] = $should_be_array;
534
-                }
535
-            }
536
-            $espresso_db_update = $corrected_db_update;
537
-            update_option('espresso_db_update', $espresso_db_update);
538
-        }
539
-        do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
540
-        return $espresso_db_update;
541
-    }
542
-
543
-
544
-    /**
545
-     * Does the traditional work of setting up the plugin's database and adding default data.
546
-     * If migration script/process did not exist, this is what would happen on every activation/reactivation/upgrade.
547
-     * NOTE: if we're in maintenance mode (which would be the case if we detect there are data
548
-     * migration scripts that need to be run and a version change happens), enqueues core for database initialization,
549
-     * so that it will be done when migrations are finished
550
-     *
551
-     * @param boolean $initialize_addons_too if true, we double-check addons' database tables etc too;
552
-     * @param boolean $verify_schema         if true will re-check the database tables have the correct schema.
553
-     *                                       This is a resource-intensive job
554
-     *                                       so we prefer to only do it when necessary
555
-     * @return void
556
-     * @throws EE_Error
557
-     */
558
-    public function initialize_db_if_no_migrations_required($initialize_addons_too = false, $verify_schema = true)
559
-    {
560
-        $request_type = $this->detect_req_type();
561
-        // only initialize system if we're not in maintenance mode.
562
-        if ($this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance) {
563
-            /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */
564
-            $rewrite_rules = $this->loader->getShared(
565
-                'EventEspresso\core\domain\services\custom_post_types\RewriteRules'
566
-            );
567
-            $rewrite_rules->flush();
568
-            if ($verify_schema) {
569
-                EEH_Activation::initialize_db_and_folders();
570
-            }
571
-            EEH_Activation::initialize_db_content();
572
-            EEH_Activation::system_initialization();
573
-            if ($initialize_addons_too) {
574
-                $this->initialize_addons();
575
-            }
576
-        } else {
577
-            EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
578
-        }
579
-        if ($request_type === EE_System::req_type_new_activation
580
-            || $request_type === EE_System::req_type_reactivation
581
-            || (
582
-                $request_type === EE_System::req_type_upgrade
583
-                && $this->is_major_version_change()
584
-            )
585
-        ) {
586
-            add_action('AHEE__EE_System__initialize_last', array($this, 'redirect_to_about_ee'), 9);
587
-        }
588
-    }
589
-
590
-
591
-    /**
592
-     * Initializes the db for all registered addons
593
-     *
594
-     * @throws EE_Error
595
-     */
596
-    public function initialize_addons()
597
-    {
598
-        // foreach registered addon, make sure its db is up-to-date too
599
-        foreach ($this->registry->addons as $addon) {
600
-            if ($addon instanceof EE_Addon) {
601
-                $addon->initialize_db_if_no_migrations_required();
602
-            }
603
-        }
604
-    }
605
-
606
-
607
-    /**
608
-     * Adds the current code version to the saved wp option which stores a list of all ee versions ever installed.
609
-     *
610
-     * @param    array  $version_history
611
-     * @param    string $current_version_to_add version to be added to the version history
612
-     * @return    boolean success as to whether or not this option was changed
613
-     */
614
-    public function update_list_of_installed_versions($version_history = null, $current_version_to_add = null)
615
-    {
616
-        if (! $version_history) {
617
-            $version_history = $this->fix_espresso_db_upgrade_option($version_history);
618
-        }
619
-        if ($current_version_to_add === null) {
620
-            $current_version_to_add = espresso_version();
621
-        }
622
-        $version_history[ $current_version_to_add ][] = date('Y-m-d H:i:s', time());
623
-        // re-save
624
-        return update_option('espresso_db_update', $version_history);
625
-    }
626
-
627
-
628
-    /**
629
-     * Detects if the current version indicated in the has existed in the list of
630
-     * previously-installed versions of EE (espresso_db_update). Does NOT modify it (ie, no side-effect)
631
-     *
632
-     * @param array $espresso_db_update array from the wp option stored under the name 'espresso_db_update'.
633
-     *                                  If not supplied, fetches it from the options table.
634
-     *                                  Also, caches its result so later parts of the code can also know whether
635
-     *                                  there's been an update or not. This way we can add the current version to
636
-     *                                  espresso_db_update, but still know if this is a new install or not
637
-     * @return int one of the constants on EE_System::req_type_
638
-     */
639
-    public function detect_req_type($espresso_db_update = null)
640
-    {
641
-        if ($this->_req_type === null) {
642
-            $espresso_db_update = ! empty($espresso_db_update)
643
-                ? $espresso_db_update
644
-                : $this->fix_espresso_db_upgrade_option();
645
-            $this->_req_type = EE_System::detect_req_type_given_activation_history(
646
-                $espresso_db_update,
647
-                'ee_espresso_activation',
648
-                espresso_version()
649
-            );
650
-            $this->_major_version_change = $this->_detect_major_version_change($espresso_db_update);
651
-            $this->request->setIsActivation($this->_req_type !== EE_System::req_type_normal);
652
-        }
653
-        return $this->_req_type;
654
-    }
655
-
656
-
657
-    /**
658
-     * Returns whether or not there was a non-micro version change (ie, change in either
659
-     * the first or second number in the version. Eg 4.9.0.rc.001 to 4.10.0.rc.000,
660
-     * but not 4.9.0.rc.0001 to 4.9.1.rc.0001
661
-     *
662
-     * @param $activation_history
663
-     * @return bool
664
-     */
665
-    private function _detect_major_version_change($activation_history)
666
-    {
667
-        $previous_version = EE_System::_get_most_recently_active_version_from_activation_history($activation_history);
668
-        $previous_version_parts = explode('.', $previous_version);
669
-        $current_version_parts = explode('.', espresso_version());
670
-        return isset($previous_version_parts[0], $previous_version_parts[1], $current_version_parts[0], $current_version_parts[1])
671
-               && (
672
-                   $previous_version_parts[0] !== $current_version_parts[0]
673
-                   || $previous_version_parts[1] !== $current_version_parts[1]
674
-               );
675
-    }
676
-
677
-
678
-    /**
679
-     * Returns true if either the major or minor version of EE changed during this request.
680
-     * Eg 4.9.0.rc.001 to 4.10.0.rc.000, but not 4.9.0.rc.0001 to 4.9.1.rc.0001
681
-     *
682
-     * @return bool
683
-     */
684
-    public function is_major_version_change()
685
-    {
686
-        return $this->_major_version_change;
687
-    }
688
-
689
-
690
-    /**
691
-     * Determines the request type for any ee addon, given three piece of info: the current array of activation
692
-     * histories (for core that' 'espresso_db_update' wp option); the name of the WordPress option which is temporarily
693
-     * set upon activation of the plugin (for core it's 'ee_espresso_activation'); and the version that this plugin was
694
-     * just activated to (for core that will always be espresso_version())
695
-     *
696
-     * @param array  $activation_history_for_addon     the option's value which stores the activation history for this
697
-     *                                                 ee plugin. for core that's 'espresso_db_update'
698
-     * @param string $activation_indicator_option_name the name of the WordPress option that is temporarily set to
699
-     *                                                 indicate that this plugin was just activated
700
-     * @param string $version_to_upgrade_to            the version that was just upgraded to (for core that will be
701
-     *                                                 espresso_version())
702
-     * @return int one of the constants on EE_System::req_type_*
703
-     */
704
-    public static function detect_req_type_given_activation_history(
705
-        $activation_history_for_addon,
706
-        $activation_indicator_option_name,
707
-        $version_to_upgrade_to
708
-    ) {
709
-        $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
710
-        if ($activation_history_for_addon) {
711
-            // it exists, so this isn't a completely new install
712
-            // check if this version already in that list of previously installed versions
713
-            if (! isset($activation_history_for_addon[ $version_to_upgrade_to ])) {
714
-                // it a version we haven't seen before
715
-                if ($version_is_higher === 1) {
716
-                    $req_type = EE_System::req_type_upgrade;
717
-                } else {
718
-                    $req_type = EE_System::req_type_downgrade;
719
-                }
720
-                delete_option($activation_indicator_option_name);
721
-            } else {
722
-                // its not an update. maybe a reactivation?
723
-                if (get_option($activation_indicator_option_name, false)) {
724
-                    if ($version_is_higher === -1) {
725
-                        $req_type = EE_System::req_type_downgrade;
726
-                    } elseif ($version_is_higher === 0) {
727
-                        // we've seen this version before, but it's an activation. must be a reactivation
728
-                        $req_type = EE_System::req_type_reactivation;
729
-                    } else {// $version_is_higher === 1
730
-                        $req_type = EE_System::req_type_upgrade;
731
-                    }
732
-                    delete_option($activation_indicator_option_name);
733
-                } else {
734
-                    // we've seen this version before and the activation indicate doesn't show it was just activated
735
-                    if ($version_is_higher === -1) {
736
-                        $req_type = EE_System::req_type_downgrade;
737
-                    } elseif ($version_is_higher === 0) {
738
-                        // we've seen this version before and it's not an activation. its normal request
739
-                        $req_type = EE_System::req_type_normal;
740
-                    } else {// $version_is_higher === 1
741
-                        $req_type = EE_System::req_type_upgrade;
742
-                    }
743
-                }
744
-            }
745
-        } else {
746
-            // brand new install
747
-            $req_type = EE_System::req_type_new_activation;
748
-            delete_option($activation_indicator_option_name);
749
-        }
750
-        return $req_type;
751
-    }
752
-
753
-
754
-    /**
755
-     * Detects if the $version_to_upgrade_to is higher than the most recent version in
756
-     * the $activation_history_for_addon
757
-     *
758
-     * @param array  $activation_history_for_addon (keys are versions, values are arrays of times activated,
759
-     *                                             sometimes containing 'unknown-date'
760
-     * @param string $version_to_upgrade_to        (current version)
761
-     * @return int results of version_compare( $version_to_upgrade_to, $most_recently_active_version ).
762
-     *                                             ie, -1 if $version_to_upgrade_to is LOWER (downgrade);
763
-     *                                             0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
764
-     *                                             1 if $version_to_upgrade_to is HIGHER (upgrade) ;
765
-     */
766
-    private static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to)
767
-    {
768
-        // find the most recently-activated version
769
-        $most_recently_active_version =
770
-            EE_System::_get_most_recently_active_version_from_activation_history($activation_history_for_addon);
771
-        return version_compare($version_to_upgrade_to, $most_recently_active_version);
772
-    }
773
-
774
-
775
-    /**
776
-     * Gets the most recently active version listed in the activation history,
777
-     * and if none are found (ie, it's a brand new install) returns '0.0.0.dev.000'.
778
-     *
779
-     * @param array $activation_history  (keys are versions, values are arrays of times activated,
780
-     *                                   sometimes containing 'unknown-date'
781
-     * @return string
782
-     */
783
-    private static function _get_most_recently_active_version_from_activation_history($activation_history)
784
-    {
785
-        $most_recently_active_version_activation = '1970-01-01 00:00:00';
786
-        $most_recently_active_version = '0.0.0.dev.000';
787
-        if (is_array($activation_history)) {
788
-            foreach ($activation_history as $version => $times_activated) {
789
-                // check there is a record of when this version was activated. Otherwise,
790
-                // mark it as unknown
791
-                if (! $times_activated) {
792
-                    $times_activated = array('unknown-date');
793
-                }
794
-                if (is_string($times_activated)) {
795
-                    $times_activated = array($times_activated);
796
-                }
797
-                foreach ($times_activated as $an_activation) {
798
-                    if ($an_activation !== 'unknown-date'
799
-                        && $an_activation
800
-                           > $most_recently_active_version_activation) {
801
-                        $most_recently_active_version = $version;
802
-                        $most_recently_active_version_activation = $an_activation === 'unknown-date'
803
-                            ? '1970-01-01 00:00:00'
804
-                            : $an_activation;
805
-                    }
806
-                }
807
-            }
808
-        }
809
-        return $most_recently_active_version;
810
-    }
811
-
812
-
813
-    /**
814
-     * This redirects to the about EE page after activation
815
-     *
816
-     * @return void
817
-     */
818
-    public function redirect_to_about_ee()
819
-    {
820
-        $notices = EE_Error::get_notices(false);
821
-        // if current user is an admin and it's not an ajax or rest request
822
-        if (! isset($notices['errors'])
823
-            && $this->request->isAdmin()
824
-            && apply_filters(
825
-                'FHEE__EE_System__redirect_to_about_ee__do_redirect',
826
-                $this->capabilities->current_user_can('manage_options', 'espresso_about_default')
827
-            )
828
-        ) {
829
-            $query_params = array('page' => 'espresso_about');
830
-            if (EE_System::instance()->detect_req_type() === EE_System::req_type_new_activation) {
831
-                $query_params['new_activation'] = true;
832
-            }
833
-            if (EE_System::instance()->detect_req_type() === EE_System::req_type_reactivation) {
834
-                $query_params['reactivation'] = true;
835
-            }
836
-            $url = add_query_arg($query_params, admin_url('admin.php'));
837
-            wp_safe_redirect($url);
838
-            exit();
839
-        }
840
-    }
841
-
842
-
843
-    /**
844
-     * load_core_configuration
845
-     * this is hooked into 'AHEE__EE_Bootstrap__load_core_configuration'
846
-     * which runs during the WP 'plugins_loaded' action at priority 5
847
-     *
848
-     * @return void
849
-     * @throws ReflectionException
850
-     * @throws Exception
851
-     */
852
-    public function load_core_configuration()
853
-    {
854
-        do_action('AHEE__EE_System__load_core_configuration__begin', $this);
855
-        $this->loader->getShared('EE_Load_Textdomain');
856
-        // load textdomain
857
-        EE_Load_Textdomain::load_textdomain();
858
-        // load caf stuff a chance to play during the activation process too.
859
-        $this->_maybe_brew_regular();
860
-        // load and setup EE_Config and EE_Network_Config
861
-        $config = $this->loader->getShared('EE_Config');
862
-        $this->loader->getShared('EE_Network_Config');
863
-        // setup autoloaders
864
-        // enable logging?
865
-        if ($config->admin->use_remote_logging) {
866
-            $this->loader->getShared('EE_Log');
867
-        }
868
-        // check for activation errors
869
-        $activation_errors = get_option('ee_plugin_activation_errors', false);
870
-        if ($activation_errors) {
871
-            EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
872
-            update_option('ee_plugin_activation_errors', false);
873
-        }
874
-        // get model names
875
-        $this->_parse_model_names();
876
-        // configure custom post type definitions
877
-        $this->loader->getShared('EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions');
878
-        $this->loader->getShared('EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions');
879
-        do_action('AHEE__EE_System__load_core_configuration__complete', $this);
880
-    }
881
-
882
-
883
-    /**
884
-     * cycles through all of the models/*.model.php files, and assembles an array of model names
885
-     *
886
-     * @return void
887
-     * @throws ReflectionException
888
-     */
889
-    private function _parse_model_names()
890
-    {
891
-        // get all the files in the EE_MODELS folder that end in .model.php
892
-        $models = glob(EE_MODELS . '*.model.php');
893
-        $model_names = array();
894
-        $non_abstract_db_models = array();
895
-        foreach ($models as $model) {
896
-            // get model classname
897
-            $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
898
-            $short_name = str_replace('EEM_', '', $classname);
899
-            $reflectionClass = new ReflectionClass($classname);
900
-            if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
901
-                $non_abstract_db_models[ $short_name ] = $classname;
902
-            }
903
-            $model_names[ $short_name ] = $classname;
904
-        }
905
-        $this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
906
-        $this->registry->non_abstract_db_models = apply_filters(
907
-            'FHEE__EE_System__parse_implemented_model_names',
908
-            $non_abstract_db_models
909
-        );
910
-    }
911
-
912
-
913
-    /**
914
-     * The purpose of this method is to simply check for a file named "caffeinated/brewing_regular.php" for any hooks
915
-     * that need to be setup before our EE_System launches.
916
-     *
917
-     * @return void
918
-     * @throws DomainException
919
-     * @throws InvalidArgumentException
920
-     * @throws InvalidDataTypeException
921
-     * @throws InvalidInterfaceException
922
-     * @throws InvalidClassException
923
-     * @throws InvalidFilePathException
924
-     */
925
-    private function _maybe_brew_regular()
926
-    {
927
-        /** @var Domain $domain */
928
-        $domain = DomainFactory::getShared(
929
-            new FullyQualifiedName(
930
-                'EventEspresso\core\domain\Domain'
931
-            ),
932
-            array(
933
-                new FilePath(EVENT_ESPRESSO_MAIN_FILE),
934
-                Version::fromString(espresso_version()),
935
-            )
936
-        );
937
-        if ($domain->isCaffeinated()) {
938
-            require_once EE_CAFF_PATH . 'brewing_regular.php';
939
-        }
940
-    }
941
-
942
-
943
-    /**
944
-     * @since 4.9.71.p
945
-     * @throws Exception
946
-     */
947
-    public function loadRouteMatchSpecifications()
948
-    {
949
-        try {
950
-            $this->router = $this->loader->getShared('EventEspresso\core\services\routing\RouteHandler');
951
-        } catch (Exception $exception) {
952
-            new ExceptionStackTraceDisplay($exception);
953
-        }
954
-        do_action('AHEE__EE_System__loadRouteMatchSpecifications');
955
-    }
956
-
957
-
958
-    /**
959
-     * register_shortcodes_modules_and_widgets
960
-     * generate lists of shortcodes and modules, then verify paths and classes
961
-     * This is hooked into 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets'
962
-     * which runs during the WP 'plugins_loaded' action at priority 7
963
-     *
964
-     * @access public
965
-     * @return void
966
-     * @throws Exception
967
-     */
968
-    public function register_shortcodes_modules_and_widgets()
969
-    {
970
-        $this->router->handleShortcodesRequest();
971
-        do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
972
-        // check for addons using old hook point
973
-        if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
974
-            $this->_incompatible_addon_error();
975
-        }
976
-    }
977
-
978
-
979
-    /**
980
-     * _incompatible_addon_error
981
-     *
982
-     * @access public
983
-     * @return void
984
-     */
985
-    private function _incompatible_addon_error()
986
-    {
987
-        // get array of classes hooking into here
988
-        $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook(
989
-            'AHEE__EE_System__register_shortcodes_modules_and_addons'
990
-        );
991
-        if (! empty($class_names)) {
992
-            $msg = __(
993
-                'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:',
994
-                'event_espresso'
995
-            );
996
-            $msg .= '<ul>';
997
-            foreach ($class_names as $class_name) {
998
-                $msg .= '<li><b>Event Espresso - '
999
-                        . str_replace(
1000
-                            array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'),
1001
-                            '',
1002
-                            $class_name
1003
-                        ) . '</b></li>';
1004
-            }
1005
-            $msg .= '</ul>';
1006
-            $msg .= __(
1007
-                'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.',
1008
-                'event_espresso'
1009
-            );
1010
-            // save list of incompatible addons to wp-options for later use
1011
-            add_option('ee_incompatible_addons', $class_names, '', 'no');
1012
-            if (is_admin()) {
1013
-                EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1014
-            }
1015
-        }
1016
-    }
1017
-
1018
-
1019
-    /**
1020
-     * brew_espresso
1021
-     * begins the process of setting hooks for initializing EE in the correct order
1022
-     * This is happening on the 'AHEE__EE_Bootstrap__brew_espresso' hook point
1023
-     * which runs during the WP 'plugins_loaded' action at priority 9
1024
-     *
1025
-     * @return void
1026
-     * @throws Exception
1027
-     */
1028
-    public function brew_espresso()
1029
-    {
1030
-        do_action('AHEE__EE_System__brew_espresso__begin', $this);
1031
-        // load some final core systems
1032
-        add_action('init', array($this, 'set_hooks_for_core'), 1);
1033
-        add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
1034
-        add_action('init', array($this, 'load_CPTs_and_session'), 5);
1035
-        add_action('init', array($this, 'load_controllers'), 7);
1036
-        add_action('init', array($this, 'core_loaded_and_ready'), 9);
1037
-        add_action('init', array($this, 'initialize'), 10);
1038
-        add_action('init', array($this, 'initialize_last'), 100);
1039
-        $this->router->handlePueRequest();
1040
-        $this->router->handleGQLRequest();
1041
-        do_action('AHEE__EE_System__brew_espresso__complete', $this);
1042
-    }
1043
-
1044
-
1045
-    /**
1046
-     *    set_hooks_for_core
1047
-     *
1048
-     * @access public
1049
-     * @return    void
1050
-     * @throws EE_Error
1051
-     */
1052
-    public function set_hooks_for_core()
1053
-    {
1054
-        $this->_deactivate_incompatible_addons();
1055
-        do_action('AHEE__EE_System__set_hooks_for_core');
1056
-        $this->loader->getShared('EventEspresso\core\domain\values\session\SessionLifespan');
1057
-        // caps need to be initialized on every request so that capability maps are set.
1058
-        // @see https://events.codebasehq.com/projects/event-espresso/tickets/8674
1059
-        $this->registry->CAP->init_caps();
1060
-    }
1061
-
1062
-
1063
-    /**
1064
-     * Using the information gathered in EE_System::_incompatible_addon_error,
1065
-     * deactivates any addons considered incompatible with the current version of EE
1066
-     */
1067
-    private function _deactivate_incompatible_addons()
1068
-    {
1069
-        $incompatible_addons = get_option('ee_incompatible_addons', array());
1070
-        if (! empty($incompatible_addons)) {
1071
-            $active_plugins = get_option('active_plugins', array());
1072
-            foreach ($active_plugins as $active_plugin) {
1073
-                foreach ($incompatible_addons as $incompatible_addon) {
1074
-                    if (strpos($active_plugin, $incompatible_addon) !== false) {
1075
-                        unset($_GET['activate']);
1076
-                        espresso_deactivate_plugin($active_plugin);
1077
-                    }
1078
-                }
1079
-            }
1080
-        }
1081
-    }
1082
-
1083
-
1084
-    /**
1085
-     *    perform_activations_upgrades_and_migrations
1086
-     *
1087
-     * @access public
1088
-     * @return    void
1089
-     */
1090
-    public function perform_activations_upgrades_and_migrations()
1091
-    {
1092
-        do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
1093
-    }
1094
-
1095
-
1096
-    /**
1097
-     * @return void
1098
-     * @throws DomainException
1099
-     */
1100
-    public function load_CPTs_and_session()
1101
-    {
1102
-        do_action('AHEE__EE_System__load_CPTs_and_session__start');
1103
-        /** @var EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies $register_custom_taxonomies */
1104
-        $register_custom_taxonomies = $this->loader->getShared(
1105
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'
1106
-        );
1107
-        $register_custom_taxonomies->registerCustomTaxonomies();
1108
-        /** @var EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes $register_custom_post_types */
1109
-        $register_custom_post_types = $this->loader->getShared(
1110
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'
1111
-        );
1112
-        $register_custom_post_types->registerCustomPostTypes();
1113
-        /** @var EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomyTerms $register_custom_taxonomy_terms */
1114
-        $register_custom_taxonomy_terms = $this->loader->getShared(
1115
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomyTerms'
1116
-        );
1117
-        $register_custom_taxonomy_terms->registerCustomTaxonomyTerms();
1118
-        // load legacy Custom Post Types and Taxonomies
1119
-        $this->loader->getShared('EE_Register_CPTs');
1120
-        do_action('AHEE__EE_System__load_CPTs_and_session__complete');
1121
-    }
1122
-
1123
-
1124
-    /**
1125
-     * load_controllers
1126
-     * this is the best place to load any additional controllers that needs access to EE core.
1127
-     * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this
1128
-     * time
1129
-     *
1130
-     * @access public
1131
-     * @return void
1132
-     * @throws Exception
1133
-     */
1134
-    public function load_controllers()
1135
-    {
1136
-        do_action('AHEE__EE_System__load_controllers__start');
1137
-        // let's get it started
1138
-        $this->router->handleControllerRequest();
1139
-        do_action('AHEE__EE_System__load_controllers__complete');
1140
-    }
1141
-
1142
-
1143
-    /**
1144
-     * core_loaded_and_ready
1145
-     * all of the basic EE core should be loaded at this point and available regardless of M-Mode
1146
-     *
1147
-     * @access public
1148
-     * @return void
1149
-     * @throws Exception
1150
-     */
1151
-    public function core_loaded_and_ready()
1152
-    {
1153
-        $this->router->handleAssetManagerRequest();
1154
-        $this->router->handleSessionRequest();
1155
-        // integrate WP_Query with the EE models
1156
-        $this->loader->getShared('EE_CPT_Strategy');
1157
-        do_action('AHEE__EE_System__core_loaded_and_ready');
1158
-        // always load template tags, because it's faster than checking if it's a front-end request, and many page
1159
-        // builders require these even on the front-end
1160
-        require_once EE_PUBLIC . 'template_tags.php';
1161
-        do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
1162
-    }
1163
-
1164
-
1165
-    /**
1166
-     * initialize
1167
-     * this is the best place to begin initializing client code
1168
-     *
1169
-     * @access public
1170
-     * @return void
1171
-     */
1172
-    public function initialize()
1173
-    {
1174
-        do_action('AHEE__EE_System__initialize');
1175
-    }
1176
-
1177
-
1178
-    /**
1179
-     * initialize_last
1180
-     * this is run really late during the WP init hook point, and ensures that mostly everything else that needs to
1181
-     * initialize has done so
1182
-     *
1183
-     * @access public
1184
-     * @return void
1185
-     * @throws Exception
1186
-     */
1187
-    public function initialize_last()
1188
-    {
1189
-        do_action('AHEE__EE_System__initialize_last');
1190
-        /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */
1191
-        $rewrite_rules = $this->loader->getShared(
1192
-            'EventEspresso\core\domain\services\custom_post_types\RewriteRules'
1193
-        );
1194
-        $rewrite_rules->flushRewriteRules();
1195
-        add_action('admin_bar_init', array($this, 'addEspressoToolbar'));
1196
-        $this->router->handlePersonalDataRequest();
1197
-    }
1198
-
1199
-
1200
-    /**
1201
-     * @return void
1202
-     */
1203
-    public function addEspressoToolbar()
1204
-    {
1205
-        $this->loader->getShared(
1206
-            'EventEspresso\core\domain\services\admin\AdminToolBar',
1207
-            array($this->registry->CAP)
1208
-        );
1209
-    }
1210
-
1211
-
1212
-    /**
1213
-     * do_not_cache
1214
-     * sets no cache headers and defines no cache constants for WP plugins
1215
-     *
1216
-     * @access public
1217
-     * @return void
1218
-     */
1219
-    public static function do_not_cache()
1220
-    {
1221
-        // set no cache constants
1222
-        if (! defined('DONOTCACHEPAGE')) {
1223
-            define('DONOTCACHEPAGE', true);
1224
-        }
1225
-        if (! defined('DONOTCACHCEOBJECT')) {
1226
-            define('DONOTCACHCEOBJECT', true);
1227
-        }
1228
-        if (! defined('DONOTCACHEDB')) {
1229
-            define('DONOTCACHEDB', true);
1230
-        }
1231
-        // add no cache headers
1232
-        add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
1233
-        // plus a little extra for nginx and Google Chrome
1234
-        add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1);
1235
-        // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
1236
-        remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
1237
-    }
1238
-
1239
-
1240
-    /**
1241
-     *    extra_nocache_headers
1242
-     *
1243
-     * @access    public
1244
-     * @param $headers
1245
-     * @return    array
1246
-     */
1247
-    public static function extra_nocache_headers($headers)
1248
-    {
1249
-        // for NGINX
1250
-        $headers['X-Accel-Expires'] = 0;
1251
-        // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store"
1252
-        $headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0';
1253
-        return $headers;
1254
-    }
1255
-
1256
-
1257
-    /**
1258
-     *    nocache_headers
1259
-     *
1260
-     * @access    public
1261
-     * @return    void
1262
-     */
1263
-    public static function nocache_headers()
1264
-    {
1265
-        nocache_headers();
1266
-    }
1267
-
1268
-
1269
-    /**
1270
-     * simply hooks into "wp_list_pages_exclude" filter (for wp_list_pages method) and makes sure EE critical pages are
1271
-     * never returned with the function.
1272
-     *
1273
-     * @param  array $exclude_array any existing pages being excluded are in this array.
1274
-     * @return array
1275
-     */
1276
-    public function remove_pages_from_wp_list_pages($exclude_array)
1277
-    {
1278
-        return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array());
1279
-    }
31
+	/**
32
+	 * indicates this is a 'normal' request. Ie, not activation, nor upgrade, nor activation.
33
+	 * So examples of this would be a normal GET request on the frontend or backend, or a POST, etc
34
+	 */
35
+	const req_type_normal = 0;
36
+
37
+	/**
38
+	 * Indicates this is a brand new installation of EE so we should install
39
+	 * tables and default data etc
40
+	 */
41
+	const req_type_new_activation = 1;
42
+
43
+	/**
44
+	 * we've detected that EE has been reactivated (or EE was activated during maintenance mode,
45
+	 * and we just exited maintenance mode). We MUST check the database is setup properly
46
+	 * and that default data is setup too
47
+	 */
48
+	const req_type_reactivation = 2;
49
+
50
+	/**
51
+	 * indicates that EE has been upgraded since its previous request.
52
+	 * We may have data migration scripts to call and will want to trigger maintenance mode
53
+	 */
54
+	const req_type_upgrade = 3;
55
+
56
+	/**
57
+	 * TODO  will detect that EE has been DOWNGRADED. We probably don't want to run in this case...
58
+	 */
59
+	const req_type_downgrade = 4;
60
+
61
+	/**
62
+	 * @deprecated since version 4.6.0.dev.006
63
+	 * Now whenever a new_activation is detected the request type is still just
64
+	 * new_activation (same for reactivation, upgrade, downgrade etc), but if we'r ein maintenance mode
65
+	 * EE_System::initialize_db_if_no_migrations_required and EE_Addon::initialize_db_if_no_migrations_required
66
+	 * will instead enqueue that EE plugin's db initialization for when we're taken out of maintenance mode.
67
+	 * (Specifically, when the migration manager indicates migrations are finished
68
+	 * EE_Data_Migration_Manager::initialize_db_for_enqueued_ee_plugins() will be called)
69
+	 */
70
+	const req_type_activation_but_not_installed = 5;
71
+
72
+	/**
73
+	 * option prefix for recording the activation history (like core's "espresso_db_update") of addons
74
+	 */
75
+	const addon_activation_history_option_prefix = 'ee_addon_activation_history_';
76
+
77
+	/**
78
+	 * @var EE_System $_instance
79
+	 */
80
+	private static $_instance;
81
+
82
+	/**
83
+	 * @var EE_Registry $registry
84
+	 */
85
+	private $registry;
86
+
87
+	/**
88
+	 * @var LoaderInterface $loader
89
+	 */
90
+	private $loader;
91
+
92
+	/**
93
+	 * @var EE_Capabilities $capabilities
94
+	 */
95
+	private $capabilities;
96
+
97
+	/**
98
+	 * @var EE_Maintenance_Mode $maintenance_mode
99
+	 */
100
+	private $maintenance_mode;
101
+
102
+	/**
103
+	 * @var RequestInterface $request
104
+	 */
105
+	private $request;
106
+
107
+	/**
108
+	 * Stores which type of request this is, options being one of the constants on EE_System starting with req_type_*.
109
+	 * It can be a brand-new activation, a reactivation, an upgrade, a downgrade, or a normal request.
110
+	 *
111
+	 * @var int $_req_type
112
+	 */
113
+	private $_req_type;
114
+
115
+
116
+	/**
117
+	 * @var RouteHandler $router
118
+	 */
119
+	private $router;
120
+
121
+	/**
122
+	 * Whether or not there was a non-micro version change in EE core version during this request
123
+	 *
124
+	 * @var boolean $_major_version_change
125
+	 */
126
+	private $_major_version_change = false;
127
+
128
+	/**
129
+	 * A Context DTO dedicated solely to identifying the current request type.
130
+	 *
131
+	 * @var RequestTypeContextCheckerInterface $request_type
132
+	 */
133
+	private $request_type;
134
+
135
+
136
+	/**
137
+	 * @singleton method used to instantiate class object
138
+	 * @param EE_Registry|null         $registry
139
+	 * @param LoaderInterface|null     $loader
140
+	 * @param RequestInterface|null    $request
141
+	 * @param EE_Maintenance_Mode|null $maintenance_mode
142
+	 * @return EE_System
143
+	 */
144
+	public static function instance(
145
+		EE_Registry $registry = null,
146
+		LoaderInterface $loader = null,
147
+		RequestInterface $request = null,
148
+		EE_Maintenance_Mode $maintenance_mode = null
149
+	) {
150
+		// check if class object is instantiated
151
+		if (! self::$_instance instanceof EE_System) {
152
+			self::$_instance = new self($registry, $loader, $request, $maintenance_mode);
153
+		}
154
+		return self::$_instance;
155
+	}
156
+
157
+
158
+	/**
159
+	 * resets the instance and returns it
160
+	 *
161
+	 * @return EE_System
162
+	 */
163
+	public static function reset()
164
+	{
165
+		self::$_instance->_req_type = null;
166
+		// make sure none of the old hooks are left hanging around
167
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
168
+		// we need to reset the migration manager in order for it to detect DMSs properly
169
+		EE_Data_Migration_Manager::reset();
170
+		self::instance()->detect_activations_or_upgrades();
171
+		self::instance()->perform_activations_upgrades_and_migrations();
172
+		return self::instance();
173
+	}
174
+
175
+
176
+	/**
177
+	 * sets hooks for running rest of system
178
+	 * provides "AHEE__EE_System__construct__complete" hook for EE Addons to use as their starting point
179
+	 * starting EE Addons from any other point may lead to problems
180
+	 *
181
+	 * @param EE_Registry         $registry
182
+	 * @param LoaderInterface     $loader
183
+	 * @param RequestInterface    $request
184
+	 * @param EE_Maintenance_Mode $maintenance_mode
185
+	 */
186
+	private function __construct(
187
+		EE_Registry $registry,
188
+		LoaderInterface $loader,
189
+		RequestInterface $request,
190
+		EE_Maintenance_Mode $maintenance_mode
191
+	) {
192
+		$this->registry = $registry;
193
+		$this->loader = $loader;
194
+		$this->request = $request;
195
+		$this->maintenance_mode = $maintenance_mode;
196
+		do_action('AHEE__EE_System__construct__begin', $this);
197
+		add_action(
198
+			'AHEE__EE_Bootstrap__load_espresso_addons',
199
+			array($this, 'loadCapabilities'),
200
+			5
201
+		);
202
+		add_action(
203
+			'AHEE__EE_Bootstrap__load_espresso_addons',
204
+			array($this, 'loadCommandBus'),
205
+			7
206
+		);
207
+		add_action(
208
+			'AHEE__EE_Bootstrap__load_espresso_addons',
209
+			array($this, 'loadPluginApi'),
210
+			9
211
+		);
212
+		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
213
+		add_action(
214
+			'AHEE__EE_Bootstrap__load_espresso_addons',
215
+			array($this, 'load_espresso_addons')
216
+		);
217
+		// when an ee addon is activated, we want to call the core hook(s) again
218
+		// because the newly-activated addon didn't get a chance to run at all
219
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
220
+		// detect whether install or upgrade
221
+		add_action(
222
+			'AHEE__EE_Bootstrap__detect_activations_or_upgrades',
223
+			array($this, 'detect_activations_or_upgrades'),
224
+			3
225
+		);
226
+		// load EE_Config, EE_Textdomain, etc
227
+		add_action(
228
+			'AHEE__EE_Bootstrap__load_core_configuration',
229
+			array($this, 'load_core_configuration'),
230
+			5
231
+		);
232
+		// load specifications for matching routes to current request
233
+		add_action(
234
+			'AHEE__EE_Bootstrap__load_core_configuration',
235
+			array($this, 'loadRouteMatchSpecifications')
236
+		);
237
+		// load EE_Config, EE_Textdomain, etc
238
+		add_action(
239
+			'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets',
240
+			array($this, 'register_shortcodes_modules_and_widgets'),
241
+			7
242
+		);
243
+		// you wanna get going? I wanna get going... let's get going!
244
+		add_action(
245
+			'AHEE__EE_Bootstrap__brew_espresso',
246
+			array($this, 'brew_espresso'),
247
+			9
248
+		);
249
+		// other housekeeping
250
+		// exclude EE critical pages from wp_list_pages
251
+		add_filter(
252
+			'wp_list_pages_excludes',
253
+			array($this, 'remove_pages_from_wp_list_pages'),
254
+			10
255
+		);
256
+		// ALL EE Addons should use the following hook point to attach their initial setup too
257
+		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
258
+		do_action('AHEE__EE_System__construct__complete', $this);
259
+	}
260
+
261
+
262
+	/**
263
+	 * load and setup EE_Capabilities
264
+	 *
265
+	 * @return void
266
+	 */
267
+	public function loadCapabilities()
268
+	{
269
+		$this->capabilities = $this->loader->getShared('EE_Capabilities');
270
+		add_action(
271
+			'AHEE__EE_Capabilities__init_caps__before_initialization',
272
+			function () {
273
+				LoaderFactory::getLoader()->getShared('EE_Payment_Method_Manager');
274
+			}
275
+		);
276
+	}
277
+
278
+
279
+	/**
280
+	 * create and cache the CommandBus, and also add middleware
281
+	 * The CapChecker middleware requires the use of EE_Capabilities
282
+	 * which is why we need to load the CommandBus after Caps are set up
283
+	 *
284
+	 * @return void
285
+	 */
286
+	public function loadCommandBus()
287
+	{
288
+		$this->loader->getShared(
289
+			'CommandBusInterface',
290
+			array(
291
+				null,
292
+				apply_filters(
293
+					'FHEE__EE_Load_Espresso_Core__handle_request__CommandBus_middleware',
294
+					array(
295
+						$this->loader->getShared('EventEspresso\core\services\commands\middleware\CapChecker'),
296
+						$this->loader->getShared('EventEspresso\core\services\commands\middleware\AddActionHook'),
297
+					)
298
+				),
299
+			)
300
+		);
301
+	}
302
+
303
+
304
+	/**
305
+	 * @return void
306
+	 * @throws EE_Error
307
+	 */
308
+	public function loadPluginApi()
309
+	{
310
+		// set autoloaders for all of the classes implementing EEI_Plugin_API
311
+		// which provide helpers for EE plugin authors to more easily register certain components with EE.
312
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES . 'plugin_api');
313
+		$this->loader->getShared('EE_Request_Handler');
314
+	}
315
+
316
+
317
+	/**
318
+	 * @param string $addon_name
319
+	 * @param string $version_constant
320
+	 * @param string $min_version_required
321
+	 * @param string $load_callback
322
+	 * @param string $plugin_file_constant
323
+	 * @return void
324
+	 */
325
+	private function deactivateIncompatibleAddon(
326
+		$addon_name,
327
+		$version_constant,
328
+		$min_version_required,
329
+		$load_callback,
330
+		$plugin_file_constant
331
+	) {
332
+		if (! defined($version_constant)) {
333
+			return;
334
+		}
335
+		$addon_version = constant($version_constant);
336
+		if ($addon_version && version_compare($addon_version, $min_version_required, '<')) {
337
+			remove_action('AHEE__EE_System__load_espresso_addons', $load_callback);
338
+			if (! function_exists('deactivate_plugins')) {
339
+				require_once ABSPATH . 'wp-admin/includes/plugin.php';
340
+			}
341
+			deactivate_plugins(plugin_basename(constant($plugin_file_constant)));
342
+			unset($_GET['activate'], $_REQUEST['activate'], $_GET['activate-multi'], $_REQUEST['activate-multi']);
343
+			EE_Error::add_error(
344
+				sprintf(
345
+					esc_html__(
346
+						'We\'re sorry, but the Event Espresso %1$s addon was deactivated because version %2$s or higher is required with this version of Event Espresso core.',
347
+						'event_espresso'
348
+					),
349
+					$addon_name,
350
+					$min_version_required
351
+				),
352
+				__FILE__,
353
+				__FUNCTION__ . "({$addon_name})",
354
+				__LINE__
355
+			);
356
+			EE_Error::get_notices(false, true);
357
+		}
358
+	}
359
+
360
+
361
+	/**
362
+	 * load_espresso_addons
363
+	 * allow addons to load first so that they can set hooks for running DMS's, etc
364
+	 * this is hooked into both:
365
+	 *    'AHEE__EE_Bootstrap__load_core_configuration'
366
+	 *        which runs during the WP 'plugins_loaded' action at priority 5
367
+	 *    and the WP 'activate_plugin' hook point
368
+	 *
369
+	 * @access public
370
+	 * @return void
371
+	 */
372
+	public function load_espresso_addons()
373
+	{
374
+		$this->deactivateIncompatibleAddon(
375
+			'Wait Lists',
376
+			'EE_WAIT_LISTS_VERSION',
377
+			'1.0.0.beta.074',
378
+			'load_espresso_wait_lists',
379
+			'EE_WAIT_LISTS_PLUGIN_FILE'
380
+		);
381
+		$this->deactivateIncompatibleAddon(
382
+			'Automated Upcoming Event Notifications',
383
+			'EE_AUTOMATED_UPCOMING_EVENT_NOTIFICATION_VERSION',
384
+			'1.0.0.beta.091',
385
+			'load_espresso_automated_upcoming_event_notification',
386
+			'EE_AUTOMATED_UPCOMING_EVENT_NOTIFICATION_PLUGIN_FILE'
387
+		);
388
+		do_action('AHEE__EE_System__load_espresso_addons');
389
+		// if the WP API basic auth plugin isn't already loaded, load it now.
390
+		// We want it for mobile apps. Just include the entire plugin
391
+		// also, don't load the basic auth when a plugin is getting activated, because
392
+		// it could be the basic auth plugin, and it doesn't check if its methods are already defined
393
+		// and causes a fatal error
394
+		if (($this->request->isWordPressApi() || $this->request->isApi())
395
+			&& $this->request->getRequestParam('activate') !== 'true'
396
+			&& ! function_exists('json_basic_auth_handler')
397
+			&& ! function_exists('json_basic_auth_error')
398
+			&& ! in_array(
399
+				$this->request->getRequestParam('action'),
400
+				array('activate', 'activate-selected'),
401
+				true
402
+			)
403
+		) {
404
+			include_once EE_THIRD_PARTY . 'wp-api-basic-auth/basic-auth.php';
405
+		}
406
+		do_action('AHEE__EE_System__load_espresso_addons__complete');
407
+	}
408
+
409
+
410
+	/**
411
+	 * detect_activations_or_upgrades
412
+	 * Checks for activation or upgrade of core first;
413
+	 * then also checks if any registered addons have been activated or upgraded
414
+	 * This is hooked into 'AHEE__EE_Bootstrap__detect_activations_or_upgrades'
415
+	 * which runs during the WP 'plugins_loaded' action at priority 3
416
+	 *
417
+	 * @access public
418
+	 * @return void
419
+	 */
420
+	public function detect_activations_or_upgrades()
421
+	{
422
+		// first off: let's make sure to handle core
423
+		$this->detect_if_activation_or_upgrade();
424
+		foreach ($this->registry->addons as $addon) {
425
+			if ($addon instanceof EE_Addon) {
426
+				// detect teh request type for that addon
427
+				$addon->detect_activation_or_upgrade();
428
+			}
429
+		}
430
+	}
431
+
432
+
433
+	/**
434
+	 * detect_if_activation_or_upgrade
435
+	 * Takes care of detecting whether this is a brand new install or code upgrade,
436
+	 * and either setting up the DB or setting up maintenance mode etc.
437
+	 *
438
+	 * @access public
439
+	 * @return void
440
+	 */
441
+	public function detect_if_activation_or_upgrade()
442
+	{
443
+		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
444
+		// check if db has been updated, or if its a brand-new installation
445
+		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
446
+		$request_type = $this->detect_req_type($espresso_db_update);
447
+		// EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
448
+		switch ($request_type) {
449
+			case EE_System::req_type_new_activation:
450
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
451
+				$this->_handle_core_version_change($espresso_db_update);
452
+				break;
453
+			case EE_System::req_type_reactivation:
454
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
455
+				$this->_handle_core_version_change($espresso_db_update);
456
+				break;
457
+			case EE_System::req_type_upgrade:
458
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
459
+				// migrations may be required now that we've upgraded
460
+				$this->maintenance_mode->set_maintenance_mode_if_db_old();
461
+				$this->_handle_core_version_change($espresso_db_update);
462
+				break;
463
+			case EE_System::req_type_downgrade:
464
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
465
+				// its possible migrations are no longer required
466
+				$this->maintenance_mode->set_maintenance_mode_if_db_old();
467
+				$this->_handle_core_version_change($espresso_db_update);
468
+				break;
469
+			case EE_System::req_type_normal:
470
+			default:
471
+				break;
472
+		}
473
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
474
+	}
475
+
476
+
477
+	/**
478
+	 * Updates the list of installed versions and sets hooks for
479
+	 * initializing the database later during the request
480
+	 *
481
+	 * @param array $espresso_db_update
482
+	 */
483
+	private function _handle_core_version_change($espresso_db_update)
484
+	{
485
+		$this->update_list_of_installed_versions($espresso_db_update);
486
+		// get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
487
+		add_action(
488
+			'AHEE__EE_System__perform_activations_upgrades_and_migrations',
489
+			array($this, 'initialize_db_if_no_migrations_required')
490
+		);
491
+	}
492
+
493
+
494
+	/**
495
+	 * standardizes the wp option 'espresso_db_upgrade' which actually stores
496
+	 * information about what versions of EE have been installed and activated,
497
+	 * NOT necessarily the state of the database
498
+	 *
499
+	 * @param mixed $espresso_db_update           the value of the WordPress option.
500
+	 *                                            If not supplied, fetches it from the options table
501
+	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
502
+	 */
503
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null)
504
+	{
505
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
506
+		if (! $espresso_db_update) {
507
+			$espresso_db_update = get_option('espresso_db_update');
508
+		}
509
+		// check that option is an array
510
+		if (! is_array($espresso_db_update)) {
511
+			// if option is FALSE, then it never existed
512
+			if ($espresso_db_update === false) {
513
+				// make $espresso_db_update an array and save option with autoload OFF
514
+				$espresso_db_update = array();
515
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
516
+			} else {
517
+				// option is NOT FALSE but also is NOT an array, so make it an array and save it
518
+				$espresso_db_update = array($espresso_db_update => array());
519
+				update_option('espresso_db_update', $espresso_db_update);
520
+			}
521
+		} else {
522
+			$corrected_db_update = array();
523
+			// if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
524
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
525
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
526
+					// the key is an int, and the value IS NOT an array
527
+					// so it must be numerically-indexed, where values are versions installed...
528
+					// fix it!
529
+					$version_string = $should_be_array;
530
+					$corrected_db_update[ $version_string ] = array('unknown-date');
531
+				} else {
532
+					// ok it checks out
533
+					$corrected_db_update[ $should_be_version_string ] = $should_be_array;
534
+				}
535
+			}
536
+			$espresso_db_update = $corrected_db_update;
537
+			update_option('espresso_db_update', $espresso_db_update);
538
+		}
539
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
540
+		return $espresso_db_update;
541
+	}
542
+
543
+
544
+	/**
545
+	 * Does the traditional work of setting up the plugin's database and adding default data.
546
+	 * If migration script/process did not exist, this is what would happen on every activation/reactivation/upgrade.
547
+	 * NOTE: if we're in maintenance mode (which would be the case if we detect there are data
548
+	 * migration scripts that need to be run and a version change happens), enqueues core for database initialization,
549
+	 * so that it will be done when migrations are finished
550
+	 *
551
+	 * @param boolean $initialize_addons_too if true, we double-check addons' database tables etc too;
552
+	 * @param boolean $verify_schema         if true will re-check the database tables have the correct schema.
553
+	 *                                       This is a resource-intensive job
554
+	 *                                       so we prefer to only do it when necessary
555
+	 * @return void
556
+	 * @throws EE_Error
557
+	 */
558
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = false, $verify_schema = true)
559
+	{
560
+		$request_type = $this->detect_req_type();
561
+		// only initialize system if we're not in maintenance mode.
562
+		if ($this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance) {
563
+			/** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */
564
+			$rewrite_rules = $this->loader->getShared(
565
+				'EventEspresso\core\domain\services\custom_post_types\RewriteRules'
566
+			);
567
+			$rewrite_rules->flush();
568
+			if ($verify_schema) {
569
+				EEH_Activation::initialize_db_and_folders();
570
+			}
571
+			EEH_Activation::initialize_db_content();
572
+			EEH_Activation::system_initialization();
573
+			if ($initialize_addons_too) {
574
+				$this->initialize_addons();
575
+			}
576
+		} else {
577
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
578
+		}
579
+		if ($request_type === EE_System::req_type_new_activation
580
+			|| $request_type === EE_System::req_type_reactivation
581
+			|| (
582
+				$request_type === EE_System::req_type_upgrade
583
+				&& $this->is_major_version_change()
584
+			)
585
+		) {
586
+			add_action('AHEE__EE_System__initialize_last', array($this, 'redirect_to_about_ee'), 9);
587
+		}
588
+	}
589
+
590
+
591
+	/**
592
+	 * Initializes the db for all registered addons
593
+	 *
594
+	 * @throws EE_Error
595
+	 */
596
+	public function initialize_addons()
597
+	{
598
+		// foreach registered addon, make sure its db is up-to-date too
599
+		foreach ($this->registry->addons as $addon) {
600
+			if ($addon instanceof EE_Addon) {
601
+				$addon->initialize_db_if_no_migrations_required();
602
+			}
603
+		}
604
+	}
605
+
606
+
607
+	/**
608
+	 * Adds the current code version to the saved wp option which stores a list of all ee versions ever installed.
609
+	 *
610
+	 * @param    array  $version_history
611
+	 * @param    string $current_version_to_add version to be added to the version history
612
+	 * @return    boolean success as to whether or not this option was changed
613
+	 */
614
+	public function update_list_of_installed_versions($version_history = null, $current_version_to_add = null)
615
+	{
616
+		if (! $version_history) {
617
+			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
618
+		}
619
+		if ($current_version_to_add === null) {
620
+			$current_version_to_add = espresso_version();
621
+		}
622
+		$version_history[ $current_version_to_add ][] = date('Y-m-d H:i:s', time());
623
+		// re-save
624
+		return update_option('espresso_db_update', $version_history);
625
+	}
626
+
627
+
628
+	/**
629
+	 * Detects if the current version indicated in the has existed in the list of
630
+	 * previously-installed versions of EE (espresso_db_update). Does NOT modify it (ie, no side-effect)
631
+	 *
632
+	 * @param array $espresso_db_update array from the wp option stored under the name 'espresso_db_update'.
633
+	 *                                  If not supplied, fetches it from the options table.
634
+	 *                                  Also, caches its result so later parts of the code can also know whether
635
+	 *                                  there's been an update or not. This way we can add the current version to
636
+	 *                                  espresso_db_update, but still know if this is a new install or not
637
+	 * @return int one of the constants on EE_System::req_type_
638
+	 */
639
+	public function detect_req_type($espresso_db_update = null)
640
+	{
641
+		if ($this->_req_type === null) {
642
+			$espresso_db_update = ! empty($espresso_db_update)
643
+				? $espresso_db_update
644
+				: $this->fix_espresso_db_upgrade_option();
645
+			$this->_req_type = EE_System::detect_req_type_given_activation_history(
646
+				$espresso_db_update,
647
+				'ee_espresso_activation',
648
+				espresso_version()
649
+			);
650
+			$this->_major_version_change = $this->_detect_major_version_change($espresso_db_update);
651
+			$this->request->setIsActivation($this->_req_type !== EE_System::req_type_normal);
652
+		}
653
+		return $this->_req_type;
654
+	}
655
+
656
+
657
+	/**
658
+	 * Returns whether or not there was a non-micro version change (ie, change in either
659
+	 * the first or second number in the version. Eg 4.9.0.rc.001 to 4.10.0.rc.000,
660
+	 * but not 4.9.0.rc.0001 to 4.9.1.rc.0001
661
+	 *
662
+	 * @param $activation_history
663
+	 * @return bool
664
+	 */
665
+	private function _detect_major_version_change($activation_history)
666
+	{
667
+		$previous_version = EE_System::_get_most_recently_active_version_from_activation_history($activation_history);
668
+		$previous_version_parts = explode('.', $previous_version);
669
+		$current_version_parts = explode('.', espresso_version());
670
+		return isset($previous_version_parts[0], $previous_version_parts[1], $current_version_parts[0], $current_version_parts[1])
671
+			   && (
672
+				   $previous_version_parts[0] !== $current_version_parts[0]
673
+				   || $previous_version_parts[1] !== $current_version_parts[1]
674
+			   );
675
+	}
676
+
677
+
678
+	/**
679
+	 * Returns true if either the major or minor version of EE changed during this request.
680
+	 * Eg 4.9.0.rc.001 to 4.10.0.rc.000, but not 4.9.0.rc.0001 to 4.9.1.rc.0001
681
+	 *
682
+	 * @return bool
683
+	 */
684
+	public function is_major_version_change()
685
+	{
686
+		return $this->_major_version_change;
687
+	}
688
+
689
+
690
+	/**
691
+	 * Determines the request type for any ee addon, given three piece of info: the current array of activation
692
+	 * histories (for core that' 'espresso_db_update' wp option); the name of the WordPress option which is temporarily
693
+	 * set upon activation of the plugin (for core it's 'ee_espresso_activation'); and the version that this plugin was
694
+	 * just activated to (for core that will always be espresso_version())
695
+	 *
696
+	 * @param array  $activation_history_for_addon     the option's value which stores the activation history for this
697
+	 *                                                 ee plugin. for core that's 'espresso_db_update'
698
+	 * @param string $activation_indicator_option_name the name of the WordPress option that is temporarily set to
699
+	 *                                                 indicate that this plugin was just activated
700
+	 * @param string $version_to_upgrade_to            the version that was just upgraded to (for core that will be
701
+	 *                                                 espresso_version())
702
+	 * @return int one of the constants on EE_System::req_type_*
703
+	 */
704
+	public static function detect_req_type_given_activation_history(
705
+		$activation_history_for_addon,
706
+		$activation_indicator_option_name,
707
+		$version_to_upgrade_to
708
+	) {
709
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
710
+		if ($activation_history_for_addon) {
711
+			// it exists, so this isn't a completely new install
712
+			// check if this version already in that list of previously installed versions
713
+			if (! isset($activation_history_for_addon[ $version_to_upgrade_to ])) {
714
+				// it a version we haven't seen before
715
+				if ($version_is_higher === 1) {
716
+					$req_type = EE_System::req_type_upgrade;
717
+				} else {
718
+					$req_type = EE_System::req_type_downgrade;
719
+				}
720
+				delete_option($activation_indicator_option_name);
721
+			} else {
722
+				// its not an update. maybe a reactivation?
723
+				if (get_option($activation_indicator_option_name, false)) {
724
+					if ($version_is_higher === -1) {
725
+						$req_type = EE_System::req_type_downgrade;
726
+					} elseif ($version_is_higher === 0) {
727
+						// we've seen this version before, but it's an activation. must be a reactivation
728
+						$req_type = EE_System::req_type_reactivation;
729
+					} else {// $version_is_higher === 1
730
+						$req_type = EE_System::req_type_upgrade;
731
+					}
732
+					delete_option($activation_indicator_option_name);
733
+				} else {
734
+					// we've seen this version before and the activation indicate doesn't show it was just activated
735
+					if ($version_is_higher === -1) {
736
+						$req_type = EE_System::req_type_downgrade;
737
+					} elseif ($version_is_higher === 0) {
738
+						// we've seen this version before and it's not an activation. its normal request
739
+						$req_type = EE_System::req_type_normal;
740
+					} else {// $version_is_higher === 1
741
+						$req_type = EE_System::req_type_upgrade;
742
+					}
743
+				}
744
+			}
745
+		} else {
746
+			// brand new install
747
+			$req_type = EE_System::req_type_new_activation;
748
+			delete_option($activation_indicator_option_name);
749
+		}
750
+		return $req_type;
751
+	}
752
+
753
+
754
+	/**
755
+	 * Detects if the $version_to_upgrade_to is higher than the most recent version in
756
+	 * the $activation_history_for_addon
757
+	 *
758
+	 * @param array  $activation_history_for_addon (keys are versions, values are arrays of times activated,
759
+	 *                                             sometimes containing 'unknown-date'
760
+	 * @param string $version_to_upgrade_to        (current version)
761
+	 * @return int results of version_compare( $version_to_upgrade_to, $most_recently_active_version ).
762
+	 *                                             ie, -1 if $version_to_upgrade_to is LOWER (downgrade);
763
+	 *                                             0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
764
+	 *                                             1 if $version_to_upgrade_to is HIGHER (upgrade) ;
765
+	 */
766
+	private static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to)
767
+	{
768
+		// find the most recently-activated version
769
+		$most_recently_active_version =
770
+			EE_System::_get_most_recently_active_version_from_activation_history($activation_history_for_addon);
771
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
772
+	}
773
+
774
+
775
+	/**
776
+	 * Gets the most recently active version listed in the activation history,
777
+	 * and if none are found (ie, it's a brand new install) returns '0.0.0.dev.000'.
778
+	 *
779
+	 * @param array $activation_history  (keys are versions, values are arrays of times activated,
780
+	 *                                   sometimes containing 'unknown-date'
781
+	 * @return string
782
+	 */
783
+	private static function _get_most_recently_active_version_from_activation_history($activation_history)
784
+	{
785
+		$most_recently_active_version_activation = '1970-01-01 00:00:00';
786
+		$most_recently_active_version = '0.0.0.dev.000';
787
+		if (is_array($activation_history)) {
788
+			foreach ($activation_history as $version => $times_activated) {
789
+				// check there is a record of when this version was activated. Otherwise,
790
+				// mark it as unknown
791
+				if (! $times_activated) {
792
+					$times_activated = array('unknown-date');
793
+				}
794
+				if (is_string($times_activated)) {
795
+					$times_activated = array($times_activated);
796
+				}
797
+				foreach ($times_activated as $an_activation) {
798
+					if ($an_activation !== 'unknown-date'
799
+						&& $an_activation
800
+						   > $most_recently_active_version_activation) {
801
+						$most_recently_active_version = $version;
802
+						$most_recently_active_version_activation = $an_activation === 'unknown-date'
803
+							? '1970-01-01 00:00:00'
804
+							: $an_activation;
805
+					}
806
+				}
807
+			}
808
+		}
809
+		return $most_recently_active_version;
810
+	}
811
+
812
+
813
+	/**
814
+	 * This redirects to the about EE page after activation
815
+	 *
816
+	 * @return void
817
+	 */
818
+	public function redirect_to_about_ee()
819
+	{
820
+		$notices = EE_Error::get_notices(false);
821
+		// if current user is an admin and it's not an ajax or rest request
822
+		if (! isset($notices['errors'])
823
+			&& $this->request->isAdmin()
824
+			&& apply_filters(
825
+				'FHEE__EE_System__redirect_to_about_ee__do_redirect',
826
+				$this->capabilities->current_user_can('manage_options', 'espresso_about_default')
827
+			)
828
+		) {
829
+			$query_params = array('page' => 'espresso_about');
830
+			if (EE_System::instance()->detect_req_type() === EE_System::req_type_new_activation) {
831
+				$query_params['new_activation'] = true;
832
+			}
833
+			if (EE_System::instance()->detect_req_type() === EE_System::req_type_reactivation) {
834
+				$query_params['reactivation'] = true;
835
+			}
836
+			$url = add_query_arg($query_params, admin_url('admin.php'));
837
+			wp_safe_redirect($url);
838
+			exit();
839
+		}
840
+	}
841
+
842
+
843
+	/**
844
+	 * load_core_configuration
845
+	 * this is hooked into 'AHEE__EE_Bootstrap__load_core_configuration'
846
+	 * which runs during the WP 'plugins_loaded' action at priority 5
847
+	 *
848
+	 * @return void
849
+	 * @throws ReflectionException
850
+	 * @throws Exception
851
+	 */
852
+	public function load_core_configuration()
853
+	{
854
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
855
+		$this->loader->getShared('EE_Load_Textdomain');
856
+		// load textdomain
857
+		EE_Load_Textdomain::load_textdomain();
858
+		// load caf stuff a chance to play during the activation process too.
859
+		$this->_maybe_brew_regular();
860
+		// load and setup EE_Config and EE_Network_Config
861
+		$config = $this->loader->getShared('EE_Config');
862
+		$this->loader->getShared('EE_Network_Config');
863
+		// setup autoloaders
864
+		// enable logging?
865
+		if ($config->admin->use_remote_logging) {
866
+			$this->loader->getShared('EE_Log');
867
+		}
868
+		// check for activation errors
869
+		$activation_errors = get_option('ee_plugin_activation_errors', false);
870
+		if ($activation_errors) {
871
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
872
+			update_option('ee_plugin_activation_errors', false);
873
+		}
874
+		// get model names
875
+		$this->_parse_model_names();
876
+		// configure custom post type definitions
877
+		$this->loader->getShared('EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions');
878
+		$this->loader->getShared('EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions');
879
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
880
+	}
881
+
882
+
883
+	/**
884
+	 * cycles through all of the models/*.model.php files, and assembles an array of model names
885
+	 *
886
+	 * @return void
887
+	 * @throws ReflectionException
888
+	 */
889
+	private function _parse_model_names()
890
+	{
891
+		// get all the files in the EE_MODELS folder that end in .model.php
892
+		$models = glob(EE_MODELS . '*.model.php');
893
+		$model_names = array();
894
+		$non_abstract_db_models = array();
895
+		foreach ($models as $model) {
896
+			// get model classname
897
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
898
+			$short_name = str_replace('EEM_', '', $classname);
899
+			$reflectionClass = new ReflectionClass($classname);
900
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
901
+				$non_abstract_db_models[ $short_name ] = $classname;
902
+			}
903
+			$model_names[ $short_name ] = $classname;
904
+		}
905
+		$this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
906
+		$this->registry->non_abstract_db_models = apply_filters(
907
+			'FHEE__EE_System__parse_implemented_model_names',
908
+			$non_abstract_db_models
909
+		);
910
+	}
911
+
912
+
913
+	/**
914
+	 * The purpose of this method is to simply check for a file named "caffeinated/brewing_regular.php" for any hooks
915
+	 * that need to be setup before our EE_System launches.
916
+	 *
917
+	 * @return void
918
+	 * @throws DomainException
919
+	 * @throws InvalidArgumentException
920
+	 * @throws InvalidDataTypeException
921
+	 * @throws InvalidInterfaceException
922
+	 * @throws InvalidClassException
923
+	 * @throws InvalidFilePathException
924
+	 */
925
+	private function _maybe_brew_regular()
926
+	{
927
+		/** @var Domain $domain */
928
+		$domain = DomainFactory::getShared(
929
+			new FullyQualifiedName(
930
+				'EventEspresso\core\domain\Domain'
931
+			),
932
+			array(
933
+				new FilePath(EVENT_ESPRESSO_MAIN_FILE),
934
+				Version::fromString(espresso_version()),
935
+			)
936
+		);
937
+		if ($domain->isCaffeinated()) {
938
+			require_once EE_CAFF_PATH . 'brewing_regular.php';
939
+		}
940
+	}
941
+
942
+
943
+	/**
944
+	 * @since 4.9.71.p
945
+	 * @throws Exception
946
+	 */
947
+	public function loadRouteMatchSpecifications()
948
+	{
949
+		try {
950
+			$this->router = $this->loader->getShared('EventEspresso\core\services\routing\RouteHandler');
951
+		} catch (Exception $exception) {
952
+			new ExceptionStackTraceDisplay($exception);
953
+		}
954
+		do_action('AHEE__EE_System__loadRouteMatchSpecifications');
955
+	}
956
+
957
+
958
+	/**
959
+	 * register_shortcodes_modules_and_widgets
960
+	 * generate lists of shortcodes and modules, then verify paths and classes
961
+	 * This is hooked into 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets'
962
+	 * which runs during the WP 'plugins_loaded' action at priority 7
963
+	 *
964
+	 * @access public
965
+	 * @return void
966
+	 * @throws Exception
967
+	 */
968
+	public function register_shortcodes_modules_and_widgets()
969
+	{
970
+		$this->router->handleShortcodesRequest();
971
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
972
+		// check for addons using old hook point
973
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
974
+			$this->_incompatible_addon_error();
975
+		}
976
+	}
977
+
978
+
979
+	/**
980
+	 * _incompatible_addon_error
981
+	 *
982
+	 * @access public
983
+	 * @return void
984
+	 */
985
+	private function _incompatible_addon_error()
986
+	{
987
+		// get array of classes hooking into here
988
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook(
989
+			'AHEE__EE_System__register_shortcodes_modules_and_addons'
990
+		);
991
+		if (! empty($class_names)) {
992
+			$msg = __(
993
+				'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:',
994
+				'event_espresso'
995
+			);
996
+			$msg .= '<ul>';
997
+			foreach ($class_names as $class_name) {
998
+				$msg .= '<li><b>Event Espresso - '
999
+						. str_replace(
1000
+							array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'),
1001
+							'',
1002
+							$class_name
1003
+						) . '</b></li>';
1004
+			}
1005
+			$msg .= '</ul>';
1006
+			$msg .= __(
1007
+				'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.',
1008
+				'event_espresso'
1009
+			);
1010
+			// save list of incompatible addons to wp-options for later use
1011
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
1012
+			if (is_admin()) {
1013
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1014
+			}
1015
+		}
1016
+	}
1017
+
1018
+
1019
+	/**
1020
+	 * brew_espresso
1021
+	 * begins the process of setting hooks for initializing EE in the correct order
1022
+	 * This is happening on the 'AHEE__EE_Bootstrap__brew_espresso' hook point
1023
+	 * which runs during the WP 'plugins_loaded' action at priority 9
1024
+	 *
1025
+	 * @return void
1026
+	 * @throws Exception
1027
+	 */
1028
+	public function brew_espresso()
1029
+	{
1030
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
1031
+		// load some final core systems
1032
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
1033
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
1034
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
1035
+		add_action('init', array($this, 'load_controllers'), 7);
1036
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
1037
+		add_action('init', array($this, 'initialize'), 10);
1038
+		add_action('init', array($this, 'initialize_last'), 100);
1039
+		$this->router->handlePueRequest();
1040
+		$this->router->handleGQLRequest();
1041
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
1042
+	}
1043
+
1044
+
1045
+	/**
1046
+	 *    set_hooks_for_core
1047
+	 *
1048
+	 * @access public
1049
+	 * @return    void
1050
+	 * @throws EE_Error
1051
+	 */
1052
+	public function set_hooks_for_core()
1053
+	{
1054
+		$this->_deactivate_incompatible_addons();
1055
+		do_action('AHEE__EE_System__set_hooks_for_core');
1056
+		$this->loader->getShared('EventEspresso\core\domain\values\session\SessionLifespan');
1057
+		// caps need to be initialized on every request so that capability maps are set.
1058
+		// @see https://events.codebasehq.com/projects/event-espresso/tickets/8674
1059
+		$this->registry->CAP->init_caps();
1060
+	}
1061
+
1062
+
1063
+	/**
1064
+	 * Using the information gathered in EE_System::_incompatible_addon_error,
1065
+	 * deactivates any addons considered incompatible with the current version of EE
1066
+	 */
1067
+	private function _deactivate_incompatible_addons()
1068
+	{
1069
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
1070
+		if (! empty($incompatible_addons)) {
1071
+			$active_plugins = get_option('active_plugins', array());
1072
+			foreach ($active_plugins as $active_plugin) {
1073
+				foreach ($incompatible_addons as $incompatible_addon) {
1074
+					if (strpos($active_plugin, $incompatible_addon) !== false) {
1075
+						unset($_GET['activate']);
1076
+						espresso_deactivate_plugin($active_plugin);
1077
+					}
1078
+				}
1079
+			}
1080
+		}
1081
+	}
1082
+
1083
+
1084
+	/**
1085
+	 *    perform_activations_upgrades_and_migrations
1086
+	 *
1087
+	 * @access public
1088
+	 * @return    void
1089
+	 */
1090
+	public function perform_activations_upgrades_and_migrations()
1091
+	{
1092
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
1093
+	}
1094
+
1095
+
1096
+	/**
1097
+	 * @return void
1098
+	 * @throws DomainException
1099
+	 */
1100
+	public function load_CPTs_and_session()
1101
+	{
1102
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
1103
+		/** @var EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies $register_custom_taxonomies */
1104
+		$register_custom_taxonomies = $this->loader->getShared(
1105
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'
1106
+		);
1107
+		$register_custom_taxonomies->registerCustomTaxonomies();
1108
+		/** @var EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes $register_custom_post_types */
1109
+		$register_custom_post_types = $this->loader->getShared(
1110
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'
1111
+		);
1112
+		$register_custom_post_types->registerCustomPostTypes();
1113
+		/** @var EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomyTerms $register_custom_taxonomy_terms */
1114
+		$register_custom_taxonomy_terms = $this->loader->getShared(
1115
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomyTerms'
1116
+		);
1117
+		$register_custom_taxonomy_terms->registerCustomTaxonomyTerms();
1118
+		// load legacy Custom Post Types and Taxonomies
1119
+		$this->loader->getShared('EE_Register_CPTs');
1120
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
1121
+	}
1122
+
1123
+
1124
+	/**
1125
+	 * load_controllers
1126
+	 * this is the best place to load any additional controllers that needs access to EE core.
1127
+	 * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this
1128
+	 * time
1129
+	 *
1130
+	 * @access public
1131
+	 * @return void
1132
+	 * @throws Exception
1133
+	 */
1134
+	public function load_controllers()
1135
+	{
1136
+		do_action('AHEE__EE_System__load_controllers__start');
1137
+		// let's get it started
1138
+		$this->router->handleControllerRequest();
1139
+		do_action('AHEE__EE_System__load_controllers__complete');
1140
+	}
1141
+
1142
+
1143
+	/**
1144
+	 * core_loaded_and_ready
1145
+	 * all of the basic EE core should be loaded at this point and available regardless of M-Mode
1146
+	 *
1147
+	 * @access public
1148
+	 * @return void
1149
+	 * @throws Exception
1150
+	 */
1151
+	public function core_loaded_and_ready()
1152
+	{
1153
+		$this->router->handleAssetManagerRequest();
1154
+		$this->router->handleSessionRequest();
1155
+		// integrate WP_Query with the EE models
1156
+		$this->loader->getShared('EE_CPT_Strategy');
1157
+		do_action('AHEE__EE_System__core_loaded_and_ready');
1158
+		// always load template tags, because it's faster than checking if it's a front-end request, and many page
1159
+		// builders require these even on the front-end
1160
+		require_once EE_PUBLIC . 'template_tags.php';
1161
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
1162
+	}
1163
+
1164
+
1165
+	/**
1166
+	 * initialize
1167
+	 * this is the best place to begin initializing client code
1168
+	 *
1169
+	 * @access public
1170
+	 * @return void
1171
+	 */
1172
+	public function initialize()
1173
+	{
1174
+		do_action('AHEE__EE_System__initialize');
1175
+	}
1176
+
1177
+
1178
+	/**
1179
+	 * initialize_last
1180
+	 * this is run really late during the WP init hook point, and ensures that mostly everything else that needs to
1181
+	 * initialize has done so
1182
+	 *
1183
+	 * @access public
1184
+	 * @return void
1185
+	 * @throws Exception
1186
+	 */
1187
+	public function initialize_last()
1188
+	{
1189
+		do_action('AHEE__EE_System__initialize_last');
1190
+		/** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */
1191
+		$rewrite_rules = $this->loader->getShared(
1192
+			'EventEspresso\core\domain\services\custom_post_types\RewriteRules'
1193
+		);
1194
+		$rewrite_rules->flushRewriteRules();
1195
+		add_action('admin_bar_init', array($this, 'addEspressoToolbar'));
1196
+		$this->router->handlePersonalDataRequest();
1197
+	}
1198
+
1199
+
1200
+	/**
1201
+	 * @return void
1202
+	 */
1203
+	public function addEspressoToolbar()
1204
+	{
1205
+		$this->loader->getShared(
1206
+			'EventEspresso\core\domain\services\admin\AdminToolBar',
1207
+			array($this->registry->CAP)
1208
+		);
1209
+	}
1210
+
1211
+
1212
+	/**
1213
+	 * do_not_cache
1214
+	 * sets no cache headers and defines no cache constants for WP plugins
1215
+	 *
1216
+	 * @access public
1217
+	 * @return void
1218
+	 */
1219
+	public static function do_not_cache()
1220
+	{
1221
+		// set no cache constants
1222
+		if (! defined('DONOTCACHEPAGE')) {
1223
+			define('DONOTCACHEPAGE', true);
1224
+		}
1225
+		if (! defined('DONOTCACHCEOBJECT')) {
1226
+			define('DONOTCACHCEOBJECT', true);
1227
+		}
1228
+		if (! defined('DONOTCACHEDB')) {
1229
+			define('DONOTCACHEDB', true);
1230
+		}
1231
+		// add no cache headers
1232
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
1233
+		// plus a little extra for nginx and Google Chrome
1234
+		add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1);
1235
+		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
1236
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
1237
+	}
1238
+
1239
+
1240
+	/**
1241
+	 *    extra_nocache_headers
1242
+	 *
1243
+	 * @access    public
1244
+	 * @param $headers
1245
+	 * @return    array
1246
+	 */
1247
+	public static function extra_nocache_headers($headers)
1248
+	{
1249
+		// for NGINX
1250
+		$headers['X-Accel-Expires'] = 0;
1251
+		// plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store"
1252
+		$headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0';
1253
+		return $headers;
1254
+	}
1255
+
1256
+
1257
+	/**
1258
+	 *    nocache_headers
1259
+	 *
1260
+	 * @access    public
1261
+	 * @return    void
1262
+	 */
1263
+	public static function nocache_headers()
1264
+	{
1265
+		nocache_headers();
1266
+	}
1267
+
1268
+
1269
+	/**
1270
+	 * simply hooks into "wp_list_pages_exclude" filter (for wp_list_pages method) and makes sure EE critical pages are
1271
+	 * never returned with the function.
1272
+	 *
1273
+	 * @param  array $exclude_array any existing pages being excluded are in this array.
1274
+	 * @return array
1275
+	 */
1276
+	public function remove_pages_from_wp_list_pages($exclude_array)
1277
+	{
1278
+		return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array());
1279
+	}
1280 1280
 }
Please login to merge, or discard this patch.
core/domain/entities/editor/blocks/EventAttendees.php 1 patch
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -21,176 +21,176 @@
 block discarded – undo
21 21
 class EventAttendees extends Block
22 22
 {
23 23
 
24
-    const BLOCK_TYPE = 'event-attendees';
24
+	const BLOCK_TYPE = 'event-attendees';
25 25
 
26
-    /**
27
-     * @var EventAttendeesBlockRenderer $renderer
28
-     */
29
-    protected $renderer;
26
+	/**
27
+	 * @var EventAttendeesBlockRenderer $renderer
28
+	 */
29
+	protected $renderer;
30 30
 
31 31
 
32
-    /**
33
-     * EventAttendees constructor.
34
-     *
35
-     * @param CoreBlocksAssetManager      $block_asset_manager
36
-     * @param RequestInterface            $request
37
-     * @param EventAttendeesBlockRenderer $renderer
38
-     */
39
-    public function __construct(
40
-        CoreBlocksAssetManager $block_asset_manager,
41
-        RequestInterface $request,
42
-        EventAttendeesBlockRenderer $renderer
43
-    ) {
44
-        parent::__construct($block_asset_manager, $request);
45
-        $this->renderer= $renderer;
46
-    }
32
+	/**
33
+	 * EventAttendees constructor.
34
+	 *
35
+	 * @param CoreBlocksAssetManager      $block_asset_manager
36
+	 * @param RequestInterface            $request
37
+	 * @param EventAttendeesBlockRenderer $renderer
38
+	 */
39
+	public function __construct(
40
+		CoreBlocksAssetManager $block_asset_manager,
41
+		RequestInterface $request,
42
+		EventAttendeesBlockRenderer $renderer
43
+	) {
44
+		parent::__construct($block_asset_manager, $request);
45
+		$this->renderer= $renderer;
46
+	}
47 47
 
48 48
 
49
-    /**
50
-     * Perform any early setup required by the block
51
-     * including setting the block type and supported post types
52
-     *
53
-     * @return void
54
-     */
55
-    public function initialize()
56
-    {
57
-        $this->setBlockType(EventAttendees::BLOCK_TYPE);
58
-        $this->setSupportedRoutes(
59
-            array(
60
-                'EventEspresso\core\domain\entities\routing\specifications\admin\WordPressPostTypeEditor',
61
-                'EventEspresso\core\domain\entities\routing\specifications\frontend\EspressoBlockRenderer',
62
-                'EventEspresso\core\domain\entities\routing\specifications\frontend\AnyFrontendRequest'
63
-            )
64
-        );
65
-        $EVT_ID = $this->request->getRequestParam('page') === 'espresso_events'
66
-            ? $this->request->getRequestParam('post', 0)
67
-            : 0;
68
-        $this->setAttributes(
69
-            array(
70
-                'eventId'           => array(
71
-                    'type'    => 'number',
72
-                    'default' => $EVT_ID,
73
-                ),
74
-                'datetimeId'        => array(
75
-                    'type'    => 'number',
76
-                    'default' => 0,
77
-                ),
78
-                'ticketId'          => array(
79
-                    'type'    => 'number',
80
-                    'default' => 0,
81
-                ),
82
-                'status'            => array(
83
-                    'type'    => 'string',
84
-                    'default' => EEM_Registration::status_id_approved,
85
-                ),
86
-                'limit'             => array(
87
-                    'type'    => 'number',
88
-                    'default' => 100,
89
-                ),
90
-                'order' => array(
91
-                    'type' => 'string',
92
-                    'default' => 'ASC'
93
-                ),
94
-                'orderBy' => array(
95
-                    'type' => 'string',
96
-                    'default' => 'lastThenFirstName',
97
-                ),
98
-                'showGravatar'      => array(
99
-                    'type'    => 'boolean',
100
-                    'default' => false,
101
-                ),
102
-                'avatarClass' => array(
103
-                    'type' => 'string',
104
-                    'default' => 'contact',
105
-                ),
106
-                'avatarSize' => array(
107
-                    'type' => 'number',
108
-                    'default' => 24,
109
-                ),
110
-                'displayOnArchives' => array(
111
-                    'type'    => 'boolean',
112
-                    'default' => false,
113
-                ),
114
-            )
115
-        );
116
-        $this->setDynamic();
117
-    }
49
+	/**
50
+	 * Perform any early setup required by the block
51
+	 * including setting the block type and supported post types
52
+	 *
53
+	 * @return void
54
+	 */
55
+	public function initialize()
56
+	{
57
+		$this->setBlockType(EventAttendees::BLOCK_TYPE);
58
+		$this->setSupportedRoutes(
59
+			array(
60
+				'EventEspresso\core\domain\entities\routing\specifications\admin\WordPressPostTypeEditor',
61
+				'EventEspresso\core\domain\entities\routing\specifications\frontend\EspressoBlockRenderer',
62
+				'EventEspresso\core\domain\entities\routing\specifications\frontend\AnyFrontendRequest'
63
+			)
64
+		);
65
+		$EVT_ID = $this->request->getRequestParam('page') === 'espresso_events'
66
+			? $this->request->getRequestParam('post', 0)
67
+			: 0;
68
+		$this->setAttributes(
69
+			array(
70
+				'eventId'           => array(
71
+					'type'    => 'number',
72
+					'default' => $EVT_ID,
73
+				),
74
+				'datetimeId'        => array(
75
+					'type'    => 'number',
76
+					'default' => 0,
77
+				),
78
+				'ticketId'          => array(
79
+					'type'    => 'number',
80
+					'default' => 0,
81
+				),
82
+				'status'            => array(
83
+					'type'    => 'string',
84
+					'default' => EEM_Registration::status_id_approved,
85
+				),
86
+				'limit'             => array(
87
+					'type'    => 'number',
88
+					'default' => 100,
89
+				),
90
+				'order' => array(
91
+					'type' => 'string',
92
+					'default' => 'ASC'
93
+				),
94
+				'orderBy' => array(
95
+					'type' => 'string',
96
+					'default' => 'lastThenFirstName',
97
+				),
98
+				'showGravatar'      => array(
99
+					'type'    => 'boolean',
100
+					'default' => false,
101
+				),
102
+				'avatarClass' => array(
103
+					'type' => 'string',
104
+					'default' => 'contact',
105
+				),
106
+				'avatarSize' => array(
107
+					'type' => 'number',
108
+					'default' => 24,
109
+				),
110
+				'displayOnArchives' => array(
111
+					'type'    => 'boolean',
112
+					'default' => false,
113
+				),
114
+			)
115
+		);
116
+		$this->setDynamic();
117
+	}
118 118
 
119 119
 
120
-    /**
121
-     * Returns an array where the key corresponds to the incoming attribute name from the WP block
122
-     * and the value corresponds to the attribute name for the existing EspressoEventAttendees shortcode
123
-     *
124
-     * @since 4.9.71.p
125
-     * @return array
126
-     */
127
-    private function getAttributesMap()
128
-    {
129
-        return array(
130
-            'event'             => 'sanitize_text_field',
131
-            'datetime'          => 'sanitize_text_field',
132
-            'ticket'            => 'sanitize_text_field',
133
-            'eventId'           => 'absint',
134
-            'datetimeId'        => 'absint',
135
-            'ticketId'          => 'absint',
136
-            'status'            => 'sanitize_text_field',
137
-            'limit'             => 'intval',
138
-            'showGravatar'      => 'bool',
139
-            'avatarClass'       => 'sanitize_text_field',
140
-            'avatarSize'        => 'absint',
141
-            'displayOnArchives' => 'bool',
142
-            'order' => 'sanitize_text_field',
143
-            'orderBy' => 'sanitize_text_field',
144
-        );
145
-    }
120
+	/**
121
+	 * Returns an array where the key corresponds to the incoming attribute name from the WP block
122
+	 * and the value corresponds to the attribute name for the existing EspressoEventAttendees shortcode
123
+	 *
124
+	 * @since 4.9.71.p
125
+	 * @return array
126
+	 */
127
+	private function getAttributesMap()
128
+	{
129
+		return array(
130
+			'event'             => 'sanitize_text_field',
131
+			'datetime'          => 'sanitize_text_field',
132
+			'ticket'            => 'sanitize_text_field',
133
+			'eventId'           => 'absint',
134
+			'datetimeId'        => 'absint',
135
+			'ticketId'          => 'absint',
136
+			'status'            => 'sanitize_text_field',
137
+			'limit'             => 'intval',
138
+			'showGravatar'      => 'bool',
139
+			'avatarClass'       => 'sanitize_text_field',
140
+			'avatarSize'        => 'absint',
141
+			'displayOnArchives' => 'bool',
142
+			'order' => 'sanitize_text_field',
143
+			'orderBy' => 'sanitize_text_field',
144
+		);
145
+	}
146 146
 
147 147
 
148
-    /**
149
-     * Sanitizes attributes.
150
-     *
151
-     * @param array $attributes
152
-     * @return array
153
-     */
154
-    private function sanitizeAttributes(array $attributes)
155
-    {
156
-        $sanitized_attributes = array();
157
-        foreach ($attributes as $attribute => $value) {
158
-            $convert = $this->getAttributesMap();
159
-            if (isset($convert[ $attribute ])) {
160
-                $sanitize = $convert[ $attribute ];
161
-                if ($sanitize === 'bool') {
162
-                    $sanitized_attributes[ $attribute ] = filter_var(
163
-                        $value,
164
-                        FILTER_VALIDATE_BOOLEAN
165
-                    );
166
-                } else {
167
-                    $sanitized_attributes[ $attribute ] = $sanitize($value);
168
-                }
169
-                // don't pass along attributes with a 0 value
170
-                if ($sanitized_attributes[ $attribute ] === 0) {
171
-                    unset($sanitized_attributes[ $attribute ]);
172
-                }
173
-            }
174
-        }
175
-        return $attributes;
176
-    }
148
+	/**
149
+	 * Sanitizes attributes.
150
+	 *
151
+	 * @param array $attributes
152
+	 * @return array
153
+	 */
154
+	private function sanitizeAttributes(array $attributes)
155
+	{
156
+		$sanitized_attributes = array();
157
+		foreach ($attributes as $attribute => $value) {
158
+			$convert = $this->getAttributesMap();
159
+			if (isset($convert[ $attribute ])) {
160
+				$sanitize = $convert[ $attribute ];
161
+				if ($sanitize === 'bool') {
162
+					$sanitized_attributes[ $attribute ] = filter_var(
163
+						$value,
164
+						FILTER_VALIDATE_BOOLEAN
165
+					);
166
+				} else {
167
+					$sanitized_attributes[ $attribute ] = $sanitize($value);
168
+				}
169
+				// don't pass along attributes with a 0 value
170
+				if ($sanitized_attributes[ $attribute ] === 0) {
171
+					unset($sanitized_attributes[ $attribute ]);
172
+				}
173
+			}
174
+		}
175
+		return $attributes;
176
+	}
177 177
 
178 178
 
179
-    /**
180
-     * Returns the rendered HTML for the block
181
-     *
182
-     * @param array $attributes
183
-     * @return string
184
-     * @throws DomainException
185
-     * @throws EE_Error
186
-     */
187
-    public function renderBlock(array $attributes = array())
188
-    {
189
-        $attributes = $this->sanitizeAttributes($attributes);
190
-        if (! (bool) $attributes['displayOnArchives'] && (is_archive() || is_front_page() || is_home())) {
191
-            return '';
192
-        }
193
-        $this->loadGraphQLRelayAutoloader();
194
-        return $this->renderer->render($attributes);
195
-    }
179
+	/**
180
+	 * Returns the rendered HTML for the block
181
+	 *
182
+	 * @param array $attributes
183
+	 * @return string
184
+	 * @throws DomainException
185
+	 * @throws EE_Error
186
+	 */
187
+	public function renderBlock(array $attributes = array())
188
+	{
189
+		$attributes = $this->sanitizeAttributes($attributes);
190
+		if (! (bool) $attributes['displayOnArchives'] && (is_archive() || is_front_page() || is_home())) {
191
+			return '';
192
+		}
193
+		$this->loadGraphQLRelayAutoloader();
194
+		return $this->renderer->render($attributes);
195
+	}
196 196
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/specifications/MultiRouteSpecification.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -16,29 +16,29 @@
 block discarded – undo
16 16
 abstract class MultiRouteSpecification extends RouteMatchSpecification
17 17
 {
18 18
 
19
-    /**
20
-     * @var RouteMatchSpecificationInterface[] $specifications
21
-     */
22
-    protected $specifications;
19
+	/**
20
+	 * @var RouteMatchSpecificationInterface[] $specifications
21
+	 */
22
+	protected $specifications;
23 23
 
24
-    /**
25
-     * MultiRouteSpecification constructor.
26
-     *
27
-     * @param RouteMatchSpecificationInterface[] $specifications
28
-     * @param RequestInterface                   $request
29
-     * @throws InvalidEntityException
30
-     */
31
-    public function __construct(array $specifications, RequestInterface $request)
32
-    {
33
-        foreach ($specifications as $specification) {
34
-            if (! $specification instanceof RouteMatchSpecificationInterface) {
35
-                throw new InvalidEntityException(
36
-                    $specification,
37
-                    'EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface'
38
-                );
39
-            }
40
-        }
41
-        $this->specifications = $specifications;
42
-        parent::__construct($request);
43
-    }
24
+	/**
25
+	 * MultiRouteSpecification constructor.
26
+	 *
27
+	 * @param RouteMatchSpecificationInterface[] $specifications
28
+	 * @param RequestInterface                   $request
29
+	 * @throws InvalidEntityException
30
+	 */
31
+	public function __construct(array $specifications, RequestInterface $request)
32
+	{
33
+		foreach ($specifications as $specification) {
34
+			if (! $specification instanceof RouteMatchSpecificationInterface) {
35
+				throw new InvalidEntityException(
36
+					$specification,
37
+					'EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface'
38
+				);
39
+			}
40
+		}
41
+		$this->specifications = $specifications;
42
+		parent::__construct($request);
43
+	}
44 44
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
     public function __construct(array $specifications, RequestInterface $request)
32 32
     {
33 33
         foreach ($specifications as $specification) {
34
-            if (! $specification instanceof RouteMatchSpecificationInterface) {
34
+            if ( ! $specification instanceof RouteMatchSpecificationInterface) {
35 35
                 throw new InvalidEntityException(
36 36
                     $specification,
37 37
                     'EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface'
Please login to merge, or discard this patch.