@@ -21,1003 +21,1003 @@ |
||
21 | 21 | class EE_Dependency_Map |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * This means that the requested class dependency is not present in the dependency map |
|
26 | - */ |
|
27 | - const not_registered = 0; |
|
28 | - |
|
29 | - /** |
|
30 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
31 | - */ |
|
32 | - const load_new_object = 1; |
|
33 | - |
|
34 | - /** |
|
35 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
36 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
37 | - */ |
|
38 | - const load_from_cache = 2; |
|
39 | - |
|
40 | - /** |
|
41 | - * When registering a dependency, |
|
42 | - * this indicates to keep any existing dependencies that already exist, |
|
43 | - * and simply discard any new dependencies declared in the incoming data |
|
44 | - */ |
|
45 | - const KEEP_EXISTING_DEPENDENCIES = 0; |
|
46 | - |
|
47 | - /** |
|
48 | - * When registering a dependency, |
|
49 | - * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
50 | - */ |
|
51 | - const OVERWRITE_DEPENDENCIES = 1; |
|
52 | - |
|
53 | - /** |
|
54 | - * @type EE_Dependency_Map $_instance |
|
55 | - */ |
|
56 | - protected static $_instance; |
|
57 | - |
|
58 | - /** |
|
59 | - * @var ClassInterfaceCache $class_cache |
|
60 | - */ |
|
61 | - private $class_cache; |
|
62 | - |
|
63 | - /** |
|
64 | - * @type RequestInterface $request |
|
65 | - */ |
|
66 | - protected $request; |
|
67 | - |
|
68 | - /** |
|
69 | - * @type LegacyRequestInterface $legacy_request |
|
70 | - */ |
|
71 | - protected $legacy_request; |
|
72 | - |
|
73 | - /** |
|
74 | - * @type ResponseInterface $response |
|
75 | - */ |
|
76 | - protected $response; |
|
77 | - |
|
78 | - /** |
|
79 | - * @type LoaderInterface $loader |
|
80 | - */ |
|
81 | - protected $loader; |
|
82 | - |
|
83 | - /** |
|
84 | - * @type array $_dependency_map |
|
85 | - */ |
|
86 | - protected $_dependency_map = []; |
|
87 | - |
|
88 | - /** |
|
89 | - * @type array $_class_loaders |
|
90 | - */ |
|
91 | - protected $_class_loaders = []; |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * EE_Dependency_Map constructor. |
|
96 | - * |
|
97 | - * @param ClassInterfaceCache $class_cache |
|
98 | - */ |
|
99 | - protected function __construct(ClassInterfaceCache $class_cache) |
|
100 | - { |
|
101 | - $this->class_cache = $class_cache; |
|
102 | - do_action('EE_Dependency_Map____construct', $this); |
|
103 | - } |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * @return void |
|
108 | - * @throws InvalidAliasException |
|
109 | - */ |
|
110 | - public function initialize() |
|
111 | - { |
|
112 | - $this->_register_core_dependencies(); |
|
113 | - $this->_register_core_class_loaders(); |
|
114 | - $this->_register_core_aliases(); |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - /** |
|
119 | - * @singleton method used to instantiate class object |
|
120 | - * @param ClassInterfaceCache|null $class_cache |
|
121 | - * @return EE_Dependency_Map |
|
122 | - */ |
|
123 | - public static function instance(ClassInterfaceCache $class_cache = null) |
|
124 | - { |
|
125 | - // check if class object is instantiated, and instantiated properly |
|
126 | - if (! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map |
|
127 | - && $class_cache instanceof ClassInterfaceCache |
|
128 | - ) { |
|
129 | - EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache); |
|
130 | - } |
|
131 | - return EE_Dependency_Map::$_instance; |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * @param RequestInterface $request |
|
137 | - */ |
|
138 | - public function setRequest(RequestInterface $request) |
|
139 | - { |
|
140 | - $this->request = $request; |
|
141 | - } |
|
142 | - |
|
143 | - |
|
144 | - /** |
|
145 | - * @param LegacyRequestInterface $legacy_request |
|
146 | - */ |
|
147 | - public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
148 | - { |
|
149 | - $this->legacy_request = $legacy_request; |
|
150 | - } |
|
151 | - |
|
152 | - |
|
153 | - /** |
|
154 | - * @param ResponseInterface $response |
|
155 | - */ |
|
156 | - public function setResponse(ResponseInterface $response) |
|
157 | - { |
|
158 | - $this->response = $response; |
|
159 | - } |
|
160 | - |
|
161 | - |
|
162 | - /** |
|
163 | - * @param LoaderInterface $loader |
|
164 | - */ |
|
165 | - public function setLoader(LoaderInterface $loader) |
|
166 | - { |
|
167 | - $this->loader = $loader; |
|
168 | - } |
|
169 | - |
|
170 | - |
|
171 | - /** |
|
172 | - * @param string $class |
|
173 | - * @param array $dependencies |
|
174 | - * @param int $overwrite |
|
175 | - * @return bool |
|
176 | - */ |
|
177 | - public static function register_dependencies( |
|
178 | - $class, |
|
179 | - array $dependencies, |
|
180 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
181 | - ) { |
|
182 | - return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - /** |
|
187 | - * Assigns an array of class names and corresponding load sources (new or cached) |
|
188 | - * to the class specified by the first parameter. |
|
189 | - * IMPORTANT !!! |
|
190 | - * The order of elements in the incoming $dependencies array MUST match |
|
191 | - * the order of the constructor parameters for the class in question. |
|
192 | - * This is especially important when overriding any existing dependencies that are registered. |
|
193 | - * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
194 | - * |
|
195 | - * @param string $class |
|
196 | - * @param array $dependencies |
|
197 | - * @param int $overwrite |
|
198 | - * @return bool |
|
199 | - */ |
|
200 | - public function registerDependencies( |
|
201 | - $class, |
|
202 | - array $dependencies, |
|
203 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
204 | - ) { |
|
205 | - $class = trim($class, '\\'); |
|
206 | - $registered = false; |
|
207 | - if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) { |
|
208 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = []; |
|
209 | - } |
|
210 | - // we need to make sure that any aliases used when registering a dependency |
|
211 | - // get resolved to the correct class name |
|
212 | - foreach ($dependencies as $dependency => $load_source) { |
|
213 | - $alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency); |
|
214 | - if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
215 | - || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ]) |
|
216 | - ) { |
|
217 | - unset($dependencies[ $dependency ]); |
|
218 | - $dependencies[ $alias ] = $load_source; |
|
219 | - $registered = true; |
|
220 | - } |
|
221 | - } |
|
222 | - // now add our two lists of dependencies together. |
|
223 | - // using Union (+=) favours the arrays in precedence from left to right, |
|
224 | - // so $dependencies is NOT overwritten because it is listed first |
|
225 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
226 | - // Union is way faster than array_merge() but should be used with caution... |
|
227 | - // especially with numerically indexed arrays |
|
228 | - $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ]; |
|
229 | - // now we need to ensure that the resulting dependencies |
|
230 | - // array only has the entries that are required for the class |
|
231 | - // so first count how many dependencies were originally registered for the class |
|
232 | - $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]); |
|
233 | - // if that count is non-zero (meaning dependencies were already registered) |
|
234 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count |
|
235 | - // then truncate the final array to match that count |
|
236 | - ? array_slice($dependencies, 0, $dependency_count) |
|
237 | - // otherwise just take the incoming array because nothing previously existed |
|
238 | - : $dependencies; |
|
239 | - return $registered; |
|
240 | - } |
|
241 | - |
|
242 | - |
|
243 | - /** |
|
244 | - * @param string $class_name |
|
245 | - * @param string $loader |
|
246 | - * @return bool |
|
247 | - * @throws DomainException |
|
248 | - */ |
|
249 | - public static function register_class_loader($class_name, $loader = 'load_core') |
|
250 | - { |
|
251 | - return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader); |
|
252 | - } |
|
253 | - |
|
254 | - |
|
255 | - /** |
|
256 | - * @param string $class_name |
|
257 | - * @param string $loader |
|
258 | - * @return bool |
|
259 | - * @throws DomainException |
|
260 | - */ |
|
261 | - public function registerClassLoader($class_name, $loader = 'load_core') |
|
262 | - { |
|
263 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
264 | - throw new DomainException( |
|
265 | - esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
266 | - ); |
|
267 | - } |
|
268 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
269 | - if (! is_callable($loader) |
|
270 | - && ( |
|
271 | - strpos($loader, 'load_') !== 0 |
|
272 | - || ! method_exists('EE_Registry', $loader) |
|
273 | - ) |
|
274 | - ) { |
|
275 | - throw new DomainException( |
|
276 | - sprintf( |
|
277 | - esc_html__( |
|
278 | - '"%1$s" is not a valid loader method on EE_Registry.', |
|
279 | - 'event_espresso' |
|
280 | - ), |
|
281 | - $loader |
|
282 | - ) |
|
283 | - ); |
|
284 | - } |
|
285 | - $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name); |
|
286 | - if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) { |
|
287 | - EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader; |
|
288 | - return true; |
|
289 | - } |
|
290 | - return false; |
|
291 | - } |
|
292 | - |
|
293 | - |
|
294 | - /** |
|
295 | - * @return array |
|
296 | - */ |
|
297 | - public function dependency_map() |
|
298 | - { |
|
299 | - return $this->_dependency_map; |
|
300 | - } |
|
301 | - |
|
302 | - |
|
303 | - /** |
|
304 | - * returns TRUE if dependency map contains a listing for the provided class name |
|
305 | - * |
|
306 | - * @param string $class_name |
|
307 | - * @return boolean |
|
308 | - */ |
|
309 | - public function has($class_name = '') |
|
310 | - { |
|
311 | - // all legacy models have the same dependencies |
|
312 | - if (strpos($class_name, 'EEM_') === 0) { |
|
313 | - $class_name = 'LEGACY_MODELS'; |
|
314 | - } |
|
315 | - return isset($this->_dependency_map[ $class_name ]); |
|
316 | - } |
|
317 | - |
|
318 | - |
|
319 | - /** |
|
320 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
321 | - * |
|
322 | - * @param string $class_name |
|
323 | - * @param string $dependency |
|
324 | - * @return bool |
|
325 | - */ |
|
326 | - public function has_dependency_for_class($class_name = '', $dependency = '') |
|
327 | - { |
|
328 | - // all legacy models have the same dependencies |
|
329 | - if (strpos($class_name, 'EEM_') === 0) { |
|
330 | - $class_name = 'LEGACY_MODELS'; |
|
331 | - } |
|
332 | - $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
333 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
334 | - } |
|
335 | - |
|
336 | - |
|
337 | - /** |
|
338 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
339 | - * |
|
340 | - * @param string $class_name |
|
341 | - * @param string $dependency |
|
342 | - * @return int |
|
343 | - */ |
|
344 | - public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
345 | - { |
|
346 | - // all legacy models have the same dependencies |
|
347 | - if (strpos($class_name, 'EEM_') === 0) { |
|
348 | - $class_name = 'LEGACY_MODELS'; |
|
349 | - } |
|
350 | - $dependency = $this->getFqnForAlias($dependency); |
|
351 | - return $this->has_dependency_for_class($class_name, $dependency) |
|
352 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
353 | - : EE_Dependency_Map::not_registered; |
|
354 | - } |
|
355 | - |
|
356 | - |
|
357 | - /** |
|
358 | - * @param string $class_name |
|
359 | - * @return string | Closure |
|
360 | - */ |
|
361 | - public function class_loader($class_name) |
|
362 | - { |
|
363 | - // all legacy models use load_model() |
|
364 | - if (strpos($class_name, 'EEM_') === 0) { |
|
365 | - return 'load_model'; |
|
366 | - } |
|
367 | - // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
368 | - // perform strpos() first to avoid loading regex every time we load a class |
|
369 | - if (strpos($class_name, 'EE_CPT_') === 0 |
|
370 | - && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
371 | - ) { |
|
372 | - return 'load_core'; |
|
373 | - } |
|
374 | - $class_name = $this->getFqnForAlias($class_name); |
|
375 | - return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
376 | - } |
|
377 | - |
|
378 | - |
|
379 | - /** |
|
380 | - * @return array |
|
381 | - */ |
|
382 | - public function class_loaders() |
|
383 | - { |
|
384 | - return $this->_class_loaders; |
|
385 | - } |
|
386 | - |
|
387 | - |
|
388 | - /** |
|
389 | - * adds an alias for a classname |
|
390 | - * |
|
391 | - * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
392 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
393 | - * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
394 | - * @throws InvalidAliasException |
|
395 | - */ |
|
396 | - public function add_alias($fqcn, $alias, $for_class = '') |
|
397 | - { |
|
398 | - $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
399 | - } |
|
400 | - |
|
401 | - |
|
402 | - /** |
|
403 | - * Returns TRUE if the provided fully qualified name IS an alias |
|
404 | - * WHY? |
|
405 | - * Because if a class is type hinting for a concretion, |
|
406 | - * then why would we need to find another class to supply it? |
|
407 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
408 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
409 | - * Don't go looking for some substitute. |
|
410 | - * Whereas if a class is type hinting for an interface... |
|
411 | - * then we need to find an actual class to use. |
|
412 | - * So the interface IS the alias for some other FQN, |
|
413 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
414 | - * represents some other class. |
|
415 | - * |
|
416 | - * @param string $fqn |
|
417 | - * @param string $for_class |
|
418 | - * @return bool |
|
419 | - */ |
|
420 | - public function isAlias($fqn = '', $for_class = '') |
|
421 | - { |
|
422 | - return $this->class_cache->isAlias($fqn, $for_class); |
|
423 | - } |
|
424 | - |
|
425 | - |
|
426 | - /** |
|
427 | - * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
428 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
429 | - * for example: |
|
430 | - * if the following two entries were added to the _aliases array: |
|
431 | - * array( |
|
432 | - * 'interface_alias' => 'some\namespace\interface' |
|
433 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
434 | - * ) |
|
435 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
436 | - * to load an instance of 'some\namespace\classname' |
|
437 | - * |
|
438 | - * @param string $alias |
|
439 | - * @param string $for_class |
|
440 | - * @return string |
|
441 | - */ |
|
442 | - public function getFqnForAlias($alias = '', $for_class = '') |
|
443 | - { |
|
444 | - return (string) $this->class_cache->getFqnForAlias($alias, $for_class); |
|
445 | - } |
|
446 | - |
|
447 | - |
|
448 | - /** |
|
449 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
450 | - * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
451 | - * This is done by using the following class constants: |
|
452 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
453 | - * EE_Dependency_Map::load_new_object - generates a new object every time |
|
454 | - */ |
|
455 | - protected function _register_core_dependencies() |
|
456 | - { |
|
457 | - $this->_dependency_map = [ |
|
458 | - 'EE_Request_Handler' => [ |
|
459 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
460 | - ], |
|
461 | - 'EE_System' => [ |
|
462 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
463 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
464 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
465 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
466 | - 'EventEspresso\core\services\routing\Router' => EE_Dependency_Map::load_from_cache, |
|
467 | - ], |
|
468 | - 'EE_Admin' => [ |
|
469 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
470 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
471 | - ], |
|
472 | - 'EE_Cart' => [ |
|
473 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
474 | - ], |
|
475 | - 'EE_Messenger_Collection_Loader' => [ |
|
476 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
477 | - ], |
|
478 | - 'EE_Message_Type_Collection_Loader' => [ |
|
479 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
480 | - ], |
|
481 | - 'EE_Message_Resource_Manager' => [ |
|
482 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
483 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
484 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
485 | - ], |
|
486 | - 'EE_Message_Factory' => [ |
|
487 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
488 | - ], |
|
489 | - 'EE_messages' => [ |
|
490 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
491 | - ], |
|
492 | - 'EE_Messages_Generator' => [ |
|
493 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
494 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
495 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
496 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
497 | - ], |
|
498 | - 'EE_Messages_Processor' => [ |
|
499 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
500 | - ], |
|
501 | - 'EE_Messages_Queue' => [ |
|
502 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
503 | - ], |
|
504 | - 'EE_Messages_Template_Defaults' => [ |
|
505 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
506 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
507 | - ], |
|
508 | - 'EE_Message_To_Generate_From_Request' => [ |
|
509 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
510 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
511 | - ], |
|
512 | - 'EventEspresso\core\services\commands\CommandBus' => [ |
|
513 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
514 | - ], |
|
515 | - 'EventEspresso\services\commands\CommandHandler' => [ |
|
516 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
517 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
518 | - ], |
|
519 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => [ |
|
520 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
521 | - ], |
|
522 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => [ |
|
523 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
524 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
525 | - ], |
|
526 | - 'EventEspresso\core\services\commands\CommandFactory' => [ |
|
527 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
528 | - ], |
|
529 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => [ |
|
530 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
531 | - ], |
|
532 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [ |
|
533 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
534 | - ], |
|
535 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [ |
|
536 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
537 | - ], |
|
538 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => [ |
|
539 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
540 | - ], |
|
541 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [ |
|
542 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
543 | - ], |
|
544 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [ |
|
545 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
546 | - ], |
|
547 | - 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [ |
|
548 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
549 | - ], |
|
550 | - 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [ |
|
551 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
552 | - ], |
|
553 | - 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => [ |
|
554 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
555 | - ], |
|
556 | - 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => [ |
|
557 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
558 | - ], |
|
559 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [ |
|
560 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
561 | - ], |
|
562 | - 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => [ |
|
563 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
564 | - ], |
|
565 | - 'EventEspresso\core\services\database\TableManager' => [ |
|
566 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
567 | - ], |
|
568 | - 'EE_Data_Migration_Class_Base' => [ |
|
569 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
570 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
571 | - ], |
|
572 | - 'EE_DMS_Core_4_1_0' => [ |
|
573 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
574 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
575 | - ], |
|
576 | - 'EE_DMS_Core_4_2_0' => [ |
|
577 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
578 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
579 | - ], |
|
580 | - 'EE_DMS_Core_4_3_0' => [ |
|
581 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
582 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
583 | - ], |
|
584 | - 'EE_DMS_Core_4_4_0' => [ |
|
585 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
586 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
587 | - ], |
|
588 | - 'EE_DMS_Core_4_5_0' => [ |
|
589 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
590 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
591 | - ], |
|
592 | - 'EE_DMS_Core_4_6_0' => [ |
|
593 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
594 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
595 | - ], |
|
596 | - 'EE_DMS_Core_4_7_0' => [ |
|
597 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
598 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
599 | - ], |
|
600 | - 'EE_DMS_Core_4_8_0' => [ |
|
601 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
602 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
603 | - ], |
|
604 | - 'EE_DMS_Core_4_9_0' => [ |
|
605 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
606 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
607 | - ], |
|
608 | - 'EE_DMS_Core_4_10_0' => [ |
|
609 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
610 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
611 | - 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
612 | - ], |
|
613 | - 'EE_DMS_Core_4_11_0' => [ |
|
614 | - 'EE_DMS_Core_4_10_0' => EE_Dependency_Map::load_from_cache, |
|
615 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
616 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
617 | - ], |
|
618 | - 'EventEspresso\core\services\assets\Registry' => [ |
|
619 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object, |
|
620 | - 'EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache, |
|
621 | - ], |
|
622 | - 'EventEspresso\core\services\cache\BasicCacheManager' => [ |
|
623 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
624 | - ], |
|
625 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [ |
|
626 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
627 | - ], |
|
628 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [ |
|
629 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
630 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
631 | - ], |
|
632 | - 'EventEspresso\core\domain\values\EmailAddress' => [ |
|
633 | - null, |
|
634 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
635 | - ], |
|
636 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => [ |
|
637 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
638 | - ], |
|
639 | - 'LEGACY_MODELS' => [ |
|
640 | - null, |
|
641 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
642 | - ], |
|
643 | - 'EE_Module_Request_Router' => [ |
|
644 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
645 | - ], |
|
646 | - 'EE_Registration_Processor' => [ |
|
647 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
648 | - ], |
|
649 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [ |
|
650 | - null, |
|
651 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
652 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
653 | - ], |
|
654 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
655 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
656 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
657 | - ], |
|
658 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
659 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
660 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
661 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
662 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
663 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
664 | - ], |
|
665 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
666 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
667 | - ], |
|
668 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
669 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
670 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
671 | - ], |
|
672 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
673 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
674 | - ], |
|
675 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
676 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
677 | - ], |
|
678 | - 'EE_CPT_Strategy' => [ |
|
679 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
680 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
681 | - ], |
|
682 | - 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
683 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
684 | - ], |
|
685 | - 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
686 | - null, |
|
687 | - null, |
|
688 | - null, |
|
689 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
690 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
691 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
692 | - ], |
|
693 | - 'EventEspresso\core\services\dependencies\DependencyResolver' => [ |
|
694 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
695 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
696 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
697 | - ], |
|
698 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => [ |
|
699 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
700 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
701 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
702 | - ], |
|
703 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => [ |
|
704 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
705 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
706 | - ], |
|
707 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => [ |
|
708 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
709 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
710 | - ], |
|
711 | - 'EE_URL_Validation_Strategy' => [ |
|
712 | - null, |
|
713 | - null, |
|
714 | - 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
715 | - ], |
|
716 | - 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
717 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
718 | - ], |
|
719 | - 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
720 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
721 | - ], |
|
722 | - 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [ |
|
723 | - 'WP_REST_Server' => EE_Dependency_Map::load_from_cache, |
|
724 | - 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache, |
|
725 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache, |
|
726 | - null, |
|
727 | - ], |
|
728 | - 'EventEspresso\core\services\routing\RouteHandler' => [ |
|
729 | - 'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache, |
|
730 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
731 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
732 | - 'EventEspresso\core\services\routing\RouteCollection' => EE_Dependency_Map::load_from_cache, |
|
733 | - ], |
|
734 | - 'EventEspresso\core\services\json\JsonDataNodeHandler' => [ |
|
735 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
736 | - ], |
|
737 | - 'EventEspresso\core\services\routing\Router' => [ |
|
738 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
739 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
740 | - 'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache, |
|
741 | - ], |
|
742 | - 'EventEspresso\core\services\assets\AssetManifest' => [ |
|
743 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
744 | - ], |
|
745 | - 'EventEspresso\core\services\assets\AssetManifestFactory' => [ |
|
746 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
747 | - ], |
|
748 | - 'EventEspresso\core\services\assets\BaristaFactory' => [ |
|
749 | - 'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache, |
|
750 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
751 | - ], |
|
752 | - 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => [ |
|
753 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
754 | - ], |
|
755 | - ]; |
|
756 | - } |
|
757 | - |
|
758 | - |
|
759 | - /** |
|
760 | - * Registers how core classes are loaded. |
|
761 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
762 | - * 'EE_Request_Handler' => 'load_core' |
|
763 | - * 'EE_Messages_Queue' => 'load_lib' |
|
764 | - * 'EEH_Debug_Tools' => 'load_helper' |
|
765 | - * or, if greater control is required, by providing a custom closure. For example: |
|
766 | - * 'Some_Class' => function () { |
|
767 | - * return new Some_Class(); |
|
768 | - * }, |
|
769 | - * This is required for instantiating dependencies |
|
770 | - * where an interface has been type hinted in a class constructor. For example: |
|
771 | - * 'Required_Interface' => function () { |
|
772 | - * return new A_Class_That_Implements_Required_Interface(); |
|
773 | - * }, |
|
774 | - */ |
|
775 | - protected function _register_core_class_loaders() |
|
776 | - { |
|
777 | - $this->_class_loaders = [ |
|
778 | - // load_core |
|
779 | - 'EE_Dependency_Map' => function () { |
|
780 | - return $this; |
|
781 | - }, |
|
782 | - 'EE_Capabilities' => 'load_core', |
|
783 | - 'EE_Encryption' => 'load_core', |
|
784 | - 'EE_Front_Controller' => 'load_core', |
|
785 | - 'EE_Module_Request_Router' => 'load_core', |
|
786 | - 'EE_Registry' => 'load_core', |
|
787 | - 'EE_Request' => function () { |
|
788 | - return $this->legacy_request; |
|
789 | - }, |
|
790 | - 'EventEspresso\core\services\request\Request' => function () { |
|
791 | - return $this->request; |
|
792 | - }, |
|
793 | - 'EventEspresso\core\services\request\Response' => function () { |
|
794 | - return $this->response; |
|
795 | - }, |
|
796 | - 'EE_Base' => 'load_core', |
|
797 | - 'EE_Request_Handler' => 'load_core', |
|
798 | - 'EE_Session' => 'load_core', |
|
799 | - 'EE_Cron_Tasks' => 'load_core', |
|
800 | - 'EE_System' => 'load_core', |
|
801 | - 'EE_Maintenance_Mode' => 'load_core', |
|
802 | - 'EE_Register_CPTs' => 'load_core', |
|
803 | - 'EE_Admin' => 'load_core', |
|
804 | - 'EE_CPT_Strategy' => 'load_core', |
|
805 | - // load_class |
|
806 | - 'EE_Registration_Processor' => 'load_class', |
|
807 | - // load_lib |
|
808 | - 'EE_Message_Resource_Manager' => 'load_lib', |
|
809 | - 'EE_Message_Type_Collection' => 'load_lib', |
|
810 | - 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
811 | - 'EE_Messenger_Collection' => 'load_lib', |
|
812 | - 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
813 | - 'EE_Messages_Processor' => 'load_lib', |
|
814 | - 'EE_Message_Repository' => 'load_lib', |
|
815 | - 'EE_Messages_Queue' => 'load_lib', |
|
816 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
817 | - 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
818 | - 'EE_Payment_Method_Manager' => 'load_lib', |
|
819 | - 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
820 | - 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
821 | - 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
822 | - 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
823 | - 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
824 | - 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
825 | - 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
826 | - 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
827 | - 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
828 | - 'EE_Messages_Generator' => static function () { |
|
829 | - return EE_Registry::instance()->load_lib( |
|
830 | - 'Messages_Generator', |
|
831 | - [], |
|
832 | - false, |
|
833 | - false |
|
834 | - ); |
|
835 | - }, |
|
836 | - 'EE_Messages_Template_Defaults' => static function ($arguments = []) { |
|
837 | - return EE_Registry::instance()->load_lib( |
|
838 | - 'Messages_Template_Defaults', |
|
839 | - $arguments, |
|
840 | - false, |
|
841 | - false |
|
842 | - ); |
|
843 | - }, |
|
844 | - // load_helper |
|
845 | - 'EEH_Parse_Shortcodes' => static function () { |
|
846 | - if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
847 | - return new EEH_Parse_Shortcodes(); |
|
848 | - } |
|
849 | - return null; |
|
850 | - }, |
|
851 | - 'EE_Template_Config' => static function () { |
|
852 | - return EE_Config::instance()->template_settings; |
|
853 | - }, |
|
854 | - 'EE_Currency_Config' => static function () { |
|
855 | - return EE_Config::instance()->currency; |
|
856 | - }, |
|
857 | - 'EE_Registration_Config' => static function () { |
|
858 | - return EE_Config::instance()->registration; |
|
859 | - }, |
|
860 | - 'EE_Core_Config' => static function () { |
|
861 | - return EE_Config::instance()->core; |
|
862 | - }, |
|
863 | - 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
864 | - return LoaderFactory::getLoader(); |
|
865 | - }, |
|
866 | - 'EE_Network_Config' => static function () { |
|
867 | - return EE_Network_Config::instance(); |
|
868 | - }, |
|
869 | - 'EE_Config' => static function () { |
|
870 | - return EE_Config::instance(); |
|
871 | - }, |
|
872 | - 'EventEspresso\core\domain\Domain' => static function () { |
|
873 | - return DomainFactory::getEventEspressoCoreDomain(); |
|
874 | - }, |
|
875 | - 'EE_Admin_Config' => static function () { |
|
876 | - return EE_Config::instance()->admin; |
|
877 | - }, |
|
878 | - 'EE_Organization_Config' => static function () { |
|
879 | - return EE_Config::instance()->organization; |
|
880 | - }, |
|
881 | - 'EE_Network_Core_Config' => static function () { |
|
882 | - return EE_Network_Config::instance()->core; |
|
883 | - }, |
|
884 | - 'EE_Environment_Config' => static function () { |
|
885 | - return EE_Config::instance()->environment; |
|
886 | - }, |
|
887 | - 'EED_Core_Rest_Api' => static function () { |
|
888 | - return EED_Core_Rest_Api::instance(); |
|
889 | - }, |
|
890 | - 'WP_REST_Server' => static function () { |
|
891 | - return rest_get_server(); |
|
892 | - }, |
|
893 | - ]; |
|
894 | - } |
|
895 | - |
|
896 | - |
|
897 | - /** |
|
898 | - * can be used for supplying alternate names for classes, |
|
899 | - * or for connecting interface names to instantiable classes |
|
900 | - * |
|
901 | - * @throws InvalidAliasException |
|
902 | - */ |
|
903 | - protected function _register_core_aliases() |
|
904 | - { |
|
905 | - $aliases = [ |
|
906 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
907 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
908 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
909 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
910 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
911 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
912 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
913 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
914 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
915 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
916 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
917 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
918 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
919 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
920 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
921 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
922 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
923 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
924 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
925 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
926 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
927 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
928 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
929 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
930 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
931 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
932 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
933 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
934 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
935 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
936 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
937 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
938 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
939 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
940 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
941 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
942 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
943 | - 'Registration_Processor' => 'EE_Registration_Processor', |
|
944 | - 'EventEspresso\core\services\assets\AssetManifestInterface' => 'EventEspresso\core\services\assets\AssetManifest', |
|
945 | - ]; |
|
946 | - foreach ($aliases as $alias => $fqn) { |
|
947 | - if (is_array($fqn)) { |
|
948 | - foreach ($fqn as $class => $for_class) { |
|
949 | - $this->class_cache->addAlias($class, $alias, $for_class); |
|
950 | - } |
|
951 | - continue; |
|
952 | - } |
|
953 | - $this->class_cache->addAlias($fqn, $alias); |
|
954 | - } |
|
955 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
956 | - $this->class_cache->addAlias( |
|
957 | - 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
958 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
959 | - ); |
|
960 | - } |
|
961 | - } |
|
962 | - |
|
963 | - |
|
964 | - /** |
|
965 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
966 | - * request Primarily used by unit tests. |
|
967 | - */ |
|
968 | - public function reset() |
|
969 | - { |
|
970 | - $this->_register_core_class_loaders(); |
|
971 | - $this->_register_core_dependencies(); |
|
972 | - } |
|
973 | - |
|
974 | - |
|
975 | - /** |
|
976 | - * PLZ NOTE: a better name for this method would be is_alias() |
|
977 | - * because it returns TRUE if the provided fully qualified name IS an alias |
|
978 | - * WHY? |
|
979 | - * Because if a class is type hinting for a concretion, |
|
980 | - * then why would we need to find another class to supply it? |
|
981 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
982 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
983 | - * Don't go looking for some substitute. |
|
984 | - * Whereas if a class is type hinting for an interface... |
|
985 | - * then we need to find an actual class to use. |
|
986 | - * So the interface IS the alias for some other FQN, |
|
987 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
988 | - * represents some other class. |
|
989 | - * |
|
990 | - * @param string $fqn |
|
991 | - * @param string $for_class |
|
992 | - * @return bool |
|
993 | - * @deprecated 4.9.62.p |
|
994 | - */ |
|
995 | - public function has_alias($fqn = '', $for_class = '') |
|
996 | - { |
|
997 | - return $this->isAlias($fqn, $for_class); |
|
998 | - } |
|
999 | - |
|
1000 | - |
|
1001 | - /** |
|
1002 | - * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1003 | - * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1004 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1005 | - * for example: |
|
1006 | - * if the following two entries were added to the _aliases array: |
|
1007 | - * array( |
|
1008 | - * 'interface_alias' => 'some\namespace\interface' |
|
1009 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
1010 | - * ) |
|
1011 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1012 | - * to load an instance of 'some\namespace\classname' |
|
1013 | - * |
|
1014 | - * @param string $alias |
|
1015 | - * @param string $for_class |
|
1016 | - * @return string |
|
1017 | - * @deprecated 4.9.62.p |
|
1018 | - */ |
|
1019 | - public function get_alias($alias = '', $for_class = '') |
|
1020 | - { |
|
1021 | - return $this->getFqnForAlias($alias, $for_class); |
|
1022 | - } |
|
24 | + /** |
|
25 | + * This means that the requested class dependency is not present in the dependency map |
|
26 | + */ |
|
27 | + const not_registered = 0; |
|
28 | + |
|
29 | + /** |
|
30 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
31 | + */ |
|
32 | + const load_new_object = 1; |
|
33 | + |
|
34 | + /** |
|
35 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
36 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
37 | + */ |
|
38 | + const load_from_cache = 2; |
|
39 | + |
|
40 | + /** |
|
41 | + * When registering a dependency, |
|
42 | + * this indicates to keep any existing dependencies that already exist, |
|
43 | + * and simply discard any new dependencies declared in the incoming data |
|
44 | + */ |
|
45 | + const KEEP_EXISTING_DEPENDENCIES = 0; |
|
46 | + |
|
47 | + /** |
|
48 | + * When registering a dependency, |
|
49 | + * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
50 | + */ |
|
51 | + const OVERWRITE_DEPENDENCIES = 1; |
|
52 | + |
|
53 | + /** |
|
54 | + * @type EE_Dependency_Map $_instance |
|
55 | + */ |
|
56 | + protected static $_instance; |
|
57 | + |
|
58 | + /** |
|
59 | + * @var ClassInterfaceCache $class_cache |
|
60 | + */ |
|
61 | + private $class_cache; |
|
62 | + |
|
63 | + /** |
|
64 | + * @type RequestInterface $request |
|
65 | + */ |
|
66 | + protected $request; |
|
67 | + |
|
68 | + /** |
|
69 | + * @type LegacyRequestInterface $legacy_request |
|
70 | + */ |
|
71 | + protected $legacy_request; |
|
72 | + |
|
73 | + /** |
|
74 | + * @type ResponseInterface $response |
|
75 | + */ |
|
76 | + protected $response; |
|
77 | + |
|
78 | + /** |
|
79 | + * @type LoaderInterface $loader |
|
80 | + */ |
|
81 | + protected $loader; |
|
82 | + |
|
83 | + /** |
|
84 | + * @type array $_dependency_map |
|
85 | + */ |
|
86 | + protected $_dependency_map = []; |
|
87 | + |
|
88 | + /** |
|
89 | + * @type array $_class_loaders |
|
90 | + */ |
|
91 | + protected $_class_loaders = []; |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * EE_Dependency_Map constructor. |
|
96 | + * |
|
97 | + * @param ClassInterfaceCache $class_cache |
|
98 | + */ |
|
99 | + protected function __construct(ClassInterfaceCache $class_cache) |
|
100 | + { |
|
101 | + $this->class_cache = $class_cache; |
|
102 | + do_action('EE_Dependency_Map____construct', $this); |
|
103 | + } |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * @return void |
|
108 | + * @throws InvalidAliasException |
|
109 | + */ |
|
110 | + public function initialize() |
|
111 | + { |
|
112 | + $this->_register_core_dependencies(); |
|
113 | + $this->_register_core_class_loaders(); |
|
114 | + $this->_register_core_aliases(); |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + /** |
|
119 | + * @singleton method used to instantiate class object |
|
120 | + * @param ClassInterfaceCache|null $class_cache |
|
121 | + * @return EE_Dependency_Map |
|
122 | + */ |
|
123 | + public static function instance(ClassInterfaceCache $class_cache = null) |
|
124 | + { |
|
125 | + // check if class object is instantiated, and instantiated properly |
|
126 | + if (! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map |
|
127 | + && $class_cache instanceof ClassInterfaceCache |
|
128 | + ) { |
|
129 | + EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache); |
|
130 | + } |
|
131 | + return EE_Dependency_Map::$_instance; |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * @param RequestInterface $request |
|
137 | + */ |
|
138 | + public function setRequest(RequestInterface $request) |
|
139 | + { |
|
140 | + $this->request = $request; |
|
141 | + } |
|
142 | + |
|
143 | + |
|
144 | + /** |
|
145 | + * @param LegacyRequestInterface $legacy_request |
|
146 | + */ |
|
147 | + public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
148 | + { |
|
149 | + $this->legacy_request = $legacy_request; |
|
150 | + } |
|
151 | + |
|
152 | + |
|
153 | + /** |
|
154 | + * @param ResponseInterface $response |
|
155 | + */ |
|
156 | + public function setResponse(ResponseInterface $response) |
|
157 | + { |
|
158 | + $this->response = $response; |
|
159 | + } |
|
160 | + |
|
161 | + |
|
162 | + /** |
|
163 | + * @param LoaderInterface $loader |
|
164 | + */ |
|
165 | + public function setLoader(LoaderInterface $loader) |
|
166 | + { |
|
167 | + $this->loader = $loader; |
|
168 | + } |
|
169 | + |
|
170 | + |
|
171 | + /** |
|
172 | + * @param string $class |
|
173 | + * @param array $dependencies |
|
174 | + * @param int $overwrite |
|
175 | + * @return bool |
|
176 | + */ |
|
177 | + public static function register_dependencies( |
|
178 | + $class, |
|
179 | + array $dependencies, |
|
180 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
181 | + ) { |
|
182 | + return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + /** |
|
187 | + * Assigns an array of class names and corresponding load sources (new or cached) |
|
188 | + * to the class specified by the first parameter. |
|
189 | + * IMPORTANT !!! |
|
190 | + * The order of elements in the incoming $dependencies array MUST match |
|
191 | + * the order of the constructor parameters for the class in question. |
|
192 | + * This is especially important when overriding any existing dependencies that are registered. |
|
193 | + * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
194 | + * |
|
195 | + * @param string $class |
|
196 | + * @param array $dependencies |
|
197 | + * @param int $overwrite |
|
198 | + * @return bool |
|
199 | + */ |
|
200 | + public function registerDependencies( |
|
201 | + $class, |
|
202 | + array $dependencies, |
|
203 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
204 | + ) { |
|
205 | + $class = trim($class, '\\'); |
|
206 | + $registered = false; |
|
207 | + if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) { |
|
208 | + EE_Dependency_Map::$_instance->_dependency_map[ $class ] = []; |
|
209 | + } |
|
210 | + // we need to make sure that any aliases used when registering a dependency |
|
211 | + // get resolved to the correct class name |
|
212 | + foreach ($dependencies as $dependency => $load_source) { |
|
213 | + $alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency); |
|
214 | + if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
215 | + || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ]) |
|
216 | + ) { |
|
217 | + unset($dependencies[ $dependency ]); |
|
218 | + $dependencies[ $alias ] = $load_source; |
|
219 | + $registered = true; |
|
220 | + } |
|
221 | + } |
|
222 | + // now add our two lists of dependencies together. |
|
223 | + // using Union (+=) favours the arrays in precedence from left to right, |
|
224 | + // so $dependencies is NOT overwritten because it is listed first |
|
225 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
226 | + // Union is way faster than array_merge() but should be used with caution... |
|
227 | + // especially with numerically indexed arrays |
|
228 | + $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ]; |
|
229 | + // now we need to ensure that the resulting dependencies |
|
230 | + // array only has the entries that are required for the class |
|
231 | + // so first count how many dependencies were originally registered for the class |
|
232 | + $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]); |
|
233 | + // if that count is non-zero (meaning dependencies were already registered) |
|
234 | + EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count |
|
235 | + // then truncate the final array to match that count |
|
236 | + ? array_slice($dependencies, 0, $dependency_count) |
|
237 | + // otherwise just take the incoming array because nothing previously existed |
|
238 | + : $dependencies; |
|
239 | + return $registered; |
|
240 | + } |
|
241 | + |
|
242 | + |
|
243 | + /** |
|
244 | + * @param string $class_name |
|
245 | + * @param string $loader |
|
246 | + * @return bool |
|
247 | + * @throws DomainException |
|
248 | + */ |
|
249 | + public static function register_class_loader($class_name, $loader = 'load_core') |
|
250 | + { |
|
251 | + return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader); |
|
252 | + } |
|
253 | + |
|
254 | + |
|
255 | + /** |
|
256 | + * @param string $class_name |
|
257 | + * @param string $loader |
|
258 | + * @return bool |
|
259 | + * @throws DomainException |
|
260 | + */ |
|
261 | + public function registerClassLoader($class_name, $loader = 'load_core') |
|
262 | + { |
|
263 | + if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
264 | + throw new DomainException( |
|
265 | + esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
266 | + ); |
|
267 | + } |
|
268 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
269 | + if (! is_callable($loader) |
|
270 | + && ( |
|
271 | + strpos($loader, 'load_') !== 0 |
|
272 | + || ! method_exists('EE_Registry', $loader) |
|
273 | + ) |
|
274 | + ) { |
|
275 | + throw new DomainException( |
|
276 | + sprintf( |
|
277 | + esc_html__( |
|
278 | + '"%1$s" is not a valid loader method on EE_Registry.', |
|
279 | + 'event_espresso' |
|
280 | + ), |
|
281 | + $loader |
|
282 | + ) |
|
283 | + ); |
|
284 | + } |
|
285 | + $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name); |
|
286 | + if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) { |
|
287 | + EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader; |
|
288 | + return true; |
|
289 | + } |
|
290 | + return false; |
|
291 | + } |
|
292 | + |
|
293 | + |
|
294 | + /** |
|
295 | + * @return array |
|
296 | + */ |
|
297 | + public function dependency_map() |
|
298 | + { |
|
299 | + return $this->_dependency_map; |
|
300 | + } |
|
301 | + |
|
302 | + |
|
303 | + /** |
|
304 | + * returns TRUE if dependency map contains a listing for the provided class name |
|
305 | + * |
|
306 | + * @param string $class_name |
|
307 | + * @return boolean |
|
308 | + */ |
|
309 | + public function has($class_name = '') |
|
310 | + { |
|
311 | + // all legacy models have the same dependencies |
|
312 | + if (strpos($class_name, 'EEM_') === 0) { |
|
313 | + $class_name = 'LEGACY_MODELS'; |
|
314 | + } |
|
315 | + return isset($this->_dependency_map[ $class_name ]); |
|
316 | + } |
|
317 | + |
|
318 | + |
|
319 | + /** |
|
320 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
321 | + * |
|
322 | + * @param string $class_name |
|
323 | + * @param string $dependency |
|
324 | + * @return bool |
|
325 | + */ |
|
326 | + public function has_dependency_for_class($class_name = '', $dependency = '') |
|
327 | + { |
|
328 | + // all legacy models have the same dependencies |
|
329 | + if (strpos($class_name, 'EEM_') === 0) { |
|
330 | + $class_name = 'LEGACY_MODELS'; |
|
331 | + } |
|
332 | + $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
333 | + return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
334 | + } |
|
335 | + |
|
336 | + |
|
337 | + /** |
|
338 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
339 | + * |
|
340 | + * @param string $class_name |
|
341 | + * @param string $dependency |
|
342 | + * @return int |
|
343 | + */ |
|
344 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
345 | + { |
|
346 | + // all legacy models have the same dependencies |
|
347 | + if (strpos($class_name, 'EEM_') === 0) { |
|
348 | + $class_name = 'LEGACY_MODELS'; |
|
349 | + } |
|
350 | + $dependency = $this->getFqnForAlias($dependency); |
|
351 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
352 | + ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
353 | + : EE_Dependency_Map::not_registered; |
|
354 | + } |
|
355 | + |
|
356 | + |
|
357 | + /** |
|
358 | + * @param string $class_name |
|
359 | + * @return string | Closure |
|
360 | + */ |
|
361 | + public function class_loader($class_name) |
|
362 | + { |
|
363 | + // all legacy models use load_model() |
|
364 | + if (strpos($class_name, 'EEM_') === 0) { |
|
365 | + return 'load_model'; |
|
366 | + } |
|
367 | + // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
368 | + // perform strpos() first to avoid loading regex every time we load a class |
|
369 | + if (strpos($class_name, 'EE_CPT_') === 0 |
|
370 | + && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
371 | + ) { |
|
372 | + return 'load_core'; |
|
373 | + } |
|
374 | + $class_name = $this->getFqnForAlias($class_name); |
|
375 | + return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
376 | + } |
|
377 | + |
|
378 | + |
|
379 | + /** |
|
380 | + * @return array |
|
381 | + */ |
|
382 | + public function class_loaders() |
|
383 | + { |
|
384 | + return $this->_class_loaders; |
|
385 | + } |
|
386 | + |
|
387 | + |
|
388 | + /** |
|
389 | + * adds an alias for a classname |
|
390 | + * |
|
391 | + * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
392 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
393 | + * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
394 | + * @throws InvalidAliasException |
|
395 | + */ |
|
396 | + public function add_alias($fqcn, $alias, $for_class = '') |
|
397 | + { |
|
398 | + $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
399 | + } |
|
400 | + |
|
401 | + |
|
402 | + /** |
|
403 | + * Returns TRUE if the provided fully qualified name IS an alias |
|
404 | + * WHY? |
|
405 | + * Because if a class is type hinting for a concretion, |
|
406 | + * then why would we need to find another class to supply it? |
|
407 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
408 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
409 | + * Don't go looking for some substitute. |
|
410 | + * Whereas if a class is type hinting for an interface... |
|
411 | + * then we need to find an actual class to use. |
|
412 | + * So the interface IS the alias for some other FQN, |
|
413 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
414 | + * represents some other class. |
|
415 | + * |
|
416 | + * @param string $fqn |
|
417 | + * @param string $for_class |
|
418 | + * @return bool |
|
419 | + */ |
|
420 | + public function isAlias($fqn = '', $for_class = '') |
|
421 | + { |
|
422 | + return $this->class_cache->isAlias($fqn, $for_class); |
|
423 | + } |
|
424 | + |
|
425 | + |
|
426 | + /** |
|
427 | + * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
428 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
429 | + * for example: |
|
430 | + * if the following two entries were added to the _aliases array: |
|
431 | + * array( |
|
432 | + * 'interface_alias' => 'some\namespace\interface' |
|
433 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
434 | + * ) |
|
435 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
436 | + * to load an instance of 'some\namespace\classname' |
|
437 | + * |
|
438 | + * @param string $alias |
|
439 | + * @param string $for_class |
|
440 | + * @return string |
|
441 | + */ |
|
442 | + public function getFqnForAlias($alias = '', $for_class = '') |
|
443 | + { |
|
444 | + return (string) $this->class_cache->getFqnForAlias($alias, $for_class); |
|
445 | + } |
|
446 | + |
|
447 | + |
|
448 | + /** |
|
449 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
450 | + * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
451 | + * This is done by using the following class constants: |
|
452 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
453 | + * EE_Dependency_Map::load_new_object - generates a new object every time |
|
454 | + */ |
|
455 | + protected function _register_core_dependencies() |
|
456 | + { |
|
457 | + $this->_dependency_map = [ |
|
458 | + 'EE_Request_Handler' => [ |
|
459 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
460 | + ], |
|
461 | + 'EE_System' => [ |
|
462 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
463 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
464 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
465 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
466 | + 'EventEspresso\core\services\routing\Router' => EE_Dependency_Map::load_from_cache, |
|
467 | + ], |
|
468 | + 'EE_Admin' => [ |
|
469 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
470 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
471 | + ], |
|
472 | + 'EE_Cart' => [ |
|
473 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
474 | + ], |
|
475 | + 'EE_Messenger_Collection_Loader' => [ |
|
476 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
477 | + ], |
|
478 | + 'EE_Message_Type_Collection_Loader' => [ |
|
479 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
480 | + ], |
|
481 | + 'EE_Message_Resource_Manager' => [ |
|
482 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
483 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
484 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
485 | + ], |
|
486 | + 'EE_Message_Factory' => [ |
|
487 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
488 | + ], |
|
489 | + 'EE_messages' => [ |
|
490 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
491 | + ], |
|
492 | + 'EE_Messages_Generator' => [ |
|
493 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
494 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
495 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
496 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
497 | + ], |
|
498 | + 'EE_Messages_Processor' => [ |
|
499 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
500 | + ], |
|
501 | + 'EE_Messages_Queue' => [ |
|
502 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
503 | + ], |
|
504 | + 'EE_Messages_Template_Defaults' => [ |
|
505 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
506 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
507 | + ], |
|
508 | + 'EE_Message_To_Generate_From_Request' => [ |
|
509 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
510 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
511 | + ], |
|
512 | + 'EventEspresso\core\services\commands\CommandBus' => [ |
|
513 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
514 | + ], |
|
515 | + 'EventEspresso\services\commands\CommandHandler' => [ |
|
516 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
517 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
518 | + ], |
|
519 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => [ |
|
520 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
521 | + ], |
|
522 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => [ |
|
523 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
524 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
525 | + ], |
|
526 | + 'EventEspresso\core\services\commands\CommandFactory' => [ |
|
527 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
528 | + ], |
|
529 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => [ |
|
530 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
531 | + ], |
|
532 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [ |
|
533 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
534 | + ], |
|
535 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [ |
|
536 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
537 | + ], |
|
538 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => [ |
|
539 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
540 | + ], |
|
541 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [ |
|
542 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
543 | + ], |
|
544 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [ |
|
545 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
546 | + ], |
|
547 | + 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [ |
|
548 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
549 | + ], |
|
550 | + 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [ |
|
551 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
552 | + ], |
|
553 | + 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => [ |
|
554 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
555 | + ], |
|
556 | + 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => [ |
|
557 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
558 | + ], |
|
559 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [ |
|
560 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
561 | + ], |
|
562 | + 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => [ |
|
563 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
564 | + ], |
|
565 | + 'EventEspresso\core\services\database\TableManager' => [ |
|
566 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
567 | + ], |
|
568 | + 'EE_Data_Migration_Class_Base' => [ |
|
569 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
570 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
571 | + ], |
|
572 | + 'EE_DMS_Core_4_1_0' => [ |
|
573 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
574 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
575 | + ], |
|
576 | + 'EE_DMS_Core_4_2_0' => [ |
|
577 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
578 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
579 | + ], |
|
580 | + 'EE_DMS_Core_4_3_0' => [ |
|
581 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
582 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
583 | + ], |
|
584 | + 'EE_DMS_Core_4_4_0' => [ |
|
585 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
586 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
587 | + ], |
|
588 | + 'EE_DMS_Core_4_5_0' => [ |
|
589 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
590 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
591 | + ], |
|
592 | + 'EE_DMS_Core_4_6_0' => [ |
|
593 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
594 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
595 | + ], |
|
596 | + 'EE_DMS_Core_4_7_0' => [ |
|
597 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
598 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
599 | + ], |
|
600 | + 'EE_DMS_Core_4_8_0' => [ |
|
601 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
602 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
603 | + ], |
|
604 | + 'EE_DMS_Core_4_9_0' => [ |
|
605 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
606 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
607 | + ], |
|
608 | + 'EE_DMS_Core_4_10_0' => [ |
|
609 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
610 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
611 | + 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
612 | + ], |
|
613 | + 'EE_DMS_Core_4_11_0' => [ |
|
614 | + 'EE_DMS_Core_4_10_0' => EE_Dependency_Map::load_from_cache, |
|
615 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
616 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
617 | + ], |
|
618 | + 'EventEspresso\core\services\assets\Registry' => [ |
|
619 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object, |
|
620 | + 'EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache, |
|
621 | + ], |
|
622 | + 'EventEspresso\core\services\cache\BasicCacheManager' => [ |
|
623 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
624 | + ], |
|
625 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [ |
|
626 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
627 | + ], |
|
628 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [ |
|
629 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
630 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
631 | + ], |
|
632 | + 'EventEspresso\core\domain\values\EmailAddress' => [ |
|
633 | + null, |
|
634 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
635 | + ], |
|
636 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => [ |
|
637 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
638 | + ], |
|
639 | + 'LEGACY_MODELS' => [ |
|
640 | + null, |
|
641 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
642 | + ], |
|
643 | + 'EE_Module_Request_Router' => [ |
|
644 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
645 | + ], |
|
646 | + 'EE_Registration_Processor' => [ |
|
647 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
648 | + ], |
|
649 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [ |
|
650 | + null, |
|
651 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
652 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
653 | + ], |
|
654 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
655 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
656 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
657 | + ], |
|
658 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
659 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
660 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
661 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
662 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
663 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
664 | + ], |
|
665 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
666 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
667 | + ], |
|
668 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
669 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
670 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
671 | + ], |
|
672 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
673 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
674 | + ], |
|
675 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
676 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
677 | + ], |
|
678 | + 'EE_CPT_Strategy' => [ |
|
679 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
680 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
681 | + ], |
|
682 | + 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
683 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
684 | + ], |
|
685 | + 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
686 | + null, |
|
687 | + null, |
|
688 | + null, |
|
689 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
690 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
691 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
692 | + ], |
|
693 | + 'EventEspresso\core\services\dependencies\DependencyResolver' => [ |
|
694 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
695 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
696 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
697 | + ], |
|
698 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => [ |
|
699 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
700 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
701 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
702 | + ], |
|
703 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => [ |
|
704 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
705 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
706 | + ], |
|
707 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => [ |
|
708 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
709 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
710 | + ], |
|
711 | + 'EE_URL_Validation_Strategy' => [ |
|
712 | + null, |
|
713 | + null, |
|
714 | + 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
715 | + ], |
|
716 | + 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
717 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
718 | + ], |
|
719 | + 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
720 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
721 | + ], |
|
722 | + 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [ |
|
723 | + 'WP_REST_Server' => EE_Dependency_Map::load_from_cache, |
|
724 | + 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache, |
|
725 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache, |
|
726 | + null, |
|
727 | + ], |
|
728 | + 'EventEspresso\core\services\routing\RouteHandler' => [ |
|
729 | + 'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache, |
|
730 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
731 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
732 | + 'EventEspresso\core\services\routing\RouteCollection' => EE_Dependency_Map::load_from_cache, |
|
733 | + ], |
|
734 | + 'EventEspresso\core\services\json\JsonDataNodeHandler' => [ |
|
735 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
736 | + ], |
|
737 | + 'EventEspresso\core\services\routing\Router' => [ |
|
738 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
739 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
740 | + 'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache, |
|
741 | + ], |
|
742 | + 'EventEspresso\core\services\assets\AssetManifest' => [ |
|
743 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
744 | + ], |
|
745 | + 'EventEspresso\core\services\assets\AssetManifestFactory' => [ |
|
746 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
747 | + ], |
|
748 | + 'EventEspresso\core\services\assets\BaristaFactory' => [ |
|
749 | + 'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache, |
|
750 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
751 | + ], |
|
752 | + 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => [ |
|
753 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
754 | + ], |
|
755 | + ]; |
|
756 | + } |
|
757 | + |
|
758 | + |
|
759 | + /** |
|
760 | + * Registers how core classes are loaded. |
|
761 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
762 | + * 'EE_Request_Handler' => 'load_core' |
|
763 | + * 'EE_Messages_Queue' => 'load_lib' |
|
764 | + * 'EEH_Debug_Tools' => 'load_helper' |
|
765 | + * or, if greater control is required, by providing a custom closure. For example: |
|
766 | + * 'Some_Class' => function () { |
|
767 | + * return new Some_Class(); |
|
768 | + * }, |
|
769 | + * This is required for instantiating dependencies |
|
770 | + * where an interface has been type hinted in a class constructor. For example: |
|
771 | + * 'Required_Interface' => function () { |
|
772 | + * return new A_Class_That_Implements_Required_Interface(); |
|
773 | + * }, |
|
774 | + */ |
|
775 | + protected function _register_core_class_loaders() |
|
776 | + { |
|
777 | + $this->_class_loaders = [ |
|
778 | + // load_core |
|
779 | + 'EE_Dependency_Map' => function () { |
|
780 | + return $this; |
|
781 | + }, |
|
782 | + 'EE_Capabilities' => 'load_core', |
|
783 | + 'EE_Encryption' => 'load_core', |
|
784 | + 'EE_Front_Controller' => 'load_core', |
|
785 | + 'EE_Module_Request_Router' => 'load_core', |
|
786 | + 'EE_Registry' => 'load_core', |
|
787 | + 'EE_Request' => function () { |
|
788 | + return $this->legacy_request; |
|
789 | + }, |
|
790 | + 'EventEspresso\core\services\request\Request' => function () { |
|
791 | + return $this->request; |
|
792 | + }, |
|
793 | + 'EventEspresso\core\services\request\Response' => function () { |
|
794 | + return $this->response; |
|
795 | + }, |
|
796 | + 'EE_Base' => 'load_core', |
|
797 | + 'EE_Request_Handler' => 'load_core', |
|
798 | + 'EE_Session' => 'load_core', |
|
799 | + 'EE_Cron_Tasks' => 'load_core', |
|
800 | + 'EE_System' => 'load_core', |
|
801 | + 'EE_Maintenance_Mode' => 'load_core', |
|
802 | + 'EE_Register_CPTs' => 'load_core', |
|
803 | + 'EE_Admin' => 'load_core', |
|
804 | + 'EE_CPT_Strategy' => 'load_core', |
|
805 | + // load_class |
|
806 | + 'EE_Registration_Processor' => 'load_class', |
|
807 | + // load_lib |
|
808 | + 'EE_Message_Resource_Manager' => 'load_lib', |
|
809 | + 'EE_Message_Type_Collection' => 'load_lib', |
|
810 | + 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
811 | + 'EE_Messenger_Collection' => 'load_lib', |
|
812 | + 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
813 | + 'EE_Messages_Processor' => 'load_lib', |
|
814 | + 'EE_Message_Repository' => 'load_lib', |
|
815 | + 'EE_Messages_Queue' => 'load_lib', |
|
816 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
817 | + 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
818 | + 'EE_Payment_Method_Manager' => 'load_lib', |
|
819 | + 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
820 | + 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
821 | + 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
822 | + 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
823 | + 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
824 | + 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
825 | + 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
826 | + 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
827 | + 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
828 | + 'EE_Messages_Generator' => static function () { |
|
829 | + return EE_Registry::instance()->load_lib( |
|
830 | + 'Messages_Generator', |
|
831 | + [], |
|
832 | + false, |
|
833 | + false |
|
834 | + ); |
|
835 | + }, |
|
836 | + 'EE_Messages_Template_Defaults' => static function ($arguments = []) { |
|
837 | + return EE_Registry::instance()->load_lib( |
|
838 | + 'Messages_Template_Defaults', |
|
839 | + $arguments, |
|
840 | + false, |
|
841 | + false |
|
842 | + ); |
|
843 | + }, |
|
844 | + // load_helper |
|
845 | + 'EEH_Parse_Shortcodes' => static function () { |
|
846 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
847 | + return new EEH_Parse_Shortcodes(); |
|
848 | + } |
|
849 | + return null; |
|
850 | + }, |
|
851 | + 'EE_Template_Config' => static function () { |
|
852 | + return EE_Config::instance()->template_settings; |
|
853 | + }, |
|
854 | + 'EE_Currency_Config' => static function () { |
|
855 | + return EE_Config::instance()->currency; |
|
856 | + }, |
|
857 | + 'EE_Registration_Config' => static function () { |
|
858 | + return EE_Config::instance()->registration; |
|
859 | + }, |
|
860 | + 'EE_Core_Config' => static function () { |
|
861 | + return EE_Config::instance()->core; |
|
862 | + }, |
|
863 | + 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
864 | + return LoaderFactory::getLoader(); |
|
865 | + }, |
|
866 | + 'EE_Network_Config' => static function () { |
|
867 | + return EE_Network_Config::instance(); |
|
868 | + }, |
|
869 | + 'EE_Config' => static function () { |
|
870 | + return EE_Config::instance(); |
|
871 | + }, |
|
872 | + 'EventEspresso\core\domain\Domain' => static function () { |
|
873 | + return DomainFactory::getEventEspressoCoreDomain(); |
|
874 | + }, |
|
875 | + 'EE_Admin_Config' => static function () { |
|
876 | + return EE_Config::instance()->admin; |
|
877 | + }, |
|
878 | + 'EE_Organization_Config' => static function () { |
|
879 | + return EE_Config::instance()->organization; |
|
880 | + }, |
|
881 | + 'EE_Network_Core_Config' => static function () { |
|
882 | + return EE_Network_Config::instance()->core; |
|
883 | + }, |
|
884 | + 'EE_Environment_Config' => static function () { |
|
885 | + return EE_Config::instance()->environment; |
|
886 | + }, |
|
887 | + 'EED_Core_Rest_Api' => static function () { |
|
888 | + return EED_Core_Rest_Api::instance(); |
|
889 | + }, |
|
890 | + 'WP_REST_Server' => static function () { |
|
891 | + return rest_get_server(); |
|
892 | + }, |
|
893 | + ]; |
|
894 | + } |
|
895 | + |
|
896 | + |
|
897 | + /** |
|
898 | + * can be used for supplying alternate names for classes, |
|
899 | + * or for connecting interface names to instantiable classes |
|
900 | + * |
|
901 | + * @throws InvalidAliasException |
|
902 | + */ |
|
903 | + protected function _register_core_aliases() |
|
904 | + { |
|
905 | + $aliases = [ |
|
906 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
907 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
908 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
909 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
910 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
911 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
912 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
913 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
914 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
915 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
916 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
917 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
918 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
919 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
920 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
921 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
922 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
923 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
924 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
925 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
926 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
927 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
928 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
929 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
930 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
931 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
932 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
933 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
934 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
935 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
936 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
937 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
938 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
939 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
940 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
941 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
942 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
943 | + 'Registration_Processor' => 'EE_Registration_Processor', |
|
944 | + 'EventEspresso\core\services\assets\AssetManifestInterface' => 'EventEspresso\core\services\assets\AssetManifest', |
|
945 | + ]; |
|
946 | + foreach ($aliases as $alias => $fqn) { |
|
947 | + if (is_array($fqn)) { |
|
948 | + foreach ($fqn as $class => $for_class) { |
|
949 | + $this->class_cache->addAlias($class, $alias, $for_class); |
|
950 | + } |
|
951 | + continue; |
|
952 | + } |
|
953 | + $this->class_cache->addAlias($fqn, $alias); |
|
954 | + } |
|
955 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
956 | + $this->class_cache->addAlias( |
|
957 | + 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
958 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
959 | + ); |
|
960 | + } |
|
961 | + } |
|
962 | + |
|
963 | + |
|
964 | + /** |
|
965 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
966 | + * request Primarily used by unit tests. |
|
967 | + */ |
|
968 | + public function reset() |
|
969 | + { |
|
970 | + $this->_register_core_class_loaders(); |
|
971 | + $this->_register_core_dependencies(); |
|
972 | + } |
|
973 | + |
|
974 | + |
|
975 | + /** |
|
976 | + * PLZ NOTE: a better name for this method would be is_alias() |
|
977 | + * because it returns TRUE if the provided fully qualified name IS an alias |
|
978 | + * WHY? |
|
979 | + * Because if a class is type hinting for a concretion, |
|
980 | + * then why would we need to find another class to supply it? |
|
981 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
982 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
983 | + * Don't go looking for some substitute. |
|
984 | + * Whereas if a class is type hinting for an interface... |
|
985 | + * then we need to find an actual class to use. |
|
986 | + * So the interface IS the alias for some other FQN, |
|
987 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
988 | + * represents some other class. |
|
989 | + * |
|
990 | + * @param string $fqn |
|
991 | + * @param string $for_class |
|
992 | + * @return bool |
|
993 | + * @deprecated 4.9.62.p |
|
994 | + */ |
|
995 | + public function has_alias($fqn = '', $for_class = '') |
|
996 | + { |
|
997 | + return $this->isAlias($fqn, $for_class); |
|
998 | + } |
|
999 | + |
|
1000 | + |
|
1001 | + /** |
|
1002 | + * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1003 | + * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1004 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1005 | + * for example: |
|
1006 | + * if the following two entries were added to the _aliases array: |
|
1007 | + * array( |
|
1008 | + * 'interface_alias' => 'some\namespace\interface' |
|
1009 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
1010 | + * ) |
|
1011 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1012 | + * to load an instance of 'some\namespace\classname' |
|
1013 | + * |
|
1014 | + * @param string $alias |
|
1015 | + * @param string $for_class |
|
1016 | + * @return string |
|
1017 | + * @deprecated 4.9.62.p |
|
1018 | + */ |
|
1019 | + public function get_alias($alias = '', $for_class = '') |
|
1020 | + { |
|
1021 | + return $this->getFqnForAlias($alias, $for_class); |
|
1022 | + } |
|
1023 | 1023 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | public static function instance(ClassInterfaceCache $class_cache = null) |
124 | 124 | { |
125 | 125 | // check if class object is instantiated, and instantiated properly |
126 | - if (! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map |
|
126 | + if ( ! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map |
|
127 | 127 | && $class_cache instanceof ClassInterfaceCache |
128 | 128 | ) { |
129 | 129 | EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache); |
@@ -204,18 +204,18 @@ discard block |
||
204 | 204 | ) { |
205 | 205 | $class = trim($class, '\\'); |
206 | 206 | $registered = false; |
207 | - if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) { |
|
208 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = []; |
|
207 | + if (empty(EE_Dependency_Map::$_instance->_dependency_map[$class])) { |
|
208 | + EE_Dependency_Map::$_instance->_dependency_map[$class] = []; |
|
209 | 209 | } |
210 | 210 | // we need to make sure that any aliases used when registering a dependency |
211 | 211 | // get resolved to the correct class name |
212 | 212 | foreach ($dependencies as $dependency => $load_source) { |
213 | 213 | $alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency); |
214 | 214 | if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
215 | - || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ]) |
|
215 | + || ! isset(EE_Dependency_Map::$_instance->_dependency_map[$class][$alias]) |
|
216 | 216 | ) { |
217 | - unset($dependencies[ $dependency ]); |
|
218 | - $dependencies[ $alias ] = $load_source; |
|
217 | + unset($dependencies[$dependency]); |
|
218 | + $dependencies[$alias] = $load_source; |
|
219 | 219 | $registered = true; |
220 | 220 | } |
221 | 221 | } |
@@ -225,13 +225,13 @@ discard block |
||
225 | 225 | // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
226 | 226 | // Union is way faster than array_merge() but should be used with caution... |
227 | 227 | // especially with numerically indexed arrays |
228 | - $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ]; |
|
228 | + $dependencies += EE_Dependency_Map::$_instance->_dependency_map[$class]; |
|
229 | 229 | // now we need to ensure that the resulting dependencies |
230 | 230 | // array only has the entries that are required for the class |
231 | 231 | // so first count how many dependencies were originally registered for the class |
232 | - $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]); |
|
232 | + $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[$class]); |
|
233 | 233 | // if that count is non-zero (meaning dependencies were already registered) |
234 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count |
|
234 | + EE_Dependency_Map::$_instance->_dependency_map[$class] = $dependency_count |
|
235 | 235 | // then truncate the final array to match that count |
236 | 236 | ? array_slice($dependencies, 0, $dependency_count) |
237 | 237 | // otherwise just take the incoming array because nothing previously existed |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function registerClassLoader($class_name, $loader = 'load_core') |
262 | 262 | { |
263 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
263 | + if ( ! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
264 | 264 | throw new DomainException( |
265 | 265 | esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
266 | 266 | ); |
267 | 267 | } |
268 | 268 | // check that loader is callable or method starts with "load_" and exists in EE_Registry |
269 | - if (! is_callable($loader) |
|
269 | + if ( ! is_callable($loader) |
|
270 | 270 | && ( |
271 | 271 | strpos($loader, 'load_') !== 0 |
272 | 272 | || ! method_exists('EE_Registry', $loader) |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | ); |
284 | 284 | } |
285 | 285 | $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name); |
286 | - if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) { |
|
287 | - EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader; |
|
286 | + if ( ! isset(EE_Dependency_Map::$_instance->_class_loaders[$class_name])) { |
|
287 | + EE_Dependency_Map::$_instance->_class_loaders[$class_name] = $loader; |
|
288 | 288 | return true; |
289 | 289 | } |
290 | 290 | return false; |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | if (strpos($class_name, 'EEM_') === 0) { |
313 | 313 | $class_name = 'LEGACY_MODELS'; |
314 | 314 | } |
315 | - return isset($this->_dependency_map[ $class_name ]); |
|
315 | + return isset($this->_dependency_map[$class_name]); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $class_name = 'LEGACY_MODELS'; |
331 | 331 | } |
332 | 332 | $dependency = $this->getFqnForAlias($dependency, $class_name); |
333 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
333 | + return isset($this->_dependency_map[$class_name][$dependency]); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | } |
350 | 350 | $dependency = $this->getFqnForAlias($dependency); |
351 | 351 | return $this->has_dependency_for_class($class_name, $dependency) |
352 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
352 | + ? $this->_dependency_map[$class_name][$dependency] |
|
353 | 353 | : EE_Dependency_Map::not_registered; |
354 | 354 | } |
355 | 355 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | return 'load_core'; |
373 | 373 | } |
374 | 374 | $class_name = $this->getFqnForAlias($class_name); |
375 | - return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
375 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | { |
777 | 777 | $this->_class_loaders = [ |
778 | 778 | // load_core |
779 | - 'EE_Dependency_Map' => function () { |
|
779 | + 'EE_Dependency_Map' => function() { |
|
780 | 780 | return $this; |
781 | 781 | }, |
782 | 782 | 'EE_Capabilities' => 'load_core', |
@@ -784,13 +784,13 @@ discard block |
||
784 | 784 | 'EE_Front_Controller' => 'load_core', |
785 | 785 | 'EE_Module_Request_Router' => 'load_core', |
786 | 786 | 'EE_Registry' => 'load_core', |
787 | - 'EE_Request' => function () { |
|
787 | + 'EE_Request' => function() { |
|
788 | 788 | return $this->legacy_request; |
789 | 789 | }, |
790 | - 'EventEspresso\core\services\request\Request' => function () { |
|
790 | + 'EventEspresso\core\services\request\Request' => function() { |
|
791 | 791 | return $this->request; |
792 | 792 | }, |
793 | - 'EventEspresso\core\services\request\Response' => function () { |
|
793 | + 'EventEspresso\core\services\request\Response' => function() { |
|
794 | 794 | return $this->response; |
795 | 795 | }, |
796 | 796 | 'EE_Base' => 'load_core', |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | 'EE_DMS_Core_4_8_0' => 'load_dms', |
826 | 826 | 'EE_DMS_Core_4_9_0' => 'load_dms', |
827 | 827 | 'EE_DMS_Core_4_10_0' => 'load_dms', |
828 | - 'EE_Messages_Generator' => static function () { |
|
828 | + 'EE_Messages_Generator' => static function() { |
|
829 | 829 | return EE_Registry::instance()->load_lib( |
830 | 830 | 'Messages_Generator', |
831 | 831 | [], |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | false |
834 | 834 | ); |
835 | 835 | }, |
836 | - 'EE_Messages_Template_Defaults' => static function ($arguments = []) { |
|
836 | + 'EE_Messages_Template_Defaults' => static function($arguments = []) { |
|
837 | 837 | return EE_Registry::instance()->load_lib( |
838 | 838 | 'Messages_Template_Defaults', |
839 | 839 | $arguments, |
@@ -842,52 +842,52 @@ discard block |
||
842 | 842 | ); |
843 | 843 | }, |
844 | 844 | // load_helper |
845 | - 'EEH_Parse_Shortcodes' => static function () { |
|
845 | + 'EEH_Parse_Shortcodes' => static function() { |
|
846 | 846 | if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
847 | 847 | return new EEH_Parse_Shortcodes(); |
848 | 848 | } |
849 | 849 | return null; |
850 | 850 | }, |
851 | - 'EE_Template_Config' => static function () { |
|
851 | + 'EE_Template_Config' => static function() { |
|
852 | 852 | return EE_Config::instance()->template_settings; |
853 | 853 | }, |
854 | - 'EE_Currency_Config' => static function () { |
|
854 | + 'EE_Currency_Config' => static function() { |
|
855 | 855 | return EE_Config::instance()->currency; |
856 | 856 | }, |
857 | - 'EE_Registration_Config' => static function () { |
|
857 | + 'EE_Registration_Config' => static function() { |
|
858 | 858 | return EE_Config::instance()->registration; |
859 | 859 | }, |
860 | - 'EE_Core_Config' => static function () { |
|
860 | + 'EE_Core_Config' => static function() { |
|
861 | 861 | return EE_Config::instance()->core; |
862 | 862 | }, |
863 | - 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
863 | + 'EventEspresso\core\services\loaders\Loader' => static function() { |
|
864 | 864 | return LoaderFactory::getLoader(); |
865 | 865 | }, |
866 | - 'EE_Network_Config' => static function () { |
|
866 | + 'EE_Network_Config' => static function() { |
|
867 | 867 | return EE_Network_Config::instance(); |
868 | 868 | }, |
869 | - 'EE_Config' => static function () { |
|
869 | + 'EE_Config' => static function() { |
|
870 | 870 | return EE_Config::instance(); |
871 | 871 | }, |
872 | - 'EventEspresso\core\domain\Domain' => static function () { |
|
872 | + 'EventEspresso\core\domain\Domain' => static function() { |
|
873 | 873 | return DomainFactory::getEventEspressoCoreDomain(); |
874 | 874 | }, |
875 | - 'EE_Admin_Config' => static function () { |
|
875 | + 'EE_Admin_Config' => static function() { |
|
876 | 876 | return EE_Config::instance()->admin; |
877 | 877 | }, |
878 | - 'EE_Organization_Config' => static function () { |
|
878 | + 'EE_Organization_Config' => static function() { |
|
879 | 879 | return EE_Config::instance()->organization; |
880 | 880 | }, |
881 | - 'EE_Network_Core_Config' => static function () { |
|
881 | + 'EE_Network_Core_Config' => static function() { |
|
882 | 882 | return EE_Network_Config::instance()->core; |
883 | 883 | }, |
884 | - 'EE_Environment_Config' => static function () { |
|
884 | + 'EE_Environment_Config' => static function() { |
|
885 | 885 | return EE_Config::instance()->environment; |
886 | 886 | }, |
887 | - 'EED_Core_Rest_Api' => static function () { |
|
887 | + 'EED_Core_Rest_Api' => static function() { |
|
888 | 888 | return EED_Core_Rest_Api::instance(); |
889 | 889 | }, |
890 | - 'WP_REST_Server' => static function () { |
|
890 | + 'WP_REST_Server' => static function() { |
|
891 | 891 | return rest_get_server(); |
892 | 892 | }, |
893 | 893 | ]; |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | } |
953 | 953 | $this->class_cache->addAlias($fqn, $alias); |
954 | 954 | } |
955 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
955 | + if ( ! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
956 | 956 | $this->class_cache->addAlias( |
957 | 957 | 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
958 | 958 | 'EventEspresso\core\services\notices\NoticeConverterInterface' |
@@ -37,122 +37,122 @@ |
||
37 | 37 | * @since 4.0 |
38 | 38 | */ |
39 | 39 | if (function_exists('espresso_version')) { |
40 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
41 | - /** |
|
42 | - * espresso_duplicate_plugin_error |
|
43 | - * displays if more than one version of EE is activated at the same time |
|
44 | - */ |
|
45 | - function espresso_duplicate_plugin_error() |
|
46 | - { |
|
47 | - ?> |
|
40 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
41 | + /** |
|
42 | + * espresso_duplicate_plugin_error |
|
43 | + * displays if more than one version of EE is activated at the same time |
|
44 | + */ |
|
45 | + function espresso_duplicate_plugin_error() |
|
46 | + { |
|
47 | + ?> |
|
48 | 48 | <div class="error"> |
49 | 49 | <p> |
50 | 50 | <?php |
51 | - echo esc_html__( |
|
52 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
53 | - 'event_espresso' |
|
54 | - ); ?> |
|
51 | + echo esc_html__( |
|
52 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
53 | + 'event_espresso' |
|
54 | + ); ?> |
|
55 | 55 | </p> |
56 | 56 | </div> |
57 | 57 | <?php |
58 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
59 | - } |
|
60 | - } |
|
61 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
58 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
59 | + } |
|
60 | + } |
|
61 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
62 | 62 | } else { |
63 | - define('EE_MIN_PHP_VER_REQUIRED', '7.1.0'); |
|
64 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
65 | - /** |
|
66 | - * espresso_minimum_php_version_error |
|
67 | - * |
|
68 | - * @return void |
|
69 | - */ |
|
70 | - function espresso_minimum_php_version_error() |
|
71 | - { |
|
72 | - ?> |
|
63 | + define('EE_MIN_PHP_VER_REQUIRED', '7.1.0'); |
|
64 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
65 | + /** |
|
66 | + * espresso_minimum_php_version_error |
|
67 | + * |
|
68 | + * @return void |
|
69 | + */ |
|
70 | + function espresso_minimum_php_version_error() |
|
71 | + { |
|
72 | + ?> |
|
73 | 73 | <div class="error"> |
74 | 74 | <p> |
75 | 75 | <?php |
76 | - printf( |
|
77 | - esc_html__( |
|
78 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
79 | - 'event_espresso' |
|
80 | - ), |
|
81 | - EE_MIN_PHP_VER_REQUIRED, |
|
82 | - PHP_VERSION, |
|
83 | - '<br/>', |
|
84 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
85 | - ); |
|
86 | - ?> |
|
76 | + printf( |
|
77 | + esc_html__( |
|
78 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
79 | + 'event_espresso' |
|
80 | + ), |
|
81 | + EE_MIN_PHP_VER_REQUIRED, |
|
82 | + PHP_VERSION, |
|
83 | + '<br/>', |
|
84 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
85 | + ); |
|
86 | + ?> |
|
87 | 87 | </p> |
88 | 88 | </div> |
89 | 89 | <?php |
90 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
91 | - } |
|
90 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
91 | + } |
|
92 | 92 | |
93 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
94 | - } else { |
|
95 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
96 | - /** |
|
97 | - * espresso_version |
|
98 | - * Returns the plugin version |
|
99 | - * |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - function espresso_version() |
|
103 | - { |
|
104 | - return apply_filters('FHEE__espresso__espresso_version', '4.11.0.rc.001'); |
|
105 | - } |
|
93 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
94 | + } else { |
|
95 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
96 | + /** |
|
97 | + * espresso_version |
|
98 | + * Returns the plugin version |
|
99 | + * |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + function espresso_version() |
|
103 | + { |
|
104 | + return apply_filters('FHEE__espresso__espresso_version', '4.11.0.rc.001'); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * espresso_plugin_activation |
|
109 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
110 | - */ |
|
111 | - function espresso_plugin_activation() |
|
112 | - { |
|
113 | - update_option('ee_espresso_activation', true); |
|
107 | + /** |
|
108 | + * espresso_plugin_activation |
|
109 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
110 | + */ |
|
111 | + function espresso_plugin_activation() |
|
112 | + { |
|
113 | + update_option('ee_espresso_activation', true); |
|
114 | 114 | |
115 | - // Run WP GraphQL activation callback |
|
116 | - if (! class_exists('WPGraphQL')) { |
|
117 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
118 | - } |
|
119 | - graphql_init()->activate(); |
|
120 | - } |
|
115 | + // Run WP GraphQL activation callback |
|
116 | + if (! class_exists('WPGraphQL')) { |
|
117 | + require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
118 | + } |
|
119 | + graphql_init()->activate(); |
|
120 | + } |
|
121 | 121 | |
122 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
122 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
123 | 123 | |
124 | - /** |
|
125 | - * espresso_plugin_deactivation |
|
126 | - */ |
|
127 | - function espresso_plugin_deactivation() |
|
128 | - { |
|
129 | - // Run WP GraphQL deactivation callback |
|
130 | - if (! class_exists('WPGraphQL')) { |
|
131 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
132 | - } |
|
133 | - graphql_init()->deactivate(); |
|
134 | - } |
|
135 | - register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
124 | + /** |
|
125 | + * espresso_plugin_deactivation |
|
126 | + */ |
|
127 | + function espresso_plugin_deactivation() |
|
128 | + { |
|
129 | + // Run WP GraphQL deactivation callback |
|
130 | + if (! class_exists('WPGraphQL')) { |
|
131 | + require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
132 | + } |
|
133 | + graphql_init()->deactivate(); |
|
134 | + } |
|
135 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
136 | 136 | |
137 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
138 | - bootstrap_espresso(); |
|
139 | - } |
|
137 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
138 | + bootstrap_espresso(); |
|
139 | + } |
|
140 | 140 | } |
141 | 141 | if (! function_exists('espresso_deactivate_plugin')) { |
142 | - /** |
|
143 | - * deactivate_plugin |
|
144 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
145 | - * |
|
146 | - * @access public |
|
147 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
148 | - * @return void |
|
149 | - */ |
|
150 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
151 | - { |
|
152 | - if (! function_exists('deactivate_plugins')) { |
|
153 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
154 | - } |
|
155 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
156 | - deactivate_plugins($plugin_basename); |
|
157 | - } |
|
142 | + /** |
|
143 | + * deactivate_plugin |
|
144 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
145 | + * |
|
146 | + * @access public |
|
147 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
148 | + * @return void |
|
149 | + */ |
|
150 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
151 | + { |
|
152 | + if (! function_exists('deactivate_plugins')) { |
|
153 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
154 | + } |
|
155 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
156 | + deactivate_plugins($plugin_basename); |
|
157 | + } |
|
158 | 158 | } |
@@ -13,63 +13,63 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class EE_DMS_Core_4_11_0 extends EE_Data_Migration_Script_Base |
15 | 15 | { |
16 | - /** |
|
17 | - * |
|
18 | - * @param EE_DMS_Core_4_10_0 $dms_4_10 |
|
19 | - * @param TableManager|null $table_manager |
|
20 | - * @param TableAnalysis|null $table_analysis |
|
21 | - */ |
|
22 | - public function __construct( |
|
23 | - EE_DMS_Core_4_10_0 $dms_4_10, |
|
24 | - TableManager $table_manager = null, |
|
25 | - TableAnalysis $table_analysis = null |
|
26 | - ) { |
|
27 | - $this->previous_dms = $dms_4_10; |
|
28 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.11.0", "event_espresso"); |
|
29 | - $this->_priority = 10; |
|
30 | - $this->_migration_stages = [ |
|
31 | - |
|
32 | - ]; |
|
33 | - parent::__construct($table_manager, $table_analysis); |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * Whether to migrate or not. |
|
39 | - * |
|
40 | - * @param array $version_array |
|
41 | - * @return bool |
|
42 | - */ |
|
43 | - public function can_migrate_from_version($version_array) |
|
44 | - { |
|
45 | - $version_string = $version_array['Core']; |
|
46 | - return $version_string |
|
47 | - && version_compare($version_string, '4.11.0.decaf', '<') |
|
48 | - && version_compare($version_string, '4.10.0.decaf', '>='); |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * @return bool |
|
54 | - * @throws EE_Error |
|
55 | - * @throws ReflectionException |
|
56 | - */ |
|
57 | - public function schema_changes_before_migration() |
|
58 | - { |
|
59 | - require_once EE_HELPERS . 'EEH_Activation.helper.php'; |
|
60 | - |
|
61 | - $table_name = 'esp_answer'; |
|
62 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
16 | + /** |
|
17 | + * |
|
18 | + * @param EE_DMS_Core_4_10_0 $dms_4_10 |
|
19 | + * @param TableManager|null $table_manager |
|
20 | + * @param TableAnalysis|null $table_analysis |
|
21 | + */ |
|
22 | + public function __construct( |
|
23 | + EE_DMS_Core_4_10_0 $dms_4_10, |
|
24 | + TableManager $table_manager = null, |
|
25 | + TableAnalysis $table_analysis = null |
|
26 | + ) { |
|
27 | + $this->previous_dms = $dms_4_10; |
|
28 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.11.0", "event_espresso"); |
|
29 | + $this->_priority = 10; |
|
30 | + $this->_migration_stages = [ |
|
31 | + |
|
32 | + ]; |
|
33 | + parent::__construct($table_manager, $table_analysis); |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * Whether to migrate or not. |
|
39 | + * |
|
40 | + * @param array $version_array |
|
41 | + * @return bool |
|
42 | + */ |
|
43 | + public function can_migrate_from_version($version_array) |
|
44 | + { |
|
45 | + $version_string = $version_array['Core']; |
|
46 | + return $version_string |
|
47 | + && version_compare($version_string, '4.11.0.decaf', '<') |
|
48 | + && version_compare($version_string, '4.10.0.decaf', '>='); |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * @return bool |
|
54 | + * @throws EE_Error |
|
55 | + * @throws ReflectionException |
|
56 | + */ |
|
57 | + public function schema_changes_before_migration() |
|
58 | + { |
|
59 | + require_once EE_HELPERS . 'EEH_Activation.helper.php'; |
|
60 | + |
|
61 | + $table_name = 'esp_answer'; |
|
62 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
63 | 63 | REG_ID int(10) unsigned NOT NULL, |
64 | 64 | QST_ID int(10) unsigned NOT NULL, |
65 | 65 | ANS_value text NOT NULL, |
66 | 66 | PRIMARY KEY (ANS_ID), |
67 | 67 | KEY REG_ID (REG_ID), |
68 | 68 | KEY QST_ID (QST_ID)"; |
69 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
69 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
70 | 70 | |
71 | - $table_name = 'esp_attendee_meta'; |
|
72 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
71 | + $table_name = 'esp_attendee_meta'; |
|
72 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
73 | 73 | ATT_ID bigint(20) unsigned NOT NULL, |
74 | 74 | ATT_fname varchar(45) NOT NULL, |
75 | 75 | ATT_lname varchar(45) NOT NULL, |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | KEY ATT_email (ATT_email(191)), |
87 | 87 | KEY ATT_lname (ATT_lname), |
88 | 88 | KEY ATT_fname (ATT_fname)"; |
89 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
89 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
90 | 90 | |
91 | - $table_name = 'esp_checkin'; |
|
92 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
91 | + $table_name = 'esp_checkin'; |
|
92 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
93 | 93 | REG_ID int(10) unsigned NOT NULL, |
94 | 94 | DTT_ID int(10) unsigned NOT NULL, |
95 | 95 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | PRIMARY KEY (CHK_ID), |
98 | 98 | KEY REG_ID (REG_ID), |
99 | 99 | KEY DTT_ID (DTT_ID)"; |
100 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
100 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
101 | 101 | |
102 | - $table_name = 'esp_country'; |
|
103 | - $sql = "CNT_ISO varchar(2) NOT NULL, |
|
102 | + $table_name = 'esp_country'; |
|
103 | + $sql = "CNT_ISO varchar(2) NOT NULL, |
|
104 | 104 | CNT_ISO3 varchar(3) NOT NULL, |
105 | 105 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
106 | 106 | CNT_name varchar(45) NOT NULL, |
@@ -116,32 +116,32 @@ discard block |
||
116 | 116 | CNT_is_EU tinyint(1) DEFAULT '0', |
117 | 117 | CNT_active tinyint(1) DEFAULT '0', |
118 | 118 | PRIMARY KEY (CNT_ISO)"; |
119 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
119 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
120 | 120 | |
121 | - $table_name = 'esp_currency'; |
|
122 | - $sql = "CUR_code varchar(6) NOT NULL, |
|
121 | + $table_name = 'esp_currency'; |
|
122 | + $sql = "CUR_code varchar(6) NOT NULL, |
|
123 | 123 | CUR_single varchar(45) DEFAULT 'dollar', |
124 | 124 | CUR_plural varchar(45) DEFAULT 'dollars', |
125 | 125 | CUR_sign varchar(45) DEFAULT '$', |
126 | 126 | CUR_dec_plc varchar(1) NOT NULL DEFAULT '2', |
127 | 127 | CUR_active tinyint(1) DEFAULT '0', |
128 | 128 | PRIMARY KEY (CUR_code)"; |
129 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
130 | - |
|
131 | - // note: although this table is no longer in use, |
|
132 | - // it hasn't been removed because then queries to the model will have errors. |
|
133 | - // but you should expect this table and its corresponding model to be removed in |
|
134 | - // the next few months |
|
135 | - $table_name = 'esp_currency_payment_method'; |
|
136 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
129 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
130 | + |
|
131 | + // note: although this table is no longer in use, |
|
132 | + // it hasn't been removed because then queries to the model will have errors. |
|
133 | + // but you should expect this table and its corresponding model to be removed in |
|
134 | + // the next few months |
|
135 | + $table_name = 'esp_currency_payment_method'; |
|
136 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
137 | 137 | CUR_code varchar(6) NOT NULL, |
138 | 138 | PMD_ID int(11) NOT NULL, |
139 | 139 | PRIMARY KEY (CPM_ID), |
140 | 140 | KEY PMD_ID (PMD_ID)"; |
141 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
141 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
142 | 142 | |
143 | - $table_name = 'esp_datetime'; |
|
144 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
143 | + $table_name = 'esp_datetime'; |
|
144 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
145 | 145 | EVT_ID bigint(20) unsigned NOT NULL, |
146 | 146 | DTT_name varchar(255) NOT NULL DEFAULT '', |
147 | 147 | DTT_description text NOT NULL, |
@@ -158,28 +158,28 @@ discard block |
||
158 | 158 | KEY DTT_EVT_start (DTT_EVT_start), |
159 | 159 | KEY EVT_ID (EVT_ID), |
160 | 160 | KEY DTT_is_primary (DTT_is_primary)"; |
161 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
161 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | 162 | |
163 | - $table_name = "esp_datetime_ticket"; |
|
164 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
163 | + $table_name = "esp_datetime_ticket"; |
|
164 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
165 | 165 | DTT_ID int(10) unsigned NOT NULL, |
166 | 166 | TKT_ID int(10) unsigned NOT NULL, |
167 | 167 | PRIMARY KEY (DTK_ID), |
168 | 168 | KEY DTT_ID (DTT_ID), |
169 | 169 | KEY TKT_ID (TKT_ID)"; |
170 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
170 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
171 | 171 | |
172 | - $table_name = 'esp_event_message_template'; |
|
173 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
172 | + $table_name = 'esp_event_message_template'; |
|
173 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
174 | 174 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
175 | 175 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
176 | 176 | PRIMARY KEY (EMT_ID), |
177 | 177 | KEY EVT_ID (EVT_ID), |
178 | 178 | KEY GRP_ID (GRP_ID)"; |
179 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
179 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
180 | 180 | |
181 | - $table_name = 'esp_event_meta'; |
|
182 | - $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
181 | + $table_name = 'esp_event_meta'; |
|
182 | + $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
183 | 183 | EVT_ID bigint(20) unsigned NOT NULL, |
184 | 184 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
185 | 185 | EVT_display_ticket_selector tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -194,10 +194,10 @@ discard block |
||
194 | 194 | EVT_donations tinyint(1) NULL, |
195 | 195 | PRIMARY KEY (EVTM_ID), |
196 | 196 | KEY EVT_ID (EVT_ID)"; |
197 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
197 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | 198 | |
199 | - $table_name = 'esp_event_question_group'; |
|
200 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
199 | + $table_name = 'esp_event_question_group'; |
|
200 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
201 | 201 | EVT_ID bigint(20) unsigned NOT NULL, |
202 | 202 | QSG_ID int(10) unsigned NOT NULL, |
203 | 203 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
@@ -205,28 +205,28 @@ discard block |
||
205 | 205 | PRIMARY KEY (EQG_ID), |
206 | 206 | KEY EVT_ID (EVT_ID), |
207 | 207 | KEY QSG_ID (QSG_ID)"; |
208 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
208 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
209 | 209 | |
210 | - $table_name = 'esp_event_venue'; |
|
211 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
210 | + $table_name = 'esp_event_venue'; |
|
211 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
212 | 212 | EVT_ID bigint(20) unsigned NOT NULL, |
213 | 213 | VNU_ID bigint(20) unsigned NOT NULL, |
214 | 214 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
215 | 215 | PRIMARY KEY (EVV_ID)"; |
216 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
216 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
217 | 217 | |
218 | - $table_name = 'esp_extra_meta'; |
|
219 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
218 | + $table_name = 'esp_extra_meta'; |
|
219 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
220 | 220 | OBJ_ID int(11) DEFAULT NULL, |
221 | 221 | EXM_type varchar(45) DEFAULT NULL, |
222 | 222 | EXM_key varchar(45) DEFAULT NULL, |
223 | 223 | EXM_value text, |
224 | 224 | PRIMARY KEY (EXM_ID), |
225 | 225 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
226 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
226 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | 227 | |
228 | - $table_name = 'esp_extra_join'; |
|
229 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
228 | + $table_name = 'esp_extra_join'; |
|
229 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
230 | 230 | EXJ_first_model_id varchar(6) NOT NULL, |
231 | 231 | EXJ_first_model_name varchar(20) NOT NULL, |
232 | 232 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | PRIMARY KEY (EXJ_ID), |
235 | 235 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
236 | 236 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
237 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
237 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
238 | 238 | |
239 | - $now_in_mysql = current_time('mysql', true); |
|
240 | - $table_name = 'esp_line_item'; |
|
241 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
239 | + $now_in_mysql = current_time('mysql', true); |
|
240 | + $table_name = 'esp_line_item'; |
|
241 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
242 | 242 | LIN_code varchar(245) NOT NULL DEFAULT '', |
243 | 243 | TXN_ID int(11) DEFAULT NULL, |
244 | 244 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | KEY txn_type_timestamp (TXN_ID,LIN_type,LIN_timestamp), |
260 | 260 | KEY txn_obj_id_obj_type (TXN_ID,OBJ_ID,OBJ_type), |
261 | 261 | KEY obj_id_obj_type (OBJ_ID,OBJ_type)"; |
262 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
262 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
263 | 263 | |
264 | - $table_name = 'esp_log'; |
|
265 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
264 | + $table_name = 'esp_log'; |
|
265 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
266 | 266 | LOG_time datetime DEFAULT NULL, |
267 | 267 | OBJ_ID varchar(45) DEFAULT NULL, |
268 | 268 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | KEY LOG_time (LOG_time), |
274 | 274 | KEY OBJ (OBJ_type,OBJ_ID), |
275 | 275 | KEY LOG_type (LOG_type)"; |
276 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
276 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
277 | 277 | |
278 | - $table_name = 'esp_message'; |
|
279 | - $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
278 | + $table_name = 'esp_message'; |
|
279 | + $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
280 | 280 | GRP_ID int(10) unsigned NULL, |
281 | 281 | MSG_token varchar(255) NULL, |
282 | 282 | TXN_ID int(10) unsigned NULL, |
@@ -308,20 +308,20 @@ discard block |
||
308 | 308 | KEY STS_ID (STS_ID), |
309 | 309 | KEY MSG_created (MSG_created), |
310 | 310 | KEY MSG_modified (MSG_modified)"; |
311 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
311 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
312 | 312 | |
313 | - $table_name = 'esp_message_template'; |
|
314 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
313 | + $table_name = 'esp_message_template'; |
|
314 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
315 | 315 | GRP_ID int(10) unsigned NOT NULL, |
316 | 316 | MTP_context varchar(50) NOT NULL, |
317 | 317 | MTP_template_field varchar(30) NOT NULL, |
318 | 318 | MTP_content text NOT NULL, |
319 | 319 | PRIMARY KEY (MTP_ID), |
320 | 320 | KEY GRP_ID (GRP_ID)"; |
321 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
321 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
322 | 322 | |
323 | - $table_name = 'esp_message_template_group'; |
|
324 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
323 | + $table_name = 'esp_message_template_group'; |
|
324 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
325 | 325 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
326 | 326 | MTP_name varchar(245) NOT NULL DEFAULT '', |
327 | 327 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -333,10 +333,10 @@ discard block |
||
333 | 333 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
334 | 334 | PRIMARY KEY (GRP_ID), |
335 | 335 | KEY MTP_user_id (MTP_user_id)"; |
336 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
336 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
337 | 337 | |
338 | - $table_name = 'esp_payment'; |
|
339 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
338 | + $table_name = 'esp_payment'; |
|
339 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
340 | 340 | TXN_ID int(10) unsigned DEFAULT NULL, |
341 | 341 | STS_ID varchar(3) DEFAULT NULL, |
342 | 342 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -353,10 +353,10 @@ discard block |
||
353 | 353 | PRIMARY KEY (PAY_ID), |
354 | 354 | KEY PAY_timestamp (PAY_timestamp), |
355 | 355 | KEY TXN_ID (TXN_ID)"; |
356 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
356 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
357 | 357 | |
358 | - $table_name = 'esp_payment_method'; |
|
359 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
358 | + $table_name = 'esp_payment_method'; |
|
359 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
360 | 360 | PMD_type varchar(124) DEFAULT NULL, |
361 | 361 | PMD_name varchar(255) DEFAULT NULL, |
362 | 362 | PMD_desc text, |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | PRIMARY KEY (PMD_ID), |
373 | 373 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
374 | 374 | KEY PMD_type (PMD_type)"; |
375 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
375 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
376 | 376 | |
377 | - $table_name = "esp_price"; |
|
378 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
377 | + $table_name = "esp_price"; |
|
378 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
379 | 379 | PRT_ID tinyint(3) unsigned NOT NULL, |
380 | 380 | PRC_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
381 | 381 | PRC_name varchar(245) NOT NULL, |
@@ -388,10 +388,10 @@ discard block |
||
388 | 388 | PRC_parent int(10) unsigned DEFAULT 0, |
389 | 389 | PRIMARY KEY (PRC_ID), |
390 | 390 | KEY PRT_ID (PRT_ID)"; |
391 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
391 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
392 | 392 | |
393 | - $table_name = "esp_price_type"; |
|
394 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
393 | + $table_name = "esp_price_type"; |
|
394 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
395 | 395 | PRT_name varchar(45) NOT NULL, |
396 | 396 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
397 | 397 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -400,27 +400,27 @@ discard block |
||
400 | 400 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
401 | 401 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
402 | 402 | PRIMARY KEY (PRT_ID)"; |
403 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
403 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
404 | 404 | |
405 | - $table_name = "esp_ticket_price"; |
|
406 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
405 | + $table_name = "esp_ticket_price"; |
|
406 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
407 | 407 | TKT_ID int(10) unsigned NOT NULL, |
408 | 408 | PRC_ID int(10) unsigned NOT NULL, |
409 | 409 | PRIMARY KEY (TKP_ID), |
410 | 410 | KEY TKT_ID (TKT_ID), |
411 | 411 | KEY PRC_ID (PRC_ID)"; |
412 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
412 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
413 | 413 | |
414 | - $table_name = "esp_ticket_template"; |
|
415 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
414 | + $table_name = "esp_ticket_template"; |
|
415 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
416 | 416 | TTM_name varchar(45) NOT NULL, |
417 | 417 | TTM_description text, |
418 | 418 | TTM_file varchar(45), |
419 | 419 | PRIMARY KEY (TTM_ID)"; |
420 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
420 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
421 | 421 | |
422 | - $table_name = 'esp_question'; |
|
423 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
422 | + $table_name = 'esp_question'; |
|
423 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
424 | 424 | QST_display_text text NOT NULL, |
425 | 425 | QST_admin_label varchar(255) NOT NULL, |
426 | 426 | QST_system varchar(25) DEFAULT NULL, |
@@ -434,10 +434,10 @@ discard block |
||
434 | 434 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
435 | 435 | PRIMARY KEY (QST_ID), |
436 | 436 | KEY QST_order (QST_order)'; |
437 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
437 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
438 | 438 | |
439 | - $table_name = 'esp_question_group'; |
|
440 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
439 | + $table_name = 'esp_question_group'; |
|
440 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
441 | 441 | QSG_name varchar(255) NOT NULL, |
442 | 442 | QSG_identifier varchar(100) NOT NULL, |
443 | 443 | QSG_desc text NULL, |
@@ -450,20 +450,20 @@ discard block |
||
450 | 450 | PRIMARY KEY (QSG_ID), |
451 | 451 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
452 | 452 | KEY QSG_order (QSG_order)'; |
453 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
453 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
454 | 454 | |
455 | - $table_name = 'esp_question_group_question'; |
|
456 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
455 | + $table_name = 'esp_question_group_question'; |
|
456 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
457 | 457 | QSG_ID int(10) unsigned NOT NULL, |
458 | 458 | QST_ID int(10) unsigned NOT NULL, |
459 | 459 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
460 | 460 | PRIMARY KEY (QGQ_ID), |
461 | 461 | KEY QST_ID (QST_ID), |
462 | 462 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
463 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
463 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
464 | 464 | |
465 | - $table_name = 'esp_question_option'; |
|
466 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
465 | + $table_name = 'esp_question_option'; |
|
466 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
467 | 467 | QSO_value varchar(255) NOT NULL, |
468 | 468 | QSO_desc text NOT NULL, |
469 | 469 | QST_ID int(10) unsigned NOT NULL, |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | PRIMARY KEY (QSO_ID), |
474 | 474 | KEY QST_ID (QST_ID), |
475 | 475 | KEY QSO_order (QSO_order)"; |
476 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
476 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
477 | 477 | |
478 | - $table_name = 'esp_registration'; |
|
479 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
478 | + $table_name = 'esp_registration'; |
|
479 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
480 | 480 | EVT_ID bigint(20) unsigned NOT NULL, |
481 | 481 | ATT_ID bigint(20) unsigned NOT NULL, |
482 | 482 | TXN_ID int(10) unsigned NOT NULL, |
@@ -500,20 +500,20 @@ discard block |
||
500 | 500 | KEY TKT_ID (TKT_ID), |
501 | 501 | KEY EVT_ID (EVT_ID), |
502 | 502 | KEY STS_ID (STS_ID)"; |
503 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
503 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
504 | 504 | |
505 | - $table_name = 'esp_registration_payment'; |
|
506 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
505 | + $table_name = 'esp_registration_payment'; |
|
506 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
507 | 507 | REG_ID int(10) unsigned NOT NULL, |
508 | 508 | PAY_ID int(10) unsigned NULL, |
509 | 509 | RPY_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
510 | 510 | PRIMARY KEY (RPY_ID), |
511 | 511 | KEY REG_ID (REG_ID), |
512 | 512 | KEY PAY_ID (PAY_ID)"; |
513 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
513 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
514 | 514 | |
515 | - $table_name = 'esp_state'; |
|
516 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
515 | + $table_name = 'esp_state'; |
|
516 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
517 | 517 | CNT_ISO varchar(2) NOT NULL, |
518 | 518 | STA_abbrev varchar(24) NOT NULL, |
519 | 519 | STA_name varchar(100) NOT NULL, |
@@ -521,10 +521,10 @@ discard block |
||
521 | 521 | PRIMARY KEY (STA_ID), |
522 | 522 | KEY STA_abbrev (STA_abbrev), |
523 | 523 | KEY CNT_ISO (CNT_ISO)"; |
524 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
524 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
525 | 525 | |
526 | - $table_name = 'esp_status'; |
|
527 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
526 | + $table_name = 'esp_status'; |
|
527 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
528 | 528 | STS_code varchar(45) NOT NULL, |
529 | 529 | STS_type varchar(45) NOT NULL, |
530 | 530 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -532,10 +532,10 @@ discard block |
||
532 | 532 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
533 | 533 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
534 | 534 | KEY STS_type (STS_type)"; |
535 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
535 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
536 | 536 | |
537 | - $table_name = "esp_ticket"; |
|
538 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
537 | + $table_name = "esp_ticket"; |
|
538 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
539 | 539 | TTM_ID int(10) unsigned NOT NULL, |
540 | 540 | TKT_name varchar(245) NOT NULL DEFAULT '', |
541 | 541 | TKT_description text NOT NULL, |
@@ -559,10 +559,10 @@ discard block |
||
559 | 559 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
560 | 560 | PRIMARY KEY (TKT_ID), |
561 | 561 | KEY TKT_start_date (TKT_start_date)"; |
562 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
562 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
563 | 563 | |
564 | - $table_name = 'esp_transaction'; |
|
565 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
564 | + $table_name = 'esp_transaction'; |
|
565 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
566 | 566 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
567 | 567 | TXN_total decimal(12,3) DEFAULT '0.00', |
568 | 568 | TXN_paid decimal(12,3) NOT NULL DEFAULT '0.00', |
@@ -574,10 +574,10 @@ discard block |
||
574 | 574 | PRIMARY KEY (TXN_ID), |
575 | 575 | KEY TXN_timestamp (TXN_timestamp), |
576 | 576 | KEY STS_ID (STS_ID)"; |
577 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
577 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
578 | 578 | |
579 | - $table_name = 'esp_venue_meta'; |
|
580 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
579 | + $table_name = 'esp_venue_meta'; |
|
580 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
581 | 581 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
582 | 582 | VNU_address varchar(255) DEFAULT NULL, |
583 | 583 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -596,36 +596,36 @@ discard block |
||
596 | 596 | KEY VNU_ID (VNU_ID), |
597 | 597 | KEY STA_ID (STA_ID), |
598 | 598 | KEY CNT_ISO (CNT_ISO)"; |
599 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
600 | - |
|
601 | - $this->insert_default_data(); |
|
602 | - return true; |
|
603 | - } |
|
604 | - |
|
605 | - |
|
606 | - /** |
|
607 | - * Inserts default data on new installs |
|
608 | - * |
|
609 | - * @throws EE_Error |
|
610 | - * @throws ReflectionException |
|
611 | - * @since 4.10.0.p |
|
612 | - */ |
|
613 | - public function insert_default_data() |
|
614 | - { |
|
615 | - $this->previous_dms->insert_default_data(); |
|
616 | - } |
|
617 | - |
|
618 | - |
|
619 | - /** |
|
620 | - * @return boolean |
|
621 | - */ |
|
622 | - public function schema_changes_after_migration() |
|
623 | - { |
|
624 | - return true; |
|
625 | - } |
|
626 | - |
|
627 | - |
|
628 | - public function migration_page_hooks() |
|
629 | - { |
|
630 | - } |
|
599 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
600 | + |
|
601 | + $this->insert_default_data(); |
|
602 | + return true; |
|
603 | + } |
|
604 | + |
|
605 | + |
|
606 | + /** |
|
607 | + * Inserts default data on new installs |
|
608 | + * |
|
609 | + * @throws EE_Error |
|
610 | + * @throws ReflectionException |
|
611 | + * @since 4.10.0.p |
|
612 | + */ |
|
613 | + public function insert_default_data() |
|
614 | + { |
|
615 | + $this->previous_dms->insert_default_data(); |
|
616 | + } |
|
617 | + |
|
618 | + |
|
619 | + /** |
|
620 | + * @return boolean |
|
621 | + */ |
|
622 | + public function schema_changes_after_migration() |
|
623 | + { |
|
624 | + return true; |
|
625 | + } |
|
626 | + |
|
627 | + |
|
628 | + public function migration_page_hooks() |
|
629 | + { |
|
630 | + } |
|
631 | 631 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | */ |
58 | 58 | public function schema_changes_before_migration() |
59 | 59 | { |
60 | - require_once EE_HELPERS . 'EEH_Activation.helper.php'; |
|
60 | + require_once EE_HELPERS.'EEH_Activation.helper.php'; |
|
61 | 61 | |
62 | 62 | $table_name = 'esp_answer'; |
63 | 63 | $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -17,219 +17,219 @@ |
||
17 | 17 | abstract class DomainBase implements DomainInterface |
18 | 18 | { |
19 | 19 | |
20 | - const ASSETS_FOLDER = 'assets/'; |
|
21 | - |
|
22 | - /** |
|
23 | - * Equivalent to `__FILE__` for main plugin file. |
|
24 | - * |
|
25 | - * @var FilePath |
|
26 | - */ |
|
27 | - private $plugin_file; |
|
28 | - |
|
29 | - /** |
|
30 | - * String indicating version for plugin |
|
31 | - * |
|
32 | - * @var string |
|
33 | - */ |
|
34 | - private $version; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var string $plugin_basename |
|
38 | - */ |
|
39 | - private $plugin_basename; |
|
40 | - |
|
41 | - /** |
|
42 | - * @var string $plugin_path |
|
43 | - */ |
|
44 | - private $plugin_path; |
|
45 | - |
|
46 | - /** |
|
47 | - * @var string $plugin_url |
|
48 | - */ |
|
49 | - private $plugin_url; |
|
50 | - |
|
51 | - /** |
|
52 | - * @var string $asset_namespace |
|
53 | - */ |
|
54 | - private $asset_namespace; |
|
55 | - |
|
56 | - /** |
|
57 | - * @var string $assets_path |
|
58 | - */ |
|
59 | - private $assets_path; |
|
60 | - |
|
61 | - /** |
|
62 | - * @var bool |
|
63 | - */ |
|
64 | - protected $initialized = false; |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * Initializes internal properties. |
|
69 | - * |
|
70 | - * @param FilePath $plugin_file |
|
71 | - * @param Version $version |
|
72 | - * @param string $asset_namespace |
|
73 | - */ |
|
74 | - public function __construct(FilePath $plugin_file, Version $version, $asset_namespace = Domain::ASSET_NAMESPACE) |
|
75 | - { |
|
76 | - $this->plugin_file = $plugin_file; |
|
77 | - $this->version = $version; |
|
78 | - $this->initialize($asset_namespace); |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - /** |
|
83 | - * @param string $asset_namespace |
|
84 | - * @return void |
|
85 | - * @since $VID:$ |
|
86 | - */ |
|
87 | - public function initialize($asset_namespace = Domain::ASSET_NAMESPACE) |
|
88 | - { |
|
89 | - if (! $this->initialized) { |
|
90 | - $this->plugin_basename = plugin_basename($this->pluginFile()); |
|
91 | - $this->plugin_path = plugin_dir_path($this->pluginFile()); |
|
92 | - $this->plugin_url = plugin_dir_url($this->pluginFile()); |
|
93 | - $this->setAssetNamespace($asset_namespace); |
|
94 | - $this->setDistributionAssetsPath(); |
|
95 | - $this->initialized = true; |
|
96 | - } |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * @param string $asset_namespace |
|
102 | - * @return void |
|
103 | - */ |
|
104 | - public function setAssetNamespace($asset_namespace = Domain::ASSET_NAMESPACE) |
|
105 | - { |
|
106 | - if (! $this->asset_namespace) { |
|
107 | - $this->asset_namespace = sanitize_key( |
|
108 | - // convert directory separators to dashes and remove file extension |
|
109 | - str_replace(['/', '.php'], ['-', ''], $asset_namespace) |
|
110 | - ); |
|
111 | - } |
|
112 | - } |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * @throws DomainException |
|
117 | - * @since $VID:$ |
|
118 | - */ |
|
119 | - private function setDistributionAssetsPath() |
|
120 | - { |
|
121 | - $assets_folder_paths = [ |
|
122 | - $this->plugin_path . DomainBase::ASSETS_FOLDER, |
|
123 | - $this->plugin_path . 'src/' . DomainBase::ASSETS_FOLDER, |
|
124 | - ]; |
|
125 | - foreach ($assets_folder_paths as $assets_folder_path) { |
|
126 | - if (is_readable($assets_folder_path)) { |
|
127 | - $this->assets_path = trailingslashit($assets_folder_path); |
|
128 | - // once we find a valid path, just break out of loop |
|
129 | - break; |
|
130 | - } |
|
131 | - } |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * @return string |
|
137 | - */ |
|
138 | - public function pluginFile() |
|
139 | - { |
|
140 | - return (string) $this->plugin_file; |
|
141 | - } |
|
142 | - |
|
143 | - |
|
144 | - /** |
|
145 | - * @return string |
|
146 | - */ |
|
147 | - public function pluginBasename() |
|
148 | - { |
|
149 | - return $this->plugin_basename; |
|
150 | - } |
|
151 | - |
|
152 | - |
|
153 | - /** |
|
154 | - * @param string $additional_path |
|
155 | - * @return string |
|
156 | - */ |
|
157 | - public function pluginPath($additional_path = '') |
|
158 | - { |
|
159 | - return is_string($additional_path) && $additional_path !== '' |
|
160 | - ? $this->plugin_path . $additional_path |
|
161 | - : $this->plugin_path; |
|
162 | - } |
|
163 | - |
|
164 | - |
|
165 | - /** |
|
166 | - * @param string $additional_path |
|
167 | - * @return string |
|
168 | - */ |
|
169 | - public function pluginUrl($additional_path = '') |
|
170 | - { |
|
171 | - return is_string($additional_path) && $additional_path !== '' |
|
172 | - ? $this->plugin_url . $additional_path |
|
173 | - : $this->plugin_url; |
|
174 | - } |
|
175 | - |
|
176 | - |
|
177 | - /** |
|
178 | - * @return string |
|
179 | - */ |
|
180 | - public function version() |
|
181 | - { |
|
182 | - return (string) $this->version; |
|
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - /** |
|
187 | - * @return Version |
|
188 | - */ |
|
189 | - public function versionValueObject() |
|
190 | - { |
|
191 | - return $this->version; |
|
192 | - } |
|
193 | - |
|
194 | - |
|
195 | - /** |
|
196 | - * @return string |
|
197 | - */ |
|
198 | - public function distributionAssetsFolder() |
|
199 | - { |
|
200 | - return DomainBase::ASSETS_FOLDER; |
|
201 | - } |
|
202 | - |
|
203 | - |
|
204 | - /** |
|
205 | - * @param string $additional_path |
|
206 | - * @return string |
|
207 | - */ |
|
208 | - public function distributionAssetsPath($additional_path = '') |
|
209 | - { |
|
210 | - return is_string($additional_path) && $additional_path !== '' |
|
211 | - ? $this->assets_path . $additional_path |
|
212 | - : $this->assets_path; |
|
213 | - } |
|
214 | - |
|
215 | - |
|
216 | - /** |
|
217 | - * @param string $additional_path |
|
218 | - * @return string |
|
219 | - */ |
|
220 | - public function distributionAssetsUrl($additional_path = '') |
|
221 | - { |
|
222 | - return is_string($additional_path) && $additional_path !== '' |
|
223 | - ? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path |
|
224 | - : $this->plugin_url . DomainBase::ASSETS_FOLDER; |
|
225 | - } |
|
226 | - |
|
227 | - |
|
228 | - /** |
|
229 | - * @return string |
|
230 | - */ |
|
231 | - public function assetNamespace() |
|
232 | - { |
|
233 | - return $this->asset_namespace; |
|
234 | - } |
|
20 | + const ASSETS_FOLDER = 'assets/'; |
|
21 | + |
|
22 | + /** |
|
23 | + * Equivalent to `__FILE__` for main plugin file. |
|
24 | + * |
|
25 | + * @var FilePath |
|
26 | + */ |
|
27 | + private $plugin_file; |
|
28 | + |
|
29 | + /** |
|
30 | + * String indicating version for plugin |
|
31 | + * |
|
32 | + * @var string |
|
33 | + */ |
|
34 | + private $version; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var string $plugin_basename |
|
38 | + */ |
|
39 | + private $plugin_basename; |
|
40 | + |
|
41 | + /** |
|
42 | + * @var string $plugin_path |
|
43 | + */ |
|
44 | + private $plugin_path; |
|
45 | + |
|
46 | + /** |
|
47 | + * @var string $plugin_url |
|
48 | + */ |
|
49 | + private $plugin_url; |
|
50 | + |
|
51 | + /** |
|
52 | + * @var string $asset_namespace |
|
53 | + */ |
|
54 | + private $asset_namespace; |
|
55 | + |
|
56 | + /** |
|
57 | + * @var string $assets_path |
|
58 | + */ |
|
59 | + private $assets_path; |
|
60 | + |
|
61 | + /** |
|
62 | + * @var bool |
|
63 | + */ |
|
64 | + protected $initialized = false; |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * Initializes internal properties. |
|
69 | + * |
|
70 | + * @param FilePath $plugin_file |
|
71 | + * @param Version $version |
|
72 | + * @param string $asset_namespace |
|
73 | + */ |
|
74 | + public function __construct(FilePath $plugin_file, Version $version, $asset_namespace = Domain::ASSET_NAMESPACE) |
|
75 | + { |
|
76 | + $this->plugin_file = $plugin_file; |
|
77 | + $this->version = $version; |
|
78 | + $this->initialize($asset_namespace); |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + /** |
|
83 | + * @param string $asset_namespace |
|
84 | + * @return void |
|
85 | + * @since $VID:$ |
|
86 | + */ |
|
87 | + public function initialize($asset_namespace = Domain::ASSET_NAMESPACE) |
|
88 | + { |
|
89 | + if (! $this->initialized) { |
|
90 | + $this->plugin_basename = plugin_basename($this->pluginFile()); |
|
91 | + $this->plugin_path = plugin_dir_path($this->pluginFile()); |
|
92 | + $this->plugin_url = plugin_dir_url($this->pluginFile()); |
|
93 | + $this->setAssetNamespace($asset_namespace); |
|
94 | + $this->setDistributionAssetsPath(); |
|
95 | + $this->initialized = true; |
|
96 | + } |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * @param string $asset_namespace |
|
102 | + * @return void |
|
103 | + */ |
|
104 | + public function setAssetNamespace($asset_namespace = Domain::ASSET_NAMESPACE) |
|
105 | + { |
|
106 | + if (! $this->asset_namespace) { |
|
107 | + $this->asset_namespace = sanitize_key( |
|
108 | + // convert directory separators to dashes and remove file extension |
|
109 | + str_replace(['/', '.php'], ['-', ''], $asset_namespace) |
|
110 | + ); |
|
111 | + } |
|
112 | + } |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * @throws DomainException |
|
117 | + * @since $VID:$ |
|
118 | + */ |
|
119 | + private function setDistributionAssetsPath() |
|
120 | + { |
|
121 | + $assets_folder_paths = [ |
|
122 | + $this->plugin_path . DomainBase::ASSETS_FOLDER, |
|
123 | + $this->plugin_path . 'src/' . DomainBase::ASSETS_FOLDER, |
|
124 | + ]; |
|
125 | + foreach ($assets_folder_paths as $assets_folder_path) { |
|
126 | + if (is_readable($assets_folder_path)) { |
|
127 | + $this->assets_path = trailingslashit($assets_folder_path); |
|
128 | + // once we find a valid path, just break out of loop |
|
129 | + break; |
|
130 | + } |
|
131 | + } |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * @return string |
|
137 | + */ |
|
138 | + public function pluginFile() |
|
139 | + { |
|
140 | + return (string) $this->plugin_file; |
|
141 | + } |
|
142 | + |
|
143 | + |
|
144 | + /** |
|
145 | + * @return string |
|
146 | + */ |
|
147 | + public function pluginBasename() |
|
148 | + { |
|
149 | + return $this->plugin_basename; |
|
150 | + } |
|
151 | + |
|
152 | + |
|
153 | + /** |
|
154 | + * @param string $additional_path |
|
155 | + * @return string |
|
156 | + */ |
|
157 | + public function pluginPath($additional_path = '') |
|
158 | + { |
|
159 | + return is_string($additional_path) && $additional_path !== '' |
|
160 | + ? $this->plugin_path . $additional_path |
|
161 | + : $this->plugin_path; |
|
162 | + } |
|
163 | + |
|
164 | + |
|
165 | + /** |
|
166 | + * @param string $additional_path |
|
167 | + * @return string |
|
168 | + */ |
|
169 | + public function pluginUrl($additional_path = '') |
|
170 | + { |
|
171 | + return is_string($additional_path) && $additional_path !== '' |
|
172 | + ? $this->plugin_url . $additional_path |
|
173 | + : $this->plugin_url; |
|
174 | + } |
|
175 | + |
|
176 | + |
|
177 | + /** |
|
178 | + * @return string |
|
179 | + */ |
|
180 | + public function version() |
|
181 | + { |
|
182 | + return (string) $this->version; |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + /** |
|
187 | + * @return Version |
|
188 | + */ |
|
189 | + public function versionValueObject() |
|
190 | + { |
|
191 | + return $this->version; |
|
192 | + } |
|
193 | + |
|
194 | + |
|
195 | + /** |
|
196 | + * @return string |
|
197 | + */ |
|
198 | + public function distributionAssetsFolder() |
|
199 | + { |
|
200 | + return DomainBase::ASSETS_FOLDER; |
|
201 | + } |
|
202 | + |
|
203 | + |
|
204 | + /** |
|
205 | + * @param string $additional_path |
|
206 | + * @return string |
|
207 | + */ |
|
208 | + public function distributionAssetsPath($additional_path = '') |
|
209 | + { |
|
210 | + return is_string($additional_path) && $additional_path !== '' |
|
211 | + ? $this->assets_path . $additional_path |
|
212 | + : $this->assets_path; |
|
213 | + } |
|
214 | + |
|
215 | + |
|
216 | + /** |
|
217 | + * @param string $additional_path |
|
218 | + * @return string |
|
219 | + */ |
|
220 | + public function distributionAssetsUrl($additional_path = '') |
|
221 | + { |
|
222 | + return is_string($additional_path) && $additional_path !== '' |
|
223 | + ? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path |
|
224 | + : $this->plugin_url . DomainBase::ASSETS_FOLDER; |
|
225 | + } |
|
226 | + |
|
227 | + |
|
228 | + /** |
|
229 | + * @return string |
|
230 | + */ |
|
231 | + public function assetNamespace() |
|
232 | + { |
|
233 | + return $this->asset_namespace; |
|
234 | + } |
|
235 | 235 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function initialize($asset_namespace = Domain::ASSET_NAMESPACE) |
88 | 88 | { |
89 | - if (! $this->initialized) { |
|
89 | + if ( ! $this->initialized) { |
|
90 | 90 | $this->plugin_basename = plugin_basename($this->pluginFile()); |
91 | 91 | $this->plugin_path = plugin_dir_path($this->pluginFile()); |
92 | 92 | $this->plugin_url = plugin_dir_url($this->pluginFile()); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function setAssetNamespace($asset_namespace = Domain::ASSET_NAMESPACE) |
105 | 105 | { |
106 | - if (! $this->asset_namespace) { |
|
106 | + if ( ! $this->asset_namespace) { |
|
107 | 107 | $this->asset_namespace = sanitize_key( |
108 | 108 | // convert directory separators to dashes and remove file extension |
109 | 109 | str_replace(['/', '.php'], ['-', ''], $asset_namespace) |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | private function setDistributionAssetsPath() |
120 | 120 | { |
121 | 121 | $assets_folder_paths = [ |
122 | - $this->plugin_path . DomainBase::ASSETS_FOLDER, |
|
123 | - $this->plugin_path . 'src/' . DomainBase::ASSETS_FOLDER, |
|
122 | + $this->plugin_path.DomainBase::ASSETS_FOLDER, |
|
123 | + $this->plugin_path.'src/'.DomainBase::ASSETS_FOLDER, |
|
124 | 124 | ]; |
125 | 125 | foreach ($assets_folder_paths as $assets_folder_path) { |
126 | 126 | if (is_readable($assets_folder_path)) { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | public function pluginPath($additional_path = '') |
158 | 158 | { |
159 | 159 | return is_string($additional_path) && $additional_path !== '' |
160 | - ? $this->plugin_path . $additional_path |
|
160 | + ? $this->plugin_path.$additional_path |
|
161 | 161 | : $this->plugin_path; |
162 | 162 | } |
163 | 163 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | public function pluginUrl($additional_path = '') |
170 | 170 | { |
171 | 171 | return is_string($additional_path) && $additional_path !== '' |
172 | - ? $this->plugin_url . $additional_path |
|
172 | + ? $this->plugin_url.$additional_path |
|
173 | 173 | : $this->plugin_url; |
174 | 174 | } |
175 | 175 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | public function distributionAssetsPath($additional_path = '') |
209 | 209 | { |
210 | 210 | return is_string($additional_path) && $additional_path !== '' |
211 | - ? $this->assets_path . $additional_path |
|
211 | + ? $this->assets_path.$additional_path |
|
212 | 212 | : $this->assets_path; |
213 | 213 | } |
214 | 214 | |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | public function distributionAssetsUrl($additional_path = '') |
221 | 221 | { |
222 | 222 | return is_string($additional_path) && $additional_path !== '' |
223 | - ? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path |
|
224 | - : $this->plugin_url . DomainBase::ASSETS_FOLDER; |
|
223 | + ? $this->plugin_url.DomainBase::ASSETS_FOLDER.$additional_path |
|
224 | + : $this->plugin_url.DomainBase::ASSETS_FOLDER; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 |