Completed
Branch EDTR/master (efe188)
by
unknown
10:39 queued 56s
created
core/admin/EE_Admin_Page_Init.core.php 2 patches
Indentation   +447 added lines, -447 removed lines patch added patch discarded remove patch
@@ -17,451 +17,451 @@
 block discarded – undo
17 17
 abstract class EE_Admin_Page_Init extends EE_Base
18 18
 {
19 19
 
20
-    /**
21
-     * @var LoaderInterface $loader
22
-     */
23
-    protected $loader;
24
-
25
-    // identity properties (set in _set_defaults and _set_init_properties)
26
-    public $label;
27
-
28
-    /**
29
-     * Menu map has a capability.  However, this allows admin pages to have separate capability requirements for menus
30
-     * and accessing pages.  If capability is NOT set, then it defaults to the menu_map capability.
31
-     *
32
-     * @var string
33
-     */
34
-    public $capability;
35
-
36
-
37
-    /**
38
-     * This holds the menu map object for this admin page.
39
-     *
40
-     * @var EE_Admin_Page_Menu_Map
41
-     */
42
-    protected $_menu_map;
43
-
44
-    /**
45
-     * deprecated
46
-     */
47
-    public $menu_label;
48
-    public $menu_slug;
49
-
50
-
51
-    // set in _set_defaults
52
-    protected $_folder_name;
53
-    protected $_folder_path;
54
-    protected $_file_name;
55
-    public $hook_file;
56
-    protected $_wp_page_slug;
57
-    protected $_routing;
58
-
59
-
60
-    /**
61
-     * This holds the page object.
62
-     *
63
-     * @var EE_Admin_Page
64
-     */
65
-    protected $_loaded_page_object;
66
-
67
-
68
-    // for caf
69
-    protected $_files_hooked;
70
-    protected $_hook_paths;
71
-
72
-    // load_page?
73
-    private $_load_page;
74
-
75
-
76
-    /**
77
-     * @throws InvalidArgumentException
78
-     * @throws InvalidDataTypeException
79
-     * @throws InvalidInterfaceException
80
-     */
81
-    public function __construct()
82
-    {
83
-        $this->loader = LoaderFactory::getLoader();
84
-        // set global defaults
85
-        $this->_set_defaults();
86
-        // set properties that are always available with objects.
87
-        $this->_set_init_properties();
88
-        // global styles/scripts across all wp admin pages
89
-        add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5);
90
-        // load initial stuff.
91
-        $this->_set_file_and_folder_name();
92
-        $this->_set_menu_map();
93
-        if (empty($this->_menu_map) || is_array($this->_menu_map)) {
94
-            EE_Error::doing_it_wrong(
95
-                get_class($this) . '::$_menu_map',
96
-                sprintf(
97
-                    __(
98
-                        'The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core.  Please see Admin_Page_Init class examples in core for the new way of setting this property up.',
99
-                        'event_espresso'
100
-                    ),
101
-                    get_class($this)
102
-                ),
103
-                '4.4.0'
104
-            );
105
-            return;
106
-        }
107
-        // set default capability
108
-        $this->_set_capability();
109
-    }
110
-
111
-
112
-    /**
113
-     * _set_init_properties
114
-     * Child classes use to set the following properties:
115
-     * $label
116
-     *
117
-     * @abstract
118
-     * @access protected
119
-     * @return void
120
-     */
121
-    abstract protected function _set_init_properties();
122
-
123
-
124
-    /**
125
-     * _set_menu_map is a function that child classes use to set the menu_map property (which should be an instance of
126
-     * EE_Admin_Page_Menu_Map.  Their menu can either be EE_Admin_Page_Main_Menu or EE_Admin_Page_Sub_Menu.
127
-     *
128
-     * @since 4.4.0
129
-     * @ return void.
130
-     */
131
-    protected function _set_menu_map()
132
-    {
133
-        return array();
134
-    }
135
-
136
-
137
-    /**
138
-     * returns the menu map for this admin page
139
-     *
140
-     * @since 4.4.0
141
-     * @return EE_Admin_Page_Menu_Map
142
-     */
143
-    public function get_menu_map()
144
-    {
145
-        return $this->_menu_map;
146
-    }
147
-
148
-
149
-    /**
150
-     * This loads scripts and styles for the EE_Admin system
151
-     * that must be available on ALL WP admin pages (i.e. EE_menu items)
152
-     *
153
-     * @return void
154
-     */
155
-    public function load_wp_global_scripts_styles()
156
-    {
157
-        wp_register_style(
158
-            'espresso_menu',
159
-            EE_ADMIN_URL . 'assets/admin-menu-styles.css',
160
-            array('dashicons'),
161
-            EVENT_ESPRESSO_VERSION
162
-        );
163
-        wp_enqueue_style('espresso_menu');
164
-    }
165
-
166
-
167
-    /**
168
-     * this sets default properties (might be overridden in _set_init_properties);
169
-     *
170
-     * @access private
171
-     * @return  void
172
-     */
173
-    private function _set_defaults()
174
-    {
175
-        $this->_file_name = $this->_folder_name = $this->_wp_page_slug = $this->capability = null;
176
-        $this->_routing = true;
177
-        $this->_load_page = false;
178
-        $this->_files_hooked = $this->_hook_paths = array();
179
-        // menu_map
180
-        $this->_menu_map = $this->get_menu_map();
181
-    }
182
-
183
-
184
-    protected function _set_capability()
185
-    {
186
-        $capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability;
187
-        $this->capability = apply_filters('FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability);
188
-    }
189
-
190
-
191
-    /**
192
-     * initialize_admin_page
193
-     * This method is what executes the loading of the specific page class for the given dir_name as called by the
194
-     * EE_Admin_Init class.
195
-     *
196
-     * @access  public
197
-     * @return void
198
-     * @throws EE_Error
199
-     * @throws InvalidArgumentException
200
-     * @throws InvalidDataTypeException
201
-     * @throws InvalidInterfaceException
202
-     * @throws ReflectionException
203
-     * @uses    _initialize_admin_page()
204
-     */
205
-    public function initialize_admin_page()
206
-    {
207
-        // let's check user access first
208
-        $this->_check_user_access();
209
-        if (! is_object($this->_loaded_page_object)) {
210
-            return;
211
-        }
212
-        $this->_loaded_page_object->route_admin_request();
213
-    }
214
-
215
-
216
-    /**
217
-     * @param string $wp_page_slug
218
-     * @throws EE_Error
219
-     * @since $VID:$
220
-     */
221
-    public function set_page_dependencies($wp_page_slug)
222
-    {
223
-        if (! $this->_load_page) {
224
-            return;
225
-        }
226
-        if (! is_object($this->_loaded_page_object)) {
227
-            $msg[] = __(
228
-                'We can\'t load the page because we\'re missing a valid page object that tells us what to load',
229
-                'event_espresso'
230
-            );
231
-            $msg[] = $msg[0] . "\r\n"
232
-                     . sprintf(
233
-                         __(
234
-                             'The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory',
235
-                             'event_espresso'
236
-                         ),
237
-                         $this->_file_name,
238
-                         $this->_file_name,
239
-                         $this->_folder_path . $this->_file_name,
240
-                         $this->_menu_map->menu_slug
241
-                     );
242
-            throw new EE_Error(implode('||', $msg));
243
-        }
244
-        $this->_loaded_page_object->set_wp_page_slug($wp_page_slug);
245
-        $page_hook = 'load-' . $wp_page_slug;
246
-        // hook into page load hook so all page specific stuff get's loaded.
247
-        if (! empty($wp_page_slug)) {
248
-            add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies'));
249
-        }
250
-    }
251
-
252
-
253
-    /**
254
-     * This executes the initial page loads for EE_Admin pages to take care of any ajax or other code needing to run
255
-     * before the load-page... hook. Note, the page loads are happening around the wp_init hook.
256
-     *
257
-     * @return void
258
-     * @throws EE_Error
259
-     * @throws InvalidArgumentException
260
-     * @throws InvalidDataTypeException
261
-     * @throws InvalidInterfaceException
262
-     * @throws ReflectionException
263
-     */
264
-    public function do_initial_loads()
265
-    {
266
-        // no loading or initializing if menu map is setup incorrectly.
267
-        if (empty($this->_menu_map) || is_array($this->_menu_map)) {
268
-            return;
269
-        }
270
-        $this->_initialize_admin_page();
271
-    }
272
-
273
-
274
-    /**
275
-     * all we're doing here is setting the $_file_name property for later use.
276
-     *
277
-     * @access private
278
-     * @return void
279
-     */
280
-    private function _set_file_and_folder_name()
281
-    {
282
-        $bt = debug_backtrace();
283
-        // for more reliable determination of folder name
284
-        // we're using this to get the actual folder name of the CALLING class (i.e. the child class that extends this).  Why?  Because $this->menu_slug may be different than the folder name (to avoid conflicts with other plugins)
285
-        $class = get_class($this);
286
-        foreach ($bt as $index => $values) {
287
-            if (isset($values['class']) && $values['class'] === $class) {
288
-                $file_index = $index - 1;
289
-                $this->_folder_name = basename(dirname($bt[ $file_index ]['file']));
290
-                if (! empty($this->_folder_name)) {
291
-                    break;
292
-                }
293
-            }
294
-        }
295
-        $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/';
296
-        $this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name);
297
-        $this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name));
298
-        $this->_file_name = str_replace(' ', '_', $this->_file_name);
299
-    }
300
-
301
-
302
-    /**
303
-     * This automatically checks if we have a hook class in the loaded child directory.  If we DO then we will register
304
-     * it with the appropriate pages.  That way all we have to do is make sure the file is named correctly and
305
-     * "dropped" in. Example: if we wanted to set this up for Messages hooking into Events then we would do:
306
-     * events_Messages_Hooks.class.php
307
-     *
308
-     * @param bool $extend This indicates whether we're checking the extend directory for any register_hooks
309
-     *                     files/classes
310
-     * @return array
311
-     */
312
-    public function register_hooks($extend = false)
313
-    {
314
-
315
-        // get a list of files in the directory that have the "Hook" in their name an
316
-        // if this is an extended check (i.e. caf is active) then we will scan the caffeinated/extend directory first and any hook files that are found will be have their reference added to the $_files_hook array property.  Then, we make sure that when we loop through the core decaf directories to find hook files that we skip over any hooks files that have already been set by caf.
317
-        if ($extend) {
318
-            $hook_files_glob_path = apply_filters(
319
-                'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend',
320
-                EE_CORE_CAF_ADMIN_EXTEND
321
-                . $this->_folder_name
322
-                . '/*'
323
-                . $this->_file_name
324
-                . '_Hooks_Extend.class.php'
325
-            );
326
-            $this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend);
327
-        }
328
-        // loop through decaf folders
329
-        $hook_files_glob_path = apply_filters(
330
-            'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path',
331
-            $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php'
332
-        );
333
-        $this->_hook_paths = array_merge(
334
-            $this->_register_hook_files($hook_files_glob_path),
335
-            $this->_hook_paths
336
-        );  // making sure any extended hook paths are later in the array than the core hook paths!
337
-        return $this->_hook_paths;
338
-    }
339
-
340
-
341
-    protected function _register_hook_files($hook_files_glob_path, $extend = false)
342
-    {
343
-        $hook_paths = array();
344
-        if ($hook_files = glob($hook_files_glob_path)) {
345
-            if (empty($hook_files)) {
346
-                return array();
347
-            }
348
-            foreach ($hook_files as $file) {
349
-                // lets get the linked admin.
350
-                $hook_file = $extend ? str_replace(EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . '/', '', $file)
351
-                    : str_replace($this->_folder_path, '', $file);
352
-                $replace = $extend
353
-                    ? '_' . $this->_file_name . '_Hooks_Extend.class.php'
354
-                    : '_'
355
-                      . $this->_file_name
356
-                      . '_Hooks.class.php';
357
-                $rel_admin = str_replace($replace, '', $hook_file);
358
-                $rel_admin = strtolower($rel_admin);
359
-                $hook_paths[] = $file;
360
-                // make sure we haven't already got a hook setup for this page path
361
-                if (in_array($rel_admin, $this->_files_hooked, true)) {
362
-                    continue;
363
-                }
364
-                $this->hook_file = $hook_file;
365
-                $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin;
366
-                add_filter($rel_admin_hook, array($this, 'load_admin_hook'));
367
-                $this->_files_hooked[] = $rel_admin;
368
-            }
369
-        }
370
-        return $hook_paths;
371
-    }
372
-
373
-
374
-    public function load_admin_hook($registered_pages)
375
-    {
376
-        $this->hook_file;
377
-        $hook_file = (array) $this->hook_file;
378
-        return array_merge($hook_file, $registered_pages);
379
-    }
380
-
381
-
382
-    /**
383
-     * _initialize_admin_page
384
-     *
385
-     * @throws EE_Error
386
-     * @throws InvalidArgumentException
387
-     * @throws InvalidDataTypeException
388
-     * @throws InvalidInterfaceException
389
-     * @throws ReflectionException
390
-     * @see  initialize_admin_page() for info
391
-     */
392
-    protected function _initialize_admin_page()
393
-    {
394
-        // just check we're on right page and if not get out
395
-        if ((! isset($_REQUEST['page']) || $_REQUEST['page'] !== $this->_menu_map->menu_slug) && $this->_routing) {
396
-            return;
397
-        }
398
-        $this->_load_page = true;
399
-
400
-        // we don't need to do a page_request check here because it's only called via WP menu system.
401
-        $admin_page = $this->_file_name . '_Admin_Page';
402
-        $hook_suffix = $this->_menu_map->menu_slug . '_' . $admin_page;
403
-        $admin_page = apply_filters(
404
-            "FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}",
405
-            $admin_page
406
-        );
407
-        // define requested admin page class name then load the file and instantiate
408
-        $path_to_file = str_replace(array('\\', '/'), '/', $this->_folder_path . $admin_page . '.core.php');
409
-        $path_to_file = apply_filters(
410
-            "FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}",
411
-            $path_to_file
412
-        );// so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
413
-        if (is_readable($path_to_file)) {
414
-            // This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place
415
-            do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization');
416
-            do_action(
417
-                'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_' . $this->_menu_map->menu_slug
418
-            );
419
-            require_once($path_to_file);
420
-            $this->_loaded_page_object = $this->loader->getShared($admin_page, [$this->_routing]);
421
-            $this->_loaded_page_object->initializePage();
422
-        }
423
-        do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization');
424
-        do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_' . $this->_menu_map->menu_slug);
425
-    }
426
-
427
-
428
-    public function get_admin_page_name()
429
-    {
430
-        return $this->_file_name . '_Admin_Page';
431
-    }
432
-
433
-
434
-    /**
435
-     * @return mixed
436
-     */
437
-    public function loaded_page_object()
438
-    {
439
-        return $this->_loaded_page_object;
440
-    }
441
-
442
-
443
-    // public function set_autoloaders($className)
444
-    // {
445
-    //     $dir_ref = array(
446
-    //         $this->_folder_path => array('core', 'class'),
447
-    //     );
448
-    //     EEH_Autoloader::try_autoload($dir_ref, $className);
449
-    // }
450
-    /**
451
-     * _check_user_access
452
-     * verifies user access for this admin page.  If no user access is available then let's gracefully exit with a
453
-     * WordPress die message.
454
-     *
455
-     * @return bool true if pass (or admin) wp_die if fail
456
-     */
457
-    private function _check_user_access()
458
-    {
459
-        if (! EE_Registry::instance()->CAP->current_user_can(
460
-            $this->_menu_map->capability,
461
-            $this->_menu_map->menu_slug
462
-        )) {
463
-            wp_die(__('You don\'t have access to this page.', 'event_espresso'), '', array('back_link' => true));
464
-        }
465
-        return true;
466
-    }
20
+	/**
21
+	 * @var LoaderInterface $loader
22
+	 */
23
+	protected $loader;
24
+
25
+	// identity properties (set in _set_defaults and _set_init_properties)
26
+	public $label;
27
+
28
+	/**
29
+	 * Menu map has a capability.  However, this allows admin pages to have separate capability requirements for menus
30
+	 * and accessing pages.  If capability is NOT set, then it defaults to the menu_map capability.
31
+	 *
32
+	 * @var string
33
+	 */
34
+	public $capability;
35
+
36
+
37
+	/**
38
+	 * This holds the menu map object for this admin page.
39
+	 *
40
+	 * @var EE_Admin_Page_Menu_Map
41
+	 */
42
+	protected $_menu_map;
43
+
44
+	/**
45
+	 * deprecated
46
+	 */
47
+	public $menu_label;
48
+	public $menu_slug;
49
+
50
+
51
+	// set in _set_defaults
52
+	protected $_folder_name;
53
+	protected $_folder_path;
54
+	protected $_file_name;
55
+	public $hook_file;
56
+	protected $_wp_page_slug;
57
+	protected $_routing;
58
+
59
+
60
+	/**
61
+	 * This holds the page object.
62
+	 *
63
+	 * @var EE_Admin_Page
64
+	 */
65
+	protected $_loaded_page_object;
66
+
67
+
68
+	// for caf
69
+	protected $_files_hooked;
70
+	protected $_hook_paths;
71
+
72
+	// load_page?
73
+	private $_load_page;
74
+
75
+
76
+	/**
77
+	 * @throws InvalidArgumentException
78
+	 * @throws InvalidDataTypeException
79
+	 * @throws InvalidInterfaceException
80
+	 */
81
+	public function __construct()
82
+	{
83
+		$this->loader = LoaderFactory::getLoader();
84
+		// set global defaults
85
+		$this->_set_defaults();
86
+		// set properties that are always available with objects.
87
+		$this->_set_init_properties();
88
+		// global styles/scripts across all wp admin pages
89
+		add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5);
90
+		// load initial stuff.
91
+		$this->_set_file_and_folder_name();
92
+		$this->_set_menu_map();
93
+		if (empty($this->_menu_map) || is_array($this->_menu_map)) {
94
+			EE_Error::doing_it_wrong(
95
+				get_class($this) . '::$_menu_map',
96
+				sprintf(
97
+					__(
98
+						'The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core.  Please see Admin_Page_Init class examples in core for the new way of setting this property up.',
99
+						'event_espresso'
100
+					),
101
+					get_class($this)
102
+				),
103
+				'4.4.0'
104
+			);
105
+			return;
106
+		}
107
+		// set default capability
108
+		$this->_set_capability();
109
+	}
110
+
111
+
112
+	/**
113
+	 * _set_init_properties
114
+	 * Child classes use to set the following properties:
115
+	 * $label
116
+	 *
117
+	 * @abstract
118
+	 * @access protected
119
+	 * @return void
120
+	 */
121
+	abstract protected function _set_init_properties();
122
+
123
+
124
+	/**
125
+	 * _set_menu_map is a function that child classes use to set the menu_map property (which should be an instance of
126
+	 * EE_Admin_Page_Menu_Map.  Their menu can either be EE_Admin_Page_Main_Menu or EE_Admin_Page_Sub_Menu.
127
+	 *
128
+	 * @since 4.4.0
129
+	 * @ return void.
130
+	 */
131
+	protected function _set_menu_map()
132
+	{
133
+		return array();
134
+	}
135
+
136
+
137
+	/**
138
+	 * returns the menu map for this admin page
139
+	 *
140
+	 * @since 4.4.0
141
+	 * @return EE_Admin_Page_Menu_Map
142
+	 */
143
+	public function get_menu_map()
144
+	{
145
+		return $this->_menu_map;
146
+	}
147
+
148
+
149
+	/**
150
+	 * This loads scripts and styles for the EE_Admin system
151
+	 * that must be available on ALL WP admin pages (i.e. EE_menu items)
152
+	 *
153
+	 * @return void
154
+	 */
155
+	public function load_wp_global_scripts_styles()
156
+	{
157
+		wp_register_style(
158
+			'espresso_menu',
159
+			EE_ADMIN_URL . 'assets/admin-menu-styles.css',
160
+			array('dashicons'),
161
+			EVENT_ESPRESSO_VERSION
162
+		);
163
+		wp_enqueue_style('espresso_menu');
164
+	}
165
+
166
+
167
+	/**
168
+	 * this sets default properties (might be overridden in _set_init_properties);
169
+	 *
170
+	 * @access private
171
+	 * @return  void
172
+	 */
173
+	private function _set_defaults()
174
+	{
175
+		$this->_file_name = $this->_folder_name = $this->_wp_page_slug = $this->capability = null;
176
+		$this->_routing = true;
177
+		$this->_load_page = false;
178
+		$this->_files_hooked = $this->_hook_paths = array();
179
+		// menu_map
180
+		$this->_menu_map = $this->get_menu_map();
181
+	}
182
+
183
+
184
+	protected function _set_capability()
185
+	{
186
+		$capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability;
187
+		$this->capability = apply_filters('FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability);
188
+	}
189
+
190
+
191
+	/**
192
+	 * initialize_admin_page
193
+	 * This method is what executes the loading of the specific page class for the given dir_name as called by the
194
+	 * EE_Admin_Init class.
195
+	 *
196
+	 * @access  public
197
+	 * @return void
198
+	 * @throws EE_Error
199
+	 * @throws InvalidArgumentException
200
+	 * @throws InvalidDataTypeException
201
+	 * @throws InvalidInterfaceException
202
+	 * @throws ReflectionException
203
+	 * @uses    _initialize_admin_page()
204
+	 */
205
+	public function initialize_admin_page()
206
+	{
207
+		// let's check user access first
208
+		$this->_check_user_access();
209
+		if (! is_object($this->_loaded_page_object)) {
210
+			return;
211
+		}
212
+		$this->_loaded_page_object->route_admin_request();
213
+	}
214
+
215
+
216
+	/**
217
+	 * @param string $wp_page_slug
218
+	 * @throws EE_Error
219
+	 * @since $VID:$
220
+	 */
221
+	public function set_page_dependencies($wp_page_slug)
222
+	{
223
+		if (! $this->_load_page) {
224
+			return;
225
+		}
226
+		if (! is_object($this->_loaded_page_object)) {
227
+			$msg[] = __(
228
+				'We can\'t load the page because we\'re missing a valid page object that tells us what to load',
229
+				'event_espresso'
230
+			);
231
+			$msg[] = $msg[0] . "\r\n"
232
+					 . sprintf(
233
+						 __(
234
+							 'The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory',
235
+							 'event_espresso'
236
+						 ),
237
+						 $this->_file_name,
238
+						 $this->_file_name,
239
+						 $this->_folder_path . $this->_file_name,
240
+						 $this->_menu_map->menu_slug
241
+					 );
242
+			throw new EE_Error(implode('||', $msg));
243
+		}
244
+		$this->_loaded_page_object->set_wp_page_slug($wp_page_slug);
245
+		$page_hook = 'load-' . $wp_page_slug;
246
+		// hook into page load hook so all page specific stuff get's loaded.
247
+		if (! empty($wp_page_slug)) {
248
+			add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies'));
249
+		}
250
+	}
251
+
252
+
253
+	/**
254
+	 * This executes the initial page loads for EE_Admin pages to take care of any ajax or other code needing to run
255
+	 * before the load-page... hook. Note, the page loads are happening around the wp_init hook.
256
+	 *
257
+	 * @return void
258
+	 * @throws EE_Error
259
+	 * @throws InvalidArgumentException
260
+	 * @throws InvalidDataTypeException
261
+	 * @throws InvalidInterfaceException
262
+	 * @throws ReflectionException
263
+	 */
264
+	public function do_initial_loads()
265
+	{
266
+		// no loading or initializing if menu map is setup incorrectly.
267
+		if (empty($this->_menu_map) || is_array($this->_menu_map)) {
268
+			return;
269
+		}
270
+		$this->_initialize_admin_page();
271
+	}
272
+
273
+
274
+	/**
275
+	 * all we're doing here is setting the $_file_name property for later use.
276
+	 *
277
+	 * @access private
278
+	 * @return void
279
+	 */
280
+	private function _set_file_and_folder_name()
281
+	{
282
+		$bt = debug_backtrace();
283
+		// for more reliable determination of folder name
284
+		// we're using this to get the actual folder name of the CALLING class (i.e. the child class that extends this).  Why?  Because $this->menu_slug may be different than the folder name (to avoid conflicts with other plugins)
285
+		$class = get_class($this);
286
+		foreach ($bt as $index => $values) {
287
+			if (isset($values['class']) && $values['class'] === $class) {
288
+				$file_index = $index - 1;
289
+				$this->_folder_name = basename(dirname($bt[ $file_index ]['file']));
290
+				if (! empty($this->_folder_name)) {
291
+					break;
292
+				}
293
+			}
294
+		}
295
+		$this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/';
296
+		$this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name);
297
+		$this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name));
298
+		$this->_file_name = str_replace(' ', '_', $this->_file_name);
299
+	}
300
+
301
+
302
+	/**
303
+	 * This automatically checks if we have a hook class in the loaded child directory.  If we DO then we will register
304
+	 * it with the appropriate pages.  That way all we have to do is make sure the file is named correctly and
305
+	 * "dropped" in. Example: if we wanted to set this up for Messages hooking into Events then we would do:
306
+	 * events_Messages_Hooks.class.php
307
+	 *
308
+	 * @param bool $extend This indicates whether we're checking the extend directory for any register_hooks
309
+	 *                     files/classes
310
+	 * @return array
311
+	 */
312
+	public function register_hooks($extend = false)
313
+	{
314
+
315
+		// get a list of files in the directory that have the "Hook" in their name an
316
+		// if this is an extended check (i.e. caf is active) then we will scan the caffeinated/extend directory first and any hook files that are found will be have their reference added to the $_files_hook array property.  Then, we make sure that when we loop through the core decaf directories to find hook files that we skip over any hooks files that have already been set by caf.
317
+		if ($extend) {
318
+			$hook_files_glob_path = apply_filters(
319
+				'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend',
320
+				EE_CORE_CAF_ADMIN_EXTEND
321
+				. $this->_folder_name
322
+				. '/*'
323
+				. $this->_file_name
324
+				. '_Hooks_Extend.class.php'
325
+			);
326
+			$this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend);
327
+		}
328
+		// loop through decaf folders
329
+		$hook_files_glob_path = apply_filters(
330
+			'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path',
331
+			$this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php'
332
+		);
333
+		$this->_hook_paths = array_merge(
334
+			$this->_register_hook_files($hook_files_glob_path),
335
+			$this->_hook_paths
336
+		);  // making sure any extended hook paths are later in the array than the core hook paths!
337
+		return $this->_hook_paths;
338
+	}
339
+
340
+
341
+	protected function _register_hook_files($hook_files_glob_path, $extend = false)
342
+	{
343
+		$hook_paths = array();
344
+		if ($hook_files = glob($hook_files_glob_path)) {
345
+			if (empty($hook_files)) {
346
+				return array();
347
+			}
348
+			foreach ($hook_files as $file) {
349
+				// lets get the linked admin.
350
+				$hook_file = $extend ? str_replace(EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . '/', '', $file)
351
+					: str_replace($this->_folder_path, '', $file);
352
+				$replace = $extend
353
+					? '_' . $this->_file_name . '_Hooks_Extend.class.php'
354
+					: '_'
355
+					  . $this->_file_name
356
+					  . '_Hooks.class.php';
357
+				$rel_admin = str_replace($replace, '', $hook_file);
358
+				$rel_admin = strtolower($rel_admin);
359
+				$hook_paths[] = $file;
360
+				// make sure we haven't already got a hook setup for this page path
361
+				if (in_array($rel_admin, $this->_files_hooked, true)) {
362
+					continue;
363
+				}
364
+				$this->hook_file = $hook_file;
365
+				$rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin;
366
+				add_filter($rel_admin_hook, array($this, 'load_admin_hook'));
367
+				$this->_files_hooked[] = $rel_admin;
368
+			}
369
+		}
370
+		return $hook_paths;
371
+	}
372
+
373
+
374
+	public function load_admin_hook($registered_pages)
375
+	{
376
+		$this->hook_file;
377
+		$hook_file = (array) $this->hook_file;
378
+		return array_merge($hook_file, $registered_pages);
379
+	}
380
+
381
+
382
+	/**
383
+	 * _initialize_admin_page
384
+	 *
385
+	 * @throws EE_Error
386
+	 * @throws InvalidArgumentException
387
+	 * @throws InvalidDataTypeException
388
+	 * @throws InvalidInterfaceException
389
+	 * @throws ReflectionException
390
+	 * @see  initialize_admin_page() for info
391
+	 */
392
+	protected function _initialize_admin_page()
393
+	{
394
+		// just check we're on right page and if not get out
395
+		if ((! isset($_REQUEST['page']) || $_REQUEST['page'] !== $this->_menu_map->menu_slug) && $this->_routing) {
396
+			return;
397
+		}
398
+		$this->_load_page = true;
399
+
400
+		// we don't need to do a page_request check here because it's only called via WP menu system.
401
+		$admin_page = $this->_file_name . '_Admin_Page';
402
+		$hook_suffix = $this->_menu_map->menu_slug . '_' . $admin_page;
403
+		$admin_page = apply_filters(
404
+			"FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}",
405
+			$admin_page
406
+		);
407
+		// define requested admin page class name then load the file and instantiate
408
+		$path_to_file = str_replace(array('\\', '/'), '/', $this->_folder_path . $admin_page . '.core.php');
409
+		$path_to_file = apply_filters(
410
+			"FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}",
411
+			$path_to_file
412
+		);// so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
413
+		if (is_readable($path_to_file)) {
414
+			// This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place
415
+			do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization');
416
+			do_action(
417
+				'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_' . $this->_menu_map->menu_slug
418
+			);
419
+			require_once($path_to_file);
420
+			$this->_loaded_page_object = $this->loader->getShared($admin_page, [$this->_routing]);
421
+			$this->_loaded_page_object->initializePage();
422
+		}
423
+		do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization');
424
+		do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_' . $this->_menu_map->menu_slug);
425
+	}
426
+
427
+
428
+	public function get_admin_page_name()
429
+	{
430
+		return $this->_file_name . '_Admin_Page';
431
+	}
432
+
433
+
434
+	/**
435
+	 * @return mixed
436
+	 */
437
+	public function loaded_page_object()
438
+	{
439
+		return $this->_loaded_page_object;
440
+	}
441
+
442
+
443
+	// public function set_autoloaders($className)
444
+	// {
445
+	//     $dir_ref = array(
446
+	//         $this->_folder_path => array('core', 'class'),
447
+	//     );
448
+	//     EEH_Autoloader::try_autoload($dir_ref, $className);
449
+	// }
450
+	/**
451
+	 * _check_user_access
452
+	 * verifies user access for this admin page.  If no user access is available then let's gracefully exit with a
453
+	 * WordPress die message.
454
+	 *
455
+	 * @return bool true if pass (or admin) wp_die if fail
456
+	 */
457
+	private function _check_user_access()
458
+	{
459
+		if (! EE_Registry::instance()->CAP->current_user_can(
460
+			$this->_menu_map->capability,
461
+			$this->_menu_map->menu_slug
462
+		)) {
463
+			wp_die(__('You don\'t have access to this page.', 'event_espresso'), '', array('back_link' => true));
464
+		}
465
+		return true;
466
+	}
467 467
 }
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $this->_set_menu_map();
93 93
         if (empty($this->_menu_map) || is_array($this->_menu_map)) {
94 94
             EE_Error::doing_it_wrong(
95
-                get_class($this) . '::$_menu_map',
95
+                get_class($this).'::$_menu_map',
96 96
                 sprintf(
97 97
                     __(
98 98
                         'The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core.  Please see Admin_Page_Init class examples in core for the new way of setting this property up.',
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     {
157 157
         wp_register_style(
158 158
             'espresso_menu',
159
-            EE_ADMIN_URL . 'assets/admin-menu-styles.css',
159
+            EE_ADMIN_URL.'assets/admin-menu-styles.css',
160 160
             array('dashicons'),
161 161
             EVENT_ESPRESSO_VERSION
162 162
         );
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     protected function _set_capability()
185 185
     {
186 186
         $capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability;
187
-        $this->capability = apply_filters('FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability);
187
+        $this->capability = apply_filters('FHEE_'.$this->_menu_map->menu_slug.'_capability', $capability);
188 188
     }
189 189
 
190 190
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     {
207 207
         // let's check user access first
208 208
         $this->_check_user_access();
209
-        if (! is_object($this->_loaded_page_object)) {
209
+        if ( ! is_object($this->_loaded_page_object)) {
210 210
             return;
211 211
         }
212 212
         $this->_loaded_page_object->route_admin_request();
@@ -220,15 +220,15 @@  discard block
 block discarded – undo
220 220
      */
221 221
     public function set_page_dependencies($wp_page_slug)
222 222
     {
223
-        if (! $this->_load_page) {
223
+        if ( ! $this->_load_page) {
224 224
             return;
225 225
         }
226
-        if (! is_object($this->_loaded_page_object)) {
226
+        if ( ! is_object($this->_loaded_page_object)) {
227 227
             $msg[] = __(
228 228
                 'We can\'t load the page because we\'re missing a valid page object that tells us what to load',
229 229
                 'event_espresso'
230 230
             );
231
-            $msg[] = $msg[0] . "\r\n"
231
+            $msg[] = $msg[0]."\r\n"
232 232
                      . sprintf(
233 233
                          __(
234 234
                              'The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory',
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
                          ),
237 237
                          $this->_file_name,
238 238
                          $this->_file_name,
239
-                         $this->_folder_path . $this->_file_name,
239
+                         $this->_folder_path.$this->_file_name,
240 240
                          $this->_menu_map->menu_slug
241 241
                      );
242 242
             throw new EE_Error(implode('||', $msg));
243 243
         }
244 244
         $this->_loaded_page_object->set_wp_page_slug($wp_page_slug);
245
-        $page_hook = 'load-' . $wp_page_slug;
245
+        $page_hook = 'load-'.$wp_page_slug;
246 246
         // hook into page load hook so all page specific stuff get's loaded.
247
-        if (! empty($wp_page_slug)) {
247
+        if ( ! empty($wp_page_slug)) {
248 248
             add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies'));
249 249
         }
250 250
     }
@@ -286,13 +286,13 @@  discard block
 block discarded – undo
286 286
         foreach ($bt as $index => $values) {
287 287
             if (isset($values['class']) && $values['class'] === $class) {
288 288
                 $file_index = $index - 1;
289
-                $this->_folder_name = basename(dirname($bt[ $file_index ]['file']));
290
-                if (! empty($this->_folder_name)) {
289
+                $this->_folder_name = basename(dirname($bt[$file_index]['file']));
290
+                if ( ! empty($this->_folder_name)) {
291 291
                     break;
292 292
                 }
293 293
             }
294 294
         }
295
-        $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/';
295
+        $this->_folder_path = EE_ADMIN_PAGES.$this->_folder_name.'/';
296 296
         $this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name);
297 297
         $this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name));
298 298
         $this->_file_name = str_replace(' ', '_', $this->_file_name);
@@ -328,12 +328,12 @@  discard block
 block discarded – undo
328 328
         // loop through decaf folders
329 329
         $hook_files_glob_path = apply_filters(
330 330
             'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path',
331
-            $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php'
331
+            $this->_folder_path.'*'.$this->_file_name.'_Hooks.class.php'
332 332
         );
333 333
         $this->_hook_paths = array_merge(
334 334
             $this->_register_hook_files($hook_files_glob_path),
335 335
             $this->_hook_paths
336
-        );  // making sure any extended hook paths are later in the array than the core hook paths!
336
+        ); // making sure any extended hook paths are later in the array than the core hook paths!
337 337
         return $this->_hook_paths;
338 338
     }
339 339
 
@@ -347,10 +347,10 @@  discard block
 block discarded – undo
347 347
             }
348 348
             foreach ($hook_files as $file) {
349 349
                 // lets get the linked admin.
350
-                $hook_file = $extend ? str_replace(EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . '/', '', $file)
350
+                $hook_file = $extend ? str_replace(EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.'/', '', $file)
351 351
                     : str_replace($this->_folder_path, '', $file);
352 352
                 $replace = $extend
353
-                    ? '_' . $this->_file_name . '_Hooks_Extend.class.php'
353
+                    ? '_'.$this->_file_name.'_Hooks_Extend.class.php'
354 354
                     : '_'
355 355
                       . $this->_file_name
356 356
                       . '_Hooks.class.php';
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
                     continue;
363 363
                 }
364 364
                 $this->hook_file = $hook_file;
365
-                $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin;
365
+                $rel_admin_hook = 'FHEE_do_other_page_hooks_'.$rel_admin;
366 366
                 add_filter($rel_admin_hook, array($this, 'load_admin_hook'));
367 367
                 $this->_files_hooked[] = $rel_admin;
368 368
             }
@@ -392,42 +392,42 @@  discard block
 block discarded – undo
392 392
     protected function _initialize_admin_page()
393 393
     {
394 394
         // just check we're on right page and if not get out
395
-        if ((! isset($_REQUEST['page']) || $_REQUEST['page'] !== $this->_menu_map->menu_slug) && $this->_routing) {
395
+        if (( ! isset($_REQUEST['page']) || $_REQUEST['page'] !== $this->_menu_map->menu_slug) && $this->_routing) {
396 396
             return;
397 397
         }
398 398
         $this->_load_page = true;
399 399
 
400 400
         // we don't need to do a page_request check here because it's only called via WP menu system.
401
-        $admin_page = $this->_file_name . '_Admin_Page';
402
-        $hook_suffix = $this->_menu_map->menu_slug . '_' . $admin_page;
401
+        $admin_page = $this->_file_name.'_Admin_Page';
402
+        $hook_suffix = $this->_menu_map->menu_slug.'_'.$admin_page;
403 403
         $admin_page = apply_filters(
404 404
             "FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}",
405 405
             $admin_page
406 406
         );
407 407
         // define requested admin page class name then load the file and instantiate
408
-        $path_to_file = str_replace(array('\\', '/'), '/', $this->_folder_path . $admin_page . '.core.php');
408
+        $path_to_file = str_replace(array('\\', '/'), '/', $this->_folder_path.$admin_page.'.core.php');
409 409
         $path_to_file = apply_filters(
410 410
             "FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}",
411 411
             $path_to_file
412
-        );// so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
412
+        ); // so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
413 413
         if (is_readable($path_to_file)) {
414 414
             // This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place
415 415
             do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization');
416 416
             do_action(
417
-                'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_' . $this->_menu_map->menu_slug
417
+                'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_'.$this->_menu_map->menu_slug
418 418
             );
419 419
             require_once($path_to_file);
420 420
             $this->_loaded_page_object = $this->loader->getShared($admin_page, [$this->_routing]);
421 421
             $this->_loaded_page_object->initializePage();
422 422
         }
423 423
         do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization');
424
-        do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_' . $this->_menu_map->menu_slug);
424
+        do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_'.$this->_menu_map->menu_slug);
425 425
     }
426 426
 
427 427
 
428 428
     public function get_admin_page_name()
429 429
     {
430
-        return $this->_file_name . '_Admin_Page';
430
+        return $this->_file_name.'_Admin_Page';
431 431
     }
432 432
 
433 433
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
      */
457 457
     private function _check_user_access()
458 458
     {
459
-        if (! EE_Registry::instance()->CAP->current_user_can(
459
+        if ( ! EE_Registry::instance()->CAP->current_user_can(
460 460
             $this->_menu_map->capability,
461 461
             $this->_menu_map->menu_slug
462 462
         )) {
Please login to merge, or discard this patch.
core/services/converters/date_time_formats/PhpToUnicode.php 2 patches
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -4,97 +4,97 @@
 block discarded – undo
4 4
 
5 5
 class PhpToUnicode
6 6
 {
7
-    /**
8
-     * array where keys are PHP date format parameters
9
-     * and values are Unicode Date Format substitutions
10
-     */
11
-    public static $date_formats = [
12
-        // YEAR
13
-        'y' => 'yy',    // 00, 01, ..., 99
14
-        'Y' => 'yyyy',  // 2000, 2001, ..., 2099
15
-        'o' => 'GGGG',  // ISO "week-numbering year" 2000, 2001, ..., 2099
16
-        // MONTH
17
-        'M' => 'MMM',   // Jan, Feb, ..., Dec
18
-        'n' => 'M',     // 1, 2, ..., 12
19
-        'm' => 'MM',    // 01, 02, ..., 12
20
-        'F' => 'MMMM',  // January, February, ..., December
21
-        // DAY
22
-        'd' => 'dd',    // 01, 02, ..., 31
23
-        'D' => 'eee',   // Sun, Mon, ..., Sat
24
-        'jS' => 'do',   // 1st, 2nd, ..., 31st
25
-        'j' => 'd',     // 1, 2, ..., 31
26
-        'l' => 'eeee',  // Sunday, Monday, ..., Saturday
27
-        'N' => 'e',     // Day of week 0, 1, ..., 6
28
-        'w' => 'i',     // ISO Day of week 1, 2, ..., 7
29
-        'z' => 'D',   // day of the year 0 - 365 to 1 - 366
30
-        // WEEK
31
-        'W' => 'w',
32
-    ];
7
+	/**
8
+	 * array where keys are PHP date format parameters
9
+	 * and values are Unicode Date Format substitutions
10
+	 */
11
+	public static $date_formats = [
12
+		// YEAR
13
+		'y' => 'yy',    // 00, 01, ..., 99
14
+		'Y' => 'yyyy',  // 2000, 2001, ..., 2099
15
+		'o' => 'GGGG',  // ISO "week-numbering year" 2000, 2001, ..., 2099
16
+		// MONTH
17
+		'M' => 'MMM',   // Jan, Feb, ..., Dec
18
+		'n' => 'M',     // 1, 2, ..., 12
19
+		'm' => 'MM',    // 01, 02, ..., 12
20
+		'F' => 'MMMM',  // January, February, ..., December
21
+		// DAY
22
+		'd' => 'dd',    // 01, 02, ..., 31
23
+		'D' => 'eee',   // Sun, Mon, ..., Sat
24
+		'jS' => 'do',   // 1st, 2nd, ..., 31st
25
+		'j' => 'd',     // 1, 2, ..., 31
26
+		'l' => 'eeee',  // Sunday, Monday, ..., Saturday
27
+		'N' => 'e',     // Day of week 0, 1, ..., 6
28
+		'w' => 'i',     // ISO Day of week 1, 2, ..., 7
29
+		'z' => 'D',   // day of the year 0 - 365 to 1 - 366
30
+		// WEEK
31
+		'W' => 'w',
32
+	];
33 33
 
34 34
 
35
-    /**
36
-     * array where keys are PHP time format parameters
37
-     * and values are Unicode Time Format substitutions
38
-     */
39
-    public static $time_formats = [
40
-        // 'a' => 'a', // am, pm, no pecific JS alternative
41
-        'A' => 'a', // AM, PM
42
-        // HOUR
43
-        // convert "g" to an intermediary format
44
-        // to avoid its result getting replaced by "h"
45
-        'g' => '@',     // 1, 2, ..., 12
46
-        'h' => 'hh',    // 01, 02, ..., 12
47
-        '@' => 'h',     // 1, 2, ..., 12
48
-        'G' => '#',     // 0, 1, ... 23
49
-        'H' => 'HH',    // 00, 01, ... 23
50
-        '#' => 'H',     // 0, 1, ... 23
51
-        // MINUTES & SECONDS
52
-        'i' => 'mm',    // minutes 00, 01, ..., 59
53
-        's' => 'ss',    // seconds 00, 01, ..., 59
54
-        'v' => 'SSS',   // milliseconds 000, 001, ..., 999
55
-        'u' => 'SSS',   // microseconds (not in unicode) 000, 001, ..., 999
56
-    ];
35
+	/**
36
+	 * array where keys are PHP time format parameters
37
+	 * and values are Unicode Time Format substitutions
38
+	 */
39
+	public static $time_formats = [
40
+		// 'a' => 'a', // am, pm, no pecific JS alternative
41
+		'A' => 'a', // AM, PM
42
+		// HOUR
43
+		// convert "g" to an intermediary format
44
+		// to avoid its result getting replaced by "h"
45
+		'g' => '@',     // 1, 2, ..., 12
46
+		'h' => 'hh',    // 01, 02, ..., 12
47
+		'@' => 'h',     // 1, 2, ..., 12
48
+		'G' => '#',     // 0, 1, ... 23
49
+		'H' => 'HH',    // 00, 01, ... 23
50
+		'#' => 'H',     // 0, 1, ... 23
51
+		// MINUTES & SECONDS
52
+		'i' => 'mm',    // minutes 00, 01, ..., 59
53
+		's' => 'ss',    // seconds 00, 01, ..., 59
54
+		'v' => 'SSS',   // milliseconds 000, 001, ..., 999
55
+		'u' => 'SSS',   // microseconds (not in unicode) 000, 001, ..., 999
56
+	];
57 57
 
58 58
 
59
-    /**
60
-     * array where keys are PHP timezone format parameters
61
-     * and values are Unicode Timezone Format substitutions
62
-     */
63
-    public static $timezone_formats = [
64
-        'Z' => 'ZZ',    // -0100, +0000, ..., +1200
65
-        'e' => 'Z',     // Timezone identifier UTC, GMT, Atlantic/Azores to -01:00, +00:00, ... +12:00
66
-        'T' => 'Z',     // Timezone abbreviation EST, MDT to -01:00, +00:00, ... +12:00
67
-        'P' => 'Z',     // -01:00, +00:00, ... +12:00
68
-        'O' => 'ZZ',    // -0100, +0000, ..., +1200
69
-    ];
59
+	/**
60
+	 * array where keys are PHP timezone format parameters
61
+	 * and values are Unicode Timezone Format substitutions
62
+	 */
63
+	public static $timezone_formats = [
64
+		'Z' => 'ZZ',    // -0100, +0000, ..., +1200
65
+		'e' => 'Z',     // Timezone identifier UTC, GMT, Atlantic/Azores to -01:00, +00:00, ... +12:00
66
+		'T' => 'Z',     // Timezone abbreviation EST, MDT to -01:00, +00:00, ... +12:00
67
+		'P' => 'Z',     // -01:00, +00:00, ... +12:00
68
+		'O' => 'ZZ',    // -0100, +0000, ..., +1200
69
+	];
70 70
 
71 71
 
72
-    /**
73
-     * @param string $date_format
74
-     * @return string
75
-     */
76
-    public function convertDateFormat($date_format)
77
-    {
78
-        foreach (PhpToUnicode::$date_formats as $find => $replace) {
79
-            $date_format = (string) str_replace($find, $replace, $date_format);
80
-        }
81
-        return $date_format;
82
-    }
72
+	/**
73
+	 * @param string $date_format
74
+	 * @return string
75
+	 */
76
+	public function convertDateFormat($date_format)
77
+	{
78
+		foreach (PhpToUnicode::$date_formats as $find => $replace) {
79
+			$date_format = (string) str_replace($find, $replace, $date_format);
80
+		}
81
+		return $date_format;
82
+	}
83 83
 
84 84
 
85
-    /**
86
-     * @param string $time_format
87
-     * @return string
88
-     */
89
-    public function convertTimeFormat($time_format)
90
-    {
91
-        foreach (PhpToUnicode::$time_formats as $find => $replace) {
92
-            $time_format = (string) str_replace($find, $replace, $time_format);
93
-        }
94
-        // and just in case the timezone has been added
95
-        foreach (PhpToUnicode::$timezone_formats as $find => $replace) {
96
-            $time_format = (string) str_replace($find, $replace, $time_format);
97
-        }
98
-        return $time_format;
99
-    }
85
+	/**
86
+	 * @param string $time_format
87
+	 * @return string
88
+	 */
89
+	public function convertTimeFormat($time_format)
90
+	{
91
+		foreach (PhpToUnicode::$time_formats as $find => $replace) {
92
+			$time_format = (string) str_replace($find, $replace, $time_format);
93
+		}
94
+		// and just in case the timezone has been added
95
+		foreach (PhpToUnicode::$timezone_formats as $find => $replace) {
96
+			$time_format = (string) str_replace($find, $replace, $time_format);
97
+		}
98
+		return $time_format;
99
+	}
100 100
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -10,23 +10,23 @@  discard block
 block discarded – undo
10 10
      */
11 11
     public static $date_formats = [
12 12
         // YEAR
13
-        'y' => 'yy',    // 00, 01, ..., 99
14
-        'Y' => 'yyyy',  // 2000, 2001, ..., 2099
15
-        'o' => 'GGGG',  // ISO "week-numbering year" 2000, 2001, ..., 2099
13
+        'y' => 'yy', // 00, 01, ..., 99
14
+        'Y' => 'yyyy', // 2000, 2001, ..., 2099
15
+        'o' => 'GGGG', // ISO "week-numbering year" 2000, 2001, ..., 2099
16 16
         // MONTH
17
-        'M' => 'MMM',   // Jan, Feb, ..., Dec
18
-        'n' => 'M',     // 1, 2, ..., 12
19
-        'm' => 'MM',    // 01, 02, ..., 12
20
-        'F' => 'MMMM',  // January, February, ..., December
17
+        'M' => 'MMM', // Jan, Feb, ..., Dec
18
+        'n' => 'M', // 1, 2, ..., 12
19
+        'm' => 'MM', // 01, 02, ..., 12
20
+        'F' => 'MMMM', // January, February, ..., December
21 21
         // DAY
22
-        'd' => 'dd',    // 01, 02, ..., 31
23
-        'D' => 'eee',   // Sun, Mon, ..., Sat
24
-        'jS' => 'do',   // 1st, 2nd, ..., 31st
25
-        'j' => 'd',     // 1, 2, ..., 31
26
-        'l' => 'eeee',  // Sunday, Monday, ..., Saturday
27
-        'N' => 'e',     // Day of week 0, 1, ..., 6
28
-        'w' => 'i',     // ISO Day of week 1, 2, ..., 7
29
-        'z' => 'D',   // day of the year 0 - 365 to 1 - 366
22
+        'd' => 'dd', // 01, 02, ..., 31
23
+        'D' => 'eee', // Sun, Mon, ..., Sat
24
+        'jS' => 'do', // 1st, 2nd, ..., 31st
25
+        'j' => 'd', // 1, 2, ..., 31
26
+        'l' => 'eeee', // Sunday, Monday, ..., Saturday
27
+        'N' => 'e', // Day of week 0, 1, ..., 6
28
+        'w' => 'i', // ISO Day of week 1, 2, ..., 7
29
+        'z' => 'D', // day of the year 0 - 365 to 1 - 366
30 30
         // WEEK
31 31
         'W' => 'w',
32 32
     ];
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
         // HOUR
43 43
         // convert "g" to an intermediary format
44 44
         // to avoid its result getting replaced by "h"
45
-        'g' => '@',     // 1, 2, ..., 12
46
-        'h' => 'hh',    // 01, 02, ..., 12
47
-        '@' => 'h',     // 1, 2, ..., 12
48
-        'G' => '#',     // 0, 1, ... 23
49
-        'H' => 'HH',    // 00, 01, ... 23
50
-        '#' => 'H',     // 0, 1, ... 23
45
+        'g' => '@', // 1, 2, ..., 12
46
+        'h' => 'hh', // 01, 02, ..., 12
47
+        '@' => 'h', // 1, 2, ..., 12
48
+        'G' => '#', // 0, 1, ... 23
49
+        'H' => 'HH', // 00, 01, ... 23
50
+        '#' => 'H', // 0, 1, ... 23
51 51
         // MINUTES & SECONDS
52
-        'i' => 'mm',    // minutes 00, 01, ..., 59
53
-        's' => 'ss',    // seconds 00, 01, ..., 59
54
-        'v' => 'SSS',   // milliseconds 000, 001, ..., 999
55
-        'u' => 'SSS',   // microseconds (not in unicode) 000, 001, ..., 999
52
+        'i' => 'mm', // minutes 00, 01, ..., 59
53
+        's' => 'ss', // seconds 00, 01, ..., 59
54
+        'v' => 'SSS', // milliseconds 000, 001, ..., 999
55
+        'u' => 'SSS', // microseconds (not in unicode) 000, 001, ..., 999
56 56
     ];
57 57
 
58 58
 
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
      * and values are Unicode Timezone Format substitutions
62 62
      */
63 63
     public static $timezone_formats = [
64
-        'Z' => 'ZZ',    // -0100, +0000, ..., +1200
65
-        'e' => 'Z',     // Timezone identifier UTC, GMT, Atlantic/Azores to -01:00, +00:00, ... +12:00
66
-        'T' => 'Z',     // Timezone abbreviation EST, MDT to -01:00, +00:00, ... +12:00
67
-        'P' => 'Z',     // -01:00, +00:00, ... +12:00
68
-        'O' => 'ZZ',    // -0100, +0000, ..., +1200
64
+        'Z' => 'ZZ', // -0100, +0000, ..., +1200
65
+        'e' => 'Z', // Timezone identifier UTC, GMT, Atlantic/Azores to -01:00, +00:00, ... +12:00
66
+        'T' => 'Z', // Timezone abbreviation EST, MDT to -01:00, +00:00, ... +12:00
67
+        'P' => 'Z', // -01:00, +00:00, ... +12:00
68
+        'O' => 'ZZ', // -0100, +0000, ..., +1200
69 69
     ];
70 70
 
71 71
 
Please login to merge, or discard this patch.
core/services/assets/AssetManager.php 1 patch
Indentation   +306 added lines, -306 removed lines patch added patch discarded remove patch
@@ -24,310 +24,310 @@
 block discarded – undo
24 24
 abstract class AssetManager implements AssetManagerInterface
25 25
 {
26 26
 
27
-    /**
28
-     * @var AssetCollection|Asset[] $assets
29
-     */
30
-    protected $assets;
31
-
32
-    /**
33
-     * @var DomainInterface
34
-     */
35
-    protected $domain;
36
-
37
-    /**
38
-     * @var Registry $registry
39
-     */
40
-    protected $registry;
41
-
42
-
43
-    /**
44
-     * AssetRegister constructor.
45
-     *
46
-     * @param DomainInterface $domain
47
-     * @param AssetCollection $assets
48
-     * @param Registry        $registry
49
-     */
50
-    public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry)
51
-    {
52
-        $this->domain = $domain;
53
-        $this->assets = $assets;
54
-        $this->registry = $registry;
55
-        $this->registry->addAssetCollection($assets);
56
-        add_action('wp_enqueue_scripts', array($this, 'addManifestFile'), 0);
57
-        add_action('admin_enqueue_scripts', array($this, 'addManifestFile'), 0);
58
-        add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2);
59
-        add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2);
60
-    }
61
-
62
-
63
-    /**
64
-     * @return AssetCollection
65
-     */
66
-    public function getAssets()
67
-    {
68
-        return $this->assets;
69
-    }
70
-
71
-
72
-    /**
73
-     * @since 4.9.71.p
74
-     * @return string
75
-     */
76
-    public function assetNamespace()
77
-    {
78
-        return $this->domain->assetNamespace();
79
-    }
80
-
81
-
82
-    /**
83
-     * @return void
84
-     * @throws DuplicateCollectionIdentifierException
85
-     * @throws InvalidDataTypeException
86
-     * @throws InvalidEntityException
87
-     * @since 4.9.62.p
88
-     */
89
-    public function addManifestFile()
90
-    {
91
-        // if a manifest file has already been added for this domain, then just return
92
-        if ($this->assets->has($this->domain->assetNamespace())) {
93
-            return;
94
-        }
95
-        $asset = new ManifestFile($this->domain);
96
-        $this->assets->add($asset, $this->domain->assetNamespace());
97
-    }
98
-
99
-
100
-    /**
101
-     * @return ManifestFile[]
102
-     * @since 4.9.62.p
103
-     */
104
-    public function getManifestFile()
105
-    {
106
-        return $this->assets->getManifestFiles();
107
-    }
108
-
109
-
110
-    /**
111
-     * @param string $handle
112
-     * @param string $source
113
-     * @param array  $dependencies
114
-     * @param bool   $load_in_footer
115
-     * @param string $version
116
-     * @return JavascriptAsset
117
-     * @throws DuplicateCollectionIdentifierException
118
-     * @throws InvalidDataTypeException
119
-     * @throws InvalidEntityException
120
-     * @throws DomainException
121
-     * @since 4.9.62.p
122
-     */
123
-    public function addJavascript(
124
-        $handle,
125
-        $source,
126
-        array $dependencies = array(),
127
-        $load_in_footer = true,
128
-        $version = ''
129
-    ) {
130
-        $asset = new JavascriptAsset(
131
-            $handle,
132
-            $source,
133
-            array_unique($dependencies),
134
-            $load_in_footer,
135
-            $this->domain,
136
-            $version
137
-        );
138
-        $this->assets->add($asset, $handle);
139
-        return $asset;
140
-    }
141
-
142
-
143
-    /**
144
-     * Used to register a javascript asset where everything is dynamically derived from the given handle.
145
-     *
146
-     * @param string       $handle
147
-     * @param string|array $extra_dependencies
148
-     * @return JavascriptAsset
149
-     * @throws DuplicateCollectionIdentifierException
150
-     * @throws InvalidDataTypeException
151
-     * @throws InvalidEntityException
152
-     * @throws DomainException
153
-     */
154
-    public function addJs($handle, $extra_dependencies = [])
155
-    {
156
-        $details = $this->getAssetDetails(
157
-            Asset::TYPE_JS,
158
-            $handle,
159
-            $extra_dependencies
160
-        );
161
-        $source = $this->registry->getJsUrl($this->domain->assetNamespace(), $handle);
162
-        return $this->addJavascript(
163
-            $handle,
164
-            $source,
165
-            $details['dependencies'],
166
-            true,
167
-            $details['version']
168
-        );
169
-    }
170
-
171
-
172
-    /**
173
-     * @param string $handle
174
-     * @param array  $dependencies
175
-     * @param bool   $load_in_footer
176
-     * @param string $version
177
-     * @return JavascriptAsset
178
-     * @throws DomainException
179
-     * @throws DuplicateCollectionIdentifierException
180
-     * @throws InvalidDataTypeException
181
-     * @throws InvalidEntityException
182
-     * @since 4.9.71.p
183
-     */
184
-    public function addVendorJavascript(
185
-        $handle,
186
-        array $dependencies = array(),
187
-        $load_in_footer = true,
188
-        $version = ''
189
-    ) {
190
-        $dev_suffix = wp_scripts_get_suffix('dev');
191
-        $vendor_path = $this->domain->pluginUrl() . 'assets/vendor/';
192
-        return $this->addJavascript(
193
-            $handle,
194
-            "{$vendor_path}{$handle}{$dev_suffix}.js",
195
-            $dependencies,
196
-            $load_in_footer,
197
-            $version
198
-        );
199
-    }
200
-
201
-
202
-    /**
203
-     * @param string $handle
204
-     * @param string $source
205
-     * @param array  $dependencies
206
-     * @param string $media
207
-     * @param string $version
208
-     * @return StylesheetAsset
209
-     * @throws DomainException
210
-     * @throws DuplicateCollectionIdentifierException
211
-     * @throws InvalidDataTypeException
212
-     * @throws InvalidEntityException
213
-     * @since 4.9.62.p
214
-     */
215
-    public function addStylesheet(
216
-        $handle,
217
-        $source,
218
-        array $dependencies = array(),
219
-        $media = 'all',
220
-        $version = ''
221
-    ) {
222
-        $asset = new StylesheetAsset(
223
-            $handle,
224
-            $source,
225
-            array_unique($dependencies),
226
-            $this->domain,
227
-            $media,
228
-            $version
229
-        );
230
-        $this->assets->add($asset, $handle);
231
-        return $asset;
232
-    }
233
-
234
-
235
-    /**
236
-     * Used to register a css asset where everything is dynamically derived from the given handle.
237
-     *
238
-     * @param string       $handle
239
-     * @param string|array $extra_dependencies
240
-     * @return StylesheetAsset
241
-     * @throws DuplicateCollectionIdentifierException
242
-     * @throws InvalidDataTypeException
243
-     * @throws InvalidEntityException
244
-     * @throws DomainException
245
-     */
246
-    public function addCss($handle, $extra_dependencies = [])
247
-    {
248
-        $details = $this->getAssetDetails(
249
-            Asset::TYPE_CSS,
250
-            $handle,
251
-            $extra_dependencies
252
-        );
253
-        return $this->addStylesheet(
254
-            $handle,
255
-            $this->registry->getCssUrl($this->domain->assetNamespace(), $handle),
256
-            $details['dependencies'],
257
-            'all',
258
-            $details['version']
259
-        );
260
-    }
261
-
262
-
263
-    /**
264
-     * @param string $handle
265
-     * @return bool
266
-     * @since 4.9.62.p
267
-     */
268
-    public function enqueueAsset($handle)
269
-    {
270
-        if ($this->assets->has($handle)) {
271
-            /** @var Asset $asset */
272
-            $asset = $this->assets->get($handle);
273
-            if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
274
-                $asset->enqueueAsset();
275
-                return true;
276
-            }
277
-        }
278
-        return false;
279
-    }
280
-
281
-
282
-    /**
283
-     * @return  void
284
-     * @since   $VID:$
285
-     */
286
-    public function enqueueBrowserAssets()
287
-    {
288
-        foreach ($this->assets as $asset) {
289
-            if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
290
-                $asset->enqueueAsset();
291
-            }
292
-        }
293
-    }
294
-
295
-
296
-    /**
297
-     * @param string $asset_type
298
-     * @param string $handle
299
-     * @param array  $extra_dependencies
300
-     * @return array
301
-     * @since 4.10.2.p
302
-     */
303
-    private function getAssetDetails($asset_type, $handle, $extra_dependencies = [])
304
-    {
305
-        $getAssetDetails = '';
306
-        switch ($asset_type) {
307
-            case Asset::TYPE_JS :
308
-                $getAssetDetails = 'getJsAssetDetails';
309
-                break;
310
-            case Asset::TYPE_CSS :
311
-                $getAssetDetails = 'getCssAssetDetails';
312
-                break;
313
-        }
314
-        if ($getAssetDetails === '') {
315
-            return ['dependencies' => [], 'version' => ''];
316
-        }
317
-        $details = $this->registry->$getAssetDetails(
318
-            $this->domain->assetNamespace(),
319
-            $handle
320
-        );
321
-        $details['dependencies'] = isset($details['dependencies'])
322
-            ? $details['dependencies']
323
-            : [];
324
-        $details['version'] = isset($details['version'])
325
-            ? $details['version']
326
-            : '';
327
-        $details['dependencies'] = ! empty($extra_dependencies)
328
-            ? array_merge($details['dependencies'], (array) $extra_dependencies)
329
-            : $details['dependencies'];
330
-        return $details;
331
-
332
-    }
27
+	/**
28
+	 * @var AssetCollection|Asset[] $assets
29
+	 */
30
+	protected $assets;
31
+
32
+	/**
33
+	 * @var DomainInterface
34
+	 */
35
+	protected $domain;
36
+
37
+	/**
38
+	 * @var Registry $registry
39
+	 */
40
+	protected $registry;
41
+
42
+
43
+	/**
44
+	 * AssetRegister constructor.
45
+	 *
46
+	 * @param DomainInterface $domain
47
+	 * @param AssetCollection $assets
48
+	 * @param Registry        $registry
49
+	 */
50
+	public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry)
51
+	{
52
+		$this->domain = $domain;
53
+		$this->assets = $assets;
54
+		$this->registry = $registry;
55
+		$this->registry->addAssetCollection($assets);
56
+		add_action('wp_enqueue_scripts', array($this, 'addManifestFile'), 0);
57
+		add_action('admin_enqueue_scripts', array($this, 'addManifestFile'), 0);
58
+		add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2);
59
+		add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2);
60
+	}
61
+
62
+
63
+	/**
64
+	 * @return AssetCollection
65
+	 */
66
+	public function getAssets()
67
+	{
68
+		return $this->assets;
69
+	}
70
+
71
+
72
+	/**
73
+	 * @since 4.9.71.p
74
+	 * @return string
75
+	 */
76
+	public function assetNamespace()
77
+	{
78
+		return $this->domain->assetNamespace();
79
+	}
80
+
81
+
82
+	/**
83
+	 * @return void
84
+	 * @throws DuplicateCollectionIdentifierException
85
+	 * @throws InvalidDataTypeException
86
+	 * @throws InvalidEntityException
87
+	 * @since 4.9.62.p
88
+	 */
89
+	public function addManifestFile()
90
+	{
91
+		// if a manifest file has already been added for this domain, then just return
92
+		if ($this->assets->has($this->domain->assetNamespace())) {
93
+			return;
94
+		}
95
+		$asset = new ManifestFile($this->domain);
96
+		$this->assets->add($asset, $this->domain->assetNamespace());
97
+	}
98
+
99
+
100
+	/**
101
+	 * @return ManifestFile[]
102
+	 * @since 4.9.62.p
103
+	 */
104
+	public function getManifestFile()
105
+	{
106
+		return $this->assets->getManifestFiles();
107
+	}
108
+
109
+
110
+	/**
111
+	 * @param string $handle
112
+	 * @param string $source
113
+	 * @param array  $dependencies
114
+	 * @param bool   $load_in_footer
115
+	 * @param string $version
116
+	 * @return JavascriptAsset
117
+	 * @throws DuplicateCollectionIdentifierException
118
+	 * @throws InvalidDataTypeException
119
+	 * @throws InvalidEntityException
120
+	 * @throws DomainException
121
+	 * @since 4.9.62.p
122
+	 */
123
+	public function addJavascript(
124
+		$handle,
125
+		$source,
126
+		array $dependencies = array(),
127
+		$load_in_footer = true,
128
+		$version = ''
129
+	) {
130
+		$asset = new JavascriptAsset(
131
+			$handle,
132
+			$source,
133
+			array_unique($dependencies),
134
+			$load_in_footer,
135
+			$this->domain,
136
+			$version
137
+		);
138
+		$this->assets->add($asset, $handle);
139
+		return $asset;
140
+	}
141
+
142
+
143
+	/**
144
+	 * Used to register a javascript asset where everything is dynamically derived from the given handle.
145
+	 *
146
+	 * @param string       $handle
147
+	 * @param string|array $extra_dependencies
148
+	 * @return JavascriptAsset
149
+	 * @throws DuplicateCollectionIdentifierException
150
+	 * @throws InvalidDataTypeException
151
+	 * @throws InvalidEntityException
152
+	 * @throws DomainException
153
+	 */
154
+	public function addJs($handle, $extra_dependencies = [])
155
+	{
156
+		$details = $this->getAssetDetails(
157
+			Asset::TYPE_JS,
158
+			$handle,
159
+			$extra_dependencies
160
+		);
161
+		$source = $this->registry->getJsUrl($this->domain->assetNamespace(), $handle);
162
+		return $this->addJavascript(
163
+			$handle,
164
+			$source,
165
+			$details['dependencies'],
166
+			true,
167
+			$details['version']
168
+		);
169
+	}
170
+
171
+
172
+	/**
173
+	 * @param string $handle
174
+	 * @param array  $dependencies
175
+	 * @param bool   $load_in_footer
176
+	 * @param string $version
177
+	 * @return JavascriptAsset
178
+	 * @throws DomainException
179
+	 * @throws DuplicateCollectionIdentifierException
180
+	 * @throws InvalidDataTypeException
181
+	 * @throws InvalidEntityException
182
+	 * @since 4.9.71.p
183
+	 */
184
+	public function addVendorJavascript(
185
+		$handle,
186
+		array $dependencies = array(),
187
+		$load_in_footer = true,
188
+		$version = ''
189
+	) {
190
+		$dev_suffix = wp_scripts_get_suffix('dev');
191
+		$vendor_path = $this->domain->pluginUrl() . 'assets/vendor/';
192
+		return $this->addJavascript(
193
+			$handle,
194
+			"{$vendor_path}{$handle}{$dev_suffix}.js",
195
+			$dependencies,
196
+			$load_in_footer,
197
+			$version
198
+		);
199
+	}
200
+
201
+
202
+	/**
203
+	 * @param string $handle
204
+	 * @param string $source
205
+	 * @param array  $dependencies
206
+	 * @param string $media
207
+	 * @param string $version
208
+	 * @return StylesheetAsset
209
+	 * @throws DomainException
210
+	 * @throws DuplicateCollectionIdentifierException
211
+	 * @throws InvalidDataTypeException
212
+	 * @throws InvalidEntityException
213
+	 * @since 4.9.62.p
214
+	 */
215
+	public function addStylesheet(
216
+		$handle,
217
+		$source,
218
+		array $dependencies = array(),
219
+		$media = 'all',
220
+		$version = ''
221
+	) {
222
+		$asset = new StylesheetAsset(
223
+			$handle,
224
+			$source,
225
+			array_unique($dependencies),
226
+			$this->domain,
227
+			$media,
228
+			$version
229
+		);
230
+		$this->assets->add($asset, $handle);
231
+		return $asset;
232
+	}
233
+
234
+
235
+	/**
236
+	 * Used to register a css asset where everything is dynamically derived from the given handle.
237
+	 *
238
+	 * @param string       $handle
239
+	 * @param string|array $extra_dependencies
240
+	 * @return StylesheetAsset
241
+	 * @throws DuplicateCollectionIdentifierException
242
+	 * @throws InvalidDataTypeException
243
+	 * @throws InvalidEntityException
244
+	 * @throws DomainException
245
+	 */
246
+	public function addCss($handle, $extra_dependencies = [])
247
+	{
248
+		$details = $this->getAssetDetails(
249
+			Asset::TYPE_CSS,
250
+			$handle,
251
+			$extra_dependencies
252
+		);
253
+		return $this->addStylesheet(
254
+			$handle,
255
+			$this->registry->getCssUrl($this->domain->assetNamespace(), $handle),
256
+			$details['dependencies'],
257
+			'all',
258
+			$details['version']
259
+		);
260
+	}
261
+
262
+
263
+	/**
264
+	 * @param string $handle
265
+	 * @return bool
266
+	 * @since 4.9.62.p
267
+	 */
268
+	public function enqueueAsset($handle)
269
+	{
270
+		if ($this->assets->has($handle)) {
271
+			/** @var Asset $asset */
272
+			$asset = $this->assets->get($handle);
273
+			if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
274
+				$asset->enqueueAsset();
275
+				return true;
276
+			}
277
+		}
278
+		return false;
279
+	}
280
+
281
+
282
+	/**
283
+	 * @return  void
284
+	 * @since   $VID:$
285
+	 */
286
+	public function enqueueBrowserAssets()
287
+	{
288
+		foreach ($this->assets as $asset) {
289
+			if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
290
+				$asset->enqueueAsset();
291
+			}
292
+		}
293
+	}
294
+
295
+
296
+	/**
297
+	 * @param string $asset_type
298
+	 * @param string $handle
299
+	 * @param array  $extra_dependencies
300
+	 * @return array
301
+	 * @since 4.10.2.p
302
+	 */
303
+	private function getAssetDetails($asset_type, $handle, $extra_dependencies = [])
304
+	{
305
+		$getAssetDetails = '';
306
+		switch ($asset_type) {
307
+			case Asset::TYPE_JS :
308
+				$getAssetDetails = 'getJsAssetDetails';
309
+				break;
310
+			case Asset::TYPE_CSS :
311
+				$getAssetDetails = 'getCssAssetDetails';
312
+				break;
313
+		}
314
+		if ($getAssetDetails === '') {
315
+			return ['dependencies' => [], 'version' => ''];
316
+		}
317
+		$details = $this->registry->$getAssetDetails(
318
+			$this->domain->assetNamespace(),
319
+			$handle
320
+		);
321
+		$details['dependencies'] = isset($details['dependencies'])
322
+			? $details['dependencies']
323
+			: [];
324
+		$details['version'] = isset($details['version'])
325
+			? $details['version']
326
+			: '';
327
+		$details['dependencies'] = ! empty($extra_dependencies)
328
+			? array_merge($details['dependencies'], (array) $extra_dependencies)
329
+			: $details['dependencies'];
330
+		return $details;
331
+
332
+	}
333 333
 }
Please login to merge, or discard this patch.
core/services/assets/Registry.php 2 patches
Indentation   +811 added lines, -811 removed lines patch added patch discarded remove patch
@@ -26,822 +26,822 @@
 block discarded – undo
26 26
 class Registry
27 27
 {
28 28
 
29
-    const FILE_NAME_BUILD_MANIFEST = 'build-manifest.json';
30
-
31
-    /**
32
-     * @var AssetCollection[] $assets
33
-     */
34
-    protected $assets = [];
35
-
36
-    /**
37
-     * @var I18nRegistry
38
-     */
39
-    private $i18n_registry;
40
-
41
-    /**
42
-     * This holds the jsdata data object that will be exposed on pages that enqueue the `eejs-core` script.
43
-     *
44
-     * @var array
45
-     */
46
-    protected $jsdata = array();
47
-
48
-    /**
49
-     * This keeps track of all scripts with registered data.  It is used to prevent duplicate data objects setup in the
50
-     * page source.
51
-     *
52
-     * @var array
53
-     */
54
-    private $script_handles_with_data = array();
55
-
56
-
57
-    /**
58
-     * Holds the manifest data obtained from registered manifest files.
59
-     * Manifests are maps of asset chunk name to actual built asset file names.
60
-     * Shape of this array is:
61
-     * array(
62
-     *  'some_namespace_slug' => array(
63
-     *      'some_chunk_name' => array(
64
-     *          'js' => 'filename.js'
65
-     *          'css' => 'filename.js'
66
-     *      ),
67
-     *      'url_base' => 'https://baseurl.com/to/assets
68
-     *  )
69
-     * )
70
-     *
71
-     * @var array
72
-     */
73
-    private $manifest_data = array();
74
-
75
-
76
-    /**
77
-     * Holds any dependency data obtained from registered dependency map json.
78
-     * Dependency map json is generated via the @wordpress/dependency-extraction-webpack-plugin via the webpack config.
79
-     * @see https://github.com/WordPress/gutenberg/tree/master/packages/dependency-extraction-webpack-plugin
80
-     *
81
-     * @var array
82
-     */
83
-    private $dependencies_data = [];
84
-
85
-
86
-    /**
87
-     * This is a known array of possible wp css handles that correspond to what may be exposed as dependencies in our
88
-     * build process.  Currently the dependency export process in webpack does not consider css imports, so we derive
89
-     * them via the js dependencies (WP uses the same handle for both js and css). This is a list of known handles that
90
-     * are used for both js and css.
91
-     * @var array
92
-     */
93
-    private $wp_css_handle_dependencies = [
94
-        'wp-components',
95
-        'wp-block-editor',
96
-        'wp-block-library',
97
-        'wp-edit-post',
98
-        'wp-edit-widgets',
99
-        'wp-editor',
100
-        'wp-format-library',
101
-        'wp-list-reusable-blocks',
102
-        'wp-nux',
103
-    ];
104
-
105
-
106
-    /**
107
-     * Registry constructor.
108
-     * Hooking into WP actions for script registry.
109
-     *
110
-     * @param AssetCollection      $assets
111
-     * @param I18nRegistry         $i18n_registry
112
-     * @throws InvalidArgumentException
113
-     * @throws InvalidDataTypeException
114
-     * @throws InvalidInterfaceException
115
-     */
116
-    public function __construct(AssetCollection $assets, I18nRegistry $i18n_registry)
117
-    {
118
-        $this->addAssetCollection($assets);
119
-        $this->i18n_registry = $i18n_registry;
120
-        add_action('wp_enqueue_scripts', array($this, 'registerManifestFiles'), 1);
121
-        add_action('admin_enqueue_scripts', array($this, 'registerManifestFiles'), 1);
122
-        add_action('wp_enqueue_scripts', array($this, 'registerScriptsAndStyles'), 4);
123
-        add_action('admin_enqueue_scripts', array($this, 'registerScriptsAndStyles'), 4);
124
-        add_action('wp_enqueue_scripts', array($this, 'enqueueData'), 5);
125
-        add_action('admin_enqueue_scripts', array($this, 'enqueueData'), 5);
126
-        add_action('wp_print_footer_scripts', array($this, 'enqueueData'), 1);
127
-        add_action('admin_print_footer_scripts', array($this, 'enqueueData'), 1);
128
-    }
129
-
130
-
131
-    /**
132
-     * @param AssetCollection $asset_collection
133
-     */
134
-    public function addAssetCollection(AssetCollection $asset_collection)
135
-    {
136
-        $id = spl_object_hash($asset_collection);
137
-        if (! array_key_exists($id, $this->assets)) {
138
-            $this->assets[ $id ] = $asset_collection;
139
-        }
140
-    }
141
-
142
-
143
-
144
-
145
-    /**
146
-     * For classes that have Registry as a dependency, this provides a handy way to register script handles for i18n
147
-     * translation handling.
148
-     *
149
-     * @return I18nRegistry
150
-     */
151
-    public function getI18nRegistry()
152
-    {
153
-        return $this->i18n_registry;
154
-    }
155
-
156
-
157
-    /**
158
-     * Callback for the wp_enqueue_scripts actions used to register assets.
159
-     *
160
-     * @since 4.9.62.p
161
-     * @throws Exception
162
-     */
163
-    public function registerScriptsAndStyles()
164
-    {
165
-        try {
166
-            foreach ($this->assets as $asset_collection) {
167
-                $this->registerScripts($asset_collection->getJavascriptAssets());
168
-                $this->registerStyles($asset_collection->getStylesheetAssets());
169
-            }
170
-        } catch (Exception $exception) {
171
-            new ExceptionStackTraceDisplay($exception);
172
-        }
173
-    }
174
-
175
-
176
-    /**
177
-     * Registers JS assets with WP core
178
-     *
179
-     * @param JavascriptAsset[] $scripts
180
-     * @throws AssetRegistrationException
181
-     * @throws InvalidDataTypeException
182
-     * @throws DomainException
183
-     * @since 4.9.62.p
184
-     */
185
-    public function registerScripts(array $scripts)
186
-    {
187
-        foreach ($scripts as $script) {
188
-            // skip to next script if this has already been done
189
-            if ($script->isRegistered()) {
190
-                continue;
191
-            }
192
-            do_action(
193
-                'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
194
-                $script
195
-            );
196
-            $registered = wp_register_script(
197
-                $script->handle(),
198
-                $script->source(),
199
-                $script->dependencies(),
200
-                $script->version(),
201
-                $script->loadInFooter()
202
-            );
203
-            if (! $registered && $this->debug()) {
204
-                throw new AssetRegistrationException($script->handle());
205
-            }
206
-            $script->setRegistered($registered);
207
-            if ($script->requiresTranslation()) {
208
-                $this->registerTranslation($script->handle());
209
-            }
210
-            if ($script->enqueueImmediately()) {
211
-                wp_enqueue_script($script->handle());
212
-            }
213
-            do_action(
214
-                'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__after_script',
215
-                $script
216
-            );
217
-        }
218
-    }
219
-
220
-
221
-    /**
222
-     * Registers CSS assets with WP core
223
-     *
224
-     * @param StylesheetAsset[] $styles
225
-     * @throws InvalidDataTypeException
226
-     * @throws DomainException
227
-     * @since 4.9.62.p
228
-     */
229
-    public function registerStyles(array $styles)
230
-    {
231
-        foreach ($styles as $style) {
232
-            // skip to next style if this has already been done
233
-            if ($style->isRegistered()) {
234
-                continue;
235
-            }
236
-            do_action(
237
-                'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__before_style',
238
-                $style
239
-            );
240
-            wp_register_style(
241
-                $style->handle(),
242
-                $style->source(),
243
-                $style->dependencies(),
244
-                $style->version(),
245
-                $style->media()
246
-            );
247
-            $style->setRegistered();
248
-            if ($style->enqueueImmediately()) {
249
-                wp_enqueue_style($style->handle());
250
-            }
251
-            do_action(
252
-                'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__after_style',
253
-                $style
254
-            );
255
-        }
256
-    }
257
-
258
-
259
-    /**
260
-     * Call back for the script print in frontend and backend.
261
-     * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.
262
-     *
263
-     * @throws Exception
264
-     * @since 4.9.31.rc.015
265
-     */
266
-    public function enqueueData()
267
-    {
268
-        try {
269
-            $this->removeAlreadyRegisteredDataForScriptHandles();
270
-            wp_add_inline_script(
271
-                'eejs-core',
272
-                'var eejsdata=' . wp_json_encode(['data' => $this->jsdata]),
273
-                'before'
274
-            );
275
-            foreach ($this->assets as $asset_collection) {
276
-                $scripts = $asset_collection->getJavascriptAssetsWithData();
277
-                foreach ($scripts as $script) {
278
-                    $this->addRegisteredScriptHandlesWithData($script->handle());
279
-                    if ($script->hasInlineDataCallback()) {
280
-                        $localize = $script->inlineDataCallback();
281
-                        $localize();
282
-                    }
283
-                }
284
-            }
285
-        } catch (Exception $exception) {
286
-            EE_Error::add_error($exception->getMessage(), __FILE__, __FUNCTION__, __LINE__);
287
-            new ExceptionStackTraceDisplay($exception);
288
-        }
289
-    }
290
-
291
-
292
-    /**
293
-     * Used to add data to eejs.data object.
294
-     * Note:  Overriding existing data is not allowed.
295
-     * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.
296
-     * If the data you add is something like this:
297
-     *  $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );
298
-     * It will be exposed in the page source as:
299
-     *  eejs.data.my_plugin_data.foo == gar
300
-     *
301
-     * @param string       $key   Key used to access your data
302
-     * @param string|array $value Value to attach to key
303
-     * @throws InvalidArgumentException
304
-     */
305
-    public function addData($key, $value)
306
-    {
307
-        if ($this->verifyDataNotExisting($key)) {
308
-            $this->jsdata[ $key ] = $value;
309
-        }
310
-    }
311
-
312
-
313
-    /**
314
-     * Similar to addData except this allows for users to push values to an existing key where the values on key are
315
-     * elements in an array.
316
-     *
317
-     * When you use this method, the value you include will be merged with the array on $key.
318
-     * So if the $key was 'test' and you added a value of ['my_data'] then it would be represented in the javascript
319
-     * object like this, eejs.data.test = [ my_data,
320
-     * ]
321
-     * If there has already been a scalar value attached to the data object given key (via addData for instance), then
322
-     * this will throw an exception.
323
-     *
324
-     * Caution: Only add data using this method if you are okay with the potential for additional data added on the same
325
-     * key potentially overriding the existing data on merge (specifically with associative arrays).
326
-     *
327
-     * @param string       $key   Key to attach data to.
328
-     * @param string|array $value Value being registered.
329
-     * @throws InvalidArgumentException
330
-     */
331
-    public function pushData($key, $value)
332
-    {
333
-        if (isset($this->jsdata[ $key ])
334
-            && ! is_array($this->jsdata[ $key ])
335
-        ) {
336
-            if (! $this->debug()) {
337
-                return;
338
-            }
339
-            throw new InvalidArgumentException(
340
-                sprintf(
341
-                    __(
342
-                        'The value for %1$s is already set and it is not an array. The %2$s method can only be used to
29
+	const FILE_NAME_BUILD_MANIFEST = 'build-manifest.json';
30
+
31
+	/**
32
+	 * @var AssetCollection[] $assets
33
+	 */
34
+	protected $assets = [];
35
+
36
+	/**
37
+	 * @var I18nRegistry
38
+	 */
39
+	private $i18n_registry;
40
+
41
+	/**
42
+	 * This holds the jsdata data object that will be exposed on pages that enqueue the `eejs-core` script.
43
+	 *
44
+	 * @var array
45
+	 */
46
+	protected $jsdata = array();
47
+
48
+	/**
49
+	 * This keeps track of all scripts with registered data.  It is used to prevent duplicate data objects setup in the
50
+	 * page source.
51
+	 *
52
+	 * @var array
53
+	 */
54
+	private $script_handles_with_data = array();
55
+
56
+
57
+	/**
58
+	 * Holds the manifest data obtained from registered manifest files.
59
+	 * Manifests are maps of asset chunk name to actual built asset file names.
60
+	 * Shape of this array is:
61
+	 * array(
62
+	 *  'some_namespace_slug' => array(
63
+	 *      'some_chunk_name' => array(
64
+	 *          'js' => 'filename.js'
65
+	 *          'css' => 'filename.js'
66
+	 *      ),
67
+	 *      'url_base' => 'https://baseurl.com/to/assets
68
+	 *  )
69
+	 * )
70
+	 *
71
+	 * @var array
72
+	 */
73
+	private $manifest_data = array();
74
+
75
+
76
+	/**
77
+	 * Holds any dependency data obtained from registered dependency map json.
78
+	 * Dependency map json is generated via the @wordpress/dependency-extraction-webpack-plugin via the webpack config.
79
+	 * @see https://github.com/WordPress/gutenberg/tree/master/packages/dependency-extraction-webpack-plugin
80
+	 *
81
+	 * @var array
82
+	 */
83
+	private $dependencies_data = [];
84
+
85
+
86
+	/**
87
+	 * This is a known array of possible wp css handles that correspond to what may be exposed as dependencies in our
88
+	 * build process.  Currently the dependency export process in webpack does not consider css imports, so we derive
89
+	 * them via the js dependencies (WP uses the same handle for both js and css). This is a list of known handles that
90
+	 * are used for both js and css.
91
+	 * @var array
92
+	 */
93
+	private $wp_css_handle_dependencies = [
94
+		'wp-components',
95
+		'wp-block-editor',
96
+		'wp-block-library',
97
+		'wp-edit-post',
98
+		'wp-edit-widgets',
99
+		'wp-editor',
100
+		'wp-format-library',
101
+		'wp-list-reusable-blocks',
102
+		'wp-nux',
103
+	];
104
+
105
+
106
+	/**
107
+	 * Registry constructor.
108
+	 * Hooking into WP actions for script registry.
109
+	 *
110
+	 * @param AssetCollection      $assets
111
+	 * @param I18nRegistry         $i18n_registry
112
+	 * @throws InvalidArgumentException
113
+	 * @throws InvalidDataTypeException
114
+	 * @throws InvalidInterfaceException
115
+	 */
116
+	public function __construct(AssetCollection $assets, I18nRegistry $i18n_registry)
117
+	{
118
+		$this->addAssetCollection($assets);
119
+		$this->i18n_registry = $i18n_registry;
120
+		add_action('wp_enqueue_scripts', array($this, 'registerManifestFiles'), 1);
121
+		add_action('admin_enqueue_scripts', array($this, 'registerManifestFiles'), 1);
122
+		add_action('wp_enqueue_scripts', array($this, 'registerScriptsAndStyles'), 4);
123
+		add_action('admin_enqueue_scripts', array($this, 'registerScriptsAndStyles'), 4);
124
+		add_action('wp_enqueue_scripts', array($this, 'enqueueData'), 5);
125
+		add_action('admin_enqueue_scripts', array($this, 'enqueueData'), 5);
126
+		add_action('wp_print_footer_scripts', array($this, 'enqueueData'), 1);
127
+		add_action('admin_print_footer_scripts', array($this, 'enqueueData'), 1);
128
+	}
129
+
130
+
131
+	/**
132
+	 * @param AssetCollection $asset_collection
133
+	 */
134
+	public function addAssetCollection(AssetCollection $asset_collection)
135
+	{
136
+		$id = spl_object_hash($asset_collection);
137
+		if (! array_key_exists($id, $this->assets)) {
138
+			$this->assets[ $id ] = $asset_collection;
139
+		}
140
+	}
141
+
142
+
143
+
144
+
145
+	/**
146
+	 * For classes that have Registry as a dependency, this provides a handy way to register script handles for i18n
147
+	 * translation handling.
148
+	 *
149
+	 * @return I18nRegistry
150
+	 */
151
+	public function getI18nRegistry()
152
+	{
153
+		return $this->i18n_registry;
154
+	}
155
+
156
+
157
+	/**
158
+	 * Callback for the wp_enqueue_scripts actions used to register assets.
159
+	 *
160
+	 * @since 4.9.62.p
161
+	 * @throws Exception
162
+	 */
163
+	public function registerScriptsAndStyles()
164
+	{
165
+		try {
166
+			foreach ($this->assets as $asset_collection) {
167
+				$this->registerScripts($asset_collection->getJavascriptAssets());
168
+				$this->registerStyles($asset_collection->getStylesheetAssets());
169
+			}
170
+		} catch (Exception $exception) {
171
+			new ExceptionStackTraceDisplay($exception);
172
+		}
173
+	}
174
+
175
+
176
+	/**
177
+	 * Registers JS assets with WP core
178
+	 *
179
+	 * @param JavascriptAsset[] $scripts
180
+	 * @throws AssetRegistrationException
181
+	 * @throws InvalidDataTypeException
182
+	 * @throws DomainException
183
+	 * @since 4.9.62.p
184
+	 */
185
+	public function registerScripts(array $scripts)
186
+	{
187
+		foreach ($scripts as $script) {
188
+			// skip to next script if this has already been done
189
+			if ($script->isRegistered()) {
190
+				continue;
191
+			}
192
+			do_action(
193
+				'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
194
+				$script
195
+			);
196
+			$registered = wp_register_script(
197
+				$script->handle(),
198
+				$script->source(),
199
+				$script->dependencies(),
200
+				$script->version(),
201
+				$script->loadInFooter()
202
+			);
203
+			if (! $registered && $this->debug()) {
204
+				throw new AssetRegistrationException($script->handle());
205
+			}
206
+			$script->setRegistered($registered);
207
+			if ($script->requiresTranslation()) {
208
+				$this->registerTranslation($script->handle());
209
+			}
210
+			if ($script->enqueueImmediately()) {
211
+				wp_enqueue_script($script->handle());
212
+			}
213
+			do_action(
214
+				'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__after_script',
215
+				$script
216
+			);
217
+		}
218
+	}
219
+
220
+
221
+	/**
222
+	 * Registers CSS assets with WP core
223
+	 *
224
+	 * @param StylesheetAsset[] $styles
225
+	 * @throws InvalidDataTypeException
226
+	 * @throws DomainException
227
+	 * @since 4.9.62.p
228
+	 */
229
+	public function registerStyles(array $styles)
230
+	{
231
+		foreach ($styles as $style) {
232
+			// skip to next style if this has already been done
233
+			if ($style->isRegistered()) {
234
+				continue;
235
+			}
236
+			do_action(
237
+				'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__before_style',
238
+				$style
239
+			);
240
+			wp_register_style(
241
+				$style->handle(),
242
+				$style->source(),
243
+				$style->dependencies(),
244
+				$style->version(),
245
+				$style->media()
246
+			);
247
+			$style->setRegistered();
248
+			if ($style->enqueueImmediately()) {
249
+				wp_enqueue_style($style->handle());
250
+			}
251
+			do_action(
252
+				'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__after_style',
253
+				$style
254
+			);
255
+		}
256
+	}
257
+
258
+
259
+	/**
260
+	 * Call back for the script print in frontend and backend.
261
+	 * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.
262
+	 *
263
+	 * @throws Exception
264
+	 * @since 4.9.31.rc.015
265
+	 */
266
+	public function enqueueData()
267
+	{
268
+		try {
269
+			$this->removeAlreadyRegisteredDataForScriptHandles();
270
+			wp_add_inline_script(
271
+				'eejs-core',
272
+				'var eejsdata=' . wp_json_encode(['data' => $this->jsdata]),
273
+				'before'
274
+			);
275
+			foreach ($this->assets as $asset_collection) {
276
+				$scripts = $asset_collection->getJavascriptAssetsWithData();
277
+				foreach ($scripts as $script) {
278
+					$this->addRegisteredScriptHandlesWithData($script->handle());
279
+					if ($script->hasInlineDataCallback()) {
280
+						$localize = $script->inlineDataCallback();
281
+						$localize();
282
+					}
283
+				}
284
+			}
285
+		} catch (Exception $exception) {
286
+			EE_Error::add_error($exception->getMessage(), __FILE__, __FUNCTION__, __LINE__);
287
+			new ExceptionStackTraceDisplay($exception);
288
+		}
289
+	}
290
+
291
+
292
+	/**
293
+	 * Used to add data to eejs.data object.
294
+	 * Note:  Overriding existing data is not allowed.
295
+	 * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.
296
+	 * If the data you add is something like this:
297
+	 *  $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );
298
+	 * It will be exposed in the page source as:
299
+	 *  eejs.data.my_plugin_data.foo == gar
300
+	 *
301
+	 * @param string       $key   Key used to access your data
302
+	 * @param string|array $value Value to attach to key
303
+	 * @throws InvalidArgumentException
304
+	 */
305
+	public function addData($key, $value)
306
+	{
307
+		if ($this->verifyDataNotExisting($key)) {
308
+			$this->jsdata[ $key ] = $value;
309
+		}
310
+	}
311
+
312
+
313
+	/**
314
+	 * Similar to addData except this allows for users to push values to an existing key where the values on key are
315
+	 * elements in an array.
316
+	 *
317
+	 * When you use this method, the value you include will be merged with the array on $key.
318
+	 * So if the $key was 'test' and you added a value of ['my_data'] then it would be represented in the javascript
319
+	 * object like this, eejs.data.test = [ my_data,
320
+	 * ]
321
+	 * If there has already been a scalar value attached to the data object given key (via addData for instance), then
322
+	 * this will throw an exception.
323
+	 *
324
+	 * Caution: Only add data using this method if you are okay with the potential for additional data added on the same
325
+	 * key potentially overriding the existing data on merge (specifically with associative arrays).
326
+	 *
327
+	 * @param string       $key   Key to attach data to.
328
+	 * @param string|array $value Value being registered.
329
+	 * @throws InvalidArgumentException
330
+	 */
331
+	public function pushData($key, $value)
332
+	{
333
+		if (isset($this->jsdata[ $key ])
334
+			&& ! is_array($this->jsdata[ $key ])
335
+		) {
336
+			if (! $this->debug()) {
337
+				return;
338
+			}
339
+			throw new InvalidArgumentException(
340
+				sprintf(
341
+					__(
342
+						'The value for %1$s is already set and it is not an array. The %2$s method can only be used to
343 343
                          push values to this data element when it is an array.',
344
-                        'event_espresso'
345
-                    ),
346
-                    $key,
347
-                    __METHOD__
348
-                )
349
-            );
350
-        }
351
-        if ( ! isset( $this->jsdata[ $key ] ) ) {
352
-            $this->jsdata[ $key ] = is_array($value) ? $value : [$value];
353
-        } else {
354
-            $this->jsdata[ $key ] = array_merge( $this->jsdata[$key], (array) $value);
355
-        }
356
-    }
357
-
358
-
359
-    /**
360
-     * Used to set content used by javascript for a template.
361
-     * Note: Overrides of existing registered templates are not allowed.
362
-     *
363
-     * @param string $template_reference
364
-     * @param string $template_content
365
-     * @throws InvalidArgumentException
366
-     */
367
-    public function addTemplate($template_reference, $template_content)
368
-    {
369
-        if (! isset($this->jsdata['templates'])) {
370
-            $this->jsdata['templates'] = array();
371
-        }
372
-        //no overrides allowed.
373
-        if (isset($this->jsdata['templates'][ $template_reference ])) {
374
-            if (! $this->debug()) {
375
-                return;
376
-            }
377
-            throw new InvalidArgumentException(
378
-                sprintf(
379
-                    __(
380
-                        'The %1$s key already exists for the templates array in the js data array.  No overrides are allowed.',
381
-                        'event_espresso'
382
-                    ),
383
-                    $template_reference
384
-                )
385
-            );
386
-        }
387
-        $this->jsdata['templates'][ $template_reference ] = $template_content;
388
-    }
389
-
390
-
391
-    /**
392
-     * Retrieve the template content already registered for the given reference.
393
-     *
394
-     * @param string $template_reference
395
-     * @return string
396
-     */
397
-    public function getTemplate($template_reference)
398
-    {
399
-        return isset($this->jsdata['templates'][ $template_reference ])
400
-            ? $this->jsdata['templates'][ $template_reference ]
401
-            : '';
402
-    }
403
-
404
-
405
-    /**
406
-     * Retrieve registered data.
407
-     *
408
-     * @param string $key Name of key to attach data to.
409
-     * @return mixed                If there is no for the given key, then false is returned.
410
-     */
411
-    public function getData($key)
412
-    {
413
-        return isset($this->jsdata[ $key ])
414
-            ? $this->jsdata[ $key ]
415
-            : false;
416
-    }
417
-
418
-
419
-    /**
420
-     * Verifies whether the given data exists already on the jsdata array.
421
-     * Overriding data is not allowed.
422
-     *
423
-     * @param string $key Index for data.
424
-     * @return bool        If valid then return true.
425
-     * @throws InvalidArgumentException if data already exists.
426
-     */
427
-    protected function verifyDataNotExisting($key)
428
-    {
429
-        if (isset($this->jsdata[ $key ])) {
430
-            if (! $this->debug()) {
431
-                return false;
432
-            }
433
-            if (is_array($this->jsdata[ $key ])) {
434
-                throw new InvalidArgumentException(
435
-                    sprintf(
436
-                        __(
437
-                            'The value for %1$s already exists in the Registry::eejs object.
344
+						'event_espresso'
345
+					),
346
+					$key,
347
+					__METHOD__
348
+				)
349
+			);
350
+		}
351
+		if ( ! isset( $this->jsdata[ $key ] ) ) {
352
+			$this->jsdata[ $key ] = is_array($value) ? $value : [$value];
353
+		} else {
354
+			$this->jsdata[ $key ] = array_merge( $this->jsdata[$key], (array) $value);
355
+		}
356
+	}
357
+
358
+
359
+	/**
360
+	 * Used to set content used by javascript for a template.
361
+	 * Note: Overrides of existing registered templates are not allowed.
362
+	 *
363
+	 * @param string $template_reference
364
+	 * @param string $template_content
365
+	 * @throws InvalidArgumentException
366
+	 */
367
+	public function addTemplate($template_reference, $template_content)
368
+	{
369
+		if (! isset($this->jsdata['templates'])) {
370
+			$this->jsdata['templates'] = array();
371
+		}
372
+		//no overrides allowed.
373
+		if (isset($this->jsdata['templates'][ $template_reference ])) {
374
+			if (! $this->debug()) {
375
+				return;
376
+			}
377
+			throw new InvalidArgumentException(
378
+				sprintf(
379
+					__(
380
+						'The %1$s key already exists for the templates array in the js data array.  No overrides are allowed.',
381
+						'event_espresso'
382
+					),
383
+					$template_reference
384
+				)
385
+			);
386
+		}
387
+		$this->jsdata['templates'][ $template_reference ] = $template_content;
388
+	}
389
+
390
+
391
+	/**
392
+	 * Retrieve the template content already registered for the given reference.
393
+	 *
394
+	 * @param string $template_reference
395
+	 * @return string
396
+	 */
397
+	public function getTemplate($template_reference)
398
+	{
399
+		return isset($this->jsdata['templates'][ $template_reference ])
400
+			? $this->jsdata['templates'][ $template_reference ]
401
+			: '';
402
+	}
403
+
404
+
405
+	/**
406
+	 * Retrieve registered data.
407
+	 *
408
+	 * @param string $key Name of key to attach data to.
409
+	 * @return mixed                If there is no for the given key, then false is returned.
410
+	 */
411
+	public function getData($key)
412
+	{
413
+		return isset($this->jsdata[ $key ])
414
+			? $this->jsdata[ $key ]
415
+			: false;
416
+	}
417
+
418
+
419
+	/**
420
+	 * Verifies whether the given data exists already on the jsdata array.
421
+	 * Overriding data is not allowed.
422
+	 *
423
+	 * @param string $key Index for data.
424
+	 * @return bool        If valid then return true.
425
+	 * @throws InvalidArgumentException if data already exists.
426
+	 */
427
+	protected function verifyDataNotExisting($key)
428
+	{
429
+		if (isset($this->jsdata[ $key ])) {
430
+			if (! $this->debug()) {
431
+				return false;
432
+			}
433
+			if (is_array($this->jsdata[ $key ])) {
434
+				throw new InvalidArgumentException(
435
+					sprintf(
436
+						__(
437
+							'The value for %1$s already exists in the Registry::eejs object.
438 438
                             Overrides are not allowed. Since the value of this data is an array, you may want to use the
439 439
                             %2$s method to push your value to the array.',
440
-                            'event_espresso'
441
-                        ),
442
-                        $key,
443
-                        'pushData()'
444
-                    )
445
-                );
446
-            }
447
-            throw new InvalidArgumentException(
448
-                sprintf(
449
-                    __(
450
-                        'The value for %1$s already exists in the Registry::eejs object. Overrides are not
440
+							'event_espresso'
441
+						),
442
+						$key,
443
+						'pushData()'
444
+					)
445
+				);
446
+			}
447
+			throw new InvalidArgumentException(
448
+				sprintf(
449
+					__(
450
+						'The value for %1$s already exists in the Registry::eejs object. Overrides are not
451 451
                         allowed.  Consider attaching your value to a different key',
452
-                        'event_espresso'
453
-                    ),
454
-                    $key
455
-                )
456
-            );
457
-        }
458
-        return true;
459
-    }
460
-
461
-
462
-    /**
463
-     * Get the actual asset path for asset manifests.
464
-     * If there is no asset path found for the given $chunk_name, then the $chunk_name is returned.
465
-     *
466
-     * @param string $namespace  The namespace associated with the manifest file hosting the map of chunk_name to actual
467
-     *                           asset file location.
468
-     * @param string $chunk_name
469
-     * @param string $asset_type
470
-     * @return string
471
-     * @since 4.9.59.p
472
-     */
473
-    public function getAssetUrl($namespace, $chunk_name, $asset_type)
474
-    {
475
-        $asset_index = $chunk_name . '.' . $asset_type;
476
-        $url = isset(
477
-            $this->manifest_data[ $namespace ][ $asset_index ],
478
-            $this->manifest_data[ $namespace ]['url_base']
479
-        )
480
-            ? $this->manifest_data[ $namespace ]['url_base']
481
-              . $this->manifest_data[ $namespace ][ $asset_index ]
482
-            : '';
483
-        return apply_filters(
484
-            'FHEE__EventEspresso_core_services_assets_Registry__getAssetUrl',
485
-            $url,
486
-            $namespace,
487
-            $chunk_name,
488
-            $asset_type
489
-        );
490
-    }
491
-
492
-
493
-
494
-    /**
495
-     * Return the url to a js file for the given namespace and chunk name.
496
-     *
497
-     * @param string $namespace
498
-     * @param string $chunk_name
499
-     * @return string
500
-     */
501
-    public function getJsUrl($namespace, $chunk_name)
502
-    {
503
-        return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_JS);
504
-    }
505
-
506
-
507
-    /**
508
-     * Return the url to a css file for the given namespace and chunk name.
509
-     *
510
-     * @param string $namespace
511
-     * @param string $chunk_name
512
-     * @return string
513
-     */
514
-    public function getCssUrl($namespace, $chunk_name)
515
-    {
516
-        return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_CSS);
517
-    }
518
-
519
-
520
-    /**
521
-     * Return the dependencies array and version string for a given asset $chunk_name
522
-     *
523
-     * @param string $namespace
524
-     * @param string $chunk_name
525
-     * @param string $asset_type
526
-     * @return array
527
-     * @since 4.9.82.p
528
-     */
529
-    private function getDetailsForAsset($namespace, $chunk_name, $asset_type)
530
-    {
531
-        $asset_index = $chunk_name . '.' . $asset_type;
532
-        if (! isset( $this->dependencies_data[ $namespace ][ $asset_index ])) {
533
-            $path = isset($this->manifest_data[ $namespace ]['path'])
534
-                ? $this->manifest_data[ $namespace ]['path']
535
-                : '';
536
-            $dependencies_index = $chunk_name . '.' . Asset::TYPE_PHP;
537
-            $file_path = isset($this->manifest_data[ $namespace ][ $dependencies_index ])
538
-                ? $path . $this->manifest_data[ $namespace ][ $dependencies_index ]
539
-                :
540
-                '';
541
-            $this->dependencies_data[ $namespace ][ $asset_index ] = $file_path !== '' && file_exists($file_path)
542
-                ? $this->getDetailsForAssetType($namespace, $asset_type, $file_path, $chunk_name)
543
-                : [];
544
-        }
545
-        return $this->dependencies_data[ $namespace ][ $asset_index ];
546
-    }
547
-
548
-
549
-    /**
550
-     * Return dependencies array and version string according to asset type.
551
-     * For css assets, this filters the auto generated dependencies by css type.
552
-     *
553
-     * @param string $namespace
554
-     * @param string $asset_type
555
-     * @param string $file_path
556
-     * @param string $chunk_name
557
-     * @return array
558
-     * @since 4.9.82.p
559
-     */
560
-    private function getDetailsForAssetType($namespace, $asset_type, $file_path, $chunk_name)
561
-    {
562
-        // $asset_dependencies = json_decode(file_get_contents($file_path), true);
563
-        $asset_details = require($file_path);
564
-        $asset_details['dependencies'] = isset($asset_details['dependencies'])
565
-            ? $asset_details['dependencies']
566
-            : [];
567
-        $asset_details['version'] = isset($asset_details['version'])
568
-            ? $asset_details['version']
569
-            : '';
570
-        if ($asset_type === Asset::TYPE_JS) {
571
-            $asset_details['dependencies'] =  $chunk_name === 'eejs-core'
572
-                ? $asset_details['dependencies']
573
-                : $asset_details['dependencies'] + [ CoreAssetManager::JS_HANDLE_JS_CORE ];
574
-            return $asset_details;
575
-        }
576
-        // for css we need to make sure there is actually a css file related to this chunk.
577
-        if (isset($this->manifest_data[ $namespace ])) {
578
-            // array of css chunk files for ee.
579
-            $css_chunks = array_map(
580
-                static function ($value) {
581
-                    return str_replace('.css', '', $value);
582
-                },
583
-                array_filter(
584
-                    array_keys($this->manifest_data[ $namespace ]),
585
-                    static function ($value) {
586
-                        return strpos($value, '.css') !== false;
587
-                    }
588
-                )
589
-            );
590
-            // add known wp chunks with css
591
-            $css_chunks = array_merge( $css_chunks, $this->wp_css_handle_dependencies);
592
-            // flip for easier search
593
-            $css_chunks = array_flip($css_chunks);
594
-
595
-            // now let's filter the dependencies for the incoming chunk to actual chunks that have styles
596
-            $asset_details['dependencies'] = array_filter(
597
-                $asset_details['dependencies'],
598
-                static function ($chunk_name) use ($css_chunks) {
599
-                    return isset($css_chunks[ $chunk_name ]);
600
-                }
601
-            );
602
-            return $asset_details;
603
-        }
604
-        return ['dependencies' => [], 'version' => ''];
605
-    }
606
-
607
-
608
-    /**
609
-     * Get the dependencies array and version string for the given js asset chunk name
610
-     *
611
-     * @param string $namespace
612
-     * @param string $chunk_name
613
-     * @return array
614
-     * @since 4.10.2.p
615
-     */
616
-    public function getJsAssetDetails($namespace, $chunk_name)
617
-    {
618
-        return $this->getDetailsForAsset($namespace, $chunk_name, Asset::TYPE_JS);
619
-    }
620
-
621
-
622
-    /**
623
-     * Get the dependencies array and version string for the given css asset chunk name
624
-     *
625
-     * @param string $namespace
626
-     * @param string $chunk_name
627
-     * @return array
628
-     * @since 4.10.2.p
629
-     */
630
-    public function getCssAssetDetails($namespace, $chunk_name)
631
-    {
632
-        return $this->getDetailsForAsset($namespace, $chunk_name, Asset::TYPE_CSS);
633
-    }
634
-
635
-
636
-    /**
637
-     * @throws Exception
638
-     * @throws InvalidArgumentException
639
-     * @throws InvalidFilePathException
640
-     * @since 4.9.62.p
641
-     */
642
-    public function registerManifestFiles()
643
-    {
644
-        try {
645
-            foreach ($this->assets as $asset_collection) {
646
-                $manifest_files = $asset_collection->getManifestFiles();
647
-                foreach ($manifest_files as $manifest_file) {
648
-                    $this->registerManifestFile(
649
-                        $manifest_file->assetNamespace(),
650
-                        $manifest_file->urlBase(),
651
-                        $manifest_file->filepath() . Registry::FILE_NAME_BUILD_MANIFEST,
652
-                        $manifest_file->filepath()
653
-                    );
654
-                }
655
-            }
656
-        } catch (Exception $exception) {
657
-            EE_Error::add_error($exception->getMessage(), __FILE__, __FUNCTION__, __LINE__);
658
-            new ExceptionStackTraceDisplay($exception);
659
-        }
660
-    }
661
-
662
-
663
-    /**
664
-     * Used to register a js/css manifest file with the registered_manifest_files property.
665
-     *
666
-     * @param string $namespace     Provided to associate the manifest file with a specific namespace.
667
-     * @param string $url_base      The url base for the manifest file location.
668
-     * @param string $manifest_file The absolute path to the manifest file.
669
-     * @param string $manifest_file_path  The path to the folder containing the manifest file. If not provided will be
670
-     *                                    default to `plugin_root/assets/dist`.
671
-     * @throws InvalidArgumentException
672
-     * @throws InvalidFilePathException
673
-     * @since 4.9.59.p
674
-     */
675
-    public function registerManifestFile($namespace, $url_base, $manifest_file, $manifest_file_path = '')
676
-    {
677
-        if (isset($this->manifest_data[ $namespace ])) {
678
-            if (! $this->debug()) {
679
-                return;
680
-            }
681
-            throw new InvalidArgumentException(
682
-                sprintf(
683
-                    esc_html__(
684
-                        'The namespace for this manifest file has already been registered, choose a namespace other than %s',
685
-                        'event_espresso'
686
-                    ),
687
-                    $namespace
688
-                )
689
-            );
690
-        }
691
-        if (filter_var($url_base, FILTER_VALIDATE_URL) === false) {
692
-            if (is_admin()) {
693
-                EE_Error::add_error(
694
-                    sprintf(
695
-                        esc_html__(
696
-                            'The url given for %1$s assets is invalid.  The url provided was: "%2$s". This usually happens when another plugin or theme on a site is using the "%3$s" filter or has an invalid url set for the "%4$s" constant',
697
-                            'event_espresso'
698
-                        ),
699
-                        'Event Espresso',
700
-                        $url_base,
701
-                        'plugins_url',
702
-                        'WP_PLUGIN_URL'
703
-                    ),
704
-                    __FILE__,
705
-                    __FUNCTION__,
706
-                    __LINE__
707
-                );
708
-            }
709
-            return;
710
-        }
711
-        $this->manifest_data[ $namespace ] = $this->decodeManifestFile($manifest_file);
712
-        if (! isset($this->manifest_data[ $namespace ]['url_base'])) {
713
-            $this->manifest_data[ $namespace ]['url_base'] = untrailingslashit($url_base);
714
-        }
715
-        if (! isset($this->manifest_data[ $namespace ]['path'])) {
716
-            $this->manifest_data[ $namespace ]['path'] = untrailingslashit($manifest_file_path);
717
-        }
718
-    }
719
-
720
-
721
-    /**
722
-     * Decodes json from the provided manifest file.
723
-     *
724
-     * @since 4.9.59.p
725
-     * @param string $manifest_file Path to manifest file.
726
-     * @return array
727
-     * @throws InvalidFilePathException
728
-     */
729
-    private function decodeManifestFile($manifest_file)
730
-    {
731
-        if (! file_exists($manifest_file)) {
732
-            throw new InvalidFilePathException($manifest_file);
733
-        }
734
-        return json_decode(file_get_contents($manifest_file), true);
735
-    }
736
-
737
-
738
-    /**
739
-     * This is used to set registered script handles that have data.
740
-     *
741
-     * @param string $script_handle
742
-     */
743
-    private function addRegisteredScriptHandlesWithData($script_handle)
744
-    {
745
-        $this->script_handles_with_data[ $script_handle ] = $script_handle;
746
-    }
747
-
748
-
749
-    /**i
452
+						'event_espresso'
453
+					),
454
+					$key
455
+				)
456
+			);
457
+		}
458
+		return true;
459
+	}
460
+
461
+
462
+	/**
463
+	 * Get the actual asset path for asset manifests.
464
+	 * If there is no asset path found for the given $chunk_name, then the $chunk_name is returned.
465
+	 *
466
+	 * @param string $namespace  The namespace associated with the manifest file hosting the map of chunk_name to actual
467
+	 *                           asset file location.
468
+	 * @param string $chunk_name
469
+	 * @param string $asset_type
470
+	 * @return string
471
+	 * @since 4.9.59.p
472
+	 */
473
+	public function getAssetUrl($namespace, $chunk_name, $asset_type)
474
+	{
475
+		$asset_index = $chunk_name . '.' . $asset_type;
476
+		$url = isset(
477
+			$this->manifest_data[ $namespace ][ $asset_index ],
478
+			$this->manifest_data[ $namespace ]['url_base']
479
+		)
480
+			? $this->manifest_data[ $namespace ]['url_base']
481
+			  . $this->manifest_data[ $namespace ][ $asset_index ]
482
+			: '';
483
+		return apply_filters(
484
+			'FHEE__EventEspresso_core_services_assets_Registry__getAssetUrl',
485
+			$url,
486
+			$namespace,
487
+			$chunk_name,
488
+			$asset_type
489
+		);
490
+	}
491
+
492
+
493
+
494
+	/**
495
+	 * Return the url to a js file for the given namespace and chunk name.
496
+	 *
497
+	 * @param string $namespace
498
+	 * @param string $chunk_name
499
+	 * @return string
500
+	 */
501
+	public function getJsUrl($namespace, $chunk_name)
502
+	{
503
+		return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_JS);
504
+	}
505
+
506
+
507
+	/**
508
+	 * Return the url to a css file for the given namespace and chunk name.
509
+	 *
510
+	 * @param string $namespace
511
+	 * @param string $chunk_name
512
+	 * @return string
513
+	 */
514
+	public function getCssUrl($namespace, $chunk_name)
515
+	{
516
+		return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_CSS);
517
+	}
518
+
519
+
520
+	/**
521
+	 * Return the dependencies array and version string for a given asset $chunk_name
522
+	 *
523
+	 * @param string $namespace
524
+	 * @param string $chunk_name
525
+	 * @param string $asset_type
526
+	 * @return array
527
+	 * @since 4.9.82.p
528
+	 */
529
+	private function getDetailsForAsset($namespace, $chunk_name, $asset_type)
530
+	{
531
+		$asset_index = $chunk_name . '.' . $asset_type;
532
+		if (! isset( $this->dependencies_data[ $namespace ][ $asset_index ])) {
533
+			$path = isset($this->manifest_data[ $namespace ]['path'])
534
+				? $this->manifest_data[ $namespace ]['path']
535
+				: '';
536
+			$dependencies_index = $chunk_name . '.' . Asset::TYPE_PHP;
537
+			$file_path = isset($this->manifest_data[ $namespace ][ $dependencies_index ])
538
+				? $path . $this->manifest_data[ $namespace ][ $dependencies_index ]
539
+				:
540
+				'';
541
+			$this->dependencies_data[ $namespace ][ $asset_index ] = $file_path !== '' && file_exists($file_path)
542
+				? $this->getDetailsForAssetType($namespace, $asset_type, $file_path, $chunk_name)
543
+				: [];
544
+		}
545
+		return $this->dependencies_data[ $namespace ][ $asset_index ];
546
+	}
547
+
548
+
549
+	/**
550
+	 * Return dependencies array and version string according to asset type.
551
+	 * For css assets, this filters the auto generated dependencies by css type.
552
+	 *
553
+	 * @param string $namespace
554
+	 * @param string $asset_type
555
+	 * @param string $file_path
556
+	 * @param string $chunk_name
557
+	 * @return array
558
+	 * @since 4.9.82.p
559
+	 */
560
+	private function getDetailsForAssetType($namespace, $asset_type, $file_path, $chunk_name)
561
+	{
562
+		// $asset_dependencies = json_decode(file_get_contents($file_path), true);
563
+		$asset_details = require($file_path);
564
+		$asset_details['dependencies'] = isset($asset_details['dependencies'])
565
+			? $asset_details['dependencies']
566
+			: [];
567
+		$asset_details['version'] = isset($asset_details['version'])
568
+			? $asset_details['version']
569
+			: '';
570
+		if ($asset_type === Asset::TYPE_JS) {
571
+			$asset_details['dependencies'] =  $chunk_name === 'eejs-core'
572
+				? $asset_details['dependencies']
573
+				: $asset_details['dependencies'] + [ CoreAssetManager::JS_HANDLE_JS_CORE ];
574
+			return $asset_details;
575
+		}
576
+		// for css we need to make sure there is actually a css file related to this chunk.
577
+		if (isset($this->manifest_data[ $namespace ])) {
578
+			// array of css chunk files for ee.
579
+			$css_chunks = array_map(
580
+				static function ($value) {
581
+					return str_replace('.css', '', $value);
582
+				},
583
+				array_filter(
584
+					array_keys($this->manifest_data[ $namespace ]),
585
+					static function ($value) {
586
+						return strpos($value, '.css') !== false;
587
+					}
588
+				)
589
+			);
590
+			// add known wp chunks with css
591
+			$css_chunks = array_merge( $css_chunks, $this->wp_css_handle_dependencies);
592
+			// flip for easier search
593
+			$css_chunks = array_flip($css_chunks);
594
+
595
+			// now let's filter the dependencies for the incoming chunk to actual chunks that have styles
596
+			$asset_details['dependencies'] = array_filter(
597
+				$asset_details['dependencies'],
598
+				static function ($chunk_name) use ($css_chunks) {
599
+					return isset($css_chunks[ $chunk_name ]);
600
+				}
601
+			);
602
+			return $asset_details;
603
+		}
604
+		return ['dependencies' => [], 'version' => ''];
605
+	}
606
+
607
+
608
+	/**
609
+	 * Get the dependencies array and version string for the given js asset chunk name
610
+	 *
611
+	 * @param string $namespace
612
+	 * @param string $chunk_name
613
+	 * @return array
614
+	 * @since 4.10.2.p
615
+	 */
616
+	public function getJsAssetDetails($namespace, $chunk_name)
617
+	{
618
+		return $this->getDetailsForAsset($namespace, $chunk_name, Asset::TYPE_JS);
619
+	}
620
+
621
+
622
+	/**
623
+	 * Get the dependencies array and version string for the given css asset chunk name
624
+	 *
625
+	 * @param string $namespace
626
+	 * @param string $chunk_name
627
+	 * @return array
628
+	 * @since 4.10.2.p
629
+	 */
630
+	public function getCssAssetDetails($namespace, $chunk_name)
631
+	{
632
+		return $this->getDetailsForAsset($namespace, $chunk_name, Asset::TYPE_CSS);
633
+	}
634
+
635
+
636
+	/**
637
+	 * @throws Exception
638
+	 * @throws InvalidArgumentException
639
+	 * @throws InvalidFilePathException
640
+	 * @since 4.9.62.p
641
+	 */
642
+	public function registerManifestFiles()
643
+	{
644
+		try {
645
+			foreach ($this->assets as $asset_collection) {
646
+				$manifest_files = $asset_collection->getManifestFiles();
647
+				foreach ($manifest_files as $manifest_file) {
648
+					$this->registerManifestFile(
649
+						$manifest_file->assetNamespace(),
650
+						$manifest_file->urlBase(),
651
+						$manifest_file->filepath() . Registry::FILE_NAME_BUILD_MANIFEST,
652
+						$manifest_file->filepath()
653
+					);
654
+				}
655
+			}
656
+		} catch (Exception $exception) {
657
+			EE_Error::add_error($exception->getMessage(), __FILE__, __FUNCTION__, __LINE__);
658
+			new ExceptionStackTraceDisplay($exception);
659
+		}
660
+	}
661
+
662
+
663
+	/**
664
+	 * Used to register a js/css manifest file with the registered_manifest_files property.
665
+	 *
666
+	 * @param string $namespace     Provided to associate the manifest file with a specific namespace.
667
+	 * @param string $url_base      The url base for the manifest file location.
668
+	 * @param string $manifest_file The absolute path to the manifest file.
669
+	 * @param string $manifest_file_path  The path to the folder containing the manifest file. If not provided will be
670
+	 *                                    default to `plugin_root/assets/dist`.
671
+	 * @throws InvalidArgumentException
672
+	 * @throws InvalidFilePathException
673
+	 * @since 4.9.59.p
674
+	 */
675
+	public function registerManifestFile($namespace, $url_base, $manifest_file, $manifest_file_path = '')
676
+	{
677
+		if (isset($this->manifest_data[ $namespace ])) {
678
+			if (! $this->debug()) {
679
+				return;
680
+			}
681
+			throw new InvalidArgumentException(
682
+				sprintf(
683
+					esc_html__(
684
+						'The namespace for this manifest file has already been registered, choose a namespace other than %s',
685
+						'event_espresso'
686
+					),
687
+					$namespace
688
+				)
689
+			);
690
+		}
691
+		if (filter_var($url_base, FILTER_VALIDATE_URL) === false) {
692
+			if (is_admin()) {
693
+				EE_Error::add_error(
694
+					sprintf(
695
+						esc_html__(
696
+							'The url given for %1$s assets is invalid.  The url provided was: "%2$s". This usually happens when another plugin or theme on a site is using the "%3$s" filter or has an invalid url set for the "%4$s" constant',
697
+							'event_espresso'
698
+						),
699
+						'Event Espresso',
700
+						$url_base,
701
+						'plugins_url',
702
+						'WP_PLUGIN_URL'
703
+					),
704
+					__FILE__,
705
+					__FUNCTION__,
706
+					__LINE__
707
+				);
708
+			}
709
+			return;
710
+		}
711
+		$this->manifest_data[ $namespace ] = $this->decodeManifestFile($manifest_file);
712
+		if (! isset($this->manifest_data[ $namespace ]['url_base'])) {
713
+			$this->manifest_data[ $namespace ]['url_base'] = untrailingslashit($url_base);
714
+		}
715
+		if (! isset($this->manifest_data[ $namespace ]['path'])) {
716
+			$this->manifest_data[ $namespace ]['path'] = untrailingslashit($manifest_file_path);
717
+		}
718
+	}
719
+
720
+
721
+	/**
722
+	 * Decodes json from the provided manifest file.
723
+	 *
724
+	 * @since 4.9.59.p
725
+	 * @param string $manifest_file Path to manifest file.
726
+	 * @return array
727
+	 * @throws InvalidFilePathException
728
+	 */
729
+	private function decodeManifestFile($manifest_file)
730
+	{
731
+		if (! file_exists($manifest_file)) {
732
+			throw new InvalidFilePathException($manifest_file);
733
+		}
734
+		return json_decode(file_get_contents($manifest_file), true);
735
+	}
736
+
737
+
738
+	/**
739
+	 * This is used to set registered script handles that have data.
740
+	 *
741
+	 * @param string $script_handle
742
+	 */
743
+	private function addRegisteredScriptHandlesWithData($script_handle)
744
+	{
745
+		$this->script_handles_with_data[ $script_handle ] = $script_handle;
746
+	}
747
+
748
+
749
+	/**i
750 750
      * Checks WP_Scripts for all of each script handle registered internally as having data and unsets from the
751 751
      * Dependency stored in WP_Scripts if its set.
752 752
      */
753
-    private function removeAlreadyRegisteredDataForScriptHandles()
754
-    {
755
-        if (empty($this->script_handles_with_data)) {
756
-            return;
757
-        }
758
-        foreach ($this->script_handles_with_data as $script_handle) {
759
-            $this->removeAlreadyRegisteredDataForScriptHandle($script_handle);
760
-        }
761
-    }
762
-
763
-
764
-    /**
765
-     * Removes any data dependency registered in WP_Scripts if its set.
766
-     *
767
-     * @param string $script_handle
768
-     */
769
-    private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
770
-    {
771
-        if (isset($this->script_handles_with_data[ $script_handle ])) {
772
-            global $wp_scripts;
773
-            $unset_handle = false;
774
-            if ($wp_scripts->get_data($script_handle, 'data')) {
775
-                unset($wp_scripts->registered[ $script_handle ]->extra['data']);
776
-                $unset_handle = true;
777
-            }
778
-            //deal with inline_scripts
779
-            if ($wp_scripts->get_data($script_handle, 'before')) {
780
-                unset($wp_scripts->registered[ $script_handle ]->extra['before']);
781
-                $unset_handle = true;
782
-            }
783
-            if ($wp_scripts->get_data($script_handle, 'after')) {
784
-                unset($wp_scripts->registered[ $script_handle ]->extra['after']);
785
-            }
786
-            if ($unset_handle) {
787
-                unset($this->script_handles_with_data[ $script_handle ]);
788
-            }
789
-        }
790
-    }
791
-
792
-
793
-    /**
794
-     * register translations for a registered script
795
-     *
796
-     * @param string $handle
797
-     */
798
-    public function registerTranslation($handle)
799
-    {
800
-        $this->i18n_registry->registerScriptI18n($handle);
801
-    }
802
-
803
-
804
-    /**
805
-     * @since 4.9.63.p
806
-     * @return bool
807
-     */
808
-    private function debug()
809
-    {
810
-        return apply_filters(
811
-            'FHEE__EventEspresso_core_services_assets_Registry__debug',
812
-            defined('EE_DEBUG') && EE_DEBUG
813
-        );
814
-    }
815
-
816
-
817
-    /**
818
-     * Get the dependencies array for the given js asset chunk name
819
-     *
820
-     * @param string $namespace
821
-     * @param string $chunk_name
822
-     * @return array
823
-     * @deprecated 4.10.2.p
824
-     * @since 4.9.82.p
825
-     */
826
-    public function getJsDependencies($namespace, $chunk_name)
827
-    {
828
-        $details = $this->getJsAssetDetails($namespace, $chunk_name);
829
-        return isset($details['dependencies']) ? $details['dependencies'] : [];
830
-    }
831
-
832
-
833
-    /**
834
-     * Get the dependencies array for the given css asset chunk name
835
-     *
836
-     * @param string $namespace
837
-     * @param string $chunk_name
838
-     * @return array
839
-     * @deprecated 4.10.2.p
840
-     * @since      4.9.82.p
841
-     */
842
-    public function getCssDependencies($namespace, $chunk_name)
843
-    {
844
-        $details = $this->getCssAssetDetails($namespace, $chunk_name);
845
-        return isset($details['dependencies']) ? $details['dependencies'] : [];
846
-    }
753
+	private function removeAlreadyRegisteredDataForScriptHandles()
754
+	{
755
+		if (empty($this->script_handles_with_data)) {
756
+			return;
757
+		}
758
+		foreach ($this->script_handles_with_data as $script_handle) {
759
+			$this->removeAlreadyRegisteredDataForScriptHandle($script_handle);
760
+		}
761
+	}
762
+
763
+
764
+	/**
765
+	 * Removes any data dependency registered in WP_Scripts if its set.
766
+	 *
767
+	 * @param string $script_handle
768
+	 */
769
+	private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
770
+	{
771
+		if (isset($this->script_handles_with_data[ $script_handle ])) {
772
+			global $wp_scripts;
773
+			$unset_handle = false;
774
+			if ($wp_scripts->get_data($script_handle, 'data')) {
775
+				unset($wp_scripts->registered[ $script_handle ]->extra['data']);
776
+				$unset_handle = true;
777
+			}
778
+			//deal with inline_scripts
779
+			if ($wp_scripts->get_data($script_handle, 'before')) {
780
+				unset($wp_scripts->registered[ $script_handle ]->extra['before']);
781
+				$unset_handle = true;
782
+			}
783
+			if ($wp_scripts->get_data($script_handle, 'after')) {
784
+				unset($wp_scripts->registered[ $script_handle ]->extra['after']);
785
+			}
786
+			if ($unset_handle) {
787
+				unset($this->script_handles_with_data[ $script_handle ]);
788
+			}
789
+		}
790
+	}
791
+
792
+
793
+	/**
794
+	 * register translations for a registered script
795
+	 *
796
+	 * @param string $handle
797
+	 */
798
+	public function registerTranslation($handle)
799
+	{
800
+		$this->i18n_registry->registerScriptI18n($handle);
801
+	}
802
+
803
+
804
+	/**
805
+	 * @since 4.9.63.p
806
+	 * @return bool
807
+	 */
808
+	private function debug()
809
+	{
810
+		return apply_filters(
811
+			'FHEE__EventEspresso_core_services_assets_Registry__debug',
812
+			defined('EE_DEBUG') && EE_DEBUG
813
+		);
814
+	}
815
+
816
+
817
+	/**
818
+	 * Get the dependencies array for the given js asset chunk name
819
+	 *
820
+	 * @param string $namespace
821
+	 * @param string $chunk_name
822
+	 * @return array
823
+	 * @deprecated 4.10.2.p
824
+	 * @since 4.9.82.p
825
+	 */
826
+	public function getJsDependencies($namespace, $chunk_name)
827
+	{
828
+		$details = $this->getJsAssetDetails($namespace, $chunk_name);
829
+		return isset($details['dependencies']) ? $details['dependencies'] : [];
830
+	}
831
+
832
+
833
+	/**
834
+	 * Get the dependencies array for the given css asset chunk name
835
+	 *
836
+	 * @param string $namespace
837
+	 * @param string $chunk_name
838
+	 * @return array
839
+	 * @deprecated 4.10.2.p
840
+	 * @since      4.9.82.p
841
+	 */
842
+	public function getCssDependencies($namespace, $chunk_name)
843
+	{
844
+		$details = $this->getCssAssetDetails($namespace, $chunk_name);
845
+		return isset($details['dependencies']) ? $details['dependencies'] : [];
846
+	}
847 847
 }
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
     public function addAssetCollection(AssetCollection $asset_collection)
135 135
     {
136 136
         $id = spl_object_hash($asset_collection);
137
-        if (! array_key_exists($id, $this->assets)) {
138
-            $this->assets[ $id ] = $asset_collection;
137
+        if ( ! array_key_exists($id, $this->assets)) {
138
+            $this->assets[$id] = $asset_collection;
139 139
         }
140 140
     }
141 141
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                 $script->version(),
201 201
                 $script->loadInFooter()
202 202
             );
203
-            if (! $registered && $this->debug()) {
203
+            if ( ! $registered && $this->debug()) {
204 204
                 throw new AssetRegistrationException($script->handle());
205 205
             }
206 206
             $script->setRegistered($registered);
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
             $this->removeAlreadyRegisteredDataForScriptHandles();
270 270
             wp_add_inline_script(
271 271
                 'eejs-core',
272
-                'var eejsdata=' . wp_json_encode(['data' => $this->jsdata]),
272
+                'var eejsdata='.wp_json_encode(['data' => $this->jsdata]),
273 273
                 'before'
274 274
             );
275 275
             foreach ($this->assets as $asset_collection) {
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     public function addData($key, $value)
306 306
     {
307 307
         if ($this->verifyDataNotExisting($key)) {
308
-            $this->jsdata[ $key ] = $value;
308
+            $this->jsdata[$key] = $value;
309 309
         }
310 310
     }
311 311
 
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
      */
331 331
     public function pushData($key, $value)
332 332
     {
333
-        if (isset($this->jsdata[ $key ])
334
-            && ! is_array($this->jsdata[ $key ])
333
+        if (isset($this->jsdata[$key])
334
+            && ! is_array($this->jsdata[$key])
335 335
         ) {
336
-            if (! $this->debug()) {
336
+            if ( ! $this->debug()) {
337 337
                 return;
338 338
             }
339 339
             throw new InvalidArgumentException(
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
                 )
349 349
             );
350 350
         }
351
-        if ( ! isset( $this->jsdata[ $key ] ) ) {
352
-            $this->jsdata[ $key ] = is_array($value) ? $value : [$value];
351
+        if ( ! isset($this->jsdata[$key])) {
352
+            $this->jsdata[$key] = is_array($value) ? $value : [$value];
353 353
         } else {
354
-            $this->jsdata[ $key ] = array_merge( $this->jsdata[$key], (array) $value);
354
+            $this->jsdata[$key] = array_merge($this->jsdata[$key], (array) $value);
355 355
         }
356 356
     }
357 357
 
@@ -366,12 +366,12 @@  discard block
 block discarded – undo
366 366
      */
367 367
     public function addTemplate($template_reference, $template_content)
368 368
     {
369
-        if (! isset($this->jsdata['templates'])) {
369
+        if ( ! isset($this->jsdata['templates'])) {
370 370
             $this->jsdata['templates'] = array();
371 371
         }
372 372
         //no overrides allowed.
373
-        if (isset($this->jsdata['templates'][ $template_reference ])) {
374
-            if (! $this->debug()) {
373
+        if (isset($this->jsdata['templates'][$template_reference])) {
374
+            if ( ! $this->debug()) {
375 375
                 return;
376 376
             }
377 377
             throw new InvalidArgumentException(
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
                 )
385 385
             );
386 386
         }
387
-        $this->jsdata['templates'][ $template_reference ] = $template_content;
387
+        $this->jsdata['templates'][$template_reference] = $template_content;
388 388
     }
389 389
 
390 390
 
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
      */
397 397
     public function getTemplate($template_reference)
398 398
     {
399
-        return isset($this->jsdata['templates'][ $template_reference ])
400
-            ? $this->jsdata['templates'][ $template_reference ]
399
+        return isset($this->jsdata['templates'][$template_reference])
400
+            ? $this->jsdata['templates'][$template_reference]
401 401
             : '';
402 402
     }
403 403
 
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
      */
411 411
     public function getData($key)
412 412
     {
413
-        return isset($this->jsdata[ $key ])
414
-            ? $this->jsdata[ $key ]
413
+        return isset($this->jsdata[$key])
414
+            ? $this->jsdata[$key]
415 415
             : false;
416 416
     }
417 417
 
@@ -426,11 +426,11 @@  discard block
 block discarded – undo
426 426
      */
427 427
     protected function verifyDataNotExisting($key)
428 428
     {
429
-        if (isset($this->jsdata[ $key ])) {
430
-            if (! $this->debug()) {
429
+        if (isset($this->jsdata[$key])) {
430
+            if ( ! $this->debug()) {
431 431
                 return false;
432 432
             }
433
-            if (is_array($this->jsdata[ $key ])) {
433
+            if (is_array($this->jsdata[$key])) {
434 434
                 throw new InvalidArgumentException(
435 435
                     sprintf(
436 436
                         __(
@@ -472,13 +472,13 @@  discard block
 block discarded – undo
472 472
      */
473 473
     public function getAssetUrl($namespace, $chunk_name, $asset_type)
474 474
     {
475
-        $asset_index = $chunk_name . '.' . $asset_type;
475
+        $asset_index = $chunk_name.'.'.$asset_type;
476 476
         $url = isset(
477
-            $this->manifest_data[ $namespace ][ $asset_index ],
478
-            $this->manifest_data[ $namespace ]['url_base']
477
+            $this->manifest_data[$namespace][$asset_index],
478
+            $this->manifest_data[$namespace]['url_base']
479 479
         )
480
-            ? $this->manifest_data[ $namespace ]['url_base']
481
-              . $this->manifest_data[ $namespace ][ $asset_index ]
480
+            ? $this->manifest_data[$namespace]['url_base']
481
+              . $this->manifest_data[$namespace][$asset_index]
482 482
             : '';
483 483
         return apply_filters(
484 484
             'FHEE__EventEspresso_core_services_assets_Registry__getAssetUrl',
@@ -528,21 +528,21 @@  discard block
 block discarded – undo
528 528
      */
529 529
     private function getDetailsForAsset($namespace, $chunk_name, $asset_type)
530 530
     {
531
-        $asset_index = $chunk_name . '.' . $asset_type;
532
-        if (! isset( $this->dependencies_data[ $namespace ][ $asset_index ])) {
533
-            $path = isset($this->manifest_data[ $namespace ]['path'])
534
-                ? $this->manifest_data[ $namespace ]['path']
531
+        $asset_index = $chunk_name.'.'.$asset_type;
532
+        if ( ! isset($this->dependencies_data[$namespace][$asset_index])) {
533
+            $path = isset($this->manifest_data[$namespace]['path'])
534
+                ? $this->manifest_data[$namespace]['path']
535 535
                 : '';
536
-            $dependencies_index = $chunk_name . '.' . Asset::TYPE_PHP;
537
-            $file_path = isset($this->manifest_data[ $namespace ][ $dependencies_index ])
538
-                ? $path . $this->manifest_data[ $namespace ][ $dependencies_index ]
536
+            $dependencies_index = $chunk_name.'.'.Asset::TYPE_PHP;
537
+            $file_path = isset($this->manifest_data[$namespace][$dependencies_index])
538
+                ? $path.$this->manifest_data[$namespace][$dependencies_index]
539 539
                 :
540 540
                 '';
541
-            $this->dependencies_data[ $namespace ][ $asset_index ] = $file_path !== '' && file_exists($file_path)
541
+            $this->dependencies_data[$namespace][$asset_index] = $file_path !== '' && file_exists($file_path)
542 542
                 ? $this->getDetailsForAssetType($namespace, $asset_type, $file_path, $chunk_name)
543 543
                 : [];
544 544
         }
545
-        return $this->dependencies_data[ $namespace ][ $asset_index ];
545
+        return $this->dependencies_data[$namespace][$asset_index];
546 546
     }
547 547
 
548 548
 
@@ -568,35 +568,35 @@  discard block
 block discarded – undo
568 568
             ? $asset_details['version']
569 569
             : '';
570 570
         if ($asset_type === Asset::TYPE_JS) {
571
-            $asset_details['dependencies'] =  $chunk_name === 'eejs-core'
571
+            $asset_details['dependencies'] = $chunk_name === 'eejs-core'
572 572
                 ? $asset_details['dependencies']
573
-                : $asset_details['dependencies'] + [ CoreAssetManager::JS_HANDLE_JS_CORE ];
573
+                : $asset_details['dependencies'] + [CoreAssetManager::JS_HANDLE_JS_CORE];
574 574
             return $asset_details;
575 575
         }
576 576
         // for css we need to make sure there is actually a css file related to this chunk.
577
-        if (isset($this->manifest_data[ $namespace ])) {
577
+        if (isset($this->manifest_data[$namespace])) {
578 578
             // array of css chunk files for ee.
579 579
             $css_chunks = array_map(
580
-                static function ($value) {
580
+                static function($value) {
581 581
                     return str_replace('.css', '', $value);
582 582
                 },
583 583
                 array_filter(
584
-                    array_keys($this->manifest_data[ $namespace ]),
585
-                    static function ($value) {
584
+                    array_keys($this->manifest_data[$namespace]),
585
+                    static function($value) {
586 586
                         return strpos($value, '.css') !== false;
587 587
                     }
588 588
                 )
589 589
             );
590 590
             // add known wp chunks with css
591
-            $css_chunks = array_merge( $css_chunks, $this->wp_css_handle_dependencies);
591
+            $css_chunks = array_merge($css_chunks, $this->wp_css_handle_dependencies);
592 592
             // flip for easier search
593 593
             $css_chunks = array_flip($css_chunks);
594 594
 
595 595
             // now let's filter the dependencies for the incoming chunk to actual chunks that have styles
596 596
             $asset_details['dependencies'] = array_filter(
597 597
                 $asset_details['dependencies'],
598
-                static function ($chunk_name) use ($css_chunks) {
599
-                    return isset($css_chunks[ $chunk_name ]);
598
+                static function($chunk_name) use ($css_chunks) {
599
+                    return isset($css_chunks[$chunk_name]);
600 600
                 }
601 601
             );
602 602
             return $asset_details;
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
                     $this->registerManifestFile(
649 649
                         $manifest_file->assetNamespace(),
650 650
                         $manifest_file->urlBase(),
651
-                        $manifest_file->filepath() . Registry::FILE_NAME_BUILD_MANIFEST,
651
+                        $manifest_file->filepath().Registry::FILE_NAME_BUILD_MANIFEST,
652 652
                         $manifest_file->filepath()
653 653
                     );
654 654
                 }
@@ -674,8 +674,8 @@  discard block
 block discarded – undo
674 674
      */
675 675
     public function registerManifestFile($namespace, $url_base, $manifest_file, $manifest_file_path = '')
676 676
     {
677
-        if (isset($this->manifest_data[ $namespace ])) {
678
-            if (! $this->debug()) {
677
+        if (isset($this->manifest_data[$namespace])) {
678
+            if ( ! $this->debug()) {
679 679
                 return;
680 680
             }
681 681
             throw new InvalidArgumentException(
@@ -708,12 +708,12 @@  discard block
 block discarded – undo
708 708
             }
709 709
             return;
710 710
         }
711
-        $this->manifest_data[ $namespace ] = $this->decodeManifestFile($manifest_file);
712
-        if (! isset($this->manifest_data[ $namespace ]['url_base'])) {
713
-            $this->manifest_data[ $namespace ]['url_base'] = untrailingslashit($url_base);
711
+        $this->manifest_data[$namespace] = $this->decodeManifestFile($manifest_file);
712
+        if ( ! isset($this->manifest_data[$namespace]['url_base'])) {
713
+            $this->manifest_data[$namespace]['url_base'] = untrailingslashit($url_base);
714 714
         }
715
-        if (! isset($this->manifest_data[ $namespace ]['path'])) {
716
-            $this->manifest_data[ $namespace ]['path'] = untrailingslashit($manifest_file_path);
715
+        if ( ! isset($this->manifest_data[$namespace]['path'])) {
716
+            $this->manifest_data[$namespace]['path'] = untrailingslashit($manifest_file_path);
717 717
         }
718 718
     }
719 719
 
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
      */
729 729
     private function decodeManifestFile($manifest_file)
730 730
     {
731
-        if (! file_exists($manifest_file)) {
731
+        if ( ! file_exists($manifest_file)) {
732 732
             throw new InvalidFilePathException($manifest_file);
733 733
         }
734 734
         return json_decode(file_get_contents($manifest_file), true);
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
      */
743 743
     private function addRegisteredScriptHandlesWithData($script_handle)
744 744
     {
745
-        $this->script_handles_with_data[ $script_handle ] = $script_handle;
745
+        $this->script_handles_with_data[$script_handle] = $script_handle;
746 746
     }
747 747
 
748 748
 
@@ -768,23 +768,23 @@  discard block
 block discarded – undo
768 768
      */
769 769
     private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
770 770
     {
771
-        if (isset($this->script_handles_with_data[ $script_handle ])) {
771
+        if (isset($this->script_handles_with_data[$script_handle])) {
772 772
             global $wp_scripts;
773 773
             $unset_handle = false;
774 774
             if ($wp_scripts->get_data($script_handle, 'data')) {
775
-                unset($wp_scripts->registered[ $script_handle ]->extra['data']);
775
+                unset($wp_scripts->registered[$script_handle]->extra['data']);
776 776
                 $unset_handle = true;
777 777
             }
778 778
             //deal with inline_scripts
779 779
             if ($wp_scripts->get_data($script_handle, 'before')) {
780
-                unset($wp_scripts->registered[ $script_handle ]->extra['before']);
780
+                unset($wp_scripts->registered[$script_handle]->extra['before']);
781 781
                 $unset_handle = true;
782 782
             }
783 783
             if ($wp_scripts->get_data($script_handle, 'after')) {
784
-                unset($wp_scripts->registered[ $script_handle ]->extra['after']);
784
+                unset($wp_scripts->registered[$script_handle]->extra['after']);
785 785
             }
786 786
             if ($unset_handle) {
787
-                unset($this->script_handles_with_data[ $script_handle ]);
787
+                unset($this->script_handles_with_data[$script_handle]);
788 788
             }
789 789
         }
790 790
     }
Please login to merge, or discard this patch.
core/EE_Dependency_Map.core.php 1 patch
Indentation   +990 added lines, -990 removed lines patch added patch discarded remove patch
@@ -21,994 +21,994 @@
 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
-     * @type EE_Dependency_Map $_instance
55
-     */
56
-    protected static $_instance;
57
-
58
-    /**
59
-     * @var ClassInterfaceCache $class_cache
60
-     */
61
-    private $class_cache;
62
-
63
-    /**
64
-     * @type RequestInterface $request
65
-     */
66
-    protected $request;
67
-
68
-    /**
69
-     * @type LegacyRequestInterface $legacy_request
70
-     */
71
-    protected $legacy_request;
72
-
73
-    /**
74
-     * @type ResponseInterface $response
75
-     */
76
-    protected $response;
77
-
78
-    /**
79
-     * @type LoaderInterface $loader
80
-     */
81
-    protected $loader;
82
-
83
-    /**
84
-     * @type array $_dependency_map
85
-     */
86
-    protected $_dependency_map = [];
87
-
88
-    /**
89
-     * @type array $_class_loaders
90
-     */
91
-    protected $_class_loaders = [];
92
-
93
-
94
-    /**
95
-     * EE_Dependency_Map constructor.
96
-     *
97
-     * @param ClassInterfaceCache $class_cache
98
-     */
99
-    protected function __construct(ClassInterfaceCache $class_cache)
100
-    {
101
-        $this->class_cache = $class_cache;
102
-        do_action('EE_Dependency_Map____construct', $this);
103
-    }
104
-
105
-
106
-    /**
107
-     * @return void
108
-     * @throws InvalidAliasException
109
-     */
110
-    public function initialize()
111
-    {
112
-        $this->_register_core_dependencies();
113
-        $this->_register_core_class_loaders();
114
-        $this->_register_core_aliases();
115
-    }
116
-
117
-
118
-    /**
119
-     * @singleton method used to instantiate class object
120
-     * @param ClassInterfaceCache|null $class_cache
121
-     * @return EE_Dependency_Map
122
-     */
123
-    public static function instance(ClassInterfaceCache $class_cache = null)
124
-    {
125
-        // check if class object is instantiated, and instantiated properly
126
-        if (! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map
127
-            && $class_cache instanceof ClassInterfaceCache
128
-        ) {
129
-            EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache);
130
-        }
131
-        return EE_Dependency_Map::$_instance;
132
-    }
133
-
134
-
135
-    /**
136
-     * @param RequestInterface $request
137
-     */
138
-    public function setRequest(RequestInterface $request)
139
-    {
140
-        $this->request = $request;
141
-    }
142
-
143
-
144
-    /**
145
-     * @param LegacyRequestInterface $legacy_request
146
-     */
147
-    public function setLegacyRequest(LegacyRequestInterface $legacy_request)
148
-    {
149
-        $this->legacy_request = $legacy_request;
150
-    }
151
-
152
-
153
-    /**
154
-     * @param ResponseInterface $response
155
-     */
156
-    public function setResponse(ResponseInterface $response)
157
-    {
158
-        $this->response = $response;
159
-    }
160
-
161
-
162
-    /**
163
-     * @param LoaderInterface $loader
164
-     */
165
-    public function setLoader(LoaderInterface $loader)
166
-    {
167
-        $this->loader = $loader;
168
-    }
169
-
170
-
171
-    /**
172
-     * @param string $class
173
-     * @param array  $dependencies
174
-     * @param int    $overwrite
175
-     * @return bool
176
-     */
177
-    public static function register_dependencies(
178
-        $class,
179
-        array $dependencies,
180
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
181
-    ) {
182
-        return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite);
183
-    }
184
-
185
-
186
-    /**
187
-     * Assigns an array of class names and corresponding load sources (new or cached)
188
-     * to the class specified by the first parameter.
189
-     * IMPORTANT !!!
190
-     * The order of elements in the incoming $dependencies array MUST match
191
-     * the order of the constructor parameters for the class in question.
192
-     * This is especially important when overriding any existing dependencies that are registered.
193
-     * the third parameter controls whether any duplicate dependencies are overwritten or not.
194
-     *
195
-     * @param string $class
196
-     * @param array  $dependencies
197
-     * @param int    $overwrite
198
-     * @return bool
199
-     */
200
-    public function registerDependencies(
201
-        $class,
202
-        array $dependencies,
203
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
204
-    ) {
205
-        $class = trim($class, '\\');
206
-        $registered = false;
207
-        if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) {
208
-            EE_Dependency_Map::$_instance->_dependency_map[ $class ] = [];
209
-        }
210
-        // we need to make sure that any aliases used when registering a dependency
211
-        // get resolved to the correct class name
212
-        foreach ($dependencies as $dependency => $load_source) {
213
-            $alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency);
214
-            if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
215
-                || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ])
216
-            ) {
217
-                unset($dependencies[ $dependency ]);
218
-                $dependencies[ $alias ] = $load_source;
219
-                $registered = true;
220
-            }
221
-        }
222
-        // now add our two lists of dependencies together.
223
-        // using Union (+=) favours the arrays in precedence from left to right,
224
-        // so $dependencies is NOT overwritten because it is listed first
225
-        // ie: with A = B + C, entries in B take precedence over duplicate entries in C
226
-        // Union is way faster than array_merge() but should be used with caution...
227
-        // especially with numerically indexed arrays
228
-        $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ];
229
-        // now we need to ensure that the resulting dependencies
230
-        // array only has the entries that are required for the class
231
-        // so first count how many dependencies were originally registered for the class
232
-        $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]);
233
-        // if that count is non-zero (meaning dependencies were already registered)
234
-        EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count
235
-            // then truncate the  final array to match that count
236
-            ? array_slice($dependencies, 0, $dependency_count)
237
-            // otherwise just take the incoming array because nothing previously existed
238
-            : $dependencies;
239
-        return $registered;
240
-    }
241
-
242
-
243
-    /**
244
-     * @param string $class_name
245
-     * @param string $loader
246
-     * @return bool
247
-     * @throws DomainException
248
-     */
249
-    public static function register_class_loader($class_name, $loader = 'load_core')
250
-    {
251
-        return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader);
252
-    }
253
-
254
-
255
-    /**
256
-     * @param string $class_name
257
-     * @param string $loader
258
-     * @return bool
259
-     * @throws DomainException
260
-     */
261
-    public function registerClassLoader($class_name, $loader = 'load_core')
262
-    {
263
-        if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
264
-            throw new DomainException(
265
-                esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
266
-            );
267
-        }
268
-        // check that loader is callable or method starts with "load_" and exists in EE_Registry
269
-        if (! is_callable($loader)
270
-            && (
271
-                strpos($loader, 'load_') !== 0
272
-                || ! method_exists('EE_Registry', $loader)
273
-            )
274
-        ) {
275
-            throw new DomainException(
276
-                sprintf(
277
-                    esc_html__(
278
-                        '"%1$s" is not a valid loader method on EE_Registry.',
279
-                        'event_espresso'
280
-                    ),
281
-                    $loader
282
-                )
283
-            );
284
-        }
285
-        $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name);
286
-        if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) {
287
-            EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader;
288
-            return true;
289
-        }
290
-        return false;
291
-    }
292
-
293
-
294
-    /**
295
-     * @return array
296
-     */
297
-    public function dependency_map()
298
-    {
299
-        return $this->_dependency_map;
300
-    }
301
-
302
-
303
-    /**
304
-     * returns TRUE if dependency map contains a listing for the provided class name
305
-     *
306
-     * @param string $class_name
307
-     * @return boolean
308
-     */
309
-    public function has($class_name = '')
310
-    {
311
-        // all legacy models have the same dependencies
312
-        if (strpos($class_name, 'EEM_') === 0) {
313
-            $class_name = 'LEGACY_MODELS';
314
-        }
315
-        return isset($this->_dependency_map[ $class_name ]);
316
-    }
317
-
318
-
319
-    /**
320
-     * returns TRUE if dependency map contains a listing for the provided class name AND dependency
321
-     *
322
-     * @param string $class_name
323
-     * @param string $dependency
324
-     * @return bool
325
-     */
326
-    public function has_dependency_for_class($class_name = '', $dependency = '')
327
-    {
328
-        // all legacy models have the same dependencies
329
-        if (strpos($class_name, 'EEM_') === 0) {
330
-            $class_name = 'LEGACY_MODELS';
331
-        }
332
-        $dependency = $this->getFqnForAlias($dependency, $class_name);
333
-        return isset($this->_dependency_map[ $class_name ][ $dependency ]);
334
-    }
335
-
336
-
337
-    /**
338
-     * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
339
-     *
340
-     * @param string $class_name
341
-     * @param string $dependency
342
-     * @return int
343
-     */
344
-    public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
345
-    {
346
-        // all legacy models have the same dependencies
347
-        if (strpos($class_name, 'EEM_') === 0) {
348
-            $class_name = 'LEGACY_MODELS';
349
-        }
350
-        $dependency = $this->getFqnForAlias($dependency);
351
-        return $this->has_dependency_for_class($class_name, $dependency)
352
-            ? $this->_dependency_map[ $class_name ][ $dependency ]
353
-            : EE_Dependency_Map::not_registered;
354
-    }
355
-
356
-
357
-    /**
358
-     * @param string $class_name
359
-     * @return string | Closure
360
-     */
361
-    public function class_loader($class_name)
362
-    {
363
-        // all legacy models use load_model()
364
-        if (strpos($class_name, 'EEM_') === 0) {
365
-            return 'load_model';
366
-        }
367
-        // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
368
-        // perform strpos() first to avoid loading regex every time we load a class
369
-        if (strpos($class_name, 'EE_CPT_') === 0
370
-            && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
371
-        ) {
372
-            return 'load_core';
373
-        }
374
-        $class_name = $this->getFqnForAlias($class_name);
375
-        return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
376
-    }
377
-
378
-
379
-    /**
380
-     * @return array
381
-     */
382
-    public function class_loaders()
383
-    {
384
-        return $this->_class_loaders;
385
-    }
386
-
387
-
388
-    /**
389
-     * adds an alias for a classname
390
-     *
391
-     * @param string $fqcn      the class name that should be used (concrete class to replace interface)
392
-     * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
393
-     * @param string $for_class the class that has the dependency (is type hinting for the interface)
394
-     * @throws InvalidAliasException
395
-     */
396
-    public function add_alias($fqcn, $alias, $for_class = '')
397
-    {
398
-        $this->class_cache->addAlias($fqcn, $alias, $for_class);
399
-    }
400
-
401
-
402
-    /**
403
-     * Returns TRUE if the provided fully qualified name IS an alias
404
-     * WHY?
405
-     * Because if a class is type hinting for a concretion,
406
-     * then why would we need to find another class to supply it?
407
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
408
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
409
-     * Don't go looking for some substitute.
410
-     * Whereas if a class is type hinting for an interface...
411
-     * then we need to find an actual class to use.
412
-     * So the interface IS the alias for some other FQN,
413
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
414
-     * represents some other class.
415
-     *
416
-     * @param string $fqn
417
-     * @param string $for_class
418
-     * @return bool
419
-     */
420
-    public function isAlias($fqn = '', $for_class = '')
421
-    {
422
-        return $this->class_cache->isAlias($fqn, $for_class);
423
-    }
424
-
425
-
426
-    /**
427
-     * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
428
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
429
-     *  for example:
430
-     *      if the following two entries were added to the _aliases array:
431
-     *          array(
432
-     *              'interface_alias'           => 'some\namespace\interface'
433
-     *              'some\namespace\interface'  => 'some\namespace\classname'
434
-     *          )
435
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
436
-     *      to load an instance of 'some\namespace\classname'
437
-     *
438
-     * @param string $alias
439
-     * @param string $for_class
440
-     * @return string
441
-     */
442
-    public function getFqnForAlias($alias = '', $for_class = '')
443
-    {
444
-        return (string) $this->class_cache->getFqnForAlias($alias, $for_class);
445
-    }
446
-
447
-
448
-    /**
449
-     * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
450
-     * if one exists, or whether a new object should be generated every time the requested class is loaded.
451
-     * This is done by using the following class constants:
452
-     *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
453
-     *        EE_Dependency_Map::load_new_object - generates a new object every time
454
-     */
455
-    protected function _register_core_dependencies()
456
-    {
457
-        $this->_dependency_map = [
458
-            'EE_Request_Handler'                                                                                          => [
459
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
460
-            ],
461
-            'EE_System'                                                                                                   => [
462
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
463
-                'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
464
-                'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
465
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
466
-                'EventEspresso\core\services\routing\Router'  => EE_Dependency_Map::load_from_cache,
467
-            ],
468
-            'EE_Admin'                                                                                                    => [
469
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
470
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
471
-            ],
472
-            'EE_Cart'                                                                                                     => [
473
-                'EE_Session' => EE_Dependency_Map::load_from_cache,
474
-            ],
475
-            'EE_Messenger_Collection_Loader'                                                                              => [
476
-                'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
477
-            ],
478
-            'EE_Message_Type_Collection_Loader'                                                                           => [
479
-                'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
480
-            ],
481
-            'EE_Message_Resource_Manager'                                                                                 => [
482
-                'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
483
-                'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
484
-                'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
485
-            ],
486
-            'EE_Message_Factory'                                                                                          => [
487
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
488
-            ],
489
-            'EE_messages'                                                                                                 => [
490
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
491
-            ],
492
-            'EE_Messages_Generator'                                                                                       => [
493
-                'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
494
-                'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
495
-                'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
496
-                'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
497
-            ],
498
-            'EE_Messages_Processor'                                                                                       => [
499
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
500
-            ],
501
-            'EE_Messages_Queue'                                                                                           => [
502
-                'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
503
-            ],
504
-            'EE_Messages_Template_Defaults'                                                                               => [
505
-                'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
506
-                'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
507
-            ],
508
-            'EE_Message_To_Generate_From_Request'                                                                         => [
509
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
510
-                'EE_Request_Handler'          => EE_Dependency_Map::load_from_cache,
511
-            ],
512
-            'EventEspresso\core\services\commands\CommandBus'                                                             => [
513
-                'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
514
-            ],
515
-            'EventEspresso\services\commands\CommandHandler'                                                              => [
516
-                'EE_Registry'         => EE_Dependency_Map::load_from_cache,
517
-                'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
518
-            ],
519
-            'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => [
520
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
521
-            ],
522
-            'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => [
523
-                'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
524
-                'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
525
-            ],
526
-            'EventEspresso\core\services\commands\CommandFactory'                                                         => [
527
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
528
-            ],
529
-            'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => [
530
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
531
-            ],
532
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => [
533
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
534
-            ],
535
-            'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => [
536
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
537
-            ],
538
-            'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => [
539
-                'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
540
-            ],
541
-            'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => [
542
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
543
-            ],
544
-            'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => [
545
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
546
-            ],
547
-            'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => [
548
-                'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
549
-            ],
550
-            'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [
551
-                'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
552
-            ],
553
-            'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => [
554
-                'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
555
-            ],
556
-            'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => [
557
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
558
-            ],
559
-            'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => [
560
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
561
-            ],
562
-            'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => [
563
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
564
-            ],
565
-            'EventEspresso\core\services\database\TableManager'                                                           => [
566
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
567
-            ],
568
-            'EE_Data_Migration_Class_Base'                                                                                => [
569
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
570
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
571
-            ],
572
-            'EE_DMS_Core_4_1_0'                                                                                           => [
573
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
574
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
575
-            ],
576
-            'EE_DMS_Core_4_2_0'                                                                                           => [
577
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
578
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
579
-            ],
580
-            'EE_DMS_Core_4_3_0'                                                                                           => [
581
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
582
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
583
-            ],
584
-            'EE_DMS_Core_4_4_0'                                                                                           => [
585
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
586
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
587
-            ],
588
-            'EE_DMS_Core_4_5_0'                                                                                           => [
589
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
590
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
591
-            ],
592
-            'EE_DMS_Core_4_6_0'                                                                                           => [
593
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
594
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
595
-            ],
596
-            'EE_DMS_Core_4_7_0'                                                                                           => [
597
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
598
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
599
-            ],
600
-            'EE_DMS_Core_4_8_0'                                                                                           => [
601
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
602
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
603
-            ],
604
-            'EE_DMS_Core_4_9_0'                                                                                           => [
605
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
606
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
607
-            ],
608
-            'EE_DMS_Core_4_10_0'                                                                                          => [
609
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
610
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
611
-                'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
612
-            ],
613
-            'EventEspresso\core\services\assets\I18nRegistry'                                                             => [
614
-                'EventEspresso\core\domain\Domain'                 => EE_Dependency_Map::load_from_cache,
615
-                'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache,
616
-                [],
617
-            ],
618
-            'EventEspresso\core\services\assets\Registry'                                                                 => [
619
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
620
-                'EventEspresso\core\services\assets\I18nRegistry'    => EE_Dependency_Map::load_from_cache,
621
-            ],
622
-            'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
623
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
624
-            ],
625
-            'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
626
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
627
-            ],
628
-            'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
629
-                'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
630
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
631
-            ],
632
-            'EventEspresso\core\domain\values\EmailAddress'                                                               => [
633
-                null,
634
-                'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
635
-            ],
636
-            'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
637
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
638
-            ],
639
-            'LEGACY_MODELS'                                                                                               => [
640
-                null,
641
-                'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
642
-            ],
643
-            'EE_Module_Request_Router'                                                                                    => [
644
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
645
-            ],
646
-            'EE_Registration_Processor'                                                                                   => [
647
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
648
-            ],
649
-            'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
650
-                null,
651
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
652
-                'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
653
-            ],
654
-            'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
655
-                'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
656
-                'EE_Session'             => EE_Dependency_Map::load_from_cache,
657
-            ],
658
-            'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
659
-                'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
660
-                'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
661
-                'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
662
-                'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
663
-                'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
664
-            ],
665
-            'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
666
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
667
-            ],
668
-            'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
669
-                'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
670
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
671
-            ],
672
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
673
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
674
-            ],
675
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
676
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
677
-            ],
678
-            'EE_CPT_Strategy'                                                                                             => [
679
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
680
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
681
-            ],
682
-            'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
683
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
684
-            ],
685
-            'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
686
-                null,
687
-                null,
688
-                null,
689
-                'EE_Request_Handler'                          => EE_Dependency_Map::load_from_cache,
690
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
691
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
692
-            ],
693
-            'EventEspresso\core\services\dependencies\DependencyResolver'                                                 => [
694
-                'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
695
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
696
-                'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
697
-            ],
698
-            'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver'                               => [
699
-                'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
700
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
701
-                'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
702
-            ],
703
-            'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'                                          => [
704
-                'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
705
-                'EventEspresso\core\services\loaders\Loader'                                    => EE_Dependency_Map::load_from_cache,
706
-            ],
707
-            'EventEspresso\core\services\routing\RouteMatchSpecificationManager'                                          => [
708
-                'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
709
-                'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
710
-            ],
711
-            'EE_URL_Validation_Strategy'                                                                                  => [
712
-                null,
713
-                null,
714
-                'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
715
-            ],
716
-            'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
717
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
718
-            ],
719
-            'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
720
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
721
-            ],
722
-            'EventEspresso\core\domain\services\converters\RestApiSpoofer'                                                => [
723
-                'WP_REST_Server'                                               => EE_Dependency_Map::load_from_cache,
724
-                'EED_Core_Rest_Api'                                            => EE_Dependency_Map::load_from_cache,
725
-                'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,
726
-                null,
727
-            ],
728
-            'EventEspresso\core\services\routing\RouteHandler'                                                            => [
729
-                'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache,
730
-                'EventEspresso\core\services\loaders\Loader'           => EE_Dependency_Map::load_from_cache,
731
-                'EventEspresso\core\services\request\Request'          => EE_Dependency_Map::load_from_cache,
732
-                'EventEspresso\core\services\routing\RouteCollection'  => EE_Dependency_Map::load_from_cache,
733
-            ],
734
-            'EventEspresso\core\services\json\JsonDataNodeHandler'                                                        => [
735
-                'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
736
-            ],
737
-            'EventEspresso\core\domain\services\assets\EspressoCoreAppAssetManager'                                       => [
738
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
739
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
740
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
741
-            ],
742
-            'EventEspresso\core\services\routing\Router'                                                                  => [
743
-                'EE_Dependency_Map'                                => EE_Dependency_Map::load_from_cache,
744
-                'EventEspresso\core\services\loaders\Loader'       => EE_Dependency_Map::load_from_cache,
745
-                'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache,
746
-            ],
747
-        ];
748
-    }
749
-
750
-
751
-    /**
752
-     * Registers how core classes are loaded.
753
-     * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
754
-     *        'EE_Request_Handler' => 'load_core'
755
-     *        'EE_Messages_Queue'  => 'load_lib'
756
-     *        'EEH_Debug_Tools'    => 'load_helper'
757
-     * or, if greater control is required, by providing a custom closure. For example:
758
-     *        'Some_Class' => function () {
759
-     *            return new Some_Class();
760
-     *        },
761
-     * This is required for instantiating dependencies
762
-     * where an interface has been type hinted in a class constructor. For example:
763
-     *        'Required_Interface' => function () {
764
-     *            return new A_Class_That_Implements_Required_Interface();
765
-     *        },
766
-     */
767
-    protected function _register_core_class_loaders()
768
-    {
769
-        $this->_class_loaders = [
770
-            // load_core
771
-            'EE_Dependency_Map'                            => function () {
772
-                return $this;
773
-            },
774
-            'EE_Capabilities'                              => 'load_core',
775
-            'EE_Encryption'                                => 'load_core',
776
-            'EE_Front_Controller'                          => 'load_core',
777
-            'EE_Module_Request_Router'                     => 'load_core',
778
-            'EE_Registry'                                  => 'load_core',
779
-            'EE_Request'                                   => function () {
780
-                return $this->legacy_request;
781
-            },
782
-            'EventEspresso\core\services\request\Request'  => function () {
783
-                return $this->request;
784
-            },
785
-            'EventEspresso\core\services\request\Response' => function () {
786
-                return $this->response;
787
-            },
788
-            'EE_Base'                                      => 'load_core',
789
-            'EE_Request_Handler'                           => 'load_core',
790
-            'EE_Session'                                   => 'load_core',
791
-            'EE_Cron_Tasks'                                => 'load_core',
792
-            'EE_System'                                    => 'load_core',
793
-            'EE_Maintenance_Mode'                          => 'load_core',
794
-            'EE_Register_CPTs'                             => 'load_core',
795
-            'EE_Admin'                                     => 'load_core',
796
-            'EE_CPT_Strategy'                              => 'load_core',
797
-            // load_class
798
-            'EE_Registration_Processor'                    => 'load_class',
799
-            // load_lib
800
-            'EE_Message_Resource_Manager'                  => 'load_lib',
801
-            'EE_Message_Type_Collection'                   => 'load_lib',
802
-            'EE_Message_Type_Collection_Loader'            => 'load_lib',
803
-            'EE_Messenger_Collection'                      => 'load_lib',
804
-            'EE_Messenger_Collection_Loader'               => 'load_lib',
805
-            'EE_Messages_Processor'                        => 'load_lib',
806
-            'EE_Message_Repository'                        => 'load_lib',
807
-            'EE_Messages_Queue'                            => 'load_lib',
808
-            'EE_Messages_Data_Handler_Collection'          => 'load_lib',
809
-            'EE_Message_Template_Group_Collection'         => 'load_lib',
810
-            'EE_Payment_Method_Manager'                    => 'load_lib',
811
-            'EE_DMS_Core_4_1_0'                            => 'load_dms',
812
-            'EE_DMS_Core_4_2_0'                            => 'load_dms',
813
-            'EE_DMS_Core_4_3_0'                            => 'load_dms',
814
-            'EE_DMS_Core_4_5_0'                            => 'load_dms',
815
-            'EE_DMS_Core_4_6_0'                            => 'load_dms',
816
-            'EE_DMS_Core_4_7_0'                            => 'load_dms',
817
-            'EE_DMS_Core_4_8_0'                            => 'load_dms',
818
-            'EE_DMS_Core_4_9_0'                            => 'load_dms',
819
-            'EE_DMS_Core_4_10_0'                           => 'load_dms',
820
-            'EE_Messages_Generator'                        => static function () {
821
-                return EE_Registry::instance()->load_lib(
822
-                    'Messages_Generator',
823
-                    [],
824
-                    false,
825
-                    false
826
-                );
827
-            },
828
-            'EE_Messages_Template_Defaults'                => static function ($arguments = []) {
829
-                return EE_Registry::instance()->load_lib(
830
-                    'Messages_Template_Defaults',
831
-                    $arguments,
832
-                    false,
833
-                    false
834
-                );
835
-            },
836
-            // load_helper
837
-            'EEH_Parse_Shortcodes'                         => static function () {
838
-                if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
839
-                    return new EEH_Parse_Shortcodes();
840
-                }
841
-                return null;
842
-            },
843
-            'EE_Template_Config'                           => static function () {
844
-                return EE_Config::instance()->template_settings;
845
-            },
846
-            'EE_Currency_Config'                           => static function () {
847
-                return EE_Config::instance()->currency;
848
-            },
849
-            'EE_Registration_Config'                       => static function () {
850
-                return EE_Config::instance()->registration;
851
-            },
852
-            'EE_Core_Config'                               => static function () {
853
-                return EE_Config::instance()->core;
854
-            },
855
-            'EventEspresso\core\services\loaders\Loader'   => static function () {
856
-                return LoaderFactory::getLoader();
857
-            },
858
-            'EE_Network_Config'                            => static function () {
859
-                return EE_Network_Config::instance();
860
-            },
861
-            'EE_Config'                                    => static function () {
862
-                return EE_Config::instance();
863
-            },
864
-            'EventEspresso\core\domain\Domain'             => static function () {
865
-                return DomainFactory::getEventEspressoCoreDomain();
866
-            },
867
-            'EE_Admin_Config'                              => static function () {
868
-                return EE_Config::instance()->admin;
869
-            },
870
-            'EE_Organization_Config'                       => static function () {
871
-                return EE_Config::instance()->organization;
872
-            },
873
-            'EE_Network_Core_Config'                       => static function () {
874
-                return EE_Network_Config::instance()->core;
875
-            },
876
-            'EE_Environment_Config'                        => static function () {
877
-                return EE_Config::instance()->environment;
878
-            },
879
-            'EED_Core_Rest_Api'                            => static function () {
880
-                return EED_Core_Rest_Api::instance();
881
-            },
882
-            'WP_REST_Server'                               => static function () {
883
-                return rest_get_server();
884
-            },
885
-        ];
886
-    }
887
-
888
-
889
-    /**
890
-     * can be used for supplying alternate names for classes,
891
-     * or for connecting interface names to instantiable classes
892
-     *
893
-     * @throws InvalidAliasException
894
-     */
895
-    protected function _register_core_aliases()
896
-    {
897
-        $aliases = [
898
-            'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
899
-            'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
900
-            'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
901
-            'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
902
-            'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
903
-            'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
904
-            'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
905
-            'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
906
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
907
-            'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
908
-            'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
909
-            'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
910
-            'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
911
-            'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
912
-            'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
913
-            'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
914
-            'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
915
-            'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
916
-            'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
917
-            'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
918
-            'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
919
-            'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
920
-            'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
921
-            'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
922
-            'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
923
-            'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
924
-            'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
925
-            'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
926
-            'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
927
-            'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
928
-            'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
929
-            'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
930
-            'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
931
-            'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
932
-            'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
933
-            'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
934
-            'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
935
-            'Registration_Processor'                                                       => 'EE_Registration_Processor',
936
-        ];
937
-        foreach ($aliases as $alias => $fqn) {
938
-            if (is_array($fqn)) {
939
-                foreach ($fqn as $class => $for_class) {
940
-                    $this->class_cache->addAlias($class, $alias, $for_class);
941
-                }
942
-                continue;
943
-            }
944
-            $this->class_cache->addAlias($fqn, $alias);
945
-        }
946
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
947
-            $this->class_cache->addAlias(
948
-                'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
949
-                'EventEspresso\core\services\notices\NoticeConverterInterface'
950
-            );
951
-        }
952
-    }
953
-
954
-
955
-    /**
956
-     * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
957
-     * request Primarily used by unit tests.
958
-     */
959
-    public function reset()
960
-    {
961
-        $this->_register_core_class_loaders();
962
-        $this->_register_core_dependencies();
963
-    }
964
-
965
-
966
-    /**
967
-     * PLZ NOTE: a better name for this method would be is_alias()
968
-     * because it returns TRUE if the provided fully qualified name IS an alias
969
-     * WHY?
970
-     * Because if a class is type hinting for a concretion,
971
-     * then why would we need to find another class to supply it?
972
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
973
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
974
-     * Don't go looking for some substitute.
975
-     * Whereas if a class is type hinting for an interface...
976
-     * then we need to find an actual class to use.
977
-     * So the interface IS the alias for some other FQN,
978
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
979
-     * represents some other class.
980
-     *
981
-     * @param string $fqn
982
-     * @param string $for_class
983
-     * @return bool
984
-     * @deprecated 4.9.62.p
985
-     */
986
-    public function has_alias($fqn = '', $for_class = '')
987
-    {
988
-        return $this->isAlias($fqn, $for_class);
989
-    }
990
-
991
-
992
-    /**
993
-     * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
994
-     * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
995
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
996
-     *  for example:
997
-     *      if the following two entries were added to the _aliases array:
998
-     *          array(
999
-     *              'interface_alias'           => 'some\namespace\interface'
1000
-     *              'some\namespace\interface'  => 'some\namespace\classname'
1001
-     *          )
1002
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1003
-     *      to load an instance of 'some\namespace\classname'
1004
-     *
1005
-     * @param string $alias
1006
-     * @param string $for_class
1007
-     * @return string
1008
-     * @deprecated 4.9.62.p
1009
-     */
1010
-    public function get_alias($alias = '', $for_class = '')
1011
-    {
1012
-        return $this->getFqnForAlias($alias, $for_class);
1013
-    }
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
+	 * @type EE_Dependency_Map $_instance
55
+	 */
56
+	protected static $_instance;
57
+
58
+	/**
59
+	 * @var ClassInterfaceCache $class_cache
60
+	 */
61
+	private $class_cache;
62
+
63
+	/**
64
+	 * @type RequestInterface $request
65
+	 */
66
+	protected $request;
67
+
68
+	/**
69
+	 * @type LegacyRequestInterface $legacy_request
70
+	 */
71
+	protected $legacy_request;
72
+
73
+	/**
74
+	 * @type ResponseInterface $response
75
+	 */
76
+	protected $response;
77
+
78
+	/**
79
+	 * @type LoaderInterface $loader
80
+	 */
81
+	protected $loader;
82
+
83
+	/**
84
+	 * @type array $_dependency_map
85
+	 */
86
+	protected $_dependency_map = [];
87
+
88
+	/**
89
+	 * @type array $_class_loaders
90
+	 */
91
+	protected $_class_loaders = [];
92
+
93
+
94
+	/**
95
+	 * EE_Dependency_Map constructor.
96
+	 *
97
+	 * @param ClassInterfaceCache $class_cache
98
+	 */
99
+	protected function __construct(ClassInterfaceCache $class_cache)
100
+	{
101
+		$this->class_cache = $class_cache;
102
+		do_action('EE_Dependency_Map____construct', $this);
103
+	}
104
+
105
+
106
+	/**
107
+	 * @return void
108
+	 * @throws InvalidAliasException
109
+	 */
110
+	public function initialize()
111
+	{
112
+		$this->_register_core_dependencies();
113
+		$this->_register_core_class_loaders();
114
+		$this->_register_core_aliases();
115
+	}
116
+
117
+
118
+	/**
119
+	 * @singleton method used to instantiate class object
120
+	 * @param ClassInterfaceCache|null $class_cache
121
+	 * @return EE_Dependency_Map
122
+	 */
123
+	public static function instance(ClassInterfaceCache $class_cache = null)
124
+	{
125
+		// check if class object is instantiated, and instantiated properly
126
+		if (! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map
127
+			&& $class_cache instanceof ClassInterfaceCache
128
+		) {
129
+			EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache);
130
+		}
131
+		return EE_Dependency_Map::$_instance;
132
+	}
133
+
134
+
135
+	/**
136
+	 * @param RequestInterface $request
137
+	 */
138
+	public function setRequest(RequestInterface $request)
139
+	{
140
+		$this->request = $request;
141
+	}
142
+
143
+
144
+	/**
145
+	 * @param LegacyRequestInterface $legacy_request
146
+	 */
147
+	public function setLegacyRequest(LegacyRequestInterface $legacy_request)
148
+	{
149
+		$this->legacy_request = $legacy_request;
150
+	}
151
+
152
+
153
+	/**
154
+	 * @param ResponseInterface $response
155
+	 */
156
+	public function setResponse(ResponseInterface $response)
157
+	{
158
+		$this->response = $response;
159
+	}
160
+
161
+
162
+	/**
163
+	 * @param LoaderInterface $loader
164
+	 */
165
+	public function setLoader(LoaderInterface $loader)
166
+	{
167
+		$this->loader = $loader;
168
+	}
169
+
170
+
171
+	/**
172
+	 * @param string $class
173
+	 * @param array  $dependencies
174
+	 * @param int    $overwrite
175
+	 * @return bool
176
+	 */
177
+	public static function register_dependencies(
178
+		$class,
179
+		array $dependencies,
180
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
181
+	) {
182
+		return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite);
183
+	}
184
+
185
+
186
+	/**
187
+	 * Assigns an array of class names and corresponding load sources (new or cached)
188
+	 * to the class specified by the first parameter.
189
+	 * IMPORTANT !!!
190
+	 * The order of elements in the incoming $dependencies array MUST match
191
+	 * the order of the constructor parameters for the class in question.
192
+	 * This is especially important when overriding any existing dependencies that are registered.
193
+	 * the third parameter controls whether any duplicate dependencies are overwritten or not.
194
+	 *
195
+	 * @param string $class
196
+	 * @param array  $dependencies
197
+	 * @param int    $overwrite
198
+	 * @return bool
199
+	 */
200
+	public function registerDependencies(
201
+		$class,
202
+		array $dependencies,
203
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
204
+	) {
205
+		$class = trim($class, '\\');
206
+		$registered = false;
207
+		if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) {
208
+			EE_Dependency_Map::$_instance->_dependency_map[ $class ] = [];
209
+		}
210
+		// we need to make sure that any aliases used when registering a dependency
211
+		// get resolved to the correct class name
212
+		foreach ($dependencies as $dependency => $load_source) {
213
+			$alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency);
214
+			if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
215
+				|| ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ])
216
+			) {
217
+				unset($dependencies[ $dependency ]);
218
+				$dependencies[ $alias ] = $load_source;
219
+				$registered = true;
220
+			}
221
+		}
222
+		// now add our two lists of dependencies together.
223
+		// using Union (+=) favours the arrays in precedence from left to right,
224
+		// so $dependencies is NOT overwritten because it is listed first
225
+		// ie: with A = B + C, entries in B take precedence over duplicate entries in C
226
+		// Union is way faster than array_merge() but should be used with caution...
227
+		// especially with numerically indexed arrays
228
+		$dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ];
229
+		// now we need to ensure that the resulting dependencies
230
+		// array only has the entries that are required for the class
231
+		// so first count how many dependencies were originally registered for the class
232
+		$dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]);
233
+		// if that count is non-zero (meaning dependencies were already registered)
234
+		EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count
235
+			// then truncate the  final array to match that count
236
+			? array_slice($dependencies, 0, $dependency_count)
237
+			// otherwise just take the incoming array because nothing previously existed
238
+			: $dependencies;
239
+		return $registered;
240
+	}
241
+
242
+
243
+	/**
244
+	 * @param string $class_name
245
+	 * @param string $loader
246
+	 * @return bool
247
+	 * @throws DomainException
248
+	 */
249
+	public static function register_class_loader($class_name, $loader = 'load_core')
250
+	{
251
+		return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader);
252
+	}
253
+
254
+
255
+	/**
256
+	 * @param string $class_name
257
+	 * @param string $loader
258
+	 * @return bool
259
+	 * @throws DomainException
260
+	 */
261
+	public function registerClassLoader($class_name, $loader = 'load_core')
262
+	{
263
+		if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
264
+			throw new DomainException(
265
+				esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
266
+			);
267
+		}
268
+		// check that loader is callable or method starts with "load_" and exists in EE_Registry
269
+		if (! is_callable($loader)
270
+			&& (
271
+				strpos($loader, 'load_') !== 0
272
+				|| ! method_exists('EE_Registry', $loader)
273
+			)
274
+		) {
275
+			throw new DomainException(
276
+				sprintf(
277
+					esc_html__(
278
+						'"%1$s" is not a valid loader method on EE_Registry.',
279
+						'event_espresso'
280
+					),
281
+					$loader
282
+				)
283
+			);
284
+		}
285
+		$class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name);
286
+		if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) {
287
+			EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader;
288
+			return true;
289
+		}
290
+		return false;
291
+	}
292
+
293
+
294
+	/**
295
+	 * @return array
296
+	 */
297
+	public function dependency_map()
298
+	{
299
+		return $this->_dependency_map;
300
+	}
301
+
302
+
303
+	/**
304
+	 * returns TRUE if dependency map contains a listing for the provided class name
305
+	 *
306
+	 * @param string $class_name
307
+	 * @return boolean
308
+	 */
309
+	public function has($class_name = '')
310
+	{
311
+		// all legacy models have the same dependencies
312
+		if (strpos($class_name, 'EEM_') === 0) {
313
+			$class_name = 'LEGACY_MODELS';
314
+		}
315
+		return isset($this->_dependency_map[ $class_name ]);
316
+	}
317
+
318
+
319
+	/**
320
+	 * returns TRUE if dependency map contains a listing for the provided class name AND dependency
321
+	 *
322
+	 * @param string $class_name
323
+	 * @param string $dependency
324
+	 * @return bool
325
+	 */
326
+	public function has_dependency_for_class($class_name = '', $dependency = '')
327
+	{
328
+		// all legacy models have the same dependencies
329
+		if (strpos($class_name, 'EEM_') === 0) {
330
+			$class_name = 'LEGACY_MODELS';
331
+		}
332
+		$dependency = $this->getFqnForAlias($dependency, $class_name);
333
+		return isset($this->_dependency_map[ $class_name ][ $dependency ]);
334
+	}
335
+
336
+
337
+	/**
338
+	 * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
339
+	 *
340
+	 * @param string $class_name
341
+	 * @param string $dependency
342
+	 * @return int
343
+	 */
344
+	public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
345
+	{
346
+		// all legacy models have the same dependencies
347
+		if (strpos($class_name, 'EEM_') === 0) {
348
+			$class_name = 'LEGACY_MODELS';
349
+		}
350
+		$dependency = $this->getFqnForAlias($dependency);
351
+		return $this->has_dependency_for_class($class_name, $dependency)
352
+			? $this->_dependency_map[ $class_name ][ $dependency ]
353
+			: EE_Dependency_Map::not_registered;
354
+	}
355
+
356
+
357
+	/**
358
+	 * @param string $class_name
359
+	 * @return string | Closure
360
+	 */
361
+	public function class_loader($class_name)
362
+	{
363
+		// all legacy models use load_model()
364
+		if (strpos($class_name, 'EEM_') === 0) {
365
+			return 'load_model';
366
+		}
367
+		// EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
368
+		// perform strpos() first to avoid loading regex every time we load a class
369
+		if (strpos($class_name, 'EE_CPT_') === 0
370
+			&& preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
371
+		) {
372
+			return 'load_core';
373
+		}
374
+		$class_name = $this->getFqnForAlias($class_name);
375
+		return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
376
+	}
377
+
378
+
379
+	/**
380
+	 * @return array
381
+	 */
382
+	public function class_loaders()
383
+	{
384
+		return $this->_class_loaders;
385
+	}
386
+
387
+
388
+	/**
389
+	 * adds an alias for a classname
390
+	 *
391
+	 * @param string $fqcn      the class name that should be used (concrete class to replace interface)
392
+	 * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
393
+	 * @param string $for_class the class that has the dependency (is type hinting for the interface)
394
+	 * @throws InvalidAliasException
395
+	 */
396
+	public function add_alias($fqcn, $alias, $for_class = '')
397
+	{
398
+		$this->class_cache->addAlias($fqcn, $alias, $for_class);
399
+	}
400
+
401
+
402
+	/**
403
+	 * Returns TRUE if the provided fully qualified name IS an alias
404
+	 * WHY?
405
+	 * Because if a class is type hinting for a concretion,
406
+	 * then why would we need to find another class to supply it?
407
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
408
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
409
+	 * Don't go looking for some substitute.
410
+	 * Whereas if a class is type hinting for an interface...
411
+	 * then we need to find an actual class to use.
412
+	 * So the interface IS the alias for some other FQN,
413
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
414
+	 * represents some other class.
415
+	 *
416
+	 * @param string $fqn
417
+	 * @param string $for_class
418
+	 * @return bool
419
+	 */
420
+	public function isAlias($fqn = '', $for_class = '')
421
+	{
422
+		return $this->class_cache->isAlias($fqn, $for_class);
423
+	}
424
+
425
+
426
+	/**
427
+	 * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
428
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
429
+	 *  for example:
430
+	 *      if the following two entries were added to the _aliases array:
431
+	 *          array(
432
+	 *              'interface_alias'           => 'some\namespace\interface'
433
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
434
+	 *          )
435
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
436
+	 *      to load an instance of 'some\namespace\classname'
437
+	 *
438
+	 * @param string $alias
439
+	 * @param string $for_class
440
+	 * @return string
441
+	 */
442
+	public function getFqnForAlias($alias = '', $for_class = '')
443
+	{
444
+		return (string) $this->class_cache->getFqnForAlias($alias, $for_class);
445
+	}
446
+
447
+
448
+	/**
449
+	 * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
450
+	 * if one exists, or whether a new object should be generated every time the requested class is loaded.
451
+	 * This is done by using the following class constants:
452
+	 *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
453
+	 *        EE_Dependency_Map::load_new_object - generates a new object every time
454
+	 */
455
+	protected function _register_core_dependencies()
456
+	{
457
+		$this->_dependency_map = [
458
+			'EE_Request_Handler'                                                                                          => [
459
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
460
+			],
461
+			'EE_System'                                                                                                   => [
462
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
463
+				'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
464
+				'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
465
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
466
+				'EventEspresso\core\services\routing\Router'  => EE_Dependency_Map::load_from_cache,
467
+			],
468
+			'EE_Admin'                                                                                                    => [
469
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
470
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
471
+			],
472
+			'EE_Cart'                                                                                                     => [
473
+				'EE_Session' => EE_Dependency_Map::load_from_cache,
474
+			],
475
+			'EE_Messenger_Collection_Loader'                                                                              => [
476
+				'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
477
+			],
478
+			'EE_Message_Type_Collection_Loader'                                                                           => [
479
+				'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
480
+			],
481
+			'EE_Message_Resource_Manager'                                                                                 => [
482
+				'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
483
+				'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
484
+				'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
485
+			],
486
+			'EE_Message_Factory'                                                                                          => [
487
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
488
+			],
489
+			'EE_messages'                                                                                                 => [
490
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
491
+			],
492
+			'EE_Messages_Generator'                                                                                       => [
493
+				'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
494
+				'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
495
+				'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
496
+				'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
497
+			],
498
+			'EE_Messages_Processor'                                                                                       => [
499
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
500
+			],
501
+			'EE_Messages_Queue'                                                                                           => [
502
+				'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
503
+			],
504
+			'EE_Messages_Template_Defaults'                                                                               => [
505
+				'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
506
+				'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
507
+			],
508
+			'EE_Message_To_Generate_From_Request'                                                                         => [
509
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
510
+				'EE_Request_Handler'          => EE_Dependency_Map::load_from_cache,
511
+			],
512
+			'EventEspresso\core\services\commands\CommandBus'                                                             => [
513
+				'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
514
+			],
515
+			'EventEspresso\services\commands\CommandHandler'                                                              => [
516
+				'EE_Registry'         => EE_Dependency_Map::load_from_cache,
517
+				'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
518
+			],
519
+			'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => [
520
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
521
+			],
522
+			'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => [
523
+				'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
524
+				'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
525
+			],
526
+			'EventEspresso\core\services\commands\CommandFactory'                                                         => [
527
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
528
+			],
529
+			'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => [
530
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
531
+			],
532
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => [
533
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
534
+			],
535
+			'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => [
536
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
537
+			],
538
+			'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => [
539
+				'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
540
+			],
541
+			'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => [
542
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
543
+			],
544
+			'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => [
545
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
546
+			],
547
+			'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => [
548
+				'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
549
+			],
550
+			'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [
551
+				'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
552
+			],
553
+			'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => [
554
+				'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
555
+			],
556
+			'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => [
557
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
558
+			],
559
+			'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => [
560
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
561
+			],
562
+			'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => [
563
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
564
+			],
565
+			'EventEspresso\core\services\database\TableManager'                                                           => [
566
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
567
+			],
568
+			'EE_Data_Migration_Class_Base'                                                                                => [
569
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
570
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
571
+			],
572
+			'EE_DMS_Core_4_1_0'                                                                                           => [
573
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
574
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
575
+			],
576
+			'EE_DMS_Core_4_2_0'                                                                                           => [
577
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
578
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
579
+			],
580
+			'EE_DMS_Core_4_3_0'                                                                                           => [
581
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
582
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
583
+			],
584
+			'EE_DMS_Core_4_4_0'                                                                                           => [
585
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
586
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
587
+			],
588
+			'EE_DMS_Core_4_5_0'                                                                                           => [
589
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
590
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
591
+			],
592
+			'EE_DMS_Core_4_6_0'                                                                                           => [
593
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
594
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
595
+			],
596
+			'EE_DMS_Core_4_7_0'                                                                                           => [
597
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
598
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
599
+			],
600
+			'EE_DMS_Core_4_8_0'                                                                                           => [
601
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
602
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
603
+			],
604
+			'EE_DMS_Core_4_9_0'                                                                                           => [
605
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
606
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
607
+			],
608
+			'EE_DMS_Core_4_10_0'                                                                                          => [
609
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
610
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
611
+				'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
612
+			],
613
+			'EventEspresso\core\services\assets\I18nRegistry'                                                             => [
614
+				'EventEspresso\core\domain\Domain'                 => EE_Dependency_Map::load_from_cache,
615
+				'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache,
616
+				[],
617
+			],
618
+			'EventEspresso\core\services\assets\Registry'                                                                 => [
619
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
620
+				'EventEspresso\core\services\assets\I18nRegistry'    => EE_Dependency_Map::load_from_cache,
621
+			],
622
+			'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
623
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
624
+			],
625
+			'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
626
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
627
+			],
628
+			'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
629
+				'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
630
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
631
+			],
632
+			'EventEspresso\core\domain\values\EmailAddress'                                                               => [
633
+				null,
634
+				'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
635
+			],
636
+			'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
637
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
638
+			],
639
+			'LEGACY_MODELS'                                                                                               => [
640
+				null,
641
+				'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
642
+			],
643
+			'EE_Module_Request_Router'                                                                                    => [
644
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
645
+			],
646
+			'EE_Registration_Processor'                                                                                   => [
647
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
648
+			],
649
+			'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
650
+				null,
651
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
652
+				'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
653
+			],
654
+			'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
655
+				'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
656
+				'EE_Session'             => EE_Dependency_Map::load_from_cache,
657
+			],
658
+			'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
659
+				'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
660
+				'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
661
+				'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
662
+				'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
663
+				'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
664
+			],
665
+			'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
666
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
667
+			],
668
+			'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
669
+				'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
670
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
671
+			],
672
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
673
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
674
+			],
675
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
676
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
677
+			],
678
+			'EE_CPT_Strategy'                                                                                             => [
679
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
680
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
681
+			],
682
+			'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
683
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
684
+			],
685
+			'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
686
+				null,
687
+				null,
688
+				null,
689
+				'EE_Request_Handler'                          => EE_Dependency_Map::load_from_cache,
690
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
691
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
692
+			],
693
+			'EventEspresso\core\services\dependencies\DependencyResolver'                                                 => [
694
+				'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
695
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
696
+				'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
697
+			],
698
+			'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver'                               => [
699
+				'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
700
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
701
+				'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
702
+			],
703
+			'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'                                          => [
704
+				'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
705
+				'EventEspresso\core\services\loaders\Loader'                                    => EE_Dependency_Map::load_from_cache,
706
+			],
707
+			'EventEspresso\core\services\routing\RouteMatchSpecificationManager'                                          => [
708
+				'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
709
+				'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
710
+			],
711
+			'EE_URL_Validation_Strategy'                                                                                  => [
712
+				null,
713
+				null,
714
+				'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
715
+			],
716
+			'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
717
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
718
+			],
719
+			'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
720
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
721
+			],
722
+			'EventEspresso\core\domain\services\converters\RestApiSpoofer'                                                => [
723
+				'WP_REST_Server'                                               => EE_Dependency_Map::load_from_cache,
724
+				'EED_Core_Rest_Api'                                            => EE_Dependency_Map::load_from_cache,
725
+				'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,
726
+				null,
727
+			],
728
+			'EventEspresso\core\services\routing\RouteHandler'                                                            => [
729
+				'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache,
730
+				'EventEspresso\core\services\loaders\Loader'           => EE_Dependency_Map::load_from_cache,
731
+				'EventEspresso\core\services\request\Request'          => EE_Dependency_Map::load_from_cache,
732
+				'EventEspresso\core\services\routing\RouteCollection'  => EE_Dependency_Map::load_from_cache,
733
+			],
734
+			'EventEspresso\core\services\json\JsonDataNodeHandler'                                                        => [
735
+				'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
736
+			],
737
+			'EventEspresso\core\domain\services\assets\EspressoCoreAppAssetManager'                                       => [
738
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
739
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
740
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
741
+			],
742
+			'EventEspresso\core\services\routing\Router'                                                                  => [
743
+				'EE_Dependency_Map'                                => EE_Dependency_Map::load_from_cache,
744
+				'EventEspresso\core\services\loaders\Loader'       => EE_Dependency_Map::load_from_cache,
745
+				'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache,
746
+			],
747
+		];
748
+	}
749
+
750
+
751
+	/**
752
+	 * Registers how core classes are loaded.
753
+	 * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
754
+	 *        'EE_Request_Handler' => 'load_core'
755
+	 *        'EE_Messages_Queue'  => 'load_lib'
756
+	 *        'EEH_Debug_Tools'    => 'load_helper'
757
+	 * or, if greater control is required, by providing a custom closure. For example:
758
+	 *        'Some_Class' => function () {
759
+	 *            return new Some_Class();
760
+	 *        },
761
+	 * This is required for instantiating dependencies
762
+	 * where an interface has been type hinted in a class constructor. For example:
763
+	 *        'Required_Interface' => function () {
764
+	 *            return new A_Class_That_Implements_Required_Interface();
765
+	 *        },
766
+	 */
767
+	protected function _register_core_class_loaders()
768
+	{
769
+		$this->_class_loaders = [
770
+			// load_core
771
+			'EE_Dependency_Map'                            => function () {
772
+				return $this;
773
+			},
774
+			'EE_Capabilities'                              => 'load_core',
775
+			'EE_Encryption'                                => 'load_core',
776
+			'EE_Front_Controller'                          => 'load_core',
777
+			'EE_Module_Request_Router'                     => 'load_core',
778
+			'EE_Registry'                                  => 'load_core',
779
+			'EE_Request'                                   => function () {
780
+				return $this->legacy_request;
781
+			},
782
+			'EventEspresso\core\services\request\Request'  => function () {
783
+				return $this->request;
784
+			},
785
+			'EventEspresso\core\services\request\Response' => function () {
786
+				return $this->response;
787
+			},
788
+			'EE_Base'                                      => 'load_core',
789
+			'EE_Request_Handler'                           => 'load_core',
790
+			'EE_Session'                                   => 'load_core',
791
+			'EE_Cron_Tasks'                                => 'load_core',
792
+			'EE_System'                                    => 'load_core',
793
+			'EE_Maintenance_Mode'                          => 'load_core',
794
+			'EE_Register_CPTs'                             => 'load_core',
795
+			'EE_Admin'                                     => 'load_core',
796
+			'EE_CPT_Strategy'                              => 'load_core',
797
+			// load_class
798
+			'EE_Registration_Processor'                    => 'load_class',
799
+			// load_lib
800
+			'EE_Message_Resource_Manager'                  => 'load_lib',
801
+			'EE_Message_Type_Collection'                   => 'load_lib',
802
+			'EE_Message_Type_Collection_Loader'            => 'load_lib',
803
+			'EE_Messenger_Collection'                      => 'load_lib',
804
+			'EE_Messenger_Collection_Loader'               => 'load_lib',
805
+			'EE_Messages_Processor'                        => 'load_lib',
806
+			'EE_Message_Repository'                        => 'load_lib',
807
+			'EE_Messages_Queue'                            => 'load_lib',
808
+			'EE_Messages_Data_Handler_Collection'          => 'load_lib',
809
+			'EE_Message_Template_Group_Collection'         => 'load_lib',
810
+			'EE_Payment_Method_Manager'                    => 'load_lib',
811
+			'EE_DMS_Core_4_1_0'                            => 'load_dms',
812
+			'EE_DMS_Core_4_2_0'                            => 'load_dms',
813
+			'EE_DMS_Core_4_3_0'                            => 'load_dms',
814
+			'EE_DMS_Core_4_5_0'                            => 'load_dms',
815
+			'EE_DMS_Core_4_6_0'                            => 'load_dms',
816
+			'EE_DMS_Core_4_7_0'                            => 'load_dms',
817
+			'EE_DMS_Core_4_8_0'                            => 'load_dms',
818
+			'EE_DMS_Core_4_9_0'                            => 'load_dms',
819
+			'EE_DMS_Core_4_10_0'                           => 'load_dms',
820
+			'EE_Messages_Generator'                        => static function () {
821
+				return EE_Registry::instance()->load_lib(
822
+					'Messages_Generator',
823
+					[],
824
+					false,
825
+					false
826
+				);
827
+			},
828
+			'EE_Messages_Template_Defaults'                => static function ($arguments = []) {
829
+				return EE_Registry::instance()->load_lib(
830
+					'Messages_Template_Defaults',
831
+					$arguments,
832
+					false,
833
+					false
834
+				);
835
+			},
836
+			// load_helper
837
+			'EEH_Parse_Shortcodes'                         => static function () {
838
+				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
839
+					return new EEH_Parse_Shortcodes();
840
+				}
841
+				return null;
842
+			},
843
+			'EE_Template_Config'                           => static function () {
844
+				return EE_Config::instance()->template_settings;
845
+			},
846
+			'EE_Currency_Config'                           => static function () {
847
+				return EE_Config::instance()->currency;
848
+			},
849
+			'EE_Registration_Config'                       => static function () {
850
+				return EE_Config::instance()->registration;
851
+			},
852
+			'EE_Core_Config'                               => static function () {
853
+				return EE_Config::instance()->core;
854
+			},
855
+			'EventEspresso\core\services\loaders\Loader'   => static function () {
856
+				return LoaderFactory::getLoader();
857
+			},
858
+			'EE_Network_Config'                            => static function () {
859
+				return EE_Network_Config::instance();
860
+			},
861
+			'EE_Config'                                    => static function () {
862
+				return EE_Config::instance();
863
+			},
864
+			'EventEspresso\core\domain\Domain'             => static function () {
865
+				return DomainFactory::getEventEspressoCoreDomain();
866
+			},
867
+			'EE_Admin_Config'                              => static function () {
868
+				return EE_Config::instance()->admin;
869
+			},
870
+			'EE_Organization_Config'                       => static function () {
871
+				return EE_Config::instance()->organization;
872
+			},
873
+			'EE_Network_Core_Config'                       => static function () {
874
+				return EE_Network_Config::instance()->core;
875
+			},
876
+			'EE_Environment_Config'                        => static function () {
877
+				return EE_Config::instance()->environment;
878
+			},
879
+			'EED_Core_Rest_Api'                            => static function () {
880
+				return EED_Core_Rest_Api::instance();
881
+			},
882
+			'WP_REST_Server'                               => static function () {
883
+				return rest_get_server();
884
+			},
885
+		];
886
+	}
887
+
888
+
889
+	/**
890
+	 * can be used for supplying alternate names for classes,
891
+	 * or for connecting interface names to instantiable classes
892
+	 *
893
+	 * @throws InvalidAliasException
894
+	 */
895
+	protected function _register_core_aliases()
896
+	{
897
+		$aliases = [
898
+			'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
899
+			'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
900
+			'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
901
+			'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
902
+			'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
903
+			'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
904
+			'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
905
+			'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
906
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
907
+			'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
908
+			'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
909
+			'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
910
+			'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
911
+			'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
912
+			'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
913
+			'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
914
+			'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
915
+			'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
916
+			'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
917
+			'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
918
+			'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
919
+			'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
920
+			'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
921
+			'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
922
+			'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
923
+			'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
924
+			'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
925
+			'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
926
+			'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
927
+			'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
928
+			'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
929
+			'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
930
+			'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
931
+			'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
932
+			'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
933
+			'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
934
+			'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
935
+			'Registration_Processor'                                                       => 'EE_Registration_Processor',
936
+		];
937
+		foreach ($aliases as $alias => $fqn) {
938
+			if (is_array($fqn)) {
939
+				foreach ($fqn as $class => $for_class) {
940
+					$this->class_cache->addAlias($class, $alias, $for_class);
941
+				}
942
+				continue;
943
+			}
944
+			$this->class_cache->addAlias($fqn, $alias);
945
+		}
946
+		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
947
+			$this->class_cache->addAlias(
948
+				'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
949
+				'EventEspresso\core\services\notices\NoticeConverterInterface'
950
+			);
951
+		}
952
+	}
953
+
954
+
955
+	/**
956
+	 * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
957
+	 * request Primarily used by unit tests.
958
+	 */
959
+	public function reset()
960
+	{
961
+		$this->_register_core_class_loaders();
962
+		$this->_register_core_dependencies();
963
+	}
964
+
965
+
966
+	/**
967
+	 * PLZ NOTE: a better name for this method would be is_alias()
968
+	 * because it returns TRUE if the provided fully qualified name IS an alias
969
+	 * WHY?
970
+	 * Because if a class is type hinting for a concretion,
971
+	 * then why would we need to find another class to supply it?
972
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
973
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
974
+	 * Don't go looking for some substitute.
975
+	 * Whereas if a class is type hinting for an interface...
976
+	 * then we need to find an actual class to use.
977
+	 * So the interface IS the alias for some other FQN,
978
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
979
+	 * represents some other class.
980
+	 *
981
+	 * @param string $fqn
982
+	 * @param string $for_class
983
+	 * @return bool
984
+	 * @deprecated 4.9.62.p
985
+	 */
986
+	public function has_alias($fqn = '', $for_class = '')
987
+	{
988
+		return $this->isAlias($fqn, $for_class);
989
+	}
990
+
991
+
992
+	/**
993
+	 * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
994
+	 * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
995
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
996
+	 *  for example:
997
+	 *      if the following two entries were added to the _aliases array:
998
+	 *          array(
999
+	 *              'interface_alias'           => 'some\namespace\interface'
1000
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
1001
+	 *          )
1002
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1003
+	 *      to load an instance of 'some\namespace\classname'
1004
+	 *
1005
+	 * @param string $alias
1006
+	 * @param string $for_class
1007
+	 * @return string
1008
+	 * @deprecated 4.9.62.p
1009
+	 */
1010
+	public function get_alias($alias = '', $for_class = '')
1011
+	{
1012
+		return $this->getFqnForAlias($alias, $for_class);
1013
+	}
1014 1014
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/shared/AssetRequests.php 1 patch
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -16,111 +16,111 @@
 block discarded – undo
16 16
 class AssetRequests extends Route
17 17
 {
18 18
 
19
-    /**
20
-     * returns true if the current request matches this route
21
-     *
22
-     * @return bool
23
-     * @since   $VID:$
24
-     */
25
-    public function matchesCurrentRequest()
26
-    {
27
-        return $this->request->isAdmin()
28
-               || $this->request->isFrontend()
29
-               || $this->request->isIframe()
30
-               || $this->request->isWordPressApi();
31
-    }
19
+	/**
20
+	 * returns true if the current request matches this route
21
+	 *
22
+	 * @return bool
23
+	 * @since   $VID:$
24
+	 */
25
+	public function matchesCurrentRequest()
26
+	{
27
+		return $this->request->isAdmin()
28
+			   || $this->request->isFrontend()
29
+			   || $this->request->isIframe()
30
+			   || $this->request->isWordPressApi();
31
+	}
32 32
 
33 33
 
34
-    /**
35
-     * @since $VID:$
36
-     */
37
-    protected function registerDependencies()
38
-    {
39
-        $default_dependencies = [
40
-            'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
41
-            'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
42
-            'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
43
-        ];
44
-        $this->dependency_map->registerDependencies(
45
-            'EventEspresso\core\domain\services\assets\ReactAssetManager',
46
-            $default_dependencies
47
-        );
48
-        $this->dependency_map->registerDependencies(
49
-            'EventEspresso\core\domain\services\assets\CoreAssetManager',
50
-            [
51
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
52
-                'EE_Currency_Config'                                 => EE_Dependency_Map::load_from_cache,
53
-                'EE_Template_Config'                                 => EE_Dependency_Map::load_from_cache,
54
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
55
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
56
-            ]
57
-        );
58
-        $this->dependency_map->registerDependencies(
59
-            'EventEspresso\core\services\editor\BlockRegistrationManager',
60
-            [
61
-                'EventEspresso\core\services\assets\BlockAssetManagerCollection'     => EE_Dependency_Map::load_from_cache,
62
-                'EventEspresso\core\domain\entities\editor\BlockCollection'          => EE_Dependency_Map::load_from_cache,
63
-                'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache,
64
-                'EventEspresso\core\services\request\Request'                        => EE_Dependency_Map::load_from_cache,
65
-            ]
66
-        );
67
-        $this->dependency_map->registerDependencies(
68
-            'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager',
69
-            [
70
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
71
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
72
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
73
-            ]
74
-        );
75
-        $this->dependency_map->registerDependencies(
76
-            'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer',
77
-            [
78
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
79
-                'EEM_Attendee'                     => EE_Dependency_Map::load_from_cache,
80
-            ]
81
-        );
82
-        $this->dependency_map->registerDependencies(
83
-            'EventEspresso\core\domain\entities\editor\blocks\EventAttendees',
84
-            [
85
-                'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'      => EE_Dependency_Map::load_from_cache,
86
-                'EventEspresso\core\services\request\Request'                           => EE_Dependency_Map::load_from_cache,
87
-                'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => EE_Dependency_Map::load_from_cache,
88
-            ]
89
-        );
90
-    }
34
+	/**
35
+	 * @since $VID:$
36
+	 */
37
+	protected function registerDependencies()
38
+	{
39
+		$default_dependencies = [
40
+			'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
41
+			'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
42
+			'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
43
+		];
44
+		$this->dependency_map->registerDependencies(
45
+			'EventEspresso\core\domain\services\assets\ReactAssetManager',
46
+			$default_dependencies
47
+		);
48
+		$this->dependency_map->registerDependencies(
49
+			'EventEspresso\core\domain\services\assets\CoreAssetManager',
50
+			[
51
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
52
+				'EE_Currency_Config'                                 => EE_Dependency_Map::load_from_cache,
53
+				'EE_Template_Config'                                 => EE_Dependency_Map::load_from_cache,
54
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
55
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
56
+			]
57
+		);
58
+		$this->dependency_map->registerDependencies(
59
+			'EventEspresso\core\services\editor\BlockRegistrationManager',
60
+			[
61
+				'EventEspresso\core\services\assets\BlockAssetManagerCollection'     => EE_Dependency_Map::load_from_cache,
62
+				'EventEspresso\core\domain\entities\editor\BlockCollection'          => EE_Dependency_Map::load_from_cache,
63
+				'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache,
64
+				'EventEspresso\core\services\request\Request'                        => EE_Dependency_Map::load_from_cache,
65
+			]
66
+		);
67
+		$this->dependency_map->registerDependencies(
68
+			'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager',
69
+			[
70
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
71
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
72
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
73
+			]
74
+		);
75
+		$this->dependency_map->registerDependencies(
76
+			'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer',
77
+			[
78
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
79
+				'EEM_Attendee'                     => EE_Dependency_Map::load_from_cache,
80
+			]
81
+		);
82
+		$this->dependency_map->registerDependencies(
83
+			'EventEspresso\core\domain\entities\editor\blocks\EventAttendees',
84
+			[
85
+				'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'      => EE_Dependency_Map::load_from_cache,
86
+				'EventEspresso\core\services\request\Request'                           => EE_Dependency_Map::load_from_cache,
87
+				'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => EE_Dependency_Map::load_from_cache,
88
+			]
89
+		);
90
+	}
91 91
 
92 92
 
93
-    /**
94
-     * implements logic required to run during request
95
-     *
96
-     * @return bool
97
-     * @since   $VID:$
98
-     */
99
-    protected function requestHandler()
100
-    {
101
-        $this->loader->getShared('EventEspresso\core\services\assets\Registry');
102
-        $this->loader->getShared('EventEspresso\core\domain\services\assets\CoreAssetManager');
103
-        if ($this->canLoadBlocks()) {
104
-            $this->loader->getShared(
105
-                'EventEspresso\core\services\editor\BlockRegistrationManager'
106
-            );
107
-        }
108
-        return true;
109
-    }
93
+	/**
94
+	 * implements logic required to run during request
95
+	 *
96
+	 * @return bool
97
+	 * @since   $VID:$
98
+	 */
99
+	protected function requestHandler()
100
+	{
101
+		$this->loader->getShared('EventEspresso\core\services\assets\Registry');
102
+		$this->loader->getShared('EventEspresso\core\domain\services\assets\CoreAssetManager');
103
+		if ($this->canLoadBlocks()) {
104
+			$this->loader->getShared(
105
+				'EventEspresso\core\services\editor\BlockRegistrationManager'
106
+			);
107
+		}
108
+		return true;
109
+	}
110 110
 
111 111
 
112
-    /**
113
-     * Return whether blocks can be registered/loaded or not.
114
-     *
115
-     * @return bool
116
-     * @since $VID:$
117
-     */
118
-    private function canLoadBlocks()
119
-    {
120
-        return apply_filters('FHEE__EE_System__canLoadBlocks', true)
121
-               && function_exists('register_block_type')
122
-               // don't load blocks if in the Divi page builder editor context
123
-               // @see https://github.com/eventespresso/event-espresso-core/issues/814
124
-               && ! $this->request->getRequestParam('et_fb', false);
125
-    }
112
+	/**
113
+	 * Return whether blocks can be registered/loaded or not.
114
+	 *
115
+	 * @return bool
116
+	 * @since $VID:$
117
+	 */
118
+	private function canLoadBlocks()
119
+	{
120
+		return apply_filters('FHEE__EE_System__canLoadBlocks', true)
121
+			   && function_exists('register_block_type')
122
+			   // don't load blocks if in the Divi page builder editor context
123
+			   // @see https://github.com/eventespresso/event-espresso-core/issues/814
124
+			   && ! $this->request->getRequestParam('et_fb', false);
125
+	}
126 126
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/shared/RegularRequests.php 1 patch
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -18,128 +18,128 @@
 block discarded – undo
18 18
 class RegularRequests extends PrimaryRoute
19 19
 {
20 20
 
21
-    /**
22
-     * called just before matchesCurrentRequest()
23
-     * and allows Route to perform any setup required such as calling setSpecification()
24
-     *
25
-     * @since $VID:$
26
-     */
27
-    public function initialize()
28
-    {
29
-        $basic_nodes = [
30
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\Api',
31
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser',
32
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale',
33
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls',
34
-        ];
35
-        foreach ($basic_nodes as $basic_node) {
36
-            $this->dependency_map->registerDependencies(
37
-                $basic_node,
38
-                ['EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache]
39
-            );
40
-        }
41
-        $this->dependency_map->registerDependencies(
42
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings',
43
-            [
44
-                'EventEspresso\core\services\json\JsonDataNodeValidator'                => EE_Dependency_Map::load_from_cache,
45
-                'EventEspresso\core\services\converters\date_time_formats\PhpToUnicode' => EE_Dependency_Map::load_from_cache,
46
-            ]
47
-        );
48
-        $this->dependency_map->registerDependencies(
49
-            'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData',
50
-            [
51
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\Api'    => EE_Dependency_Map::load_from_cache,
52
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\Config' => EE_Dependency_Map::load_from_cache,
53
-                'EventEspresso\core\services\assets\JedLocaleData'                  => EE_Dependency_Map::load_from_cache,
54
-                'EventEspresso\core\services\json\JsonDataNodeValidator'            => EE_Dependency_Map::load_from_cache,
55
-            ]
56
-        );
57
-        $this->dependency_map->registerDependencies(
58
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\Config',
59
-            [
60
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser'        => EE_Dependency_Map::load_from_cache,
61
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain' => EE_Dependency_Map::load_from_cache,
62
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings'    => EE_Dependency_Map::load_from_cache,
63
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale'             => EE_Dependency_Map::load_from_cache,
64
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency'       => EE_Dependency_Map::load_from_cache,
65
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls'           => EE_Dependency_Map::load_from_cache,
66
-                'EventEspresso\core\services\json\JsonDataNodeValidator'                        => EE_Dependency_Map::load_from_cache,
67
-            ]
68
-        );
69
-        $this->dependency_map->registerDependencies(
70
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain',
71
-            [
72
-                'EventEspresso\core\domain\Domain'                       => EE_Dependency_Map::load_from_cache,
73
-                'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
74
-            ]
75
-        );
76
-        $this->dependency_map->registerDependencies(
77
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency',
78
-            [
79
-                'EE_Currency_Config'                                     => EE_Dependency_Map::load_from_cache,
80
-                'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
81
-            ]
82
-        );
83
-        $this->setDataNode(
84
-            $this->loader->getShared('EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData')
85
-        );
86
-    }
21
+	/**
22
+	 * called just before matchesCurrentRequest()
23
+	 * and allows Route to perform any setup required such as calling setSpecification()
24
+	 *
25
+	 * @since $VID:$
26
+	 */
27
+	public function initialize()
28
+	{
29
+		$basic_nodes = [
30
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\Api',
31
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser',
32
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale',
33
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls',
34
+		];
35
+		foreach ($basic_nodes as $basic_node) {
36
+			$this->dependency_map->registerDependencies(
37
+				$basic_node,
38
+				['EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache]
39
+			);
40
+		}
41
+		$this->dependency_map->registerDependencies(
42
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings',
43
+			[
44
+				'EventEspresso\core\services\json\JsonDataNodeValidator'                => EE_Dependency_Map::load_from_cache,
45
+				'EventEspresso\core\services\converters\date_time_formats\PhpToUnicode' => EE_Dependency_Map::load_from_cache,
46
+			]
47
+		);
48
+		$this->dependency_map->registerDependencies(
49
+			'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData',
50
+			[
51
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\Api'    => EE_Dependency_Map::load_from_cache,
52
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\Config' => EE_Dependency_Map::load_from_cache,
53
+				'EventEspresso\core\services\assets\JedLocaleData'                  => EE_Dependency_Map::load_from_cache,
54
+				'EventEspresso\core\services\json\JsonDataNodeValidator'            => EE_Dependency_Map::load_from_cache,
55
+			]
56
+		);
57
+		$this->dependency_map->registerDependencies(
58
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\Config',
59
+			[
60
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser'        => EE_Dependency_Map::load_from_cache,
61
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain' => EE_Dependency_Map::load_from_cache,
62
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings'    => EE_Dependency_Map::load_from_cache,
63
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale'             => EE_Dependency_Map::load_from_cache,
64
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency'       => EE_Dependency_Map::load_from_cache,
65
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls'           => EE_Dependency_Map::load_from_cache,
66
+				'EventEspresso\core\services\json\JsonDataNodeValidator'                        => EE_Dependency_Map::load_from_cache,
67
+			]
68
+		);
69
+		$this->dependency_map->registerDependencies(
70
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain',
71
+			[
72
+				'EventEspresso\core\domain\Domain'                       => EE_Dependency_Map::load_from_cache,
73
+				'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
74
+			]
75
+		);
76
+		$this->dependency_map->registerDependencies(
77
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency',
78
+			[
79
+				'EE_Currency_Config'                                     => EE_Dependency_Map::load_from_cache,
80
+				'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
81
+			]
82
+		);
83
+		$this->setDataNode(
84
+			$this->loader->getShared('EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData')
85
+		);
86
+	}
87 87
 
88 88
 
89
-    /**
90
-     * returns true if the current request matches this route
91
-     *
92
-     * @return bool
93
-     * @since   $VID:$
94
-     */
95
-    public function matchesCurrentRequest()
96
-    {
97
-        return ! $this->request->isActivation() || $this->request->isUnitTesting();
98
-    }
89
+	/**
90
+	 * returns true if the current request matches this route
91
+	 *
92
+	 * @return bool
93
+	 * @since   $VID:$
94
+	 */
95
+	public function matchesCurrentRequest()
96
+	{
97
+		return ! $this->request->isActivation() || $this->request->isUnitTesting();
98
+	}
99 99
 
100 100
 
101
-    /**
102
-     * @since $VID:$
103
-     */
104
-    protected function registerDependencies()
105
-    {
106
-        $admin = ['EE_Admin_Config' => EE_Dependency_Map::load_from_cache] + Route::$default_dependencies;
107
-        $public = ['EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache] + Route::$default_dependencies;
108
-        $default_routes = [
109
-            // default dependencies
110
-            'EventEspresso\core\domain\entities\routing\handlers\admin\PueRequests'          => Route::$default_dependencies,
111
-            'EventEspresso\core\domain\entities\routing\handlers\admin\WordPressPluginsPage' => Route::$default_dependencies,
112
-            'EventEspresso\core\domain\entities\routing\handlers\frontend\ShortcodeRequests' => Route::$default_dependencies,
113
-            'EventEspresso\core\domain\entities\routing\handlers\shared\AssetRequests'       => Route::$default_dependencies,
114
-            'EventEspresso\core\domain\entities\routing\handlers\shared\GQLRequests'         => Route::$default_dependencies,
115
-            'EventEspresso\core\domain\entities\routing\handlers\shared\RestApiRequests'     => Route::$default_dependencies,
116
-            'EventEspresso\core\domain\entities\routing\handlers\shared\SessionRequests'     => Route::$default_dependencies,
117
-            'EventEspresso\core\domain\entities\routing\handlers\shared\WordPressHeartbeat'  => Route::$default_dependencies,
118
-            // admin dependencies
119
-            'EventEspresso\core\domain\entities\routing\handlers\admin\AdminRoute'           => $admin,
120
-            'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventsAdmin'  => $admin,
121
-            'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventEditor'  => $admin,
122
-            'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoLegacyAdmin'  => $admin,
123
-            'EventEspresso\core\domain\entities\routing\handlers\admin\GutenbergEditor'  => $admin,
124
-            // public dependencies
125
-            'EventEspresso\core\domain\entities\routing\handlers\admin\PersonalDataRequests' => $public,
126
-            'EventEspresso\core\domain\entities\routing\handlers\frontend\FrontendRequests'  => $public,
127
-        ];
128
-        foreach ($default_routes as $route => $dependencies) {
129
-            $this->dependency_map->registerDependencies($route, $dependencies);
130
-        }
131
-    }
101
+	/**
102
+	 * @since $VID:$
103
+	 */
104
+	protected function registerDependencies()
105
+	{
106
+		$admin = ['EE_Admin_Config' => EE_Dependency_Map::load_from_cache] + Route::$default_dependencies;
107
+		$public = ['EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache] + Route::$default_dependencies;
108
+		$default_routes = [
109
+			// default dependencies
110
+			'EventEspresso\core\domain\entities\routing\handlers\admin\PueRequests'          => Route::$default_dependencies,
111
+			'EventEspresso\core\domain\entities\routing\handlers\admin\WordPressPluginsPage' => Route::$default_dependencies,
112
+			'EventEspresso\core\domain\entities\routing\handlers\frontend\ShortcodeRequests' => Route::$default_dependencies,
113
+			'EventEspresso\core\domain\entities\routing\handlers\shared\AssetRequests'       => Route::$default_dependencies,
114
+			'EventEspresso\core\domain\entities\routing\handlers\shared\GQLRequests'         => Route::$default_dependencies,
115
+			'EventEspresso\core\domain\entities\routing\handlers\shared\RestApiRequests'     => Route::$default_dependencies,
116
+			'EventEspresso\core\domain\entities\routing\handlers\shared\SessionRequests'     => Route::$default_dependencies,
117
+			'EventEspresso\core\domain\entities\routing\handlers\shared\WordPressHeartbeat'  => Route::$default_dependencies,
118
+			// admin dependencies
119
+			'EventEspresso\core\domain\entities\routing\handlers\admin\AdminRoute'           => $admin,
120
+			'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventsAdmin'  => $admin,
121
+			'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventEditor'  => $admin,
122
+			'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoLegacyAdmin'  => $admin,
123
+			'EventEspresso\core\domain\entities\routing\handlers\admin\GutenbergEditor'  => $admin,
124
+			// public dependencies
125
+			'EventEspresso\core\domain\entities\routing\handlers\admin\PersonalDataRequests' => $public,
126
+			'EventEspresso\core\domain\entities\routing\handlers\frontend\FrontendRequests'  => $public,
127
+		];
128
+		foreach ($default_routes as $route => $dependencies) {
129
+			$this->dependency_map->registerDependencies($route, $dependencies);
130
+		}
131
+	}
132 132
 
133 133
 
134
-    /**
135
-     * implements logic required to run during request
136
-     *
137
-     * @return bool
138
-     * @since   $VID:$
139
-     */
140
-    protected function requestHandler()
141
-    {
142
-        $this->setRouteRequestType(PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR);
143
-        return true;
144
-    }
134
+	/**
135
+	 * implements logic required to run during request
136
+	 *
137
+	 * @return bool
138
+	 * @since   $VID:$
139
+	 */
140
+	protected function requestHandler()
141
+	{
142
+		$this->setRouteRequestType(PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR);
143
+		return true;
144
+	}
145 145
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/admin/GutenbergEditor.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -19,71 +19,71 @@
 block discarded – undo
19 19
 class GutenbergEditor extends AdminRoute
20 20
 {
21 21
 
22
-    /**
23
-     * returns true if the current request matches this route
24
-     *
25
-     * @return bool
26
-     * @since   $VID:$
27
-     */
28
-    public function matchesCurrentRequest()
29
-    {
30
-        global $pagenow;
31
-        return parent::matchesCurrentRequest()
32
-               && $pagenow
33
-               && (
34
-                   $pagenow === 'post-new.php'
35
-                   || (
36
-                       $pagenow === 'post.php'
37
-                       && $this->request->getRequestParam('action') === 'edit'
38
-                   )
39
-               );
40
-    }
22
+	/**
23
+	 * returns true if the current request matches this route
24
+	 *
25
+	 * @return bool
26
+	 * @since   $VID:$
27
+	 */
28
+	public function matchesCurrentRequest()
29
+	{
30
+		global $pagenow;
31
+		return parent::matchesCurrentRequest()
32
+			   && $pagenow
33
+			   && (
34
+				   $pagenow === 'post-new.php'
35
+				   || (
36
+					   $pagenow === 'post.php'
37
+					   && $this->request->getRequestParam('action') === 'edit'
38
+				   )
39
+			   );
40
+	}
41 41
 
42 42
 
43
-    /**
44
-     * @since $VID:$
45
-     */
46
-    protected function registerDependencies()
47
-    {
48
-        $this->dependency_map->registerDependencies(
49
-            'EventEspresso\core\domain\entities\routing\data_nodes\domains\GutenbergEditorData',
50
-            [
51
-                'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
52
-            ]
53
-        );
54
-        $this->dependency_map->registerDependencies(
55
-            'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager',
56
-            [
57
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
58
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
59
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
60
-            ]
61
-        );
62
-        /** @var EventEspressoData $primary_data_node */
63
-        $primary_data_node = $this->loader->getShared(
64
-            'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData'
65
-        );
66
-        $primary_data_node->setTargetScript(CoreBlocksAssetManager::JS_HANDLE_CORE_BLOCKS);
67
-        /** @var EventEditor $data_node */
68
-        $data_node = $this->loader->getShared(
69
-            'EventEspresso\core\domain\entities\routing\data_nodes\domains\GutenbergEditorData'
70
-        );
71
-        $this->setDataNode($data_node);
72
-    }
43
+	/**
44
+	 * @since $VID:$
45
+	 */
46
+	protected function registerDependencies()
47
+	{
48
+		$this->dependency_map->registerDependencies(
49
+			'EventEspresso\core\domain\entities\routing\data_nodes\domains\GutenbergEditorData',
50
+			[
51
+				'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
52
+			]
53
+		);
54
+		$this->dependency_map->registerDependencies(
55
+			'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager',
56
+			[
57
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
58
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
59
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
60
+			]
61
+		);
62
+		/** @var EventEspressoData $primary_data_node */
63
+		$primary_data_node = $this->loader->getShared(
64
+			'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData'
65
+		);
66
+		$primary_data_node->setTargetScript(CoreBlocksAssetManager::JS_HANDLE_CORE_BLOCKS);
67
+		/** @var EventEditor $data_node */
68
+		$data_node = $this->loader->getShared(
69
+			'EventEspresso\core\domain\entities\routing\data_nodes\domains\GutenbergEditorData'
70
+		);
71
+		$this->setDataNode($data_node);
72
+	}
73 73
 
74 74
 
75
-    /**
76
-     * implements logic required to run during request
77
-     *
78
-     * @return bool
79
-     * @since   $VID:$
80
-     */
81
-    protected function requestHandler()
82
-    {
83
-        $this->asset_manager = $this->loader->getShared(
84
-            'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'
85
-        );
86
-        add_action('admin_enqueue_scripts', [$this->asset_manager, 'enqueueBrowserAssets'], 100);
87
-        return true;
88
-    }
75
+	/**
76
+	 * implements logic required to run during request
77
+	 *
78
+	 * @return bool
79
+	 * @since   $VID:$
80
+	 */
81
+	protected function requestHandler()
82
+	{
83
+		$this->asset_manager = $this->loader->getShared(
84
+			'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'
85
+		);
86
+		add_action('admin_enqueue_scripts', [$this->asset_manager, 'enqueueBrowserAssets'], 100);
87
+		return true;
88
+	}
89 89
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/admin/EspressoLegacyAdmin.php 1 patch
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -18,121 +18,121 @@
 block discarded – undo
18 18
 class EspressoLegacyAdmin extends AdminRoute
19 19
 {
20 20
 
21
-    /**
22
-     * @var LegacyAccountingAssetManager $asset_manager
23
-     */
24
-    protected $asset_manager;
21
+	/**
22
+	 * @var LegacyAccountingAssetManager $asset_manager
23
+	 */
24
+	protected $asset_manager;
25 25
 
26 26
 
27
-    /**
28
-     * returns true if the current request matches this route
29
-     *
30
-     * @return bool
31
-     * @since   $VID:$
32
-     */
33
-    public function matchesCurrentRequest()
34
-    {
35
-        global $pagenow;
36
-        return $this->request->isAdminAjax() || (
37
-            parent::matchesCurrentRequest() && $pagenow && $pagenow === 'admin.php'
38
-        );
39
-    }
27
+	/**
28
+	 * returns true if the current request matches this route
29
+	 *
30
+	 * @return bool
31
+	 * @since   $VID:$
32
+	 */
33
+	public function matchesCurrentRequest()
34
+	{
35
+		global $pagenow;
36
+		return $this->request->isAdminAjax() || (
37
+			parent::matchesCurrentRequest() && $pagenow && $pagenow === 'admin.php'
38
+		);
39
+	}
40 40
 
41 41
 
42
-    /**
43
-     * @since $VID:$
44
-     */
45
-    protected function registerDependencies()
46
-    {
47
-        $asset_manger_dependencies = [
48
-            'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
49
-            'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
50
-            'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
51
-        ];
52
-        $this->dependency_map->registerDependencies(JqueryAssetManager::class, $asset_manger_dependencies);
53
-        $this->dependency_map->registerDependencies(EspressoLegacyAdminAssetManager::class, $asset_manger_dependencies);
54
-        $this->dependency_map->registerDependencies(
55
-            LegacyAccountingAssetManager::class,
56
-            ['EE_Currency_Config' => EE_Dependency_Map::load_from_cache] + $asset_manger_dependencies
57
-        );
58
-        $this->dependency_map->registerDependencies(
59
-            'EE_Admin_Transactions_List_Table',
60
-            [
61
-                null,
62
-                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
63
-            ]
64
-        );
65
-        $this->dependency_map->registerDependencies(
66
-            'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings',
67
-            ['EE_Registration_Config' => EE_Dependency_Map::load_from_cache]
68
-        );
69
-        $this->dependency_map->registerDependencies(
70
-            'EventEspresso\admin_pages\general_settings\OrganizationSettings',
71
-            [
72
-                'EE_Registry'                                             => EE_Dependency_Map::load_from_cache,
73
-                'EE_Organization_Config'                                  => EE_Dependency_Map::load_from_cache,
74
-                'EE_Core_Config'                                          => EE_Dependency_Map::load_from_cache,
75
-                'EE_Network_Core_Config'                                  => EE_Dependency_Map::load_from_cache,
76
-                'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache,
77
-            ]
78
-        );
79
-        $this->dependency_map->registerDependencies(
80
-            'EventEspresso\core\services\address\CountrySubRegionDao',
81
-            [
82
-                'EEM_State'                                            => EE_Dependency_Map::load_from_cache,
83
-                'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache
84
-            ]
85
-        );
86
-        $this->dependency_map->registerDependencies(
87
-            'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder',
88
-            [
89
-                null,
90
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
91
-                'EEM_Registration'                            => EE_Dependency_Map::load_from_cache,
92
-            ]
93
-        );
94
-        $this->dependency_map->registerDependencies(
95
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader',
96
-            [
97
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
98
-                'EEM_Attendee'                                => EE_Dependency_Map::load_from_cache,
99
-            ]
100
-        );
101
-        $this->dependency_map->registerDependencies(
102
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader',
103
-            [
104
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
105
-                'EEM_Datetime'                                => EE_Dependency_Map::load_from_cache,
106
-            ]
107
-        );
108
-        $this->dependency_map->registerDependencies(
109
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader',
110
-            [
111
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
112
-                'EEM_Event'                                   => EE_Dependency_Map::load_from_cache,
113
-            ]
114
-        );
115
-        $this->dependency_map->registerDependencies(
116
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader',
117
-            [
118
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
119
-                'EEM_Ticket'                                  => EE_Dependency_Map::load_from_cache,
120
-            ]
121
-        );
122
-    }
42
+	/**
43
+	 * @since $VID:$
44
+	 */
45
+	protected function registerDependencies()
46
+	{
47
+		$asset_manger_dependencies = [
48
+			'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
49
+			'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
50
+			'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
51
+		];
52
+		$this->dependency_map->registerDependencies(JqueryAssetManager::class, $asset_manger_dependencies);
53
+		$this->dependency_map->registerDependencies(EspressoLegacyAdminAssetManager::class, $asset_manger_dependencies);
54
+		$this->dependency_map->registerDependencies(
55
+			LegacyAccountingAssetManager::class,
56
+			['EE_Currency_Config' => EE_Dependency_Map::load_from_cache] + $asset_manger_dependencies
57
+		);
58
+		$this->dependency_map->registerDependencies(
59
+			'EE_Admin_Transactions_List_Table',
60
+			[
61
+				null,
62
+				'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
63
+			]
64
+		);
65
+		$this->dependency_map->registerDependencies(
66
+			'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings',
67
+			['EE_Registration_Config' => EE_Dependency_Map::load_from_cache]
68
+		);
69
+		$this->dependency_map->registerDependencies(
70
+			'EventEspresso\admin_pages\general_settings\OrganizationSettings',
71
+			[
72
+				'EE_Registry'                                             => EE_Dependency_Map::load_from_cache,
73
+				'EE_Organization_Config'                                  => EE_Dependency_Map::load_from_cache,
74
+				'EE_Core_Config'                                          => EE_Dependency_Map::load_from_cache,
75
+				'EE_Network_Core_Config'                                  => EE_Dependency_Map::load_from_cache,
76
+				'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache,
77
+			]
78
+		);
79
+		$this->dependency_map->registerDependencies(
80
+			'EventEspresso\core\services\address\CountrySubRegionDao',
81
+			[
82
+				'EEM_State'                                            => EE_Dependency_Map::load_from_cache,
83
+				'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache
84
+			]
85
+		);
86
+		$this->dependency_map->registerDependencies(
87
+			'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder',
88
+			[
89
+				null,
90
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
91
+				'EEM_Registration'                            => EE_Dependency_Map::load_from_cache,
92
+			]
93
+		);
94
+		$this->dependency_map->registerDependencies(
95
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader',
96
+			[
97
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
98
+				'EEM_Attendee'                                => EE_Dependency_Map::load_from_cache,
99
+			]
100
+		);
101
+		$this->dependency_map->registerDependencies(
102
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader',
103
+			[
104
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
105
+				'EEM_Datetime'                                => EE_Dependency_Map::load_from_cache,
106
+			]
107
+		);
108
+		$this->dependency_map->registerDependencies(
109
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader',
110
+			[
111
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
112
+				'EEM_Event'                                   => EE_Dependency_Map::load_from_cache,
113
+			]
114
+		);
115
+		$this->dependency_map->registerDependencies(
116
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader',
117
+			[
118
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
119
+				'EEM_Ticket'                                  => EE_Dependency_Map::load_from_cache,
120
+			]
121
+		);
122
+	}
123 123
 
124 124
 
125
-    /**
126
-     * implements logic required to run during request
127
-     *
128
-     * @return bool
129
-     * @since   $VID:$
130
-     */
131
-    protected function requestHandler()
132
-    {
133
-        $this->loader->getShared(JqueryAssetManager::class);
134
-        $this->loader->getShared(EspressoLegacyAdminAssetManager::class);
135
-        $this->loader->getShared(LegacyAccountingAssetManager::class);
136
-        return true;
137
-    }
125
+	/**
126
+	 * implements logic required to run during request
127
+	 *
128
+	 * @return bool
129
+	 * @since   $VID:$
130
+	 */
131
+	protected function requestHandler()
132
+	{
133
+		$this->loader->getShared(JqueryAssetManager::class);
134
+		$this->loader->getShared(EspressoLegacyAdminAssetManager::class);
135
+		$this->loader->getShared(LegacyAccountingAssetManager::class);
136
+		return true;
137
+	}
138 138
 }
Please login to merge, or discard this patch.