Completed
Branch dev (1399ad)
by
unknown
60:04 queued 50:49
created
core/EE_Dependency_Map.core.php 1 patch
Indentation   +1038 added lines, -1038 removed lines patch added patch discarded remove patch
@@ -21,1042 +21,1042 @@
 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 (
127
-            ! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map
128
-            && $class_cache instanceof ClassInterfaceCache
129
-        ) {
130
-            EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache);
131
-        }
132
-        return EE_Dependency_Map::$_instance;
133
-    }
134
-
135
-
136
-    /**
137
-     * @param RequestInterface $request
138
-     */
139
-    public function setRequest(RequestInterface $request)
140
-    {
141
-        $this->request = $request;
142
-    }
143
-
144
-
145
-    /**
146
-     * @param LegacyRequestInterface $legacy_request
147
-     */
148
-    public function setLegacyRequest(LegacyRequestInterface $legacy_request)
149
-    {
150
-        $this->legacy_request = $legacy_request;
151
-    }
152
-
153
-
154
-    /**
155
-     * @param ResponseInterface $response
156
-     */
157
-    public function setResponse(ResponseInterface $response)
158
-    {
159
-        $this->response = $response;
160
-    }
161
-
162
-
163
-    /**
164
-     * @param LoaderInterface $loader
165
-     */
166
-    public function setLoader(LoaderInterface $loader)
167
-    {
168
-        $this->loader = $loader;
169
-    }
170
-
171
-
172
-    /**
173
-     * @param string $class
174
-     * @param array  $dependencies
175
-     * @param int    $overwrite
176
-     * @return bool
177
-     */
178
-    public static function register_dependencies(
179
-        $class,
180
-        array $dependencies,
181
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
182
-    ) {
183
-        return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite);
184
-    }
185
-
186
-
187
-    /**
188
-     * Assigns an array of class names and corresponding load sources (new or cached)
189
-     * to the class specified by the first parameter.
190
-     * IMPORTANT !!!
191
-     * The order of elements in the incoming $dependencies array MUST match
192
-     * the order of the constructor parameters for the class in question.
193
-     * This is especially important when overriding any existing dependencies that are registered.
194
-     * the third parameter controls whether any duplicate dependencies are overwritten or not.
195
-     *
196
-     * @param string $class
197
-     * @param array  $dependencies
198
-     * @param int    $overwrite
199
-     * @return bool
200
-     */
201
-    public function registerDependencies(
202
-        $class,
203
-        array $dependencies,
204
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
205
-    ) {
206
-        $class      = trim($class, '\\');
207
-        $registered = false;
208
-        if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) {
209
-            EE_Dependency_Map::$_instance->_dependency_map[ $class ] = [];
210
-        }
211
-        // we need to make sure that any aliases used when registering a dependency
212
-        // get resolved to the correct class name
213
-        foreach ($dependencies as $dependency => $load_source) {
214
-            $alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency);
215
-            if (
216
-                $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
217
-                || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ])
218
-            ) {
219
-                unset($dependencies[ $dependency ]);
220
-                $dependencies[ $alias ] = $load_source;
221
-                $registered             = true;
222
-            }
223
-        }
224
-        // now add our two lists of dependencies together.
225
-        // using Union (+=) favours the arrays in precedence from left to right,
226
-        // so $dependencies is NOT overwritten because it is listed first
227
-        // ie: with A = B + C, entries in B take precedence over duplicate entries in C
228
-        // Union is way faster than array_merge() but should be used with caution...
229
-        // especially with numerically indexed arrays
230
-        $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ];
231
-        // now we need to ensure that the resulting dependencies
232
-        // array only has the entries that are required for the class
233
-        // so first count how many dependencies were originally registered for the class
234
-        $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]);
235
-        // if that count is non-zero (meaning dependencies were already registered)
236
-        EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count
237
-            // then truncate the  final array to match that count
238
-            ? array_slice($dependencies, 0, $dependency_count)
239
-            // otherwise just take the incoming array because nothing previously existed
240
-            : $dependencies;
241
-        return $registered;
242
-    }
243
-
244
-
245
-    /**
246
-     * @param string $class_name
247
-     * @param string $loader
248
-     * @return bool
249
-     * @throws DomainException
250
-     */
251
-    public static function register_class_loader($class_name, $loader = 'load_core')
252
-    {
253
-        return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader);
254
-    }
255
-
256
-
257
-    /**
258
-     * @param string $class_name
259
-     * @param string $loader
260
-     * @return bool
261
-     * @throws DomainException
262
-     */
263
-    public function registerClassLoader($class_name, $loader = 'load_core')
264
-    {
265
-        if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
266
-            throw new DomainException(
267
-                esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
268
-            );
269
-        }
270
-        // check that loader is callable or method starts with "load_" and exists in EE_Registry
271
-        if (
272
-            ! is_callable($loader)
273
-            && (
274
-                strpos($loader, 'load_') !== 0
275
-                || ! method_exists('EE_Registry', $loader)
276
-            )
277
-        ) {
278
-            throw new DomainException(
279
-                sprintf(
280
-                    esc_html__(
281
-                        '"%1$s" is not a valid loader method on EE_Registry.',
282
-                        'event_espresso'
283
-                    ),
284
-                    $loader
285
-                )
286
-            );
287
-        }
288
-        $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name);
289
-        if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) {
290
-            EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader;
291
-            return true;
292
-        }
293
-        return false;
294
-    }
295
-
296
-
297
-    /**
298
-     * @return array
299
-     */
300
-    public function dependency_map()
301
-    {
302
-        return $this->_dependency_map;
303
-    }
304
-
305
-
306
-    /**
307
-     * returns TRUE if dependency map contains a listing for the provided class name
308
-     *
309
-     * @param string $class_name
310
-     * @return boolean
311
-     */
312
-    public function has($class_name = '')
313
-    {
314
-        // all legacy models have the same dependencies
315
-        if (strpos($class_name, 'EEM_') === 0) {
316
-            $class_name = 'LEGACY_MODELS';
317
-        }
318
-        return isset($this->_dependency_map[ $class_name ]);
319
-    }
320
-
321
-
322
-    /**
323
-     * returns TRUE if dependency map contains a listing for the provided class name AND dependency
324
-     *
325
-     * @param string $class_name
326
-     * @param string $dependency
327
-     * @return bool
328
-     */
329
-    public function has_dependency_for_class($class_name = '', $dependency = '')
330
-    {
331
-        // all legacy models have the same dependencies
332
-        if (strpos($class_name, 'EEM_') === 0) {
333
-            $class_name = 'LEGACY_MODELS';
334
-        }
335
-        $dependency = $this->getFqnForAlias($dependency, $class_name);
336
-        return isset($this->_dependency_map[ $class_name ][ $dependency ]);
337
-    }
338
-
339
-
340
-    /**
341
-     * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
342
-     *
343
-     * @param string $class_name
344
-     * @param string $dependency
345
-     * @return int
346
-     */
347
-    public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
348
-    {
349
-        // all legacy models have the same dependencies
350
-        if (strpos($class_name, 'EEM_') === 0) {
351
-            $class_name = 'LEGACY_MODELS';
352
-        }
353
-        $dependency = $this->getFqnForAlias($dependency);
354
-        return $this->has_dependency_for_class($class_name, $dependency)
355
-            ? $this->_dependency_map[ $class_name ][ $dependency ]
356
-            : EE_Dependency_Map::not_registered;
357
-    }
358
-
359
-
360
-    /**
361
-     * @param string $class_name
362
-     * @return string | Closure
363
-     */
364
-    public function class_loader($class_name)
365
-    {
366
-        // all legacy models use load_model()
367
-        if (strpos($class_name, 'EEM_') === 0) {
368
-            return 'load_model';
369
-        }
370
-        // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
371
-        // perform strpos() first to avoid loading regex every time we load a class
372
-        if (
373
-            strpos($class_name, 'EE_CPT_') === 0
374
-            && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
375
-        ) {
376
-            return 'load_core';
377
-        }
378
-        $class_name = $this->getFqnForAlias($class_name);
379
-        return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
380
-    }
381
-
382
-
383
-    /**
384
-     * @return array
385
-     */
386
-    public function class_loaders()
387
-    {
388
-        return $this->_class_loaders;
389
-    }
390
-
391
-
392
-    /**
393
-     * adds an alias for a classname
394
-     *
395
-     * @param string $fqcn      the class name that should be used (concrete class to replace interface)
396
-     * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
397
-     * @param string $for_class the class that has the dependency (is type hinting for the interface)
398
-     * @throws InvalidAliasException
399
-     */
400
-    public function add_alias($fqcn, $alias, $for_class = '')
401
-    {
402
-        $this->class_cache->addAlias($fqcn, $alias, $for_class);
403
-    }
404
-
405
-
406
-    /**
407
-     * Returns TRUE if the provided fully qualified name IS an alias
408
-     * WHY?
409
-     * Because if a class is type hinting for a concretion,
410
-     * then why would we need to find another class to supply it?
411
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
412
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
413
-     * Don't go looking for some substitute.
414
-     * Whereas if a class is type hinting for an interface...
415
-     * then we need to find an actual class to use.
416
-     * So the interface IS the alias for some other FQN,
417
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
418
-     * represents some other class.
419
-     *
420
-     * @param string $fqn
421
-     * @param string $for_class
422
-     * @return bool
423
-     */
424
-    public function isAlias($fqn = '', $for_class = '')
425
-    {
426
-        return $this->class_cache->isAlias($fqn, $for_class);
427
-    }
428
-
429
-
430
-    /**
431
-     * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
432
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
433
-     *  for example:
434
-     *      if the following two entries were added to the _aliases array:
435
-     *          array(
436
-     *              'interface_alias'           => 'some\namespace\interface'
437
-     *              'some\namespace\interface'  => 'some\namespace\classname'
438
-     *          )
439
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
440
-     *      to load an instance of 'some\namespace\classname'
441
-     *
442
-     * @param string $alias
443
-     * @param string $for_class
444
-     * @return string
445
-     */
446
-    public function getFqnForAlias($alias = '', $for_class = '')
447
-    {
448
-        return (string) $this->class_cache->getFqnForAlias($alias, $for_class);
449
-    }
450
-
451
-
452
-    /**
453
-     * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
454
-     * if one exists, or whether a new object should be generated every time the requested class is loaded.
455
-     * This is done by using the following class constants:
456
-     *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
457
-     *        EE_Dependency_Map::load_new_object - generates a new object every time
458
-     */
459
-    protected function _register_core_dependencies()
460
-    {
461
-        $this->_dependency_map = [
462
-            'EE_Request_Handler'                                                                                          => [
463
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
464
-            ],
465
-            'EE_System'                                                                                                   => [
466
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
467
-                'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
468
-                'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
469
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
470
-                'EventEspresso\core\services\routing\Router'  => EE_Dependency_Map::load_from_cache,
471
-            ],
472
-            'EE_Admin'                                                                                                    => [
473
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
474
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
475
-            ],
476
-            'EE_Cart'                                                                                                     => [
477
-                'EE_Session' => EE_Dependency_Map::load_from_cache,
478
-            ],
479
-            'EE_Messenger_Collection_Loader'                                                                              => [
480
-                'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
481
-            ],
482
-            'EE_Message_Type_Collection_Loader'                                                                           => [
483
-                'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
484
-            ],
485
-            'EE_Message_Resource_Manager'                                                                                 => [
486
-                'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
487
-                'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
488
-                'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
489
-            ],
490
-            'EE_Message_Factory'                                                                                          => [
491
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
492
-            ],
493
-            'EE_messages'                                                                                                 => [
494
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
495
-            ],
496
-            'EE_Messages_Generator'                                                                                       => [
497
-                'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
498
-                'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
499
-                'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
500
-                'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
501
-            ],
502
-            'EE_Messages_Processor'                                                                                       => [
503
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
504
-            ],
505
-            'EE_Messages_Queue'                                                                                           => [
506
-                'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
507
-            ],
508
-            'EE_Messages_Template_Defaults'                                                                               => [
509
-                'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
510
-                'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
511
-            ],
512
-            'EE_Message_To_Generate_From_Request'                                                                         => [
513
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
514
-                'EE_Request_Handler'          => EE_Dependency_Map::load_from_cache,
515
-            ],
516
-            'EventEspresso\core\services\commands\CommandBus'                                                             => [
517
-                'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
518
-            ],
519
-            'EventEspresso\services\commands\CommandHandler'                                                              => [
520
-                'EE_Registry'         => EE_Dependency_Map::load_from_cache,
521
-                'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
522
-            ],
523
-            'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => [
524
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
525
-            ],
526
-            'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => [
527
-                'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
528
-                'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
529
-            ],
530
-            'EventEspresso\core\services\commands\CommandFactory'                                                         => [
531
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
532
-            ],
533
-            'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => [
534
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
535
-            ],
536
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => [
537
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
538
-            ],
539
-            'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => [
540
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
541
-            ],
542
-            'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => [
543
-                'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
544
-            ],
545
-            'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => [
546
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
547
-            ],
548
-            'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => [
549
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
550
-            ],
551
-            'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => [
552
-                'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
553
-            ],
554
-            'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [
555
-                'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
556
-            ],
557
-            'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => [
558
-                'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
559
-            ],
560
-            'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => [
561
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
562
-            ],
563
-            'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => [
564
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
565
-            ],
566
-            'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => [
567
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
568
-            ],
569
-            'EventEspresso\core\services\database\TableManager'                                                           => [
570
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
571
-            ],
572
-            'EE_Data_Migration_Class_Base'                                                                                => [
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_1_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_2_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_3_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_4_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_5_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_6_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_7_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_8_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_9_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
-            ],
612
-            'EE_DMS_Core_4_10_0'                                                                                          => [
613
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
614
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
615
-                'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
616
-            ],
617
-            'EE_DMS_Core_4_11_0'                                                                                          => [
618
-                'EE_DMS_Core_4_10_0'                                 => EE_Dependency_Map::load_from_cache,
619
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
620
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
621
-            ],
622
-            'EventEspresso\core\services\assets\Registry'                                                                 => [
623
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
624
-                'EventEspresso\core\services\assets\AssetManifest'   => EE_Dependency_Map::load_from_cache,
625
-            ],
626
-            'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
627
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
628
-            ],
629
-            'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
630
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
631
-            ],
632
-            'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
633
-                'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
634
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
635
-            ],
636
-            'EventEspresso\core\domain\values\EmailAddress'                                                               => [
637
-                null,
638
-                'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
639
-            ],
640
-            'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
641
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
642
-            ],
643
-            'LEGACY_MODELS'                                                                                               => [
644
-                null,
645
-                'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
646
-            ],
647
-            'EE_Module_Request_Router'                                                                                    => [
648
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
649
-            ],
650
-            'EE_Registration_Processor'                                                                                   => [
651
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
652
-            ],
653
-            'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
654
-                null,
655
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
656
-                'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
657
-            ],
658
-            'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
659
-                'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
660
-                'EE_Session'             => EE_Dependency_Map::load_from_cache,
661
-            ],
662
-            'EventEspresso\modules\ticket_selector\DisplayTicketSelector'                                                 => [
663
-                'EventEspresso\core\domain\entities\users\CurrentUser' => EE_Dependency_Map::load_from_cache,
664
-            ],
665
-            'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
666
-                'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
667
-                'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
668
-                'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
669
-                'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
670
-                'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
671
-            ],
672
-            'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
673
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
674
-            ],
675
-            'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
676
-                'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
677
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
678
-            ],
679
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
680
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
681
-            ],
682
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
683
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
684
-            ],
685
-            'EE_CPT_Strategy'                                                                                             => [
686
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
687
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
688
-            ],
689
-            'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
690
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
691
-            ],
692
-            'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
693
-                null,
694
-                null,
695
-                null,
696
-                'EE_Request_Handler'                          => EE_Dependency_Map::load_from_cache,
697
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
698
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
699
-            ],
700
-            'EventEspresso\core\services\dependencies\DependencyResolver'                                                 => [
701
-                'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
702
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
703
-                'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
704
-            ],
705
-            'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver'                               => [
706
-                'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
707
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
708
-                'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
709
-            ],
710
-            'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'                                          => [
711
-                'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
712
-                'EventEspresso\core\services\loaders\Loader'                                    => EE_Dependency_Map::load_from_cache,
713
-            ],
714
-            'EventEspresso\core\services\routing\RouteMatchSpecificationManager'                                          => [
715
-                'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
716
-                'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
717
-            ],
718
-            'EE_URL_Validation_Strategy'                                                                                  => [
719
-                null,
720
-                null,
721
-                'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
722
-            ],
723
-            'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
724
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
725
-            ],
726
-            'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
727
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
728
-            ],
729
-            'EventEspresso\core\domain\services\converters\RestApiSpoofer'                                                => [
730
-                'WP_REST_Server'                                               => EE_Dependency_Map::load_from_cache,
731
-                'EED_Core_Rest_Api'                                            => EE_Dependency_Map::load_from_cache,
732
-                'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,
733
-                null,
734
-            ],
735
-            'EventEspresso\core\services\routing\RouteHandler'                                                            => [
736
-                'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache,
737
-                'EventEspresso\core\services\loaders\Loader'           => EE_Dependency_Map::load_from_cache,
738
-                'EventEspresso\core\services\request\Request'          => EE_Dependency_Map::load_from_cache,
739
-                'EventEspresso\core\services\routing\RouteCollection'  => EE_Dependency_Map::load_from_cache,
740
-            ],
741
-            'EventEspresso\core\services\json\JsonDataNodeHandler'                                                        => [
742
-                'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
743
-            ],
744
-            'EventEspresso\core\services\routing\Router'                                                                  => [
745
-                'EE_Dependency_Map'                                => EE_Dependency_Map::load_from_cache,
746
-                'EventEspresso\core\services\loaders\Loader'       => EE_Dependency_Map::load_from_cache,
747
-                'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache,
748
-            ],
749
-            'EventEspresso\core\services\assets\AssetManifest'                                                            => [
750
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
751
-            ],
752
-            'EventEspresso\core\services\assets\AssetManifestFactory'                                                     => [
753
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
754
-            ],
755
-            'EventEspresso\core\services\assets\BaristaFactory'                                                           => [
756
-                'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache,
757
-                'EventEspresso\core\services\loaders\Loader'              => EE_Dependency_Map::load_from_cache,
758
-            ],
759
-            'EventEspresso\core\domain\services\capabilities\FeatureFlags'                                                => [
760
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
761
-            ],
762
-            'EventEspresso\core\services\addon\AddonManager' => [
763
-                'EventEspresso\core\services\addon\AddonCollection'              => EE_Dependency_Map::load_from_cache,
764
-                'EventEspresso\core\Psr4Autoloader'                              => EE_Dependency_Map::load_from_cache,
765
-                'EventEspresso\core\services\addon\api\v1\RegisterAddon'         => EE_Dependency_Map::load_from_cache,
766
-                'EventEspresso\core\services\addon\api\IncompatibleAddonHandler' => EE_Dependency_Map::load_from_cache,
767
-                'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler'  => EE_Dependency_Map::load_from_cache,
768
-            ],
769
-            'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => [
770
-                'EventEspresso\core\services\request\Request'  => EE_Dependency_Map::load_from_cache,
771
-            ],
772
-            'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [
773
-                'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache
774
-            ],
775
-            'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [
776
-                'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache
777
-            ],
778
-            'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [
779
-                'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
780
-                'EEM_Event' => EE_Dependency_Map::load_from_cache,
781
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
782
-                'EEM_Registration' => EE_Dependency_Map::load_from_cache
783
-            ],
784
-            'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [
785
-                'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
786
-            ],
787
-            'EventEspresso\core\domain\entities\users\CurrentUser' => [
788
-                'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache,
789
-            ],
790
-        ];
791
-    }
792
-
793
-
794
-    /**
795
-     * Registers how core classes are loaded.
796
-     * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
797
-     *        'EE_Request_Handler' => 'load_core'
798
-     *        'EE_Messages_Queue'  => 'load_lib'
799
-     *        'EEH_Debug_Tools'    => 'load_helper'
800
-     * or, if greater control is required, by providing a custom closure. For example:
801
-     *        'Some_Class' => function () {
802
-     *            return new Some_Class();
803
-     *        },
804
-     * This is required for instantiating dependencies
805
-     * where an interface has been type hinted in a class constructor. For example:
806
-     *        'Required_Interface' => function () {
807
-     *            return new A_Class_That_Implements_Required_Interface();
808
-     *        },
809
-     */
810
-    protected function _register_core_class_loaders()
811
-    {
812
-        $this->_class_loaders = [
813
-            // load_core
814
-            'EE_Dependency_Map'                            => function () {
815
-                return $this;
816
-            },
817
-            'EE_Capabilities'                              => 'load_core',
818
-            'EE_Encryption'                                => 'load_core',
819
-            'EE_Front_Controller'                          => 'load_core',
820
-            'EE_Module_Request_Router'                     => 'load_core',
821
-            'EE_Registry'                                  => 'load_core',
822
-            'EE_Request'                                   => function () {
823
-                return $this->legacy_request;
824
-            },
825
-            'EventEspresso\core\services\request\Request'  => function () {
826
-                return $this->request;
827
-            },
828
-            'EventEspresso\core\services\request\Response' => function () {
829
-                return $this->response;
830
-            },
831
-            'EE_Base'                                      => 'load_core',
832
-            'EE_Request_Handler'                           => 'load_core',
833
-            'EE_Session'                                   => 'load_core',
834
-            'EE_Cron_Tasks'                                => 'load_core',
835
-            'EE_System'                                    => 'load_core',
836
-            'EE_Maintenance_Mode'                          => 'load_core',
837
-            'EE_Register_CPTs'                             => 'load_core',
838
-            'EE_Admin'                                     => 'load_core',
839
-            'EE_CPT_Strategy'                              => 'load_core',
840
-            // load_class
841
-            'EE_Registration_Processor'                    => 'load_class',
842
-            // load_lib
843
-            'EE_Message_Resource_Manager'                  => 'load_lib',
844
-            'EE_Message_Type_Collection'                   => 'load_lib',
845
-            'EE_Message_Type_Collection_Loader'            => 'load_lib',
846
-            'EE_Messenger_Collection'                      => 'load_lib',
847
-            'EE_Messenger_Collection_Loader'               => 'load_lib',
848
-            'EE_Messages_Processor'                        => 'load_lib',
849
-            'EE_Message_Repository'                        => 'load_lib',
850
-            'EE_Messages_Queue'                            => 'load_lib',
851
-            'EE_Messages_Data_Handler_Collection'          => 'load_lib',
852
-            'EE_Message_Template_Group_Collection'         => 'load_lib',
853
-            'EE_Payment_Method_Manager'                    => 'load_lib',
854
-            'EE_DMS_Core_4_1_0'                            => 'load_dms',
855
-            'EE_DMS_Core_4_2_0'                            => 'load_dms',
856
-            'EE_DMS_Core_4_3_0'                            => 'load_dms',
857
-            'EE_DMS_Core_4_5_0'                            => 'load_dms',
858
-            'EE_DMS_Core_4_6_0'                            => 'load_dms',
859
-            'EE_DMS_Core_4_7_0'                            => 'load_dms',
860
-            'EE_DMS_Core_4_8_0'                            => 'load_dms',
861
-            'EE_DMS_Core_4_9_0'                            => 'load_dms',
862
-            'EE_DMS_Core_4_10_0'                           => 'load_dms',
863
-            'EE_DMS_Core_4_11_0'                           => 'load_dms',
864
-            'EE_Messages_Generator'                        => static function () {
865
-                return EE_Registry::instance()->load_lib(
866
-                    'Messages_Generator',
867
-                    [],
868
-                    false,
869
-                    false
870
-                );
871
-            },
872
-            'EE_Messages_Template_Defaults'                => static function ($arguments = []) {
873
-                return EE_Registry::instance()->load_lib(
874
-                    'Messages_Template_Defaults',
875
-                    $arguments,
876
-                    false,
877
-                    false
878
-                );
879
-            },
880
-            // load_helper
881
-            'EEH_Parse_Shortcodes'                         => static function () {
882
-                if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
883
-                    return new EEH_Parse_Shortcodes();
884
-                }
885
-                return null;
886
-            },
887
-            'EE_Template_Config'                           => static function () {
888
-                return EE_Config::instance()->template_settings;
889
-            },
890
-            'EE_Currency_Config'                           => static function () {
891
-                return EE_Config::instance()->currency;
892
-            },
893
-            'EE_Registration_Config'                       => static function () {
894
-                return EE_Config::instance()->registration;
895
-            },
896
-            'EE_Core_Config'                               => static function () {
897
-                return EE_Config::instance()->core;
898
-            },
899
-            'EventEspresso\core\services\loaders\Loader'   => static function () {
900
-                return LoaderFactory::getLoader();
901
-            },
902
-            'EE_Network_Config'                            => static function () {
903
-                return EE_Network_Config::instance();
904
-            },
905
-            'EE_Config'                                    => static function () {
906
-                return EE_Config::instance();
907
-            },
908
-            'EventEspresso\core\domain\Domain'             => static function () {
909
-                return DomainFactory::getEventEspressoCoreDomain();
910
-            },
911
-            'EE_Admin_Config'                              => static function () {
912
-                return EE_Config::instance()->admin;
913
-            },
914
-            'EE_Organization_Config'                       => static function () {
915
-                return EE_Config::instance()->organization;
916
-            },
917
-            'EE_Network_Core_Config'                       => static function () {
918
-                return EE_Network_Config::instance()->core;
919
-            },
920
-            'EE_Environment_Config'                        => static function () {
921
-                return EE_Config::instance()->environment;
922
-            },
923
-            'EED_Core_Rest_Api'                            => static function () {
924
-                return EED_Core_Rest_Api::instance();
925
-            },
926
-            'WP_REST_Server'                               => static function () {
927
-                return rest_get_server();
928
-            },
929
-            'EventEspresso\core\Psr4Autoloader'            => static function () {
930
-                return EE_Psr4AutoloaderInit::psr4_loader();
931
-            },
932
-        ];
933
-    }
934
-
935
-
936
-    /**
937
-     * can be used for supplying alternate names for classes,
938
-     * or for connecting interface names to instantiable classes
939
-     *
940
-     * @throws InvalidAliasException
941
-     */
942
-    protected function _register_core_aliases()
943
-    {
944
-        $aliases = [
945
-            'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
946
-            'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
947
-            'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
948
-            'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
949
-            'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
950
-            'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
951
-            'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
952
-            'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
953
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
954
-            'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
955
-            'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
956
-            'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
957
-            'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
958
-            'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
959
-            'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
960
-            'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
961
-            'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
962
-            'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
963
-            'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
964
-            'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
965
-            'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
966
-            'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
967
-            'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
968
-            'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
969
-            'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
970
-            'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
971
-            'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
972
-            'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
973
-            'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
974
-            'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
975
-            'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
976
-            'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
977
-            'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
978
-            'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
979
-            'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
980
-            'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
981
-            'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
982
-            'Registration_Processor'                                                       => 'EE_Registration_Processor',
983
-            'EventEspresso\core\services\assets\AssetManifestInterface'                    => 'EventEspresso\core\services\assets\AssetManifest',
984
-        ];
985
-        foreach ($aliases as $alias => $fqn) {
986
-            if (is_array($fqn)) {
987
-                foreach ($fqn as $class => $for_class) {
988
-                    $this->class_cache->addAlias($class, $alias, $for_class);
989
-                }
990
-                continue;
991
-            }
992
-            $this->class_cache->addAlias($fqn, $alias);
993
-        }
994
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
995
-            $this->class_cache->addAlias(
996
-                'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
997
-                'EventEspresso\core\services\notices\NoticeConverterInterface'
998
-            );
999
-        }
1000
-    }
1001
-
1002
-
1003
-    /**
1004
-     * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
1005
-     * request Primarily used by unit tests.
1006
-     */
1007
-    public function reset()
1008
-    {
1009
-        $this->_register_core_class_loaders();
1010
-        $this->_register_core_dependencies();
1011
-    }
1012
-
1013
-
1014
-    /**
1015
-     * PLZ NOTE: a better name for this method would be is_alias()
1016
-     * because it returns TRUE if the provided fully qualified name IS an alias
1017
-     * WHY?
1018
-     * Because if a class is type hinting for a concretion,
1019
-     * then why would we need to find another class to supply it?
1020
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
1021
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
1022
-     * Don't go looking for some substitute.
1023
-     * Whereas if a class is type hinting for an interface...
1024
-     * then we need to find an actual class to use.
1025
-     * So the interface IS the alias for some other FQN,
1026
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
1027
-     * represents some other class.
1028
-     *
1029
-     * @param string $fqn
1030
-     * @param string $for_class
1031
-     * @return bool
1032
-     * @deprecated 4.9.62.p
1033
-     */
1034
-    public function has_alias($fqn = '', $for_class = '')
1035
-    {
1036
-        return $this->isAlias($fqn, $for_class);
1037
-    }
1038
-
1039
-
1040
-    /**
1041
-     * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
1042
-     * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
1043
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
1044
-     *  for example:
1045
-     *      if the following two entries were added to the _aliases array:
1046
-     *          array(
1047
-     *              'interface_alias'           => 'some\namespace\interface'
1048
-     *              'some\namespace\interface'  => 'some\namespace\classname'
1049
-     *          )
1050
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1051
-     *      to load an instance of 'some\namespace\classname'
1052
-     *
1053
-     * @param string $alias
1054
-     * @param string $for_class
1055
-     * @return string
1056
-     * @deprecated 4.9.62.p
1057
-     */
1058
-    public function get_alias($alias = '', $for_class = '')
1059
-    {
1060
-        return $this->getFqnForAlias($alias, $for_class);
1061
-    }
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 (
127
+			! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map
128
+			&& $class_cache instanceof ClassInterfaceCache
129
+		) {
130
+			EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache);
131
+		}
132
+		return EE_Dependency_Map::$_instance;
133
+	}
134
+
135
+
136
+	/**
137
+	 * @param RequestInterface $request
138
+	 */
139
+	public function setRequest(RequestInterface $request)
140
+	{
141
+		$this->request = $request;
142
+	}
143
+
144
+
145
+	/**
146
+	 * @param LegacyRequestInterface $legacy_request
147
+	 */
148
+	public function setLegacyRequest(LegacyRequestInterface $legacy_request)
149
+	{
150
+		$this->legacy_request = $legacy_request;
151
+	}
152
+
153
+
154
+	/**
155
+	 * @param ResponseInterface $response
156
+	 */
157
+	public function setResponse(ResponseInterface $response)
158
+	{
159
+		$this->response = $response;
160
+	}
161
+
162
+
163
+	/**
164
+	 * @param LoaderInterface $loader
165
+	 */
166
+	public function setLoader(LoaderInterface $loader)
167
+	{
168
+		$this->loader = $loader;
169
+	}
170
+
171
+
172
+	/**
173
+	 * @param string $class
174
+	 * @param array  $dependencies
175
+	 * @param int    $overwrite
176
+	 * @return bool
177
+	 */
178
+	public static function register_dependencies(
179
+		$class,
180
+		array $dependencies,
181
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
182
+	) {
183
+		return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite);
184
+	}
185
+
186
+
187
+	/**
188
+	 * Assigns an array of class names and corresponding load sources (new or cached)
189
+	 * to the class specified by the first parameter.
190
+	 * IMPORTANT !!!
191
+	 * The order of elements in the incoming $dependencies array MUST match
192
+	 * the order of the constructor parameters for the class in question.
193
+	 * This is especially important when overriding any existing dependencies that are registered.
194
+	 * the third parameter controls whether any duplicate dependencies are overwritten or not.
195
+	 *
196
+	 * @param string $class
197
+	 * @param array  $dependencies
198
+	 * @param int    $overwrite
199
+	 * @return bool
200
+	 */
201
+	public function registerDependencies(
202
+		$class,
203
+		array $dependencies,
204
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
205
+	) {
206
+		$class      = trim($class, '\\');
207
+		$registered = false;
208
+		if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) {
209
+			EE_Dependency_Map::$_instance->_dependency_map[ $class ] = [];
210
+		}
211
+		// we need to make sure that any aliases used when registering a dependency
212
+		// get resolved to the correct class name
213
+		foreach ($dependencies as $dependency => $load_source) {
214
+			$alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency);
215
+			if (
216
+				$overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
217
+				|| ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ])
218
+			) {
219
+				unset($dependencies[ $dependency ]);
220
+				$dependencies[ $alias ] = $load_source;
221
+				$registered             = true;
222
+			}
223
+		}
224
+		// now add our two lists of dependencies together.
225
+		// using Union (+=) favours the arrays in precedence from left to right,
226
+		// so $dependencies is NOT overwritten because it is listed first
227
+		// ie: with A = B + C, entries in B take precedence over duplicate entries in C
228
+		// Union is way faster than array_merge() but should be used with caution...
229
+		// especially with numerically indexed arrays
230
+		$dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ];
231
+		// now we need to ensure that the resulting dependencies
232
+		// array only has the entries that are required for the class
233
+		// so first count how many dependencies were originally registered for the class
234
+		$dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]);
235
+		// if that count is non-zero (meaning dependencies were already registered)
236
+		EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count
237
+			// then truncate the  final array to match that count
238
+			? array_slice($dependencies, 0, $dependency_count)
239
+			// otherwise just take the incoming array because nothing previously existed
240
+			: $dependencies;
241
+		return $registered;
242
+	}
243
+
244
+
245
+	/**
246
+	 * @param string $class_name
247
+	 * @param string $loader
248
+	 * @return bool
249
+	 * @throws DomainException
250
+	 */
251
+	public static function register_class_loader($class_name, $loader = 'load_core')
252
+	{
253
+		return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader);
254
+	}
255
+
256
+
257
+	/**
258
+	 * @param string $class_name
259
+	 * @param string $loader
260
+	 * @return bool
261
+	 * @throws DomainException
262
+	 */
263
+	public function registerClassLoader($class_name, $loader = 'load_core')
264
+	{
265
+		if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
266
+			throw new DomainException(
267
+				esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
268
+			);
269
+		}
270
+		// check that loader is callable or method starts with "load_" and exists in EE_Registry
271
+		if (
272
+			! is_callable($loader)
273
+			&& (
274
+				strpos($loader, 'load_') !== 0
275
+				|| ! method_exists('EE_Registry', $loader)
276
+			)
277
+		) {
278
+			throw new DomainException(
279
+				sprintf(
280
+					esc_html__(
281
+						'"%1$s" is not a valid loader method on EE_Registry.',
282
+						'event_espresso'
283
+					),
284
+					$loader
285
+				)
286
+			);
287
+		}
288
+		$class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name);
289
+		if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) {
290
+			EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader;
291
+			return true;
292
+		}
293
+		return false;
294
+	}
295
+
296
+
297
+	/**
298
+	 * @return array
299
+	 */
300
+	public function dependency_map()
301
+	{
302
+		return $this->_dependency_map;
303
+	}
304
+
305
+
306
+	/**
307
+	 * returns TRUE if dependency map contains a listing for the provided class name
308
+	 *
309
+	 * @param string $class_name
310
+	 * @return boolean
311
+	 */
312
+	public function has($class_name = '')
313
+	{
314
+		// all legacy models have the same dependencies
315
+		if (strpos($class_name, 'EEM_') === 0) {
316
+			$class_name = 'LEGACY_MODELS';
317
+		}
318
+		return isset($this->_dependency_map[ $class_name ]);
319
+	}
320
+
321
+
322
+	/**
323
+	 * returns TRUE if dependency map contains a listing for the provided class name AND dependency
324
+	 *
325
+	 * @param string $class_name
326
+	 * @param string $dependency
327
+	 * @return bool
328
+	 */
329
+	public function has_dependency_for_class($class_name = '', $dependency = '')
330
+	{
331
+		// all legacy models have the same dependencies
332
+		if (strpos($class_name, 'EEM_') === 0) {
333
+			$class_name = 'LEGACY_MODELS';
334
+		}
335
+		$dependency = $this->getFqnForAlias($dependency, $class_name);
336
+		return isset($this->_dependency_map[ $class_name ][ $dependency ]);
337
+	}
338
+
339
+
340
+	/**
341
+	 * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
342
+	 *
343
+	 * @param string $class_name
344
+	 * @param string $dependency
345
+	 * @return int
346
+	 */
347
+	public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
348
+	{
349
+		// all legacy models have the same dependencies
350
+		if (strpos($class_name, 'EEM_') === 0) {
351
+			$class_name = 'LEGACY_MODELS';
352
+		}
353
+		$dependency = $this->getFqnForAlias($dependency);
354
+		return $this->has_dependency_for_class($class_name, $dependency)
355
+			? $this->_dependency_map[ $class_name ][ $dependency ]
356
+			: EE_Dependency_Map::not_registered;
357
+	}
358
+
359
+
360
+	/**
361
+	 * @param string $class_name
362
+	 * @return string | Closure
363
+	 */
364
+	public function class_loader($class_name)
365
+	{
366
+		// all legacy models use load_model()
367
+		if (strpos($class_name, 'EEM_') === 0) {
368
+			return 'load_model';
369
+		}
370
+		// EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
371
+		// perform strpos() first to avoid loading regex every time we load a class
372
+		if (
373
+			strpos($class_name, 'EE_CPT_') === 0
374
+			&& preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
375
+		) {
376
+			return 'load_core';
377
+		}
378
+		$class_name = $this->getFqnForAlias($class_name);
379
+		return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
380
+	}
381
+
382
+
383
+	/**
384
+	 * @return array
385
+	 */
386
+	public function class_loaders()
387
+	{
388
+		return $this->_class_loaders;
389
+	}
390
+
391
+
392
+	/**
393
+	 * adds an alias for a classname
394
+	 *
395
+	 * @param string $fqcn      the class name that should be used (concrete class to replace interface)
396
+	 * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
397
+	 * @param string $for_class the class that has the dependency (is type hinting for the interface)
398
+	 * @throws InvalidAliasException
399
+	 */
400
+	public function add_alias($fqcn, $alias, $for_class = '')
401
+	{
402
+		$this->class_cache->addAlias($fqcn, $alias, $for_class);
403
+	}
404
+
405
+
406
+	/**
407
+	 * Returns TRUE if the provided fully qualified name IS an alias
408
+	 * WHY?
409
+	 * Because if a class is type hinting for a concretion,
410
+	 * then why would we need to find another class to supply it?
411
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
412
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
413
+	 * Don't go looking for some substitute.
414
+	 * Whereas if a class is type hinting for an interface...
415
+	 * then we need to find an actual class to use.
416
+	 * So the interface IS the alias for some other FQN,
417
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
418
+	 * represents some other class.
419
+	 *
420
+	 * @param string $fqn
421
+	 * @param string $for_class
422
+	 * @return bool
423
+	 */
424
+	public function isAlias($fqn = '', $for_class = '')
425
+	{
426
+		return $this->class_cache->isAlias($fqn, $for_class);
427
+	}
428
+
429
+
430
+	/**
431
+	 * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
432
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
433
+	 *  for example:
434
+	 *      if the following two entries were added to the _aliases array:
435
+	 *          array(
436
+	 *              'interface_alias'           => 'some\namespace\interface'
437
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
438
+	 *          )
439
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
440
+	 *      to load an instance of 'some\namespace\classname'
441
+	 *
442
+	 * @param string $alias
443
+	 * @param string $for_class
444
+	 * @return string
445
+	 */
446
+	public function getFqnForAlias($alias = '', $for_class = '')
447
+	{
448
+		return (string) $this->class_cache->getFqnForAlias($alias, $for_class);
449
+	}
450
+
451
+
452
+	/**
453
+	 * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
454
+	 * if one exists, or whether a new object should be generated every time the requested class is loaded.
455
+	 * This is done by using the following class constants:
456
+	 *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
457
+	 *        EE_Dependency_Map::load_new_object - generates a new object every time
458
+	 */
459
+	protected function _register_core_dependencies()
460
+	{
461
+		$this->_dependency_map = [
462
+			'EE_Request_Handler'                                                                                          => [
463
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
464
+			],
465
+			'EE_System'                                                                                                   => [
466
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
467
+				'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
468
+				'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
469
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
470
+				'EventEspresso\core\services\routing\Router'  => EE_Dependency_Map::load_from_cache,
471
+			],
472
+			'EE_Admin'                                                                                                    => [
473
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
474
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
475
+			],
476
+			'EE_Cart'                                                                                                     => [
477
+				'EE_Session' => EE_Dependency_Map::load_from_cache,
478
+			],
479
+			'EE_Messenger_Collection_Loader'                                                                              => [
480
+				'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
481
+			],
482
+			'EE_Message_Type_Collection_Loader'                                                                           => [
483
+				'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
484
+			],
485
+			'EE_Message_Resource_Manager'                                                                                 => [
486
+				'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
487
+				'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
488
+				'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
489
+			],
490
+			'EE_Message_Factory'                                                                                          => [
491
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
492
+			],
493
+			'EE_messages'                                                                                                 => [
494
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
495
+			],
496
+			'EE_Messages_Generator'                                                                                       => [
497
+				'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
498
+				'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
499
+				'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
500
+				'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
501
+			],
502
+			'EE_Messages_Processor'                                                                                       => [
503
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
504
+			],
505
+			'EE_Messages_Queue'                                                                                           => [
506
+				'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
507
+			],
508
+			'EE_Messages_Template_Defaults'                                                                               => [
509
+				'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
510
+				'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
511
+			],
512
+			'EE_Message_To_Generate_From_Request'                                                                         => [
513
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
514
+				'EE_Request_Handler'          => EE_Dependency_Map::load_from_cache,
515
+			],
516
+			'EventEspresso\core\services\commands\CommandBus'                                                             => [
517
+				'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
518
+			],
519
+			'EventEspresso\services\commands\CommandHandler'                                                              => [
520
+				'EE_Registry'         => EE_Dependency_Map::load_from_cache,
521
+				'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
522
+			],
523
+			'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => [
524
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
525
+			],
526
+			'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => [
527
+				'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
528
+				'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
529
+			],
530
+			'EventEspresso\core\services\commands\CommandFactory'                                                         => [
531
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
532
+			],
533
+			'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => [
534
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
535
+			],
536
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => [
537
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
538
+			],
539
+			'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => [
540
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
541
+			],
542
+			'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => [
543
+				'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
544
+			],
545
+			'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => [
546
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
547
+			],
548
+			'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => [
549
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
550
+			],
551
+			'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => [
552
+				'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
553
+			],
554
+			'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [
555
+				'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
556
+			],
557
+			'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => [
558
+				'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
559
+			],
560
+			'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => [
561
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
562
+			],
563
+			'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => [
564
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
565
+			],
566
+			'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => [
567
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
568
+			],
569
+			'EventEspresso\core\services\database\TableManager'                                                           => [
570
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
571
+			],
572
+			'EE_Data_Migration_Class_Base'                                                                                => [
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_1_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_2_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_3_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_4_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_5_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_6_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_7_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_8_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_9_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
+			],
612
+			'EE_DMS_Core_4_10_0'                                                                                          => [
613
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
614
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
615
+				'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
616
+			],
617
+			'EE_DMS_Core_4_11_0'                                                                                          => [
618
+				'EE_DMS_Core_4_10_0'                                 => EE_Dependency_Map::load_from_cache,
619
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
620
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
621
+			],
622
+			'EventEspresso\core\services\assets\Registry'                                                                 => [
623
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
624
+				'EventEspresso\core\services\assets\AssetManifest'   => EE_Dependency_Map::load_from_cache,
625
+			],
626
+			'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
627
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
628
+			],
629
+			'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
630
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
631
+			],
632
+			'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
633
+				'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
634
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
635
+			],
636
+			'EventEspresso\core\domain\values\EmailAddress'                                                               => [
637
+				null,
638
+				'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
639
+			],
640
+			'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
641
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
642
+			],
643
+			'LEGACY_MODELS'                                                                                               => [
644
+				null,
645
+				'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
646
+			],
647
+			'EE_Module_Request_Router'                                                                                    => [
648
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
649
+			],
650
+			'EE_Registration_Processor'                                                                                   => [
651
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
652
+			],
653
+			'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
654
+				null,
655
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
656
+				'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
657
+			],
658
+			'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
659
+				'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
660
+				'EE_Session'             => EE_Dependency_Map::load_from_cache,
661
+			],
662
+			'EventEspresso\modules\ticket_selector\DisplayTicketSelector'                                                 => [
663
+				'EventEspresso\core\domain\entities\users\CurrentUser' => EE_Dependency_Map::load_from_cache,
664
+			],
665
+			'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
666
+				'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
667
+				'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
668
+				'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
669
+				'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
670
+				'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
671
+			],
672
+			'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
673
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
674
+			],
675
+			'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
676
+				'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
677
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
678
+			],
679
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
680
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
681
+			],
682
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
683
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
684
+			],
685
+			'EE_CPT_Strategy'                                                                                             => [
686
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
687
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
688
+			],
689
+			'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
690
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
691
+			],
692
+			'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
693
+				null,
694
+				null,
695
+				null,
696
+				'EE_Request_Handler'                          => EE_Dependency_Map::load_from_cache,
697
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
698
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
699
+			],
700
+			'EventEspresso\core\services\dependencies\DependencyResolver'                                                 => [
701
+				'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
702
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
703
+				'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
704
+			],
705
+			'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver'                               => [
706
+				'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
707
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
708
+				'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
709
+			],
710
+			'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'                                          => [
711
+				'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
712
+				'EventEspresso\core\services\loaders\Loader'                                    => EE_Dependency_Map::load_from_cache,
713
+			],
714
+			'EventEspresso\core\services\routing\RouteMatchSpecificationManager'                                          => [
715
+				'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
716
+				'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
717
+			],
718
+			'EE_URL_Validation_Strategy'                                                                                  => [
719
+				null,
720
+				null,
721
+				'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
722
+			],
723
+			'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
724
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
725
+			],
726
+			'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
727
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
728
+			],
729
+			'EventEspresso\core\domain\services\converters\RestApiSpoofer'                                                => [
730
+				'WP_REST_Server'                                               => EE_Dependency_Map::load_from_cache,
731
+				'EED_Core_Rest_Api'                                            => EE_Dependency_Map::load_from_cache,
732
+				'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,
733
+				null,
734
+			],
735
+			'EventEspresso\core\services\routing\RouteHandler'                                                            => [
736
+				'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache,
737
+				'EventEspresso\core\services\loaders\Loader'           => EE_Dependency_Map::load_from_cache,
738
+				'EventEspresso\core\services\request\Request'          => EE_Dependency_Map::load_from_cache,
739
+				'EventEspresso\core\services\routing\RouteCollection'  => EE_Dependency_Map::load_from_cache,
740
+			],
741
+			'EventEspresso\core\services\json\JsonDataNodeHandler'                                                        => [
742
+				'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
743
+			],
744
+			'EventEspresso\core\services\routing\Router'                                                                  => [
745
+				'EE_Dependency_Map'                                => EE_Dependency_Map::load_from_cache,
746
+				'EventEspresso\core\services\loaders\Loader'       => EE_Dependency_Map::load_from_cache,
747
+				'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache,
748
+			],
749
+			'EventEspresso\core\services\assets\AssetManifest'                                                            => [
750
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
751
+			],
752
+			'EventEspresso\core\services\assets\AssetManifestFactory'                                                     => [
753
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
754
+			],
755
+			'EventEspresso\core\services\assets\BaristaFactory'                                                           => [
756
+				'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache,
757
+				'EventEspresso\core\services\loaders\Loader'              => EE_Dependency_Map::load_from_cache,
758
+			],
759
+			'EventEspresso\core\domain\services\capabilities\FeatureFlags'                                                => [
760
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
761
+			],
762
+			'EventEspresso\core\services\addon\AddonManager' => [
763
+				'EventEspresso\core\services\addon\AddonCollection'              => EE_Dependency_Map::load_from_cache,
764
+				'EventEspresso\core\Psr4Autoloader'                              => EE_Dependency_Map::load_from_cache,
765
+				'EventEspresso\core\services\addon\api\v1\RegisterAddon'         => EE_Dependency_Map::load_from_cache,
766
+				'EventEspresso\core\services\addon\api\IncompatibleAddonHandler' => EE_Dependency_Map::load_from_cache,
767
+				'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler'  => EE_Dependency_Map::load_from_cache,
768
+			],
769
+			'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => [
770
+				'EventEspresso\core\services\request\Request'  => EE_Dependency_Map::load_from_cache,
771
+			],
772
+			'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [
773
+				'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache
774
+			],
775
+			'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [
776
+				'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache
777
+			],
778
+			'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [
779
+				'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
780
+				'EEM_Event' => EE_Dependency_Map::load_from_cache,
781
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
782
+				'EEM_Registration' => EE_Dependency_Map::load_from_cache
783
+			],
784
+			'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [
785
+				'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache,
786
+			],
787
+			'EventEspresso\core\domain\entities\users\CurrentUser' => [
788
+				'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache,
789
+			],
790
+		];
791
+	}
792
+
793
+
794
+	/**
795
+	 * Registers how core classes are loaded.
796
+	 * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
797
+	 *        'EE_Request_Handler' => 'load_core'
798
+	 *        'EE_Messages_Queue'  => 'load_lib'
799
+	 *        'EEH_Debug_Tools'    => 'load_helper'
800
+	 * or, if greater control is required, by providing a custom closure. For example:
801
+	 *        'Some_Class' => function () {
802
+	 *            return new Some_Class();
803
+	 *        },
804
+	 * This is required for instantiating dependencies
805
+	 * where an interface has been type hinted in a class constructor. For example:
806
+	 *        'Required_Interface' => function () {
807
+	 *            return new A_Class_That_Implements_Required_Interface();
808
+	 *        },
809
+	 */
810
+	protected function _register_core_class_loaders()
811
+	{
812
+		$this->_class_loaders = [
813
+			// load_core
814
+			'EE_Dependency_Map'                            => function () {
815
+				return $this;
816
+			},
817
+			'EE_Capabilities'                              => 'load_core',
818
+			'EE_Encryption'                                => 'load_core',
819
+			'EE_Front_Controller'                          => 'load_core',
820
+			'EE_Module_Request_Router'                     => 'load_core',
821
+			'EE_Registry'                                  => 'load_core',
822
+			'EE_Request'                                   => function () {
823
+				return $this->legacy_request;
824
+			},
825
+			'EventEspresso\core\services\request\Request'  => function () {
826
+				return $this->request;
827
+			},
828
+			'EventEspresso\core\services\request\Response' => function () {
829
+				return $this->response;
830
+			},
831
+			'EE_Base'                                      => 'load_core',
832
+			'EE_Request_Handler'                           => 'load_core',
833
+			'EE_Session'                                   => 'load_core',
834
+			'EE_Cron_Tasks'                                => 'load_core',
835
+			'EE_System'                                    => 'load_core',
836
+			'EE_Maintenance_Mode'                          => 'load_core',
837
+			'EE_Register_CPTs'                             => 'load_core',
838
+			'EE_Admin'                                     => 'load_core',
839
+			'EE_CPT_Strategy'                              => 'load_core',
840
+			// load_class
841
+			'EE_Registration_Processor'                    => 'load_class',
842
+			// load_lib
843
+			'EE_Message_Resource_Manager'                  => 'load_lib',
844
+			'EE_Message_Type_Collection'                   => 'load_lib',
845
+			'EE_Message_Type_Collection_Loader'            => 'load_lib',
846
+			'EE_Messenger_Collection'                      => 'load_lib',
847
+			'EE_Messenger_Collection_Loader'               => 'load_lib',
848
+			'EE_Messages_Processor'                        => 'load_lib',
849
+			'EE_Message_Repository'                        => 'load_lib',
850
+			'EE_Messages_Queue'                            => 'load_lib',
851
+			'EE_Messages_Data_Handler_Collection'          => 'load_lib',
852
+			'EE_Message_Template_Group_Collection'         => 'load_lib',
853
+			'EE_Payment_Method_Manager'                    => 'load_lib',
854
+			'EE_DMS_Core_4_1_0'                            => 'load_dms',
855
+			'EE_DMS_Core_4_2_0'                            => 'load_dms',
856
+			'EE_DMS_Core_4_3_0'                            => 'load_dms',
857
+			'EE_DMS_Core_4_5_0'                            => 'load_dms',
858
+			'EE_DMS_Core_4_6_0'                            => 'load_dms',
859
+			'EE_DMS_Core_4_7_0'                            => 'load_dms',
860
+			'EE_DMS_Core_4_8_0'                            => 'load_dms',
861
+			'EE_DMS_Core_4_9_0'                            => 'load_dms',
862
+			'EE_DMS_Core_4_10_0'                           => 'load_dms',
863
+			'EE_DMS_Core_4_11_0'                           => 'load_dms',
864
+			'EE_Messages_Generator'                        => static function () {
865
+				return EE_Registry::instance()->load_lib(
866
+					'Messages_Generator',
867
+					[],
868
+					false,
869
+					false
870
+				);
871
+			},
872
+			'EE_Messages_Template_Defaults'                => static function ($arguments = []) {
873
+				return EE_Registry::instance()->load_lib(
874
+					'Messages_Template_Defaults',
875
+					$arguments,
876
+					false,
877
+					false
878
+				);
879
+			},
880
+			// load_helper
881
+			'EEH_Parse_Shortcodes'                         => static function () {
882
+				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
883
+					return new EEH_Parse_Shortcodes();
884
+				}
885
+				return null;
886
+			},
887
+			'EE_Template_Config'                           => static function () {
888
+				return EE_Config::instance()->template_settings;
889
+			},
890
+			'EE_Currency_Config'                           => static function () {
891
+				return EE_Config::instance()->currency;
892
+			},
893
+			'EE_Registration_Config'                       => static function () {
894
+				return EE_Config::instance()->registration;
895
+			},
896
+			'EE_Core_Config'                               => static function () {
897
+				return EE_Config::instance()->core;
898
+			},
899
+			'EventEspresso\core\services\loaders\Loader'   => static function () {
900
+				return LoaderFactory::getLoader();
901
+			},
902
+			'EE_Network_Config'                            => static function () {
903
+				return EE_Network_Config::instance();
904
+			},
905
+			'EE_Config'                                    => static function () {
906
+				return EE_Config::instance();
907
+			},
908
+			'EventEspresso\core\domain\Domain'             => static function () {
909
+				return DomainFactory::getEventEspressoCoreDomain();
910
+			},
911
+			'EE_Admin_Config'                              => static function () {
912
+				return EE_Config::instance()->admin;
913
+			},
914
+			'EE_Organization_Config'                       => static function () {
915
+				return EE_Config::instance()->organization;
916
+			},
917
+			'EE_Network_Core_Config'                       => static function () {
918
+				return EE_Network_Config::instance()->core;
919
+			},
920
+			'EE_Environment_Config'                        => static function () {
921
+				return EE_Config::instance()->environment;
922
+			},
923
+			'EED_Core_Rest_Api'                            => static function () {
924
+				return EED_Core_Rest_Api::instance();
925
+			},
926
+			'WP_REST_Server'                               => static function () {
927
+				return rest_get_server();
928
+			},
929
+			'EventEspresso\core\Psr4Autoloader'            => static function () {
930
+				return EE_Psr4AutoloaderInit::psr4_loader();
931
+			},
932
+		];
933
+	}
934
+
935
+
936
+	/**
937
+	 * can be used for supplying alternate names for classes,
938
+	 * or for connecting interface names to instantiable classes
939
+	 *
940
+	 * @throws InvalidAliasException
941
+	 */
942
+	protected function _register_core_aliases()
943
+	{
944
+		$aliases = [
945
+			'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
946
+			'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
947
+			'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
948
+			'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
949
+			'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
950
+			'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
951
+			'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
952
+			'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
953
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
954
+			'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
955
+			'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
956
+			'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
957
+			'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
958
+			'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
959
+			'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
960
+			'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
961
+			'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
962
+			'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
963
+			'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
964
+			'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
965
+			'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
966
+			'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
967
+			'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
968
+			'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
969
+			'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
970
+			'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
971
+			'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
972
+			'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
973
+			'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
974
+			'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
975
+			'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
976
+			'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
977
+			'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
978
+			'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
979
+			'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
980
+			'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
981
+			'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
982
+			'Registration_Processor'                                                       => 'EE_Registration_Processor',
983
+			'EventEspresso\core\services\assets\AssetManifestInterface'                    => 'EventEspresso\core\services\assets\AssetManifest',
984
+		];
985
+		foreach ($aliases as $alias => $fqn) {
986
+			if (is_array($fqn)) {
987
+				foreach ($fqn as $class => $for_class) {
988
+					$this->class_cache->addAlias($class, $alias, $for_class);
989
+				}
990
+				continue;
991
+			}
992
+			$this->class_cache->addAlias($fqn, $alias);
993
+		}
994
+		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
995
+			$this->class_cache->addAlias(
996
+				'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
997
+				'EventEspresso\core\services\notices\NoticeConverterInterface'
998
+			);
999
+		}
1000
+	}
1001
+
1002
+
1003
+	/**
1004
+	 * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
1005
+	 * request Primarily used by unit tests.
1006
+	 */
1007
+	public function reset()
1008
+	{
1009
+		$this->_register_core_class_loaders();
1010
+		$this->_register_core_dependencies();
1011
+	}
1012
+
1013
+
1014
+	/**
1015
+	 * PLZ NOTE: a better name for this method would be is_alias()
1016
+	 * because it returns TRUE if the provided fully qualified name IS an alias
1017
+	 * WHY?
1018
+	 * Because if a class is type hinting for a concretion,
1019
+	 * then why would we need to find another class to supply it?
1020
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
1021
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
1022
+	 * Don't go looking for some substitute.
1023
+	 * Whereas if a class is type hinting for an interface...
1024
+	 * then we need to find an actual class to use.
1025
+	 * So the interface IS the alias for some other FQN,
1026
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
1027
+	 * represents some other class.
1028
+	 *
1029
+	 * @param string $fqn
1030
+	 * @param string $for_class
1031
+	 * @return bool
1032
+	 * @deprecated 4.9.62.p
1033
+	 */
1034
+	public function has_alias($fqn = '', $for_class = '')
1035
+	{
1036
+		return $this->isAlias($fqn, $for_class);
1037
+	}
1038
+
1039
+
1040
+	/**
1041
+	 * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
1042
+	 * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
1043
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
1044
+	 *  for example:
1045
+	 *      if the following two entries were added to the _aliases array:
1046
+	 *          array(
1047
+	 *              'interface_alias'           => 'some\namespace\interface'
1048
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
1049
+	 *          )
1050
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1051
+	 *      to load an instance of 'some\namespace\classname'
1052
+	 *
1053
+	 * @param string $alias
1054
+	 * @param string $for_class
1055
+	 * @return string
1056
+	 * @deprecated 4.9.62.p
1057
+	 */
1058
+	public function get_alias($alias = '', $for_class = '')
1059
+	{
1060
+		return $this->getFqnForAlias($alias, $for_class);
1061
+	}
1062 1062
 }
Please login to merge, or discard this patch.
core/domain/entities/users/CurrentUser.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 
51 51
     public function setCurrentUser(): void
52 52
     {
53
-        if (! $this->current_user instanceof WP_User) {
53
+        if ( ! $this->current_user instanceof WP_User) {
54 54
             $this->current_user = wp_get_current_user();
55 55
             $event_manager_roles    = array_keys($this->event_managers->roles());
56 56
             $current_user_roles     = $this->current_user->roles;
Please login to merge, or discard this patch.
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -14,78 +14,78 @@
 block discarded – undo
14 14
 class CurrentUser
15 15
 {
16 16
 
17
-    /**
18
-     * @var WP_User
19
-     */
20
-    private $current_user;
21
-
22
-    /**
23
-     * @var boolean
24
-     */
25
-    private $is_event_manager = false;
26
-
27
-    /**
28
-     * @var boolean
29
-     */
30
-    private $is_logged_in = false;
31
-
32
-
33
-    /**
34
-     * @var EventManagers
35
-     */
36
-    private $event_managers;
37
-
38
-
39
-    /**
40
-     * CurrentUser constructor.
41
-     *
42
-     * @param EventManagers $event_managers
43
-     */
44
-    public function __construct(EventManagers $event_managers)
45
-    {
46
-        $this->event_managers = $event_managers;
47
-        $this->setCurrentUser();
48
-    }
49
-
50
-
51
-    public function setCurrentUser(): void
52
-    {
53
-        if (! $this->current_user instanceof WP_User) {
54
-            $this->current_user = wp_get_current_user();
55
-            $event_manager_roles    = array_keys($this->event_managers->roles());
56
-            $current_user_roles     = $this->current_user->roles;
57
-            $this->is_event_manager = ! empty(array_intersect($event_manager_roles, $current_user_roles));
58
-            $this->is_logged_in     = $this->current_user->exists();
59
-        }
60
-    }
61
-
62
-
63
-    /**
64
-     * @return WP_User
65
-     */
66
-    public function currentUser(): ?WP_User
67
-    {
68
-        $this->setCurrentUser();
69
-        return $this->current_user;
70
-    }
71
-
72
-
73
-    /**
74
-     * @return bool
75
-     */
76
-    public function isEventManager(): bool
77
-    {
78
-        $this->setCurrentUser();
79
-        return $this->is_event_manager;
80
-    }
81
-
82
-
83
-    /**
84
-     * @return bool
85
-     */
86
-    public function isLoggedIn(): bool
87
-    {
88
-        $this->setCurrentUser();
89
-        return $this->is_logged_in;
90
-    }
17
+	/**
18
+	 * @var WP_User
19
+	 */
20
+	private $current_user;
21
+
22
+	/**
23
+	 * @var boolean
24
+	 */
25
+	private $is_event_manager = false;
26
+
27
+	/**
28
+	 * @var boolean
29
+	 */
30
+	private $is_logged_in = false;
31
+
32
+
33
+	/**
34
+	 * @var EventManagers
35
+	 */
36
+	private $event_managers;
37
+
38
+
39
+	/**
40
+	 * CurrentUser constructor.
41
+	 *
42
+	 * @param EventManagers $event_managers
43
+	 */
44
+	public function __construct(EventManagers $event_managers)
45
+	{
46
+		$this->event_managers = $event_managers;
47
+		$this->setCurrentUser();
48
+	}
49
+
50
+
51
+	public function setCurrentUser(): void
52
+	{
53
+		if (! $this->current_user instanceof WP_User) {
54
+			$this->current_user = wp_get_current_user();
55
+			$event_manager_roles    = array_keys($this->event_managers->roles());
56
+			$current_user_roles     = $this->current_user->roles;
57
+			$this->is_event_manager = ! empty(array_intersect($event_manager_roles, $current_user_roles));
58
+			$this->is_logged_in     = $this->current_user->exists();
59
+		}
60
+	}
61
+
62
+
63
+	/**
64
+	 * @return WP_User
65
+	 */
66
+	public function currentUser(): ?WP_User
67
+	{
68
+		$this->setCurrentUser();
69
+		return $this->current_user;
70
+	}
71
+
72
+
73
+	/**
74
+	 * @return bool
75
+	 */
76
+	public function isEventManager(): bool
77
+	{
78
+		$this->setCurrentUser();
79
+		return $this->is_event_manager;
80
+	}
81
+
82
+
83
+	/**
84
+	 * @return bool
85
+	 */
86
+	public function isLoggedIn(): bool
87
+	{
88
+		$this->setCurrentUser();
89
+		return $this->is_logged_in;
90
+	}
91 91
 }
Please login to merge, or discard this patch.
core/domain/entities/users/EventManagers.php 2 patches
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -16,135 +16,135 @@
 block discarded – undo
16 16
 class EventManagers
17 17
 {
18 18
 
19
-    /**
20
-     * @var string[]
21
-     */
22
-    private $capabilities = [];
23
-
24
-    /**
25
-     * @var WP_Role[]
26
-     */
27
-    private $roles = [];
28
-
29
-    /**
30
-     * @var array
31
-     */
32
-    private $user_list = [];
33
-
34
-    /**
35
-     * @var WP_Role[]
36
-     */
37
-    private $wp_roles;
38
-
39
-
40
-    /**
41
-     * EventManagerRoles constructor.
42
-     */
43
-    public function __construct()
44
-    {
45
-        global $wp_roles;
46
-        // first let's grab ALL of the WP_Role objects
47
-        $this->wp_roles = $wp_roles->role_objects;
48
-        $this->setCapabilities();
49
-        $this->buildRolesArray();
50
-        $this->buildUserList();
51
-    }
52
-
53
-
54
-    private function setCapabilities(): void
55
-    {
56
-        // filter a list of capabilities we want to use to define an event manager
57
-        $capabilities = (array) apply_filters(
58
-            'FHEE__EventEspresso_core_domain_services_capabilities_EventManagers__setCapabilities',
59
-            ['ee_edit_events', 'ee_edit_event'],
60
-            $this->wp_roles
61
-        );
62
-        $this->capabilities = array_map('sanitize_text_field', $capabilities);
63
-    }
64
-
65
-
66
-    private function buildRolesArray(): void
67
-    {
68
-        // we'll use this array to capture all of the WP_Role objects that have any of the caps we are targeting
69
-        $event_manager_roles = [];
70
-        foreach ($this->wp_roles as $role) {
71
-            if ($role instanceof WP_Role) {
72
-                foreach ($this->capabilities as $capability) {
73
-                    // we're using the role name as the array index to prevent duplicates
74
-                    if (! isset($event_manager_roles[ $role->name ]) && $role->has_cap($capability)) {
75
-                        $event_manager_roles[ $role->name ] = $role;
76
-                    }
77
-                }
78
-            }
79
-        }
80
-        $this->roles = $event_manager_roles;
81
-    }
82
-
83
-
84
-    private function buildUserList(): void
85
-    {
86
-        global $wpdb;
87
-        // no roles ?!!? then nothing to query for
88
-        if (empty($this->roles)) {
89
-            $this->user_list = [];
90
-        }
91
-        // begin to build our query
92
-        $SQL      = "SELECT u1.ID, u1.display_name FROM $wpdb->users AS u1 "
93
-                    . "INNER JOIN $wpdb->usermeta AS u2 ON u1.ID = u2.user_id "
94
-                    . "AND u2.meta_key='{$wpdb->prefix}capabilities' "
95
-                    . 'WHERE';
96
-        $operator = '';
97
-        foreach ($this->roles as $role) {
98
-            // for each role, add a WHERE clause
99
-            if ($role instanceof WP_Role) {
100
-                $SQL .= $operator . ' u2.meta_value LIKE \'%"' . $role->name . '"%\' ';
101
-                // subsequent clauses will use OR so that any role is accepted
102
-                $operator = 'OR';
103
-            }
104
-        }
105
-        foreach ($this->capabilities as $capability) {
106
-            // for each capability, add a WHERE clause
107
-            $SQL .= $operator . ' u2.meta_value LIKE \'%"' . $capability . '";b:1;%\' ';
108
-            // subsequent clauses will use OR so that any role is accepted
109
-            $operator = 'OR';
110
-        }
111
-        $SQL   .= 'ORDER BY user_id ASC';
112
-        $users = $wpdb->get_results($SQL);
113
-
114
-        $this->user_list = ! empty($users) ? $users : [];
115
-    }
116
-
117
-
118
-    /**
119
-     * @return array
120
-     */
121
-    public function capabilities(): array
122
-    {
123
-        return $this->capabilities;
124
-    }
125
-
126
-
127
-    /**
128
-     * Returns a list of WP_Role objects that have "event manager" capabilities
129
-     * The list of "event manager" capabilities is filtered but defaults to:
130
-     *      - 'ee_edit_events'
131
-     *      - 'ee_edit_event'
132
-     *
133
-     * @return WP_Role[]
134
-     */
135
-    public function roles(): array
136
-    {
137
-        return $this->roles;
138
-    }
139
-
140
-
141
-    /**
142
-     * Returns a list of users that have any of the Event Manager roles
143
-     *
144
-     * @return stdClass[]
145
-     */
146
-    public function userList(): array
147
-    {
148
-        return $this->user_list;
149
-    }
19
+	/**
20
+	 * @var string[]
21
+	 */
22
+	private $capabilities = [];
23
+
24
+	/**
25
+	 * @var WP_Role[]
26
+	 */
27
+	private $roles = [];
28
+
29
+	/**
30
+	 * @var array
31
+	 */
32
+	private $user_list = [];
33
+
34
+	/**
35
+	 * @var WP_Role[]
36
+	 */
37
+	private $wp_roles;
38
+
39
+
40
+	/**
41
+	 * EventManagerRoles constructor.
42
+	 */
43
+	public function __construct()
44
+	{
45
+		global $wp_roles;
46
+		// first let's grab ALL of the WP_Role objects
47
+		$this->wp_roles = $wp_roles->role_objects;
48
+		$this->setCapabilities();
49
+		$this->buildRolesArray();
50
+		$this->buildUserList();
51
+	}
52
+
53
+
54
+	private function setCapabilities(): void
55
+	{
56
+		// filter a list of capabilities we want to use to define an event manager
57
+		$capabilities = (array) apply_filters(
58
+			'FHEE__EventEspresso_core_domain_services_capabilities_EventManagers__setCapabilities',
59
+			['ee_edit_events', 'ee_edit_event'],
60
+			$this->wp_roles
61
+		);
62
+		$this->capabilities = array_map('sanitize_text_field', $capabilities);
63
+	}
64
+
65
+
66
+	private function buildRolesArray(): void
67
+	{
68
+		// we'll use this array to capture all of the WP_Role objects that have any of the caps we are targeting
69
+		$event_manager_roles = [];
70
+		foreach ($this->wp_roles as $role) {
71
+			if ($role instanceof WP_Role) {
72
+				foreach ($this->capabilities as $capability) {
73
+					// we're using the role name as the array index to prevent duplicates
74
+					if (! isset($event_manager_roles[ $role->name ]) && $role->has_cap($capability)) {
75
+						$event_manager_roles[ $role->name ] = $role;
76
+					}
77
+				}
78
+			}
79
+		}
80
+		$this->roles = $event_manager_roles;
81
+	}
82
+
83
+
84
+	private function buildUserList(): void
85
+	{
86
+		global $wpdb;
87
+		// no roles ?!!? then nothing to query for
88
+		if (empty($this->roles)) {
89
+			$this->user_list = [];
90
+		}
91
+		// begin to build our query
92
+		$SQL      = "SELECT u1.ID, u1.display_name FROM $wpdb->users AS u1 "
93
+					. "INNER JOIN $wpdb->usermeta AS u2 ON u1.ID = u2.user_id "
94
+					. "AND u2.meta_key='{$wpdb->prefix}capabilities' "
95
+					. 'WHERE';
96
+		$operator = '';
97
+		foreach ($this->roles as $role) {
98
+			// for each role, add a WHERE clause
99
+			if ($role instanceof WP_Role) {
100
+				$SQL .= $operator . ' u2.meta_value LIKE \'%"' . $role->name . '"%\' ';
101
+				// subsequent clauses will use OR so that any role is accepted
102
+				$operator = 'OR';
103
+			}
104
+		}
105
+		foreach ($this->capabilities as $capability) {
106
+			// for each capability, add a WHERE clause
107
+			$SQL .= $operator . ' u2.meta_value LIKE \'%"' . $capability . '";b:1;%\' ';
108
+			// subsequent clauses will use OR so that any role is accepted
109
+			$operator = 'OR';
110
+		}
111
+		$SQL   .= 'ORDER BY user_id ASC';
112
+		$users = $wpdb->get_results($SQL);
113
+
114
+		$this->user_list = ! empty($users) ? $users : [];
115
+	}
116
+
117
+
118
+	/**
119
+	 * @return array
120
+	 */
121
+	public function capabilities(): array
122
+	{
123
+		return $this->capabilities;
124
+	}
125
+
126
+
127
+	/**
128
+	 * Returns a list of WP_Role objects that have "event manager" capabilities
129
+	 * The list of "event manager" capabilities is filtered but defaults to:
130
+	 *      - 'ee_edit_events'
131
+	 *      - 'ee_edit_event'
132
+	 *
133
+	 * @return WP_Role[]
134
+	 */
135
+	public function roles(): array
136
+	{
137
+		return $this->roles;
138
+	}
139
+
140
+
141
+	/**
142
+	 * Returns a list of users that have any of the Event Manager roles
143
+	 *
144
+	 * @return stdClass[]
145
+	 */
146
+	public function userList(): array
147
+	{
148
+		return $this->user_list;
149
+	}
150 150
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
             if ($role instanceof WP_Role) {
72 72
                 foreach ($this->capabilities as $capability) {
73 73
                     // we're using the role name as the array index to prevent duplicates
74
-                    if (! isset($event_manager_roles[ $role->name ]) && $role->has_cap($capability)) {
75
-                        $event_manager_roles[ $role->name ] = $role;
74
+                    if ( ! isset($event_manager_roles[$role->name]) && $role->has_cap($capability)) {
75
+                        $event_manager_roles[$role->name] = $role;
76 76
                     }
77 77
                 }
78 78
             }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             $this->user_list = [];
90 90
         }
91 91
         // begin to build our query
92
-        $SQL      = "SELECT u1.ID, u1.display_name FROM $wpdb->users AS u1 "
92
+        $SQL = "SELECT u1.ID, u1.display_name FROM $wpdb->users AS u1 "
93 93
                     . "INNER JOIN $wpdb->usermeta AS u2 ON u1.ID = u2.user_id "
94 94
                     . "AND u2.meta_key='{$wpdb->prefix}capabilities' "
95 95
                     . 'WHERE';
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
         foreach ($this->roles as $role) {
98 98
             // for each role, add a WHERE clause
99 99
             if ($role instanceof WP_Role) {
100
-                $SQL .= $operator . ' u2.meta_value LIKE \'%"' . $role->name . '"%\' ';
100
+                $SQL .= $operator.' u2.meta_value LIKE \'%"'.$role->name.'"%\' ';
101 101
                 // subsequent clauses will use OR so that any role is accepted
102 102
                 $operator = 'OR';
103 103
             }
104 104
         }
105 105
         foreach ($this->capabilities as $capability) {
106 106
             // for each capability, add a WHERE clause
107
-            $SQL .= $operator . ' u2.meta_value LIKE \'%"' . $capability . '";b:1;%\' ';
107
+            $SQL .= $operator.' u2.meta_value LIKE \'%"'.$capability.'";b:1;%\' ';
108 108
             // subsequent clauses will use OR so that any role is accepted
109 109
             $operator = 'OR';
110 110
         }
111
-        $SQL   .= 'ORDER BY user_id ASC';
111
+        $SQL .= 'ORDER BY user_id ASC';
112 112
         $users = $wpdb->get_results($SQL);
113 113
 
114 114
         $this->user_list = ! empty($users) ? $users : [];
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/admin/EspressoEventEditor.php 1 patch
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -18,144 +18,144 @@
 block discarded – undo
18 18
 class EspressoEventEditor extends EspressoEventsAdmin
19 19
 {
20 20
 
21
-    /**
22
-     * returns true if the current request matches this route
23
-     *
24
-     * @return bool
25
-     * @since   $VID:$
26
-     */
27
-    public function matchesCurrentRequest(): bool
28
-    {
29
-        return parent::matchesCurrentRequest()
30
-               && $this->admin_config->useAdvancedEditor()
31
-               && (
32
-                $this->request->getRequestParam('action') === 'create_new'
33
-                || $this->request->getRequestParam('action') === 'edit'
34
-            );
35
-    }
21
+	/**
22
+	 * returns true if the current request matches this route
23
+	 *
24
+	 * @return bool
25
+	 * @since   $VID:$
26
+	 */
27
+	public function matchesCurrentRequest(): bool
28
+	{
29
+		return parent::matchesCurrentRequest()
30
+			   && $this->admin_config->useAdvancedEditor()
31
+			   && (
32
+				$this->request->getRequestParam('action') === 'create_new'
33
+				|| $this->request->getRequestParam('action') === 'edit'
34
+			);
35
+	}
36 36
 
37 37
 
38
-    /**
39
-     * @since $VID:$
40
-     */
41
-    protected function registerDependencies()
42
-    {
43
-        $this->dependency_map->registerDependencies(
44
-            'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData',
45
-            [
46
-                'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes'                 => EE_Dependency_Map::load_from_cache,
47
-                'EventEspresso\core\domain\entities\admin\GraphQLData\Event'                     => EE_Dependency_Map::load_from_cache,
48
-                'EventEspresso\core\domain\entities\admin\GraphQLData\Prices'                    => EE_Dependency_Map::load_from_cache,
49
-                'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes'                => EE_Dependency_Map::load_from_cache,
50
-                'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets'                   => EE_Dependency_Map::load_from_cache,
51
-                'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache,
52
-                '\EventEspresso\core\domain\services\admin\events\editor\EventManagerData'       => EE_Dependency_Map::load_from_cache,
53
-                'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations'    => EE_Dependency_Map::load_from_cache,
54
-                'EventEspresso\core\domain\services\admin\events\editor\TicketMeta'              => EE_Dependency_Map::load_from_cache,
55
-            ]
56
-        );
57
-        $this->dependency_map->registerDependencies(
58
-            'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations',
59
-            [
60
-                'EEM_Datetime'                                         => EE_Dependency_Map::load_from_cache,
61
-                'EEM_Event'                                            => EE_Dependency_Map::load_from_cache,
62
-                'EEM_Price'                                            => EE_Dependency_Map::load_from_cache,
63
-                'EEM_Price_Type'                                       => EE_Dependency_Map::load_from_cache,
64
-                'EEM_Ticket'                                           => EE_Dependency_Map::load_from_cache,
65
-                'EventEspresso\core\domain\services\graphql\Utilities' => EE_Dependency_Map::load_from_cache,
66
-            ]
67
-        );
68
-        $this->dependency_map->registerDependencies(
69
-            'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities',
70
-            [
71
-                'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => EE_Dependency_Map::load_from_cache,
72
-                'EEM_Datetime'                                                       => EE_Dependency_Map::load_from_cache,
73
-                'EEM_Event'                                                          => EE_Dependency_Map::load_from_cache,
74
-                'EEM_Price'                                                          => EE_Dependency_Map::load_from_cache,
75
-                'EEM_Price_Type'                                                     => EE_Dependency_Map::load_from_cache,
76
-                'EEM_Ticket'                                                         => EE_Dependency_Map::load_from_cache,
77
-                'EventEspresso\core\domain\services\graphql\Utilities'               => EE_Dependency_Map::load_from_cache,
78
-            ]
79
-        );
80
-        $this->dependency_map->registerDependencies(
81
-            'EventEspresso\core\domain\services\admin\events\editor\TicketMeta',
82
-            ['EEM_Ticket' => EE_Dependency_Map::load_from_cache]
83
-        );
84
-        $this->dependency_map->registerDependencies(
85
-            'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes',
86
-            [
87
-                'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache,
88
-                'EEM_Datetime'                                                     => EE_Dependency_Map::load_from_cache,
89
-            ]
90
-        );
91
-        $this->dependency_map->registerDependencies(
92
-            'EventEspresso\core\domain\services\admin\entities\DefaultTickets',
93
-            [
94
-                'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache,
95
-                'EEM_Ticket'                                                      => EE_Dependency_Map::load_from_cache,
96
-            ]
97
-        );
98
-        $this->dependency_map->registerDependencies(
99
-            'EventEspresso\core\domain\services\admin\entities\DefaultPrices',
100
-            [
101
-                'EEM_Price'      => EE_Dependency_Map::load_from_cache,
102
-                'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
103
-            ]
104
-        );
105
-        $this->dependency_map->registerDependencies(
106
-            'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor',
107
-            [
108
-                'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => EE_Dependency_Map::load_from_cache,
109
-                'EventEspresso\core\services\json\JsonDataNodeValidator'                        => EE_Dependency_Map::load_from_cache,
110
-            ]
111
-        );
112
-        $this->dependency_map->registerDependencies(
113
-            'EventEspresso\core\domain\services\assets\EventEditorAssetManager',
114
-            [
115
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
116
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
117
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
118
-            ]
119
-        );
120
-        $this->dependency_map->registerDependencies(
121
-            'EventEspresso\core\domain\services\admin\events\editor\EventManagerData',
122
-            [
123
-                'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache,
124
-                'EventEspresso\core\domain\services\graphql\Utilities'   => EE_Dependency_Map::load_from_cache,
125
-            ]
126
-        );
127
-    }
38
+	/**
39
+	 * @since $VID:$
40
+	 */
41
+	protected function registerDependencies()
42
+	{
43
+		$this->dependency_map->registerDependencies(
44
+			'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData',
45
+			[
46
+				'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes'                 => EE_Dependency_Map::load_from_cache,
47
+				'EventEspresso\core\domain\entities\admin\GraphQLData\Event'                     => EE_Dependency_Map::load_from_cache,
48
+				'EventEspresso\core\domain\entities\admin\GraphQLData\Prices'                    => EE_Dependency_Map::load_from_cache,
49
+				'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes'                => EE_Dependency_Map::load_from_cache,
50
+				'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets'                   => EE_Dependency_Map::load_from_cache,
51
+				'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache,
52
+				'\EventEspresso\core\domain\services\admin\events\editor\EventManagerData'       => EE_Dependency_Map::load_from_cache,
53
+				'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations'    => EE_Dependency_Map::load_from_cache,
54
+				'EventEspresso\core\domain\services\admin\events\editor\TicketMeta'              => EE_Dependency_Map::load_from_cache,
55
+			]
56
+		);
57
+		$this->dependency_map->registerDependencies(
58
+			'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations',
59
+			[
60
+				'EEM_Datetime'                                         => EE_Dependency_Map::load_from_cache,
61
+				'EEM_Event'                                            => EE_Dependency_Map::load_from_cache,
62
+				'EEM_Price'                                            => EE_Dependency_Map::load_from_cache,
63
+				'EEM_Price_Type'                                       => EE_Dependency_Map::load_from_cache,
64
+				'EEM_Ticket'                                           => EE_Dependency_Map::load_from_cache,
65
+				'EventEspresso\core\domain\services\graphql\Utilities' => EE_Dependency_Map::load_from_cache,
66
+			]
67
+		);
68
+		$this->dependency_map->registerDependencies(
69
+			'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities',
70
+			[
71
+				'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => EE_Dependency_Map::load_from_cache,
72
+				'EEM_Datetime'                                                       => EE_Dependency_Map::load_from_cache,
73
+				'EEM_Event'                                                          => EE_Dependency_Map::load_from_cache,
74
+				'EEM_Price'                                                          => EE_Dependency_Map::load_from_cache,
75
+				'EEM_Price_Type'                                                     => EE_Dependency_Map::load_from_cache,
76
+				'EEM_Ticket'                                                         => EE_Dependency_Map::load_from_cache,
77
+				'EventEspresso\core\domain\services\graphql\Utilities'               => EE_Dependency_Map::load_from_cache,
78
+			]
79
+		);
80
+		$this->dependency_map->registerDependencies(
81
+			'EventEspresso\core\domain\services\admin\events\editor\TicketMeta',
82
+			['EEM_Ticket' => EE_Dependency_Map::load_from_cache]
83
+		);
84
+		$this->dependency_map->registerDependencies(
85
+			'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes',
86
+			[
87
+				'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache,
88
+				'EEM_Datetime'                                                     => EE_Dependency_Map::load_from_cache,
89
+			]
90
+		);
91
+		$this->dependency_map->registerDependencies(
92
+			'EventEspresso\core\domain\services\admin\entities\DefaultTickets',
93
+			[
94
+				'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache,
95
+				'EEM_Ticket'                                                      => EE_Dependency_Map::load_from_cache,
96
+			]
97
+		);
98
+		$this->dependency_map->registerDependencies(
99
+			'EventEspresso\core\domain\services\admin\entities\DefaultPrices',
100
+			[
101
+				'EEM_Price'      => EE_Dependency_Map::load_from_cache,
102
+				'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
103
+			]
104
+		);
105
+		$this->dependency_map->registerDependencies(
106
+			'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor',
107
+			[
108
+				'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => EE_Dependency_Map::load_from_cache,
109
+				'EventEspresso\core\services\json\JsonDataNodeValidator'                        => EE_Dependency_Map::load_from_cache,
110
+			]
111
+		);
112
+		$this->dependency_map->registerDependencies(
113
+			'EventEspresso\core\domain\services\assets\EventEditorAssetManager',
114
+			[
115
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
116
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
117
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
118
+			]
119
+		);
120
+		$this->dependency_map->registerDependencies(
121
+			'EventEspresso\core\domain\services\admin\events\editor\EventManagerData',
122
+			[
123
+				'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache,
124
+				'EventEspresso\core\domain\services\graphql\Utilities'   => EE_Dependency_Map::load_from_cache,
125
+			]
126
+		);
127
+	}
128 128
 
129 129
 
130
-    /**
131
-     * @return string
132
-     */
133
-    protected function dataNodeClass(): string
134
-    {
135
-        return EventEditor::class;
136
-    }
130
+	/**
131
+	 * @return string
132
+	 */
133
+	protected function dataNodeClass(): string
134
+	{
135
+		return EventEditor::class;
136
+	}
137 137
 
138 138
 
139
-    /**
140
-     * implements logic required to run during request
141
-     *
142
-     * @return bool
143
-     * @since   $VID:$
144
-     */
145
-    protected function requestHandler(): bool
146
-    {
147
-        if (! class_exists('WPGraphQL')) {
148
-            require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php';
149
-        }
150
-        /** @var GraphQLManager $graphQL_manager */
151
-        $graphQL_manager = $this->loader->getShared('EventEspresso\core\services\graphql\GraphQLManager');
152
-        $graphQL_manager->init();
139
+	/**
140
+	 * implements logic required to run during request
141
+	 *
142
+	 * @return bool
143
+	 * @since   $VID:$
144
+	 */
145
+	protected function requestHandler(): bool
146
+	{
147
+		if (! class_exists('WPGraphQL')) {
148
+			require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php';
149
+		}
150
+		/** @var GraphQLManager $graphQL_manager */
151
+		$graphQL_manager = $this->loader->getShared('EventEspresso\core\services\graphql\GraphQLManager');
152
+		$graphQL_manager->init();
153 153
 
154
-        /** @var EventEditorAssetManager $asset_manager */
155
-        $asset_manager = $this->loader->getShared(
156
-            'EventEspresso\core\domain\services\assets\EventEditorAssetManager'
157
-        );
158
-        add_action('admin_enqueue_scripts', [$asset_manager, 'enqueueEventEditor']);
159
-        return true;
160
-    }
154
+		/** @var EventEditorAssetManager $asset_manager */
155
+		$asset_manager = $this->loader->getShared(
156
+			'EventEspresso\core\domain\services\assets\EventEditorAssetManager'
157
+		);
158
+		add_action('admin_enqueue_scripts', [$asset_manager, 'enqueueEventEditor']);
159
+		return true;
160
+	}
161 161
 }
Please login to merge, or discard this patch.
core/domain/services/admin/events/editor/TicketMeta.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -15,29 +15,29 @@
 block discarded – undo
15 15
 class TicketMeta implements EventEditorDataInterface
16 16
 {
17 17
 
18
-    /**
19
-     * @var EEM_Ticket $ticket_model
20
-     */
21
-    protected $ticket_model;
22
-
23
-
24
-    /**
25
-     * TicketMeta constructor.
26
-     *
27
-     * @param EEM_Ticket $ticket_model
28
-     */
29
-    public function __construct(EEM_Ticket $ticket_model)
30
-    {
31
-        $this->ticket_model = $ticket_model;
32
-    }
33
-
34
-
35
-    /**
36
-     * @param int $eventId
37
-     * @return array
38
-     */
39
-    public function getData(int $eventId): array
40
-    {
41
-        return ['visibilityOptions' => $this->ticket_model->getTicketVisibilityLabels()];
42
-    }
18
+	/**
19
+	 * @var EEM_Ticket $ticket_model
20
+	 */
21
+	protected $ticket_model;
22
+
23
+
24
+	/**
25
+	 * TicketMeta constructor.
26
+	 *
27
+	 * @param EEM_Ticket $ticket_model
28
+	 */
29
+	public function __construct(EEM_Ticket $ticket_model)
30
+	{
31
+		$this->ticket_model = $ticket_model;
32
+	}
33
+
34
+
35
+	/**
36
+	 * @param int $eventId
37
+	 * @return array
38
+	 */
39
+	public function getData(int $eventId): array
40
+	{
41
+		return ['visibilityOptions' => $this->ticket_model->getTicketVisibilityLabels()];
42
+	}
43 43
 }
Please login to merge, or discard this patch.
core/domain/services/admin/events/editor/EventEditorGraphQLData.php 1 patch
Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -21,136 +21,136 @@
 block discarded – undo
21 21
 class EventEditorGraphQLData
22 22
 {
23 23
 
24
-    /**
25
-     * @var Event
26
-     */
27
-    protected $event;
28
-
29
-    /**
30
-     * @var Datetimes
31
-     */
32
-    protected $datetimes;
33
-
34
-    /**
35
-     * @var Prices
36
-     */
37
-    protected $prices;
38
-
39
-    /**
40
-     * @var PriceTypes
41
-     */
42
-    protected $price_types;
43
-
44
-    /**
45
-     * @var Tickets
46
-     */
47
-    protected $tickets;
48
-
49
-    /**
50
-     * @var EventEntityRelations
51
-     */
52
-    protected $relations;
53
-
54
-    /**
55
-     * @var EventManagerData
56
-     */
57
-    protected $managers;
58
-
59
-    /**
60
-     * @var NewEventDefaultEntities
61
-     */
62
-    protected $default_entities;
63
-
64
-    /**
65
-     * @var TicketMeta
66
-     */
67
-    protected $ticket_meta;
68
-
69
-
70
-    /**
71
-     * EventEditorGraphQLData constructor.
72
-     *
73
-     * @param Datetimes               $datetimes
74
-     * @param Event                   $event
75
-     * @param Prices                  $prices
76
-     * @param PriceTypes              $price_types
77
-     * @param Tickets                 $tickets
78
-     * @param EventEntityRelations    $relations
79
-     * @param EventManagerData        $managers
80
-     * @param NewEventDefaultEntities $default_entities
81
-     * @param TicketMeta              $ticket_meta
82
-     */
83
-    public function __construct(
84
-        Datetimes $datetimes,
85
-        Event $event,
86
-        Prices $prices,
87
-        PriceTypes $price_types,
88
-        Tickets $tickets,
89
-        EventEntityRelations $relations,
90
-        EventManagerData $managers,
91
-        NewEventDefaultEntities $default_entities,
92
-        TicketMeta $ticket_meta
93
-    ) {
94
-        $this->datetimes        = $datetimes;
95
-        $this->event            = $event;
96
-        $this->default_entities = $default_entities;
97
-        $this->prices           = $prices;
98
-        $this->price_types      = $price_types;
99
-        $this->managers         = $managers;
100
-        $this->relations        = $relations;
101
-        $this->tickets          = $tickets;
102
-        $this->ticket_meta      = $ticket_meta;
103
-    }
104
-
105
-
106
-    /**
107
-     * @param int $eventId
108
-     * @return array
109
-     * @throws EE_Error
110
-     * @throws ReflectionException
111
-     * @since $VID:$
112
-     */
113
-    public function getData(int $eventId)
114
-    {
115
-        $event = $this->event->getData(['id' => $eventId]);
116
-        $datetimes = $this->datetimes->getData(['eventId' => $eventId]);
117
-        $eventManagers = $this->managers ->getData($eventId);
118
-
119
-        // Avoid undefined variable warning in PHP >= 7.3
120
-        $tickets = null;
121
-        $prices  = null;
122
-
123
-        if (empty($datetimes['nodes']) || (isset($_REQUEST['action']) && $_REQUEST['action'] === 'create_new')) {
124
-            $this->default_entities->getData($eventId);
125
-            $datetimes = $this->datetimes->getData(['eventId' => $eventId]);
126
-        }
127
-
128
-        $tickets = $this->tickets->getData([
129
-            'eventId'               => $eventId,
130
-            'includeDefaultTickets' => true,
131
-        ]);
132
-
133
-        $prices = $this->prices->getData([
134
-            'eventId'                     => $eventId,
135
-            'includeDefaultTicketsPrices' => true,
136
-            'includeDefaultPrices'        => true,
137
-        ]);
138
-
139
-        $priceTypes = $this->price_types->getData();
140
-
141
-        $relations = $this->relations->getData($eventId);
142
-
143
-        $ticketMeta = $this->ticket_meta->getData($eventId);
144
-
145
-        return compact(
146
-            'datetimes',
147
-            'event',
148
-            'eventManagers',
149
-            'prices',
150
-            'priceTypes',
151
-            'relations',
152
-            'tickets',
153
-            'ticketMeta'
154
-        );
155
-    }
24
+	/**
25
+	 * @var Event
26
+	 */
27
+	protected $event;
28
+
29
+	/**
30
+	 * @var Datetimes
31
+	 */
32
+	protected $datetimes;
33
+
34
+	/**
35
+	 * @var Prices
36
+	 */
37
+	protected $prices;
38
+
39
+	/**
40
+	 * @var PriceTypes
41
+	 */
42
+	protected $price_types;
43
+
44
+	/**
45
+	 * @var Tickets
46
+	 */
47
+	protected $tickets;
48
+
49
+	/**
50
+	 * @var EventEntityRelations
51
+	 */
52
+	protected $relations;
53
+
54
+	/**
55
+	 * @var EventManagerData
56
+	 */
57
+	protected $managers;
58
+
59
+	/**
60
+	 * @var NewEventDefaultEntities
61
+	 */
62
+	protected $default_entities;
63
+
64
+	/**
65
+	 * @var TicketMeta
66
+	 */
67
+	protected $ticket_meta;
68
+
69
+
70
+	/**
71
+	 * EventEditorGraphQLData constructor.
72
+	 *
73
+	 * @param Datetimes               $datetimes
74
+	 * @param Event                   $event
75
+	 * @param Prices                  $prices
76
+	 * @param PriceTypes              $price_types
77
+	 * @param Tickets                 $tickets
78
+	 * @param EventEntityRelations    $relations
79
+	 * @param EventManagerData        $managers
80
+	 * @param NewEventDefaultEntities $default_entities
81
+	 * @param TicketMeta              $ticket_meta
82
+	 */
83
+	public function __construct(
84
+		Datetimes $datetimes,
85
+		Event $event,
86
+		Prices $prices,
87
+		PriceTypes $price_types,
88
+		Tickets $tickets,
89
+		EventEntityRelations $relations,
90
+		EventManagerData $managers,
91
+		NewEventDefaultEntities $default_entities,
92
+		TicketMeta $ticket_meta
93
+	) {
94
+		$this->datetimes        = $datetimes;
95
+		$this->event            = $event;
96
+		$this->default_entities = $default_entities;
97
+		$this->prices           = $prices;
98
+		$this->price_types      = $price_types;
99
+		$this->managers         = $managers;
100
+		$this->relations        = $relations;
101
+		$this->tickets          = $tickets;
102
+		$this->ticket_meta      = $ticket_meta;
103
+	}
104
+
105
+
106
+	/**
107
+	 * @param int $eventId
108
+	 * @return array
109
+	 * @throws EE_Error
110
+	 * @throws ReflectionException
111
+	 * @since $VID:$
112
+	 */
113
+	public function getData(int $eventId)
114
+	{
115
+		$event = $this->event->getData(['id' => $eventId]);
116
+		$datetimes = $this->datetimes->getData(['eventId' => $eventId]);
117
+		$eventManagers = $this->managers ->getData($eventId);
118
+
119
+		// Avoid undefined variable warning in PHP >= 7.3
120
+		$tickets = null;
121
+		$prices  = null;
122
+
123
+		if (empty($datetimes['nodes']) || (isset($_REQUEST['action']) && $_REQUEST['action'] === 'create_new')) {
124
+			$this->default_entities->getData($eventId);
125
+			$datetimes = $this->datetimes->getData(['eventId' => $eventId]);
126
+		}
127
+
128
+		$tickets = $this->tickets->getData([
129
+			'eventId'               => $eventId,
130
+			'includeDefaultTickets' => true,
131
+		]);
132
+
133
+		$prices = $this->prices->getData([
134
+			'eventId'                     => $eventId,
135
+			'includeDefaultTicketsPrices' => true,
136
+			'includeDefaultPrices'        => true,
137
+		]);
138
+
139
+		$priceTypes = $this->price_types->getData();
140
+
141
+		$relations = $this->relations->getData($eventId);
142
+
143
+		$ticketMeta = $this->ticket_meta->getData($eventId);
144
+
145
+		return compact(
146
+			'datetimes',
147
+			'event',
148
+			'eventManagers',
149
+			'prices',
150
+			'priceTypes',
151
+			'relations',
152
+			'tickets',
153
+			'ticketMeta'
154
+		);
155
+	}
156 156
 }
Please login to merge, or discard this patch.
core/domain/services/admin/events/editor/EventManagerData.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -17,46 +17,46 @@
 block discarded – undo
17 17
 class EventManagerData implements EventEditorDataInterface
18 18
 {
19 19
 
20
-    /**
21
-     * @var EventManagers
22
-     */
23
-    private $event_managers;
24
-
25
-    /**
26
-     * @var Utilities
27
-     */
28
-    private $utilities;
29
-
30
-
31
-    /**
32
-     * EventManagerRoles constructor.
33
-     *
34
-     * @param EventManagers $event_managers
35
-     * @param Utilities $utilities
36
-     */
37
-    public function __construct(EventManagers $event_managers, Utilities $utilities)
38
-    {
39
-        $this->event_managers = $event_managers;
40
-        $this->utilities = $utilities;
41
-    }
42
-
43
-
44
-    /**
45
-     * @param int $eventId
46
-     * @return array
47
-     */
48
-    public function getData(int $eventId): array
49
-    {
50
-        $event_managers = [];
51
-        $event_manager_users = $this->event_managers->userList();
52
-        // now convert to a format that's usable by GQL
53
-        foreach ($event_manager_users as $user) {
54
-            $GUID = $this->utilities->convertToGlobalId('user', $user->ID);
55
-            $event_managers[] = [
56
-                'id'   => $GUID,
57
-                'name' => $user->display_name,
58
-            ];
59
-        }
60
-        return $event_managers;
61
-    }
20
+	/**
21
+	 * @var EventManagers
22
+	 */
23
+	private $event_managers;
24
+
25
+	/**
26
+	 * @var Utilities
27
+	 */
28
+	private $utilities;
29
+
30
+
31
+	/**
32
+	 * EventManagerRoles constructor.
33
+	 *
34
+	 * @param EventManagers $event_managers
35
+	 * @param Utilities $utilities
36
+	 */
37
+	public function __construct(EventManagers $event_managers, Utilities $utilities)
38
+	{
39
+		$this->event_managers = $event_managers;
40
+		$this->utilities = $utilities;
41
+	}
42
+
43
+
44
+	/**
45
+	 * @param int $eventId
46
+	 * @return array
47
+	 */
48
+	public function getData(int $eventId): array
49
+	{
50
+		$event_managers = [];
51
+		$event_manager_users = $this->event_managers->userList();
52
+		// now convert to a format that's usable by GQL
53
+		foreach ($event_manager_users as $user) {
54
+			$GUID = $this->utilities->convertToGlobalId('user', $user->ID);
55
+			$event_managers[] = [
56
+				'id'   => $GUID,
57
+				'name' => $user->display_name,
58
+			];
59
+		}
60
+		return $event_managers;
61
+	}
62 62
 }
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorIframe.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -23,83 +23,83 @@
 block discarded – undo
23 23
 class TicketSelectorIframe extends Iframe
24 24
 {
25 25
 
26
-    /**
27
-     * TicketSelectorIframe constructor.
28
-     *
29
-     * @throws InvalidArgumentException
30
-     * @throws InvalidInterfaceException
31
-     * @throws InvalidDataTypeException
32
-     * @throws DomainException
33
-     * @throws EE_Error
34
-     * @throws ReflectionException
35
-     */
36
-    public function __construct()
37
-    {
38
-        EE_Registry::instance()->REQ->set_espresso_page(true);
39
-        /** @type \EEM_Event $EEM_Event */
40
-        $EEM_Event = EE_Registry::instance()->load_model('Event');
41
-        $event = $EEM_Event->get_one_by_ID(
42
-            EE_Registry::instance()->REQ->get('event', 0)
43
-        );
44
-        $ticket_selector = LoaderFactory::getLoader()->getShared(
45
-            DisplayTicketSelector::class,
46
-            [null, true]
47
-        );
48
-        parent::__construct(
49
-            esc_html__('Ticket Selector', 'event_espresso'),
50
-            $ticket_selector->display($event)
51
-        );
52
-        $this->addStylesheets(
53
-            apply_filters(
54
-                'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
55
-                array(
56
-                    'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL
57
-                                               . 'ticket_selector_embed.css?ver='
58
-                                               . EVENT_ESPRESSO_VERSION,
59
-                    'ticket_selector'       => TICKET_SELECTOR_ASSETS_URL
60
-                                               . 'ticket_selector.css?ver='
61
-                                               . EVENT_ESPRESSO_VERSION,
62
-                ),
63
-                $this
64
-            )
65
-        );
66
-        if (! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) {
67
-            $this->addStylesheets(array('site_theme' => ''));
68
-        }
69
-        $this->addScripts(
70
-            apply_filters(
71
-                'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
72
-                array(
73
-                    'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL
74
-                                                      . 'ticket_selector_iframe_embed.js?ver='
75
-                                                      . EVENT_ESPRESSO_VERSION,
76
-                ),
77
-                $this
78
-            )
79
-        );
80
-        $js_attributes = apply_filters(
81
-            'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__js_attributes',
82
-            array(),
83
-            $this
84
-        );
85
-        if (! empty($js_attributes)) {
86
-            $this->addScriptAttributes($js_attributes);
87
-        }
88
-        $this->addLocalizedVars(
89
-            apply_filters(
90
-                'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__localized_vars',
91
-                array(
92
-                    'ticket_selector_iframe' => true,
93
-                    'EEDTicketSelectorMsg'   => __(
94
-                        'Please choose at least one ticket before continuing.',
95
-                        'event_espresso'
96
-                    ),
97
-                )
98
-            )
99
-        );
100
-        do_action(
101
-            'AHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__complete',
102
-            $this
103
-        );
104
-    }
26
+	/**
27
+	 * TicketSelectorIframe constructor.
28
+	 *
29
+	 * @throws InvalidArgumentException
30
+	 * @throws InvalidInterfaceException
31
+	 * @throws InvalidDataTypeException
32
+	 * @throws DomainException
33
+	 * @throws EE_Error
34
+	 * @throws ReflectionException
35
+	 */
36
+	public function __construct()
37
+	{
38
+		EE_Registry::instance()->REQ->set_espresso_page(true);
39
+		/** @type \EEM_Event $EEM_Event */
40
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
41
+		$event = $EEM_Event->get_one_by_ID(
42
+			EE_Registry::instance()->REQ->get('event', 0)
43
+		);
44
+		$ticket_selector = LoaderFactory::getLoader()->getShared(
45
+			DisplayTicketSelector::class,
46
+			[null, true]
47
+		);
48
+		parent::__construct(
49
+			esc_html__('Ticket Selector', 'event_espresso'),
50
+			$ticket_selector->display($event)
51
+		);
52
+		$this->addStylesheets(
53
+			apply_filters(
54
+				'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
55
+				array(
56
+					'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL
57
+											   . 'ticket_selector_embed.css?ver='
58
+											   . EVENT_ESPRESSO_VERSION,
59
+					'ticket_selector'       => TICKET_SELECTOR_ASSETS_URL
60
+											   . 'ticket_selector.css?ver='
61
+											   . EVENT_ESPRESSO_VERSION,
62
+				),
63
+				$this
64
+			)
65
+		);
66
+		if (! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) {
67
+			$this->addStylesheets(array('site_theme' => ''));
68
+		}
69
+		$this->addScripts(
70
+			apply_filters(
71
+				'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
72
+				array(
73
+					'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL
74
+													  . 'ticket_selector_iframe_embed.js?ver='
75
+													  . EVENT_ESPRESSO_VERSION,
76
+				),
77
+				$this
78
+			)
79
+		);
80
+		$js_attributes = apply_filters(
81
+			'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__js_attributes',
82
+			array(),
83
+			$this
84
+		);
85
+		if (! empty($js_attributes)) {
86
+			$this->addScriptAttributes($js_attributes);
87
+		}
88
+		$this->addLocalizedVars(
89
+			apply_filters(
90
+				'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__localized_vars',
91
+				array(
92
+					'ticket_selector_iframe' => true,
93
+					'EEDTicketSelectorMsg'   => __(
94
+						'Please choose at least one ticket before continuing.',
95
+						'event_espresso'
96
+					),
97
+				)
98
+			)
99
+		);
100
+		do_action(
101
+			'AHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__complete',
102
+			$this
103
+		);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
modules/ticket_selector/DisplayTicketSelector.php 2 patches
Indentation   +821 added lines, -821 removed lines patch added patch discarded remove patch
@@ -39,828 +39,828 @@
 block discarded – undo
39 39
 class DisplayTicketSelector
40 40
 {
41 41
 
42
-    /**
43
-     * event that ticket selector is being generated for
44
-     *
45
-     * @access protected
46
-     * @var EE_Event $event
47
-     */
48
-    protected $event;
49
-
50
-    /**
51
-     * Used to flag when the ticket selector is being called from an external iframe.
52
-     *
53
-     * @var bool $iframe
54
-     */
55
-    protected $iframe = false;
56
-
57
-    /**
58
-     * max attendees that can register for event at one time
59
-     *
60
-     * @var int $max_attendees
61
-     */
62
-    private $max_attendees = EE_INF;
63
-
64
-    /**
65
-     * @var string $date_format
66
-     */
67
-    private $date_format;
68
-
69
-    /**
70
-     * @var string $time_format
71
-     */
72
-    private $time_format;
73
-
74
-    /**
75
-     * @var boolean $display_full_ui
76
-     */
77
-    private $display_full_ui;
78
-
79
-    /**
80
-     * @var CurrentUser
81
-     */
82
-    private $current_user;
83
-
84
-
85
-    /**
86
-     * DisplayTicketSelector constructor.
87
-     *
88
-     * @param CurrentUser $current_user
89
-     * @param bool        $iframe
90
-     */
91
-    public function __construct(CurrentUser $current_user, bool $iframe = false)
92
-    {
93
-        $this->current_user = $current_user;
94
-        $this->setIframe($iframe);
95
-        $this->date_format  = apply_filters(
96
-            'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format',
97
-            get_option('date_format')
98
-        );
99
-        $this->time_format  = apply_filters(
100
-            'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format',
101
-            get_option('time_format')
102
-        );
103
-    }
104
-
105
-
106
-    /**
107
-     * @return bool
108
-     */
109
-    public function isIframe(): bool
110
-    {
111
-        return $this->iframe;
112
-    }
113
-
114
-
115
-    /**
116
-     * @param boolean $iframe
117
-     */
118
-    public function setIframe(bool $iframe = true)
119
-    {
120
-        $this->iframe = filter_var($iframe, FILTER_VALIDATE_BOOLEAN);
121
-    }
122
-
123
-
124
-    /**
125
-     * finds and sets the \EE_Event object for use throughout class
126
-     *
127
-     * @param mixed $event
128
-     * @return bool
129
-     * @throws EE_Error
130
-     * @throws InvalidDataTypeException
131
-     * @throws InvalidInterfaceException
132
-     * @throws InvalidArgumentException
133
-     */
134
-    protected function setEvent($event = null): bool
135
-    {
136
-        if ($event === null) {
137
-            global $post;
138
-            $event = $post;
139
-        }
140
-        if ($event instanceof EE_Event) {
141
-            $this->event = $event;
142
-        } elseif ($event instanceof WP_Post) {
143
-            if (isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
144
-                $this->event = $event->EE_Event;
145
-            } elseif ($event->post_type === 'espresso_events') {
146
-                $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
147
-                $this->event     = $event->EE_Event;
148
-            }
149
-        } else {
150
-            $user_msg = esc_html__('No Event object or an invalid Event object was supplied.', 'event_espresso');
151
-            $dev_msg  = $user_msg . esc_html__(
152
-                'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.',
153
-                'event_espresso'
154
-            );
155
-            EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
156
-            return false;
157
-        }
158
-        return true;
159
-    }
160
-
161
-
162
-    /**
163
-     * @return int
164
-     */
165
-    public function getMaxAttendees(): int
166
-    {
167
-        return $this->max_attendees;
168
-    }
169
-
170
-
171
-    /**
172
-     * @param int $max_attendees
173
-     */
174
-    public function setMaxAttendees(int $max_attendees)
175
-    {
176
-        $this->max_attendees = absint(
177
-            apply_filters(
178
-                'FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets',
179
-                $max_attendees
180
-            )
181
-        );
182
-    }
183
-
184
-
185
-    /**
186
-     * Returns whether or not the full ticket selector should be shown or not.
187
-     * Currently, it displays on the frontend (including ajax requests) but not the backend
188
-     *
189
-     * @return bool
190
-     */
191
-    private function display_full_ui(): bool
192
-    {
193
-        if ($this->display_full_ui === null) {
194
-            $this->display_full_ui = ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX);
195
-        }
196
-        return $this->display_full_ui;
197
-    }
198
-
199
-
200
-    /**
201
-     * creates buttons for selecting number of attendees for an event
202
-     *
203
-     * @param WP_Post|int $event
204
-     * @param bool        $view_details
205
-     * @return string
206
-     * @throws EE_Error
207
-     * @throws InvalidArgumentException
208
-     * @throws InvalidDataTypeException
209
-     * @throws InvalidInterfaceException
210
-     * @throws ReflectionException
211
-     * @throws Exception
212
-     */
213
-    public function display($event = null, bool $view_details = false)
214
-    {
215
-        // reset filter for displaying submit button
216
-        remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
217
-        // poke and prod incoming event till it tells us what it is
218
-        if (! $this->setEvent($event)) {
219
-            return $this->handleMissingEvent();
220
-        }
221
-        // is the event expired ?
222
-        $template_args['event_is_expired'] = ! is_admin() && $this->event->is_expired();
223
-        if ($template_args['event_is_expired']) {
224
-            return is_single()
225
-                ? $this->expiredEventMessage()
226
-                : $this->expiredEventMessage() . $this->displayViewDetailsButton();
227
-        }
228
-        // begin gathering template arguments by getting event status
229
-        $template_args = ['event_status' => $this->event->get_active_status()];
230
-        if (
231
-            $this->activeEventAndShowTicketSelector(
232
-                $event,
233
-                $template_args['event_status'],
234
-                $view_details
235
-            )
236
-        ) {
237
-            return ! is_single() ? $this->displayViewDetailsButton() : '';
238
-        }
239
-        // filter the maximum qty that can appear in the Ticket Selector qty dropdowns
240
-        $this->setMaxAttendees($this->event->additional_limit());
241
-        if ($this->getMaxAttendees() < 1) {
242
-            return $this->ticketSalesClosedMessage();
243
-        }
244
-        // get all tickets for this event ordered by the datetime
245
-        $tickets = $this->getTickets();
246
-        if (count($tickets) < 1) {
247
-            return $this->noTicketAvailableMessage();
248
-        }
249
-        // redirecting to another site for registration ??
250
-        $external_url = (string) $this->event->external_url()
251
-                        && $this->event->external_url() !== get_the_permalink()
252
-            ? $this->event->external_url()
253
-            : '';
254
-        // if redirecting to another site for registration, then we don't load the TS
255
-        $ticket_selector = $external_url
256
-            ? $this->externalEventRegistration()
257
-            : $this->loadTicketSelector($tickets, $template_args);
258
-        // now set up the form (but not for the admin)
259
-        $ticket_selector = $this->display_full_ui()
260
-            ? $this->formOpen($this->event->ID(), $external_url) . $ticket_selector
261
-            : $ticket_selector;
262
-        // submit button and form close tag
263
-        $ticket_selector .= $this->display_full_ui() ? $this->displaySubmitButton($external_url) : '';
264
-        return $ticket_selector;
265
-    }
266
-
267
-
268
-    /**
269
-     * displayTicketSelector
270
-     * examines the event properties and determines whether a Ticket Selector should be displayed
271
-     *
272
-     * @param WP_Post|int $event
273
-     * @param string      $_event_active_status
274
-     * @param bool        $view_details
275
-     * @return bool
276
-     * @throws EE_Error
277
-     * @throws ReflectionException
278
-     */
279
-    protected function activeEventAndShowTicketSelector($event, string $_event_active_status, bool $view_details): bool
280
-    {
281
-        $event_post = $this->event instanceof EE_Event ? $this->event->ID() : $event;
282
-        return $this->display_full_ui()
283
-               && (
284
-                   ! $this->event->display_ticket_selector()
285
-                   || $view_details
286
-                   || post_password_required($event_post)
287
-                   || (
288
-                       $_event_active_status !== EE_Datetime::active
289
-                       && $_event_active_status !== EE_Datetime::upcoming
290
-                       && $_event_active_status !== EE_Datetime::sold_out
291
-                       && ! (
292
-                           $_event_active_status === EE_Datetime::inactive
293
-                           && is_user_logged_in()
294
-                       )
295
-                   )
296
-               );
297
-    }
298
-
299
-
300
-    /**
301
-     * noTicketAvailableMessage
302
-     * notice displayed if event is expired
303
-     *
304
-     * @return string
305
-     */
306
-    protected function expiredEventMessage(): string
307
-    {
308
-        return '<div class="ee-event-expired-notice"><span class="important-notice">'
309
-           . esc_html__(
310
-               'We\'re sorry, but all tickets sales have ended because the event is expired.',
311
-               'event_espresso'
312
-           )
313
-           . '</span></div><!-- .ee-event-expired-notice -->';
314
-    }
315
-
316
-
317
-    /**
318
-     * noTicketAvailableMessage
319
-     * notice displayed if event has no more tickets available
320
-     *
321
-     * @return string
322
-     * @throws EE_Error
323
-     * @throws ReflectionException
324
-     */
325
-    protected function noTicketAvailableMessage(): string
326
-    {
327
-        $no_ticket_available_msg = esc_html__('We\'re sorry, but all ticket sales have ended.', 'event_espresso');
328
-        if (current_user_can('edit_post', $this->event->ID())) {
329
-            $no_ticket_available_msg .= sprintf(
330
-                esc_html__(
331
-                    '%1$sNote to Event Admin:%2$sNo tickets were found for this event. This effectively turns off ticket sales. Please ensure that at least one ticket is available for if you want people to be able to register.%3$s(click to edit this event)%4$s',
332
-                    'event_espresso'
333
-                ),
334
-                '<div class="ee-attention" style="text-align: left;"><b>',
335
-                '</b><br />',
336
-                '<span class="edit-link"><a class="post-edit-link" href="'
337
-                . get_edit_post_link($this->event->ID())
338
-                . '">',
339
-                '</a></span></div><!-- .ee-attention noTicketAvailableMessage -->'
340
-            );
341
-        }
342
-        return '
42
+	/**
43
+	 * event that ticket selector is being generated for
44
+	 *
45
+	 * @access protected
46
+	 * @var EE_Event $event
47
+	 */
48
+	protected $event;
49
+
50
+	/**
51
+	 * Used to flag when the ticket selector is being called from an external iframe.
52
+	 *
53
+	 * @var bool $iframe
54
+	 */
55
+	protected $iframe = false;
56
+
57
+	/**
58
+	 * max attendees that can register for event at one time
59
+	 *
60
+	 * @var int $max_attendees
61
+	 */
62
+	private $max_attendees = EE_INF;
63
+
64
+	/**
65
+	 * @var string $date_format
66
+	 */
67
+	private $date_format;
68
+
69
+	/**
70
+	 * @var string $time_format
71
+	 */
72
+	private $time_format;
73
+
74
+	/**
75
+	 * @var boolean $display_full_ui
76
+	 */
77
+	private $display_full_ui;
78
+
79
+	/**
80
+	 * @var CurrentUser
81
+	 */
82
+	private $current_user;
83
+
84
+
85
+	/**
86
+	 * DisplayTicketSelector constructor.
87
+	 *
88
+	 * @param CurrentUser $current_user
89
+	 * @param bool        $iframe
90
+	 */
91
+	public function __construct(CurrentUser $current_user, bool $iframe = false)
92
+	{
93
+		$this->current_user = $current_user;
94
+		$this->setIframe($iframe);
95
+		$this->date_format  = apply_filters(
96
+			'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format',
97
+			get_option('date_format')
98
+		);
99
+		$this->time_format  = apply_filters(
100
+			'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format',
101
+			get_option('time_format')
102
+		);
103
+	}
104
+
105
+
106
+	/**
107
+	 * @return bool
108
+	 */
109
+	public function isIframe(): bool
110
+	{
111
+		return $this->iframe;
112
+	}
113
+
114
+
115
+	/**
116
+	 * @param boolean $iframe
117
+	 */
118
+	public function setIframe(bool $iframe = true)
119
+	{
120
+		$this->iframe = filter_var($iframe, FILTER_VALIDATE_BOOLEAN);
121
+	}
122
+
123
+
124
+	/**
125
+	 * finds and sets the \EE_Event object for use throughout class
126
+	 *
127
+	 * @param mixed $event
128
+	 * @return bool
129
+	 * @throws EE_Error
130
+	 * @throws InvalidDataTypeException
131
+	 * @throws InvalidInterfaceException
132
+	 * @throws InvalidArgumentException
133
+	 */
134
+	protected function setEvent($event = null): bool
135
+	{
136
+		if ($event === null) {
137
+			global $post;
138
+			$event = $post;
139
+		}
140
+		if ($event instanceof EE_Event) {
141
+			$this->event = $event;
142
+		} elseif ($event instanceof WP_Post) {
143
+			if (isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
144
+				$this->event = $event->EE_Event;
145
+			} elseif ($event->post_type === 'espresso_events') {
146
+				$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
147
+				$this->event     = $event->EE_Event;
148
+			}
149
+		} else {
150
+			$user_msg = esc_html__('No Event object or an invalid Event object was supplied.', 'event_espresso');
151
+			$dev_msg  = $user_msg . esc_html__(
152
+				'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.',
153
+				'event_espresso'
154
+			);
155
+			EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
156
+			return false;
157
+		}
158
+		return true;
159
+	}
160
+
161
+
162
+	/**
163
+	 * @return int
164
+	 */
165
+	public function getMaxAttendees(): int
166
+	{
167
+		return $this->max_attendees;
168
+	}
169
+
170
+
171
+	/**
172
+	 * @param int $max_attendees
173
+	 */
174
+	public function setMaxAttendees(int $max_attendees)
175
+	{
176
+		$this->max_attendees = absint(
177
+			apply_filters(
178
+				'FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets',
179
+				$max_attendees
180
+			)
181
+		);
182
+	}
183
+
184
+
185
+	/**
186
+	 * Returns whether or not the full ticket selector should be shown or not.
187
+	 * Currently, it displays on the frontend (including ajax requests) but not the backend
188
+	 *
189
+	 * @return bool
190
+	 */
191
+	private function display_full_ui(): bool
192
+	{
193
+		if ($this->display_full_ui === null) {
194
+			$this->display_full_ui = ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX);
195
+		}
196
+		return $this->display_full_ui;
197
+	}
198
+
199
+
200
+	/**
201
+	 * creates buttons for selecting number of attendees for an event
202
+	 *
203
+	 * @param WP_Post|int $event
204
+	 * @param bool        $view_details
205
+	 * @return string
206
+	 * @throws EE_Error
207
+	 * @throws InvalidArgumentException
208
+	 * @throws InvalidDataTypeException
209
+	 * @throws InvalidInterfaceException
210
+	 * @throws ReflectionException
211
+	 * @throws Exception
212
+	 */
213
+	public function display($event = null, bool $view_details = false)
214
+	{
215
+		// reset filter for displaying submit button
216
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
217
+		// poke and prod incoming event till it tells us what it is
218
+		if (! $this->setEvent($event)) {
219
+			return $this->handleMissingEvent();
220
+		}
221
+		// is the event expired ?
222
+		$template_args['event_is_expired'] = ! is_admin() && $this->event->is_expired();
223
+		if ($template_args['event_is_expired']) {
224
+			return is_single()
225
+				? $this->expiredEventMessage()
226
+				: $this->expiredEventMessage() . $this->displayViewDetailsButton();
227
+		}
228
+		// begin gathering template arguments by getting event status
229
+		$template_args = ['event_status' => $this->event->get_active_status()];
230
+		if (
231
+			$this->activeEventAndShowTicketSelector(
232
+				$event,
233
+				$template_args['event_status'],
234
+				$view_details
235
+			)
236
+		) {
237
+			return ! is_single() ? $this->displayViewDetailsButton() : '';
238
+		}
239
+		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
240
+		$this->setMaxAttendees($this->event->additional_limit());
241
+		if ($this->getMaxAttendees() < 1) {
242
+			return $this->ticketSalesClosedMessage();
243
+		}
244
+		// get all tickets for this event ordered by the datetime
245
+		$tickets = $this->getTickets();
246
+		if (count($tickets) < 1) {
247
+			return $this->noTicketAvailableMessage();
248
+		}
249
+		// redirecting to another site for registration ??
250
+		$external_url = (string) $this->event->external_url()
251
+						&& $this->event->external_url() !== get_the_permalink()
252
+			? $this->event->external_url()
253
+			: '';
254
+		// if redirecting to another site for registration, then we don't load the TS
255
+		$ticket_selector = $external_url
256
+			? $this->externalEventRegistration()
257
+			: $this->loadTicketSelector($tickets, $template_args);
258
+		// now set up the form (but not for the admin)
259
+		$ticket_selector = $this->display_full_ui()
260
+			? $this->formOpen($this->event->ID(), $external_url) . $ticket_selector
261
+			: $ticket_selector;
262
+		// submit button and form close tag
263
+		$ticket_selector .= $this->display_full_ui() ? $this->displaySubmitButton($external_url) : '';
264
+		return $ticket_selector;
265
+	}
266
+
267
+
268
+	/**
269
+	 * displayTicketSelector
270
+	 * examines the event properties and determines whether a Ticket Selector should be displayed
271
+	 *
272
+	 * @param WP_Post|int $event
273
+	 * @param string      $_event_active_status
274
+	 * @param bool        $view_details
275
+	 * @return bool
276
+	 * @throws EE_Error
277
+	 * @throws ReflectionException
278
+	 */
279
+	protected function activeEventAndShowTicketSelector($event, string $_event_active_status, bool $view_details): bool
280
+	{
281
+		$event_post = $this->event instanceof EE_Event ? $this->event->ID() : $event;
282
+		return $this->display_full_ui()
283
+			   && (
284
+				   ! $this->event->display_ticket_selector()
285
+				   || $view_details
286
+				   || post_password_required($event_post)
287
+				   || (
288
+					   $_event_active_status !== EE_Datetime::active
289
+					   && $_event_active_status !== EE_Datetime::upcoming
290
+					   && $_event_active_status !== EE_Datetime::sold_out
291
+					   && ! (
292
+						   $_event_active_status === EE_Datetime::inactive
293
+						   && is_user_logged_in()
294
+					   )
295
+				   )
296
+			   );
297
+	}
298
+
299
+
300
+	/**
301
+	 * noTicketAvailableMessage
302
+	 * notice displayed if event is expired
303
+	 *
304
+	 * @return string
305
+	 */
306
+	protected function expiredEventMessage(): string
307
+	{
308
+		return '<div class="ee-event-expired-notice"><span class="important-notice">'
309
+		   . esc_html__(
310
+			   'We\'re sorry, but all tickets sales have ended because the event is expired.',
311
+			   'event_espresso'
312
+		   )
313
+		   . '</span></div><!-- .ee-event-expired-notice -->';
314
+	}
315
+
316
+
317
+	/**
318
+	 * noTicketAvailableMessage
319
+	 * notice displayed if event has no more tickets available
320
+	 *
321
+	 * @return string
322
+	 * @throws EE_Error
323
+	 * @throws ReflectionException
324
+	 */
325
+	protected function noTicketAvailableMessage(): string
326
+	{
327
+		$no_ticket_available_msg = esc_html__('We\'re sorry, but all ticket sales have ended.', 'event_espresso');
328
+		if (current_user_can('edit_post', $this->event->ID())) {
329
+			$no_ticket_available_msg .= sprintf(
330
+				esc_html__(
331
+					'%1$sNote to Event Admin:%2$sNo tickets were found for this event. This effectively turns off ticket sales. Please ensure that at least one ticket is available for if you want people to be able to register.%3$s(click to edit this event)%4$s',
332
+					'event_espresso'
333
+				),
334
+				'<div class="ee-attention" style="text-align: left;"><b>',
335
+				'</b><br />',
336
+				'<span class="edit-link"><a class="post-edit-link" href="'
337
+				. get_edit_post_link($this->event->ID())
338
+				. '">',
339
+				'</a></span></div><!-- .ee-attention noTicketAvailableMessage -->'
340
+			);
341
+		}
342
+		return '
343 343
             <div class="ee-event-expired-notice">
344 344
                 <span class="important-notice">' . $no_ticket_available_msg . '</span>
345 345
             </div><!-- .ee-event-expired-notice -->';
346
-    }
347
-
348
-
349
-    /**
350
-     * ticketSalesClosed
351
-     * notice displayed if event ticket sales are turned off
352
-     *
353
-     * @return string
354
-     * @throws EE_Error
355
-     * @throws ReflectionException
356
-     */
357
-    protected function ticketSalesClosedMessage(): string
358
-    {
359
-        $sales_closed_msg = esc_html__(
360
-            'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.',
361
-            'event_espresso'
362
-        );
363
-        if (current_user_can('edit_post', $this->event->ID())) {
364
-            $sales_closed_msg .= sprintf(
365
-                esc_html__(
366
-                    '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s',
367
-                    'event_espresso'
368
-                ),
369
-                '<div class="ee-attention" style="text-align: left;"><b>',
370
-                '</b><br />',
371
-                '<span class="edit-link"><a class="post-edit-link" href="'
372
-                . get_edit_post_link($this->event->ID())
373
-                . '">',
374
-                '</a></span></div><!-- .ee-attention ticketSalesClosedMessage -->'
375
-            );
376
-        }
377
-        return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
378
-    }
379
-
380
-
381
-    /**
382
-     * getTickets
383
-     *
384
-     * @return EE_Base_Class[]|EE_Ticket[]
385
-     * @throws EE_Error
386
-     * @throws InvalidDataTypeException
387
-     * @throws InvalidInterfaceException
388
-     * @throws InvalidArgumentException
389
-     * @throws ReflectionException
390
-     */
391
-    protected function getTickets()
392
-    {
393
-        $ticket_selector_config = EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector;
394
-        $show_expired_tickets = is_admin()
395
-            || (
396
-                $ticket_selector_config instanceof EE_Ticket_Selector_Config
397
-                && $ticket_selector_config->show_expired_tickets
398
-            );
399
-
400
-        $ticket_query_args = [
401
-            [
402
-                'Datetime.EVT_ID' => $this->event->ID(),
403
-                'TKT_visibility'  => ['>', EEM_Ticket::TICKET_VISIBILITY_NONE_VALUE],
404
-            ],
405
-            'order_by' => [
406
-                'TKT_order'              => 'ASC',
407
-                'TKT_required'           => 'DESC',
408
-                'TKT_start_date'         => 'ASC',
409
-                'TKT_end_date'           => 'ASC',
410
-                'Datetime.DTT_EVT_start' => 'DESC',
411
-            ],
412
-        ];
413
-        if (! $show_expired_tickets) {
414
-            // use the correct applicable time query depending on what version of core is being run.
415
-            $current_time = method_exists('EEM_Datetime', 'current_time_for_query')
416
-                ? time()
417
-                : current_time('timestamp');
418
-            $ticket_query_args[0]['TKT_end_date'] = ['>', $current_time];
419
-        }
420
-        /** @var EE_Ticket[] $tickets */
421
-        $tickets = EEM_Ticket::instance()->get_all($ticket_query_args);
422
-        // remove tickets based on their visibility and the current user's allowed access (crudely based on roles)
423
-        return array_filter($tickets, [$this, 'ticketVisibilityFilter']);
424
-    }
425
-
426
-
427
-    /**
428
-     * returns true if any of the following is true:
429
-     *  - ticket visibility is PUBLIC
430
-     *  - ticket visibility is MEMBERS_ONLY and user is logged in
431
-     *  - ticket visibility is ADMINS_ONLY when user IS logged in as an admin
432
-     *  - ticket visibility is ADMIN_UI_ONLY when ticket selector is being viewed via an admin page UI
433
-     *
434
-     * @param EE_Ticket $ticket
435
-     * @return bool
436
-     * @throws EE_Error
437
-     * @throws ReflectionException
438
-     * @since   $VID:$
439
-     */
440
-    public function ticketVisibilityFilter(EE_Ticket $ticket): bool
441
-    {
442
-        return $ticket->isPublicOnly()
443
-               || ($ticket->isMembersOnly() && $this->current_user->isLoggedIn())
444
-               || ($ticket->isAdminsOnly() && $this->current_user->isEventManager())
445
-               || ($ticket->isAdminUiOnly() && is_admin());
446
-    }
447
-
448
-
449
-    /**
450
-     * loadTicketSelector
451
-     * begins to assemble template arguments
452
-     * and decides whether to load a "simple" ticket selector, or the standard
453
-     *
454
-     * @param EE_Ticket[] $tickets
455
-     * @param array       $template_args
456
-     * @return TicketSelector
457
-     * @throws EE_Error
458
-     * @throws ReflectionException
459
-     */
460
-    protected function loadTicketSelector(array $tickets, array $template_args)
461
-    {
462
-        $template_args['event']            = $this->event;
463
-        $template_args['EVT_ID']           = $this->event->ID();
464
-        $template_args['event_is_expired'] = $this->event->is_expired();
465
-        $template_args['max_atndz']        = $this->getMaxAttendees();
466
-        $template_args['date_format']      = $this->date_format;
467
-        $template_args['time_format']      = $this->time_format;
468
-        /**
469
-         * Filters the anchor ID used when redirecting to the Ticket Selector if no quantity selected
470
-         *
471
-         * @param string  '#tkt-slctr-tbl-' . $EVT_ID The html ID to anchor to
472
-         * @param int $EVT_ID The Event ID
473
-         * @since 4.9.13
474
-         */
475
-        $template_args['anchor_id']    = apply_filters(
476
-            'FHEE__EE_Ticket_Selector__redirect_anchor_id',
477
-            '#tkt-slctr-tbl-' . $this->event->ID(),
478
-            $this->event->ID()
479
-        );
480
-        $template_args['tickets']      = $tickets;
481
-        $template_args['ticket_count'] = count($tickets);
482
-        $ticket_selector               = $this->simpleTicketSelector($tickets, $template_args);
483
-        return $ticket_selector instanceof TicketSelectorSimple
484
-            ? $ticket_selector
485
-            : new TicketSelectorStandard(
486
-                $this->event,
487
-                $tickets,
488
-                $this->getMaxAttendees(),
489
-                $template_args,
490
-                $this->date_format,
491
-                $this->time_format
492
-            );
493
-    }
494
-
495
-
496
-    /**
497
-     * simpleTicketSelector
498
-     * there's one ticket, and max attendees is set to one,
499
-     * so if the event is free, then this is a "simple" ticket selector
500
-     * a.k.a. "Dude Where's my Ticket Selector?"
501
-     *
502
-     * @param EE_Ticket[] $tickets
503
-     * @param array       $template_args
504
-     * @return string
505
-     * @throws EE_Error
506
-     * @throws ReflectionException
507
-     */
508
-    protected function simpleTicketSelector(array $tickets, array $template_args)
509
-    {
510
-        // if there is only ONE ticket with a max qty of ONE
511
-        if (count($tickets) > 1 || $this->getMaxAttendees() !== 1) {
512
-            return '';
513
-        }
514
-        /** @var EE_Ticket $ticket */
515
-        $ticket = reset($tickets);
516
-        // if the ticket is free... then not much need for the ticket selector
517
-        if (
518
-            apply_filters(
519
-                'FHEE__ticket_selector_chart_template__hide_ticket_selector',
520
-                $ticket->is_free(),
521
-                $this->event->ID()
522
-            )
523
-        ) {
524
-            return new TicketSelectorSimple(
525
-                $this->event,
526
-                $ticket,
527
-                $this->getMaxAttendees(),
528
-                $template_args
529
-            );
530
-        }
531
-        return '';
532
-    }
533
-
534
-
535
-    /**
536
-     * externalEventRegistration
537
-     *
538
-     * @return string
539
-     */
540
-    public function externalEventRegistration(): string
541
-    {
542
-        // if not we still need to trigger the display of the submit button
543
-        add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
544
-        // display notice to admin that registration is external
545
-        return $this->display_full_ui()
546
-            ? esc_html__(
547
-                'Registration is at an external URL for this event.',
548
-                'event_espresso'
549
-            )
550
-            : '';
551
-    }
552
-
553
-
554
-    /**
555
-     * formOpen
556
-     *
557
-     * @param int    $ID
558
-     * @param string $external_url
559
-     * @return        string
560
-     */
561
-    public function formOpen(int $ID = 0, string $external_url = ''): string
562
-    {
563
-        // if redirecting, we don't need any anything else
564
-        if ($external_url) {
565
-            $html = '<form method="GET" ';
566
-            $html .= 'action="' . EEH_URL::refactor_url($external_url) . '" ';
567
-            $html .= 'name="ticket-selector-form-' . $ID . '"';
568
-            // open link in new window ?
569
-            $html       .= apply_filters(
570
-                'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__formOpen__external_url_target_blank',
571
-                $this->isIframe(),
572
-                $this
573
-            )
574
-                ? ' target="_blank"'
575
-                : '';
576
-            $html       .= '>';
577
-            $query_args = EEH_URL::get_query_string($external_url);
578
-            foreach ((array) $query_args as $query_arg => $value) {
579
-                $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
580
-            }
581
-            return $html;
582
-        }
583
-        // if there is no submit button, then don't start building a form
584
-        // because the "View Details" button will build its own form
585
-        if (! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
586
-            return '';
587
-        }
588
-        $checkout_url = EEH_Event_View::event_link_url($ID);
589
-        if (! $checkout_url) {
590
-            EE_Error::add_error(
591
-                esc_html__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
592
-                __FILE__,
593
-                __FUNCTION__,
594
-                __LINE__
595
-            );
596
-        }
597
-        // set no cache headers and constants
598
-        EE_System::do_not_cache();
599
-        $html = '<form method="POST" ';
600
-        $html .= 'action="' . $checkout_url . '" ';
601
-        $html .= 'name="ticket-selector-form-' . $ID . '"';
602
-        $html .= $this->iframe ? ' target="_blank"' : '';
603
-        $html .= '>';
604
-        $html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
605
-        return apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, $this->event);
606
-    }
607
-
608
-
609
-    /**
610
-     * displaySubmitButton
611
-     *
612
-     * @param string $external_url
613
-     * @return string
614
-     * @throws EE_Error
615
-     * @throws ReflectionException
616
-     */
617
-    public function displaySubmitButton(string $external_url = ''): string
618
-    {
619
-        $html = '';
620
-        if ($this->display_full_ui()) {
621
-            // standard TS displayed with submit button, ie: "Register Now"
622
-            if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
623
-                $html .= $this->displayRegisterNowButton();
624
-                $html .= empty($external_url)
625
-                    ? $this->ticketSelectorEndDiv()
626
-                    : $this->clearTicketSelector();
627
-                $html .= '<br/>' . $this->formClose();
628
-            } elseif ($this->getMaxAttendees() === 1) {
629
-                // its a "Dude Where's my Ticket Selector?" (DWMTS) type event (ie: $_max_atndz === 1)
630
-                if ($this->event->is_sold_out()) {
631
-                    // then instead of a View Details or Submit button, just display a "Sold Out" message
632
-                    $html .= apply_filters(
633
-                        'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__sold_out_msg',
634
-                        sprintf(
635
-                            esc_html__(
636
-                                '%1$s"%2$s" is currently sold out.%4$sPlease check back again later, as spots may become available.%3$s',
637
-                                'event_espresso'
638
-                            ),
639
-                            '<p class="no-ticket-selector-msg clear-float">',
640
-                            $this->event->name(),
641
-                            '</p>',
642
-                            '<br />'
643
-                        ),
644
-                        $this->event
645
-                    );
646
-                    if (
647
-                        apply_filters(
648
-                            'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button',
649
-                            false,
650
-                            $this->event
651
-                        )
652
-                    ) {
653
-                        $html .= $this->displayRegisterNowButton();
654
-                    }
655
-                    // sold out DWMTS event, no TS, no submit or view details button, but has additional content
656
-                    $html .= $this->ticketSelectorEndDiv();
657
-                } elseif (
658
-                    apply_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector', false)
659
-                    && ! is_single()
660
-                ) {
661
-                    // this is a "Dude Where's my Ticket Selector?" (DWMTS) type event,
662
-                    // but no tickets are available, so display event's "View Details" button.
663
-                    // it is being viewed via somewhere other than a single post
664
-                    $html .= $this->displayViewDetailsButton(true);
665
-                } else {
666
-                    $html .= $this->ticketSelectorEndDiv();
667
-                }
668
-            } elseif (is_archive()) {
669
-                // event list, no tickets available so display event's "View Details" button
670
-                $html .= $this->ticketSelectorEndDiv();
671
-                $html .= $this->displayViewDetailsButton();
672
-            } else {
673
-                if (
674
-                    apply_filters(
675
-                        'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button',
676
-                        false,
677
-                        $this->event
678
-                    )
679
-                ) {
680
-                    $html .= $this->displayRegisterNowButton();
681
-                }
682
-                // no submit or view details button, and no additional content
683
-                $html .= $this->ticketSelectorEndDiv();
684
-            }
685
-            if (! $this->iframe && ! is_archive()) {
686
-                $html .= EEH_Template::powered_by_event_espresso('', '', ['utm_content' => 'ticket_selector']);
687
-            }
688
-        }
689
-        return apply_filters(
690
-            'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__displaySubmitButton__html',
691
-            $html,
692
-            $this->event,
693
-            $this
694
-        );
695
-    }
696
-
697
-
698
-    /**
699
-     * @return string
700
-     * @throws EE_Error
701
-     * @throws ReflectionException
702
-     */
703
-    public function displayRegisterNowButton(): string
704
-    {
705
-        $btn_text     = apply_filters(
706
-            'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
707
-            esc_html__('Register Now', 'event_espresso'),
708
-            $this->event
709
-        );
710
-        $external_url = (string) $this->event->external_url()
711
-                        && $this->event->external_url() !== get_the_permalink()
712
-            ? $this->event->external_url()
713
-            : '';
714
-        $html         = EEH_HTML::div(
715
-            '',
716
-            'ticket-selector-submit-' . $this->event->ID() . '-btn-wrap',
717
-            'ticket-selector-submit-btn-wrap'
718
-        );
719
-        $html         .= '<input id="ticket-selector-submit-' . $this->event->ID() . '-btn"';
720
-        $html         .= ' class="ticket-selector-submit-btn ';
721
-        $html         .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
722
-        $html         .= ' type="submit" value="' . $btn_text . '" data-ee-disable-after-recaptcha="true" />';
723
-        $html         .= EEH_HTML::divx() . '<!-- .ticket-selector-submit-btn-wrap -->';
724
-        $html         .= apply_filters(
725
-            'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
726
-            '',
727
-            $this->event,
728
-            $this->iframe
729
-        );
730
-        return $html;
731
-    }
732
-
733
-
734
-    /**
735
-     * displayViewDetailsButton
736
-     *
737
-     * @param bool $DWMTS indicates a "Dude Where's my Ticket Selector?" (DWMTS) type event
738
-     *                    (ie: $_max_atndz === 1) where there are no available tickets,
739
-     *                    either because they are sold out, expired, or not yet on sale.
740
-     *                    In this case, we need to close the form BEFORE adding any closing divs
741
-     * @return string
742
-     * @throws EE_Error
743
-     * @throws ReflectionException
744
-     */
745
-    public function displayViewDetailsButton(bool $DWMTS = false): string
746
-    {
747
-        if (! $this->event->get_permalink()) {
748
-            EE_Error::add_error(
749
-                esc_html__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
750
-                __FILE__,
751
-                __FUNCTION__,
752
-                __LINE__
753
-            );
754
-        }
755
-        $view_details_btn = '<form method="GET" action="';
756
-        $view_details_btn .= apply_filters(
757
-            'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_url',
758
-            $this->event->get_permalink(),
759
-            $this->event
760
-        );
761
-        $view_details_btn .= '"';
762
-        // open link in new window ?
763
-        $view_details_btn .= apply_filters(
764
-            'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__displayViewDetailsButton__url_target_blank',
765
-            $this->isIframe(),
766
-            $this
767
-        )
768
-            ? ' target="_blank"'
769
-            : '';
770
-        $view_details_btn .= '>';
771
-        $btn_text         = apply_filters(
772
-            'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
773
-            esc_html__('View Details', 'event_espresso'),
774
-            $this->event
775
-        );
776
-        $view_details_btn .= '<input id="ticket-selector-submit-'
777
-                             . $this->event->ID()
778
-                             . '-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'
779
-                             . $btn_text
780
-                             . '" />';
781
-        $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', $this->event);
782
-        if ($DWMTS) {
783
-            $view_details_btn .= $this->formClose();
784
-            $view_details_btn .= $this->ticketSelectorEndDiv();
785
-            $view_details_btn .= '<br/>';
786
-        } else {
787
-            $view_details_btn .= $this->clearTicketSelector();
788
-            $view_details_btn .= '<br/>';
789
-            $view_details_btn .= $this->formClose();
790
-        }
791
-        return $view_details_btn;
792
-    }
793
-
794
-
795
-    /**
796
-     * @return string
797
-     */
798
-    public function ticketSelectorEndDiv(): string
799
-    {
800
-        return $this->clearTicketSelector() . '</div><!-- ticketSelectorEndDiv -->';
801
-    }
802
-
803
-
804
-    /**
805
-     * @return string
806
-     */
807
-    public function clearTicketSelector(): string
808
-    {
809
-        // standard TS displayed, appears after a "Register Now" or "view Details" button
810
-        return '<div class="clear"></div><!-- clearTicketSelector -->';
811
-    }
812
-
813
-
814
-    /**
815
-     * @access        public
816
-     * @return        string
817
-     */
818
-    public function formClose(): string
819
-    {
820
-        return '</form>';
821
-    }
822
-
823
-
824
-    /**
825
-     * handleMissingEvent
826
-     * Returns either false or an error to display when no valid event is passed.
827
-     *
828
-     * @return false|string
829
-     * @throws ExceptionStackTraceDisplay
830
-     * @throws InvalidInterfaceException
831
-     * @throws Exception
832
-     */
833
-    protected function handleMissingEvent()
834
-    {
835
-        // If this is not an iFrame request, simply return false.
836
-        if (! $this->isIframe()) {
837
-            return false;
838
-        }
839
-        // This is an iFrame so return an error.
840
-        // Display stack trace if WP_DEBUG is enabled.
841
-        if (WP_DEBUG === true && current_user_can('edit_pages')) {
842
-            $event_id = EE_Registry::instance()->REQ->get('event', 0);
843
-            new ExceptionStackTraceDisplay(
844
-                new InvalidArgumentException(
845
-                    sprintf(
846
-                        esc_html__(
847
-                            'A valid Event ID is required to display the ticket selector.%3$sAn Event with an ID of "%1$s" could not be found.%3$sPlease verify that the embed code added to this post\'s content includes an "%2$s" argument and that its value corresponds to a valid Event ID.',
848
-                            'event_espresso'
849
-                        ),
850
-                        $event_id,
851
-                        'event',
852
-                        '<br />'
853
-                    )
854
-                )
855
-            );
856
-            return '';
857
-        }
858
-        // If WP_DEBUG is not enabled, display a message stating the event could not be found.
859
-        return EEH_HTML::p(
860
-            esc_html__(
861
-                'A valid Event could not be found. Please contact the event administrator for assistance.',
862
-                'event_espresso'
863
-            )
864
-        );
865
-    }
346
+	}
347
+
348
+
349
+	/**
350
+	 * ticketSalesClosed
351
+	 * notice displayed if event ticket sales are turned off
352
+	 *
353
+	 * @return string
354
+	 * @throws EE_Error
355
+	 * @throws ReflectionException
356
+	 */
357
+	protected function ticketSalesClosedMessage(): string
358
+	{
359
+		$sales_closed_msg = esc_html__(
360
+			'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.',
361
+			'event_espresso'
362
+		);
363
+		if (current_user_can('edit_post', $this->event->ID())) {
364
+			$sales_closed_msg .= sprintf(
365
+				esc_html__(
366
+					'%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s',
367
+					'event_espresso'
368
+				),
369
+				'<div class="ee-attention" style="text-align: left;"><b>',
370
+				'</b><br />',
371
+				'<span class="edit-link"><a class="post-edit-link" href="'
372
+				. get_edit_post_link($this->event->ID())
373
+				. '">',
374
+				'</a></span></div><!-- .ee-attention ticketSalesClosedMessage -->'
375
+			);
376
+		}
377
+		return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
378
+	}
379
+
380
+
381
+	/**
382
+	 * getTickets
383
+	 *
384
+	 * @return EE_Base_Class[]|EE_Ticket[]
385
+	 * @throws EE_Error
386
+	 * @throws InvalidDataTypeException
387
+	 * @throws InvalidInterfaceException
388
+	 * @throws InvalidArgumentException
389
+	 * @throws ReflectionException
390
+	 */
391
+	protected function getTickets()
392
+	{
393
+		$ticket_selector_config = EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector;
394
+		$show_expired_tickets = is_admin()
395
+			|| (
396
+				$ticket_selector_config instanceof EE_Ticket_Selector_Config
397
+				&& $ticket_selector_config->show_expired_tickets
398
+			);
399
+
400
+		$ticket_query_args = [
401
+			[
402
+				'Datetime.EVT_ID' => $this->event->ID(),
403
+				'TKT_visibility'  => ['>', EEM_Ticket::TICKET_VISIBILITY_NONE_VALUE],
404
+			],
405
+			'order_by' => [
406
+				'TKT_order'              => 'ASC',
407
+				'TKT_required'           => 'DESC',
408
+				'TKT_start_date'         => 'ASC',
409
+				'TKT_end_date'           => 'ASC',
410
+				'Datetime.DTT_EVT_start' => 'DESC',
411
+			],
412
+		];
413
+		if (! $show_expired_tickets) {
414
+			// use the correct applicable time query depending on what version of core is being run.
415
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query')
416
+				? time()
417
+				: current_time('timestamp');
418
+			$ticket_query_args[0]['TKT_end_date'] = ['>', $current_time];
419
+		}
420
+		/** @var EE_Ticket[] $tickets */
421
+		$tickets = EEM_Ticket::instance()->get_all($ticket_query_args);
422
+		// remove tickets based on their visibility and the current user's allowed access (crudely based on roles)
423
+		return array_filter($tickets, [$this, 'ticketVisibilityFilter']);
424
+	}
425
+
426
+
427
+	/**
428
+	 * returns true if any of the following is true:
429
+	 *  - ticket visibility is PUBLIC
430
+	 *  - ticket visibility is MEMBERS_ONLY and user is logged in
431
+	 *  - ticket visibility is ADMINS_ONLY when user IS logged in as an admin
432
+	 *  - ticket visibility is ADMIN_UI_ONLY when ticket selector is being viewed via an admin page UI
433
+	 *
434
+	 * @param EE_Ticket $ticket
435
+	 * @return bool
436
+	 * @throws EE_Error
437
+	 * @throws ReflectionException
438
+	 * @since   $VID:$
439
+	 */
440
+	public function ticketVisibilityFilter(EE_Ticket $ticket): bool
441
+	{
442
+		return $ticket->isPublicOnly()
443
+			   || ($ticket->isMembersOnly() && $this->current_user->isLoggedIn())
444
+			   || ($ticket->isAdminsOnly() && $this->current_user->isEventManager())
445
+			   || ($ticket->isAdminUiOnly() && is_admin());
446
+	}
447
+
448
+
449
+	/**
450
+	 * loadTicketSelector
451
+	 * begins to assemble template arguments
452
+	 * and decides whether to load a "simple" ticket selector, or the standard
453
+	 *
454
+	 * @param EE_Ticket[] $tickets
455
+	 * @param array       $template_args
456
+	 * @return TicketSelector
457
+	 * @throws EE_Error
458
+	 * @throws ReflectionException
459
+	 */
460
+	protected function loadTicketSelector(array $tickets, array $template_args)
461
+	{
462
+		$template_args['event']            = $this->event;
463
+		$template_args['EVT_ID']           = $this->event->ID();
464
+		$template_args['event_is_expired'] = $this->event->is_expired();
465
+		$template_args['max_atndz']        = $this->getMaxAttendees();
466
+		$template_args['date_format']      = $this->date_format;
467
+		$template_args['time_format']      = $this->time_format;
468
+		/**
469
+		 * Filters the anchor ID used when redirecting to the Ticket Selector if no quantity selected
470
+		 *
471
+		 * @param string  '#tkt-slctr-tbl-' . $EVT_ID The html ID to anchor to
472
+		 * @param int $EVT_ID The Event ID
473
+		 * @since 4.9.13
474
+		 */
475
+		$template_args['anchor_id']    = apply_filters(
476
+			'FHEE__EE_Ticket_Selector__redirect_anchor_id',
477
+			'#tkt-slctr-tbl-' . $this->event->ID(),
478
+			$this->event->ID()
479
+		);
480
+		$template_args['tickets']      = $tickets;
481
+		$template_args['ticket_count'] = count($tickets);
482
+		$ticket_selector               = $this->simpleTicketSelector($tickets, $template_args);
483
+		return $ticket_selector instanceof TicketSelectorSimple
484
+			? $ticket_selector
485
+			: new TicketSelectorStandard(
486
+				$this->event,
487
+				$tickets,
488
+				$this->getMaxAttendees(),
489
+				$template_args,
490
+				$this->date_format,
491
+				$this->time_format
492
+			);
493
+	}
494
+
495
+
496
+	/**
497
+	 * simpleTicketSelector
498
+	 * there's one ticket, and max attendees is set to one,
499
+	 * so if the event is free, then this is a "simple" ticket selector
500
+	 * a.k.a. "Dude Where's my Ticket Selector?"
501
+	 *
502
+	 * @param EE_Ticket[] $tickets
503
+	 * @param array       $template_args
504
+	 * @return string
505
+	 * @throws EE_Error
506
+	 * @throws ReflectionException
507
+	 */
508
+	protected function simpleTicketSelector(array $tickets, array $template_args)
509
+	{
510
+		// if there is only ONE ticket with a max qty of ONE
511
+		if (count($tickets) > 1 || $this->getMaxAttendees() !== 1) {
512
+			return '';
513
+		}
514
+		/** @var EE_Ticket $ticket */
515
+		$ticket = reset($tickets);
516
+		// if the ticket is free... then not much need for the ticket selector
517
+		if (
518
+			apply_filters(
519
+				'FHEE__ticket_selector_chart_template__hide_ticket_selector',
520
+				$ticket->is_free(),
521
+				$this->event->ID()
522
+			)
523
+		) {
524
+			return new TicketSelectorSimple(
525
+				$this->event,
526
+				$ticket,
527
+				$this->getMaxAttendees(),
528
+				$template_args
529
+			);
530
+		}
531
+		return '';
532
+	}
533
+
534
+
535
+	/**
536
+	 * externalEventRegistration
537
+	 *
538
+	 * @return string
539
+	 */
540
+	public function externalEventRegistration(): string
541
+	{
542
+		// if not we still need to trigger the display of the submit button
543
+		add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
544
+		// display notice to admin that registration is external
545
+		return $this->display_full_ui()
546
+			? esc_html__(
547
+				'Registration is at an external URL for this event.',
548
+				'event_espresso'
549
+			)
550
+			: '';
551
+	}
552
+
553
+
554
+	/**
555
+	 * formOpen
556
+	 *
557
+	 * @param int    $ID
558
+	 * @param string $external_url
559
+	 * @return        string
560
+	 */
561
+	public function formOpen(int $ID = 0, string $external_url = ''): string
562
+	{
563
+		// if redirecting, we don't need any anything else
564
+		if ($external_url) {
565
+			$html = '<form method="GET" ';
566
+			$html .= 'action="' . EEH_URL::refactor_url($external_url) . '" ';
567
+			$html .= 'name="ticket-selector-form-' . $ID . '"';
568
+			// open link in new window ?
569
+			$html       .= apply_filters(
570
+				'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__formOpen__external_url_target_blank',
571
+				$this->isIframe(),
572
+				$this
573
+			)
574
+				? ' target="_blank"'
575
+				: '';
576
+			$html       .= '>';
577
+			$query_args = EEH_URL::get_query_string($external_url);
578
+			foreach ((array) $query_args as $query_arg => $value) {
579
+				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
580
+			}
581
+			return $html;
582
+		}
583
+		// if there is no submit button, then don't start building a form
584
+		// because the "View Details" button will build its own form
585
+		if (! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
586
+			return '';
587
+		}
588
+		$checkout_url = EEH_Event_View::event_link_url($ID);
589
+		if (! $checkout_url) {
590
+			EE_Error::add_error(
591
+				esc_html__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
592
+				__FILE__,
593
+				__FUNCTION__,
594
+				__LINE__
595
+			);
596
+		}
597
+		// set no cache headers and constants
598
+		EE_System::do_not_cache();
599
+		$html = '<form method="POST" ';
600
+		$html .= 'action="' . $checkout_url . '" ';
601
+		$html .= 'name="ticket-selector-form-' . $ID . '"';
602
+		$html .= $this->iframe ? ' target="_blank"' : '';
603
+		$html .= '>';
604
+		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
605
+		return apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, $this->event);
606
+	}
607
+
608
+
609
+	/**
610
+	 * displaySubmitButton
611
+	 *
612
+	 * @param string $external_url
613
+	 * @return string
614
+	 * @throws EE_Error
615
+	 * @throws ReflectionException
616
+	 */
617
+	public function displaySubmitButton(string $external_url = ''): string
618
+	{
619
+		$html = '';
620
+		if ($this->display_full_ui()) {
621
+			// standard TS displayed with submit button, ie: "Register Now"
622
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
623
+				$html .= $this->displayRegisterNowButton();
624
+				$html .= empty($external_url)
625
+					? $this->ticketSelectorEndDiv()
626
+					: $this->clearTicketSelector();
627
+				$html .= '<br/>' . $this->formClose();
628
+			} elseif ($this->getMaxAttendees() === 1) {
629
+				// its a "Dude Where's my Ticket Selector?" (DWMTS) type event (ie: $_max_atndz === 1)
630
+				if ($this->event->is_sold_out()) {
631
+					// then instead of a View Details or Submit button, just display a "Sold Out" message
632
+					$html .= apply_filters(
633
+						'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__sold_out_msg',
634
+						sprintf(
635
+							esc_html__(
636
+								'%1$s"%2$s" is currently sold out.%4$sPlease check back again later, as spots may become available.%3$s',
637
+								'event_espresso'
638
+							),
639
+							'<p class="no-ticket-selector-msg clear-float">',
640
+							$this->event->name(),
641
+							'</p>',
642
+							'<br />'
643
+						),
644
+						$this->event
645
+					);
646
+					if (
647
+						apply_filters(
648
+							'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button',
649
+							false,
650
+							$this->event
651
+						)
652
+					) {
653
+						$html .= $this->displayRegisterNowButton();
654
+					}
655
+					// sold out DWMTS event, no TS, no submit or view details button, but has additional content
656
+					$html .= $this->ticketSelectorEndDiv();
657
+				} elseif (
658
+					apply_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector', false)
659
+					&& ! is_single()
660
+				) {
661
+					// this is a "Dude Where's my Ticket Selector?" (DWMTS) type event,
662
+					// but no tickets are available, so display event's "View Details" button.
663
+					// it is being viewed via somewhere other than a single post
664
+					$html .= $this->displayViewDetailsButton(true);
665
+				} else {
666
+					$html .= $this->ticketSelectorEndDiv();
667
+				}
668
+			} elseif (is_archive()) {
669
+				// event list, no tickets available so display event's "View Details" button
670
+				$html .= $this->ticketSelectorEndDiv();
671
+				$html .= $this->displayViewDetailsButton();
672
+			} else {
673
+				if (
674
+					apply_filters(
675
+						'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button',
676
+						false,
677
+						$this->event
678
+					)
679
+				) {
680
+					$html .= $this->displayRegisterNowButton();
681
+				}
682
+				// no submit or view details button, and no additional content
683
+				$html .= $this->ticketSelectorEndDiv();
684
+			}
685
+			if (! $this->iframe && ! is_archive()) {
686
+				$html .= EEH_Template::powered_by_event_espresso('', '', ['utm_content' => 'ticket_selector']);
687
+			}
688
+		}
689
+		return apply_filters(
690
+			'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__displaySubmitButton__html',
691
+			$html,
692
+			$this->event,
693
+			$this
694
+		);
695
+	}
696
+
697
+
698
+	/**
699
+	 * @return string
700
+	 * @throws EE_Error
701
+	 * @throws ReflectionException
702
+	 */
703
+	public function displayRegisterNowButton(): string
704
+	{
705
+		$btn_text     = apply_filters(
706
+			'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
707
+			esc_html__('Register Now', 'event_espresso'),
708
+			$this->event
709
+		);
710
+		$external_url = (string) $this->event->external_url()
711
+						&& $this->event->external_url() !== get_the_permalink()
712
+			? $this->event->external_url()
713
+			: '';
714
+		$html         = EEH_HTML::div(
715
+			'',
716
+			'ticket-selector-submit-' . $this->event->ID() . '-btn-wrap',
717
+			'ticket-selector-submit-btn-wrap'
718
+		);
719
+		$html         .= '<input id="ticket-selector-submit-' . $this->event->ID() . '-btn"';
720
+		$html         .= ' class="ticket-selector-submit-btn ';
721
+		$html         .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
722
+		$html         .= ' type="submit" value="' . $btn_text . '" data-ee-disable-after-recaptcha="true" />';
723
+		$html         .= EEH_HTML::divx() . '<!-- .ticket-selector-submit-btn-wrap -->';
724
+		$html         .= apply_filters(
725
+			'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
726
+			'',
727
+			$this->event,
728
+			$this->iframe
729
+		);
730
+		return $html;
731
+	}
732
+
733
+
734
+	/**
735
+	 * displayViewDetailsButton
736
+	 *
737
+	 * @param bool $DWMTS indicates a "Dude Where's my Ticket Selector?" (DWMTS) type event
738
+	 *                    (ie: $_max_atndz === 1) where there are no available tickets,
739
+	 *                    either because they are sold out, expired, or not yet on sale.
740
+	 *                    In this case, we need to close the form BEFORE adding any closing divs
741
+	 * @return string
742
+	 * @throws EE_Error
743
+	 * @throws ReflectionException
744
+	 */
745
+	public function displayViewDetailsButton(bool $DWMTS = false): string
746
+	{
747
+		if (! $this->event->get_permalink()) {
748
+			EE_Error::add_error(
749
+				esc_html__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
750
+				__FILE__,
751
+				__FUNCTION__,
752
+				__LINE__
753
+			);
754
+		}
755
+		$view_details_btn = '<form method="GET" action="';
756
+		$view_details_btn .= apply_filters(
757
+			'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_url',
758
+			$this->event->get_permalink(),
759
+			$this->event
760
+		);
761
+		$view_details_btn .= '"';
762
+		// open link in new window ?
763
+		$view_details_btn .= apply_filters(
764
+			'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__displayViewDetailsButton__url_target_blank',
765
+			$this->isIframe(),
766
+			$this
767
+		)
768
+			? ' target="_blank"'
769
+			: '';
770
+		$view_details_btn .= '>';
771
+		$btn_text         = apply_filters(
772
+			'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
773
+			esc_html__('View Details', 'event_espresso'),
774
+			$this->event
775
+		);
776
+		$view_details_btn .= '<input id="ticket-selector-submit-'
777
+							 . $this->event->ID()
778
+							 . '-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'
779
+							 . $btn_text
780
+							 . '" />';
781
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', $this->event);
782
+		if ($DWMTS) {
783
+			$view_details_btn .= $this->formClose();
784
+			$view_details_btn .= $this->ticketSelectorEndDiv();
785
+			$view_details_btn .= '<br/>';
786
+		} else {
787
+			$view_details_btn .= $this->clearTicketSelector();
788
+			$view_details_btn .= '<br/>';
789
+			$view_details_btn .= $this->formClose();
790
+		}
791
+		return $view_details_btn;
792
+	}
793
+
794
+
795
+	/**
796
+	 * @return string
797
+	 */
798
+	public function ticketSelectorEndDiv(): string
799
+	{
800
+		return $this->clearTicketSelector() . '</div><!-- ticketSelectorEndDiv -->';
801
+	}
802
+
803
+
804
+	/**
805
+	 * @return string
806
+	 */
807
+	public function clearTicketSelector(): string
808
+	{
809
+		// standard TS displayed, appears after a "Register Now" or "view Details" button
810
+		return '<div class="clear"></div><!-- clearTicketSelector -->';
811
+	}
812
+
813
+
814
+	/**
815
+	 * @access        public
816
+	 * @return        string
817
+	 */
818
+	public function formClose(): string
819
+	{
820
+		return '</form>';
821
+	}
822
+
823
+
824
+	/**
825
+	 * handleMissingEvent
826
+	 * Returns either false or an error to display when no valid event is passed.
827
+	 *
828
+	 * @return false|string
829
+	 * @throws ExceptionStackTraceDisplay
830
+	 * @throws InvalidInterfaceException
831
+	 * @throws Exception
832
+	 */
833
+	protected function handleMissingEvent()
834
+	{
835
+		// If this is not an iFrame request, simply return false.
836
+		if (! $this->isIframe()) {
837
+			return false;
838
+		}
839
+		// This is an iFrame so return an error.
840
+		// Display stack trace if WP_DEBUG is enabled.
841
+		if (WP_DEBUG === true && current_user_can('edit_pages')) {
842
+			$event_id = EE_Registry::instance()->REQ->get('event', 0);
843
+			new ExceptionStackTraceDisplay(
844
+				new InvalidArgumentException(
845
+					sprintf(
846
+						esc_html__(
847
+							'A valid Event ID is required to display the ticket selector.%3$sAn Event with an ID of "%1$s" could not be found.%3$sPlease verify that the embed code added to this post\'s content includes an "%2$s" argument and that its value corresponds to a valid Event ID.',
848
+							'event_espresso'
849
+						),
850
+						$event_id,
851
+						'event',
852
+						'<br />'
853
+					)
854
+				)
855
+			);
856
+			return '';
857
+		}
858
+		// If WP_DEBUG is not enabled, display a message stating the event could not be found.
859
+		return EEH_HTML::p(
860
+			esc_html__(
861
+				'A valid Event could not be found. Please contact the event administrator for assistance.',
862
+				'event_espresso'
863
+			)
864
+		);
865
+	}
866 866
 }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format',
97 97
             get_option('date_format')
98 98
         );
99
-        $this->time_format  = apply_filters(
99
+        $this->time_format = apply_filters(
100 100
             'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format',
101 101
             get_option('time_format')
102 102
         );
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
             }
149 149
         } else {
150 150
             $user_msg = esc_html__('No Event object or an invalid Event object was supplied.', 'event_espresso');
151
-            $dev_msg  = $user_msg . esc_html__(
151
+            $dev_msg  = $user_msg.esc_html__(
152 152
                 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.',
153 153
                 'event_espresso'
154 154
             );
155
-            EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
155
+            EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
156 156
             return false;
157 157
         }
158 158
         return true;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         // reset filter for displaying submit button
216 216
         remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
217 217
         // poke and prod incoming event till it tells us what it is
218
-        if (! $this->setEvent($event)) {
218
+        if ( ! $this->setEvent($event)) {
219 219
             return $this->handleMissingEvent();
220 220
         }
221 221
         // is the event expired ?
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         if ($template_args['event_is_expired']) {
224 224
             return is_single()
225 225
                 ? $this->expiredEventMessage()
226
-                : $this->expiredEventMessage() . $this->displayViewDetailsButton();
226
+                : $this->expiredEventMessage().$this->displayViewDetailsButton();
227 227
         }
228 228
         // begin gathering template arguments by getting event status
229 229
         $template_args = ['event_status' => $this->event->get_active_status()];
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
             : $this->loadTicketSelector($tickets, $template_args);
258 258
         // now set up the form (but not for the admin)
259 259
         $ticket_selector = $this->display_full_ui()
260
-            ? $this->formOpen($this->event->ID(), $external_url) . $ticket_selector
260
+            ? $this->formOpen($this->event->ID(), $external_url).$ticket_selector
261 261
             : $ticket_selector;
262 262
         // submit button and form close tag
263 263
         $ticket_selector .= $this->display_full_ui() ? $this->displaySubmitButton($external_url) : '';
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
         }
342 342
         return '
343 343
             <div class="ee-event-expired-notice">
344
-                <span class="important-notice">' . $no_ticket_available_msg . '</span>
344
+                <span class="important-notice">' . $no_ticket_available_msg.'</span>
345 345
             </div><!-- .ee-event-expired-notice -->';
346 346
     }
347 347
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
                 '</a></span></div><!-- .ee-attention ticketSalesClosedMessage -->'
375 375
             );
376 376
         }
377
-        return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
377
+        return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
378 378
     }
379 379
 
380 380
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
                 'Datetime.DTT_EVT_start' => 'DESC',
411 411
             ],
412 412
         ];
413
-        if (! $show_expired_tickets) {
413
+        if ( ! $show_expired_tickets) {
414 414
             // use the correct applicable time query depending on what version of core is being run.
415 415
             $current_time = method_exists('EEM_Datetime', 'current_time_for_query')
416 416
                 ? time()
@@ -472,9 +472,9 @@  discard block
 block discarded – undo
472 472
          * @param int $EVT_ID The Event ID
473 473
          * @since 4.9.13
474 474
          */
475
-        $template_args['anchor_id']    = apply_filters(
475
+        $template_args['anchor_id'] = apply_filters(
476 476
             'FHEE__EE_Ticket_Selector__redirect_anchor_id',
477
-            '#tkt-slctr-tbl-' . $this->event->ID(),
477
+            '#tkt-slctr-tbl-'.$this->event->ID(),
478 478
             $this->event->ID()
479 479
         );
480 480
         $template_args['tickets']      = $tickets;
@@ -563,30 +563,30 @@  discard block
 block discarded – undo
563 563
         // if redirecting, we don't need any anything else
564 564
         if ($external_url) {
565 565
             $html = '<form method="GET" ';
566
-            $html .= 'action="' . EEH_URL::refactor_url($external_url) . '" ';
567
-            $html .= 'name="ticket-selector-form-' . $ID . '"';
566
+            $html .= 'action="'.EEH_URL::refactor_url($external_url).'" ';
567
+            $html .= 'name="ticket-selector-form-'.$ID.'"';
568 568
             // open link in new window ?
569
-            $html       .= apply_filters(
569
+            $html .= apply_filters(
570 570
                 'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__formOpen__external_url_target_blank',
571 571
                 $this->isIframe(),
572 572
                 $this
573 573
             )
574 574
                 ? ' target="_blank"'
575 575
                 : '';
576
-            $html       .= '>';
576
+            $html .= '>';
577 577
             $query_args = EEH_URL::get_query_string($external_url);
578 578
             foreach ((array) $query_args as $query_arg => $value) {
579
-                $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
579
+                $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
580 580
             }
581 581
             return $html;
582 582
         }
583 583
         // if there is no submit button, then don't start building a form
584 584
         // because the "View Details" button will build its own form
585
-        if (! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
585
+        if ( ! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
586 586
             return '';
587 587
         }
588 588
         $checkout_url = EEH_Event_View::event_link_url($ID);
589
-        if (! $checkout_url) {
589
+        if ( ! $checkout_url) {
590 590
             EE_Error::add_error(
591 591
                 esc_html__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
592 592
                 __FILE__,
@@ -597,8 +597,8 @@  discard block
 block discarded – undo
597 597
         // set no cache headers and constants
598 598
         EE_System::do_not_cache();
599 599
         $html = '<form method="POST" ';
600
-        $html .= 'action="' . $checkout_url . '" ';
601
-        $html .= 'name="ticket-selector-form-' . $ID . '"';
600
+        $html .= 'action="'.$checkout_url.'" ';
601
+        $html .= 'name="ticket-selector-form-'.$ID.'"';
602 602
         $html .= $this->iframe ? ' target="_blank"' : '';
603 603
         $html .= '>';
604 604
         $html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
                 $html .= empty($external_url)
625 625
                     ? $this->ticketSelectorEndDiv()
626 626
                     : $this->clearTicketSelector();
627
-                $html .= '<br/>' . $this->formClose();
627
+                $html .= '<br/>'.$this->formClose();
628 628
             } elseif ($this->getMaxAttendees() === 1) {
629 629
                 // its a "Dude Where's my Ticket Selector?" (DWMTS) type event (ie: $_max_atndz === 1)
630 630
                 if ($this->event->is_sold_out()) {
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
                 // no submit or view details button, and no additional content
683 683
                 $html .= $this->ticketSelectorEndDiv();
684 684
             }
685
-            if (! $this->iframe && ! is_archive()) {
685
+            if ( ! $this->iframe && ! is_archive()) {
686 686
                 $html .= EEH_Template::powered_by_event_espresso('', '', ['utm_content' => 'ticket_selector']);
687 687
             }
688 688
         }
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
      */
703 703
     public function displayRegisterNowButton(): string
704 704
     {
705
-        $btn_text     = apply_filters(
705
+        $btn_text = apply_filters(
706 706
             'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
707 707
             esc_html__('Register Now', 'event_espresso'),
708 708
             $this->event
@@ -711,16 +711,16 @@  discard block
 block discarded – undo
711 711
                         && $this->event->external_url() !== get_the_permalink()
712 712
             ? $this->event->external_url()
713 713
             : '';
714
-        $html         = EEH_HTML::div(
714
+        $html = EEH_HTML::div(
715 715
             '',
716
-            'ticket-selector-submit-' . $this->event->ID() . '-btn-wrap',
716
+            'ticket-selector-submit-'.$this->event->ID().'-btn-wrap',
717 717
             'ticket-selector-submit-btn-wrap'
718 718
         );
719
-        $html         .= '<input id="ticket-selector-submit-' . $this->event->ID() . '-btn"';
719
+        $html         .= '<input id="ticket-selector-submit-'.$this->event->ID().'-btn"';
720 720
         $html         .= ' class="ticket-selector-submit-btn ';
721 721
         $html         .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
722
-        $html         .= ' type="submit" value="' . $btn_text . '" data-ee-disable-after-recaptcha="true" />';
723
-        $html         .= EEH_HTML::divx() . '<!-- .ticket-selector-submit-btn-wrap -->';
722
+        $html         .= ' type="submit" value="'.$btn_text.'" data-ee-disable-after-recaptcha="true" />';
723
+        $html         .= EEH_HTML::divx().'<!-- .ticket-selector-submit-btn-wrap -->';
724 724
         $html         .= apply_filters(
725 725
             'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
726 726
             '',
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
      */
745 745
     public function displayViewDetailsButton(bool $DWMTS = false): string
746 746
     {
747
-        if (! $this->event->get_permalink()) {
747
+        if ( ! $this->event->get_permalink()) {
748 748
             EE_Error::add_error(
749 749
                 esc_html__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
750 750
                 __FILE__,
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
             ? ' target="_blank"'
769 769
             : '';
770 770
         $view_details_btn .= '>';
771
-        $btn_text         = apply_filters(
771
+        $btn_text = apply_filters(
772 772
             'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
773 773
             esc_html__('View Details', 'event_espresso'),
774 774
             $this->event
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
      */
798 798
     public function ticketSelectorEndDiv(): string
799 799
     {
800
-        return $this->clearTicketSelector() . '</div><!-- ticketSelectorEndDiv -->';
800
+        return $this->clearTicketSelector().'</div><!-- ticketSelectorEndDiv -->';
801 801
     }
802 802
 
803 803
 
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
     protected function handleMissingEvent()
834 834
     {
835 835
         // If this is not an iFrame request, simply return false.
836
-        if (! $this->isIframe()) {
836
+        if ( ! $this->isIframe()) {
837 837
             return false;
838 838
         }
839 839
         // This is an iFrame so return an error.
Please login to merge, or discard this patch.