@@ -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 | } |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * @param int $TKT_ID ID of ticket to retrieve the datetimes for |
464 | 464 | * @param boolean $include_expired whether to include expired datetimes or not |
465 | 465 | * @param boolean $include_deleted whether to include trashed datetimes or not. |
466 | - * @param int|null $limit if null, no limit, if int then limit results by |
|
466 | + * @param integer $limit if null, no limit, if int then limit results by |
|
467 | 467 | * that number |
468 | 468 | * @return EE_Datetime[] |
469 | 469 | * @throws EE_Error |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | /** |
649 | 649 | * This returns an array of counts of datetimes in the database for each Datetime status that can be queried. |
650 | 650 | * |
651 | - * @param array $stati_to_include If included you can restrict the statuses we return counts for by including the |
|
651 | + * @param string[] $stati_to_include If included you can restrict the statuses we return counts for by including the |
|
652 | 652 | * stati you want counts for as values in the array. An empty array returns counts |
653 | 653 | * for all valid stati. |
654 | 654 | * @param array $query_params If included can be used to refine the conditions for returning the count (i.e. |
@@ -13,834 +13,834 @@ |
||
13 | 13 | class EEM_Datetime extends EEM_Soft_Delete_Base |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @var EEM_Datetime $_instance |
|
18 | - */ |
|
19 | - protected static $_instance; |
|
20 | - |
|
21 | - |
|
22 | - /** |
|
23 | - * private constructor to prevent direct creation |
|
24 | - * |
|
25 | - * @param string $timezone A string representing the timezone we want to set for returned Date Time Strings |
|
26 | - * (and any incoming timezone data that gets saved). |
|
27 | - * Note this just sends the timezone info to the date time model field objects. |
|
28 | - * Default is NULL |
|
29 | - * (and will be assumed using the set timezone in the 'timezone_string' wp option) |
|
30 | - * @throws EE_Error |
|
31 | - * @throws InvalidArgumentException |
|
32 | - * @throws InvalidArgumentException |
|
33 | - */ |
|
34 | - protected function __construct($timezone) |
|
35 | - { |
|
36 | - $this->singular_item = esc_html__('Datetime', 'event_espresso'); |
|
37 | - $this->plural_item = esc_html__('Datetimes', 'event_espresso'); |
|
38 | - $this->_tables = [ |
|
39 | - 'Datetime' => new EE_Primary_Table('esp_datetime', 'DTT_ID'), |
|
40 | - ]; |
|
41 | - $this->_fields = [ |
|
42 | - 'Datetime' => [ |
|
43 | - 'DTT_ID' => new EE_Primary_Key_Int_Field( |
|
44 | - 'DTT_ID', |
|
45 | - esc_html__('Datetime ID', 'event_espresso') |
|
46 | - ), |
|
47 | - 'EVT_ID' => new EE_Foreign_Key_Int_Field( |
|
48 | - 'EVT_ID', |
|
49 | - esc_html__('Event ID', 'event_espresso'), |
|
50 | - false, |
|
51 | - 0, |
|
52 | - 'Event' |
|
53 | - ), |
|
54 | - 'DTT_name' => new EE_Plain_Text_Field( |
|
55 | - 'DTT_name', |
|
56 | - esc_html__('Datetime Name', 'event_espresso'), |
|
57 | - false, |
|
58 | - '' |
|
59 | - ), |
|
60 | - 'DTT_description' => new EE_Post_Content_Field( |
|
61 | - 'DTT_description', |
|
62 | - esc_html__('Description for Datetime', 'event_espresso'), |
|
63 | - false, |
|
64 | - '' |
|
65 | - ), |
|
66 | - 'DTT_EVT_start' => new EE_Datetime_Field( |
|
67 | - 'DTT_EVT_start', |
|
68 | - esc_html__('Start time/date of Event', 'event_espresso'), |
|
69 | - false, |
|
70 | - EE_Datetime_Field::now, |
|
71 | - $timezone |
|
72 | - ), |
|
73 | - 'DTT_EVT_end' => new EE_Datetime_Field( |
|
74 | - 'DTT_EVT_end', |
|
75 | - esc_html__('End time/date of Event', 'event_espresso'), |
|
76 | - false, |
|
77 | - EE_Datetime_Field::now, |
|
78 | - $timezone |
|
79 | - ), |
|
80 | - 'DTT_reg_limit' => new EE_Infinite_Integer_Field( |
|
81 | - 'DTT_reg_limit', |
|
82 | - esc_html__('Registration Limit for this time', 'event_espresso'), |
|
83 | - true, |
|
84 | - EE_INF |
|
85 | - ), |
|
86 | - 'DTT_sold' => new EE_Integer_Field( |
|
87 | - 'DTT_sold', |
|
88 | - esc_html__('How many sales for this Datetime that have occurred', 'event_espresso'), |
|
89 | - true, |
|
90 | - 0 |
|
91 | - ), |
|
92 | - 'DTT_reserved' => new EE_Integer_Field( |
|
93 | - 'DTT_reserved', |
|
94 | - esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso'), |
|
95 | - false, |
|
96 | - 0 |
|
97 | - ), |
|
98 | - 'DTT_is_primary' => new EE_Boolean_Field( |
|
99 | - 'DTT_is_primary', |
|
100 | - esc_html__('Flag indicating datetime is primary one for event', 'event_espresso'), |
|
101 | - false, |
|
102 | - false |
|
103 | - ), |
|
104 | - 'DTT_order' => new EE_Integer_Field( |
|
105 | - 'DTT_order', |
|
106 | - esc_html__('The order in which the Datetime is displayed', 'event_espresso'), |
|
107 | - false, |
|
108 | - 0 |
|
109 | - ), |
|
110 | - 'DTT_parent' => new EE_Integer_Field( |
|
111 | - 'DTT_parent', |
|
112 | - esc_html__('Indicates what DTT_ID is the parent of this DTT_ID', 'event_espresso'), |
|
113 | - true, |
|
114 | - 0 |
|
115 | - ), |
|
116 | - 'DTT_deleted' => new EE_Trashed_Flag_Field( |
|
117 | - 'DTT_deleted', |
|
118 | - esc_html__('Flag indicating datetime is archived', 'event_espresso'), |
|
119 | - false, |
|
120 | - false |
|
121 | - ), |
|
122 | - ], |
|
123 | - ]; |
|
124 | - $this->_model_relations = [ |
|
125 | - 'Ticket' => new EE_HABTM_Relation('Datetime_Ticket'), |
|
126 | - 'Event' => new EE_Belongs_To_Relation(), |
|
127 | - 'Checkin' => new EE_Has_Many_Relation(), |
|
128 | - 'Datetime_Ticket' => new EE_Has_Many_Relation(), |
|
129 | - ]; |
|
130 | - $path_to_event_model = 'Event'; |
|
131 | - $this->model_chain_to_password = $path_to_event_model; |
|
132 | - $this->_model_chain_to_wp_user = $path_to_event_model; |
|
133 | - // this model is generally available for reading |
|
134 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = |
|
135 | - new EE_Restriction_Generator_Event_Related_Public( |
|
136 | - $path_to_event_model |
|
137 | - ); |
|
138 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = |
|
139 | - new EE_Restriction_Generator_Event_Related_Protected( |
|
140 | - $path_to_event_model |
|
141 | - ); |
|
142 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = |
|
143 | - new EE_Restriction_Generator_Event_Related_Protected( |
|
144 | - $path_to_event_model |
|
145 | - ); |
|
146 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = |
|
147 | - new EE_Restriction_Generator_Event_Related_Protected( |
|
148 | - $path_to_event_model, |
|
149 | - EEM_Base::caps_edit |
|
150 | - ); |
|
151 | - parent::__construct($timezone); |
|
152 | - } |
|
153 | - |
|
154 | - |
|
155 | - /** |
|
156 | - * create new blank datetime |
|
157 | - * |
|
158 | - * @access public |
|
159 | - * @return EE_Datetime[] array on success, FALSE on fail |
|
160 | - * @throws EE_Error |
|
161 | - * @throws InvalidArgumentException |
|
162 | - * @throws InvalidDataTypeException |
|
163 | - * @throws ReflectionException |
|
164 | - * @throws InvalidInterfaceException |
|
165 | - */ |
|
166 | - public function create_new_blank_datetime() |
|
167 | - { |
|
168 | - // makes sure timezone is always set. |
|
169 | - $timezone_string = $this->get_timezone(); |
|
170 | - /** |
|
171 | - * Filters the initial start date for the new datetime. |
|
172 | - * Any time included in this value will be overridden later so use additional filters to modify the time. |
|
173 | - * |
|
174 | - * @param int $start_date Unix timestamp representing now + 30 days in seconds. |
|
175 | - * @return int Unix timestamp |
|
176 | - */ |
|
177 | - $start_date = apply_filters( |
|
178 | - 'FHEE__EEM_Datetime__create_new_blank_datetime__start_date', |
|
179 | - $this->current_time_for_query('DTT_EVT_start', true) + MONTH_IN_SECONDS |
|
180 | - ); |
|
181 | - /** |
|
182 | - * Filters the initial end date for the new datetime. |
|
183 | - * Any time included in this value will be overridden later so use additional filters to modify the time. |
|
184 | - * |
|
185 | - * @param int $end_data Unix timestamp representing now + 30 days in seconds. |
|
186 | - * @return int Unix timestamp |
|
187 | - */ |
|
188 | - $end_date = apply_filters( |
|
189 | - 'FHEE__EEM_Datetime__create_new_blank_datetime__end_date', |
|
190 | - $this->current_time_for_query('DTT_EVT_end', true) + MONTH_IN_SECONDS |
|
191 | - ); |
|
192 | - $blank_datetime = EE_Datetime::new_instance( |
|
193 | - [ |
|
194 | - 'DTT_EVT_start' => $start_date, |
|
195 | - 'DTT_EVT_end' => $end_date, |
|
196 | - 'DTT_order' => 1, |
|
197 | - 'DTT_reg_limit' => EE_INF, |
|
198 | - ], |
|
199 | - $timezone_string |
|
200 | - ); |
|
201 | - /** |
|
202 | - * Filters the initial start time and format for the new EE_Datetime instance. |
|
203 | - * |
|
204 | - * @param array $start_time An array having size 2. First element is the time, second element is the time |
|
205 | - * format. |
|
206 | - * @return array |
|
207 | - */ |
|
208 | - $start_time = apply_filters( |
|
209 | - 'FHEE__EEM_Datetime__create_new_blank_datetime__start_time', |
|
210 | - ['8am', 'ga'] |
|
211 | - ); |
|
212 | - /** |
|
213 | - * Filters the initial end time and format for the new EE_Datetime instance. |
|
214 | - * |
|
215 | - * @param array $end_time An array having size 2. First element is the time, second element is the time |
|
216 | - * format |
|
217 | - * @return array |
|
218 | - */ |
|
219 | - $end_time = apply_filters( |
|
220 | - 'FHEE__EEM_Datetime__create_new_blank_datetime__end_time', |
|
221 | - ['5pm', 'ga'] |
|
222 | - ); |
|
223 | - $this->validateStartAndEndTimeForBlankDate($start_time, $end_time); |
|
224 | - $blank_datetime->set_start_time( |
|
225 | - $this->convert_datetime_for_query( |
|
226 | - 'DTT_EVT_start', |
|
227 | - $start_time[0], |
|
228 | - $start_time[1], |
|
229 | - $timezone_string |
|
230 | - ) |
|
231 | - ); |
|
232 | - $blank_datetime->set_end_time( |
|
233 | - $this->convert_datetime_for_query( |
|
234 | - 'DTT_EVT_end', |
|
235 | - $end_time[0], |
|
236 | - $end_time[1], |
|
237 | - $timezone_string |
|
238 | - ) |
|
239 | - ); |
|
240 | - return [$blank_datetime]; |
|
241 | - } |
|
242 | - |
|
243 | - |
|
244 | - /** |
|
245 | - * Validates whether the start_time and end_time are in the expected format. |
|
246 | - * |
|
247 | - * @param array $start_time |
|
248 | - * @param array $end_time |
|
249 | - * @throws InvalidArgumentException |
|
250 | - * @throws InvalidDataTypeException |
|
251 | - */ |
|
252 | - private function validateStartAndEndTimeForBlankDate(array $start_time, array $end_time) |
|
253 | - { |
|
254 | - if (! is_array($start_time)) { |
|
255 | - throw new InvalidDataTypeException('start_time', $start_time, 'array'); |
|
256 | - } |
|
257 | - if (! is_array($end_time)) { |
|
258 | - throw new InvalidDataTypeException('end_time', $end_time, 'array'); |
|
259 | - } |
|
260 | - if (count($start_time) !== 2) { |
|
261 | - throw new InvalidArgumentException( |
|
262 | - sprintf( |
|
263 | - 'The variable %1$s is expected to be an array with two elements. The first item in the ' |
|
264 | - . 'array should be a valid time string, the second item in the array should be a valid time format', |
|
265 | - '$start_time' |
|
266 | - ) |
|
267 | - ); |
|
268 | - } |
|
269 | - if (count($end_time) !== 2) { |
|
270 | - throw new InvalidArgumentException( |
|
271 | - sprintf( |
|
272 | - 'The variable %1$s is expected to be an array with two elements. The first item in the ' |
|
273 | - . 'array should be a valid time string, the second item in the array should be a valid time format', |
|
274 | - '$end_time' |
|
275 | - ) |
|
276 | - ); |
|
277 | - } |
|
278 | - } |
|
279 | - |
|
280 | - |
|
281 | - /** |
|
282 | - * get event start date from db |
|
283 | - * |
|
284 | - * @access public |
|
285 | - * @param int $EVT_ID |
|
286 | - * @return EE_Datetime[] array on success, FALSE on fail |
|
287 | - * @throws EE_Error |
|
288 | - * @throws ReflectionException |
|
289 | - */ |
|
290 | - public function get_all_event_dates($EVT_ID = 0) |
|
291 | - { |
|
292 | - if (! $EVT_ID) { // on add_new_event event_id gets set to 0 |
|
293 | - return $this->create_new_blank_datetime(); |
|
294 | - } |
|
295 | - $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
296 | - if (empty($results)) { |
|
297 | - return $this->create_new_blank_datetime(); |
|
298 | - } |
|
299 | - return $results; |
|
300 | - } |
|
301 | - |
|
302 | - |
|
303 | - /** |
|
304 | - * get all datetimes attached to an event ordered by the DTT_order field |
|
305 | - * |
|
306 | - * @public |
|
307 | - * @param int $EVT_ID event id |
|
308 | - * @param boolean $include_expired |
|
309 | - * @param boolean $include_deleted |
|
310 | - * @param int $limit If included then limit the count of results by |
|
311 | - * the given number |
|
312 | - * @return EE_Datetime[] |
|
313 | - * @throws EE_Error |
|
314 | - */ |
|
315 | - public function get_datetimes_for_event_ordered_by_DTT_order( |
|
316 | - int $EVT_ID, |
|
317 | - bool $include_expired = true, |
|
318 | - bool $include_deleted = true, |
|
319 | - $limit = 0 |
|
320 | - ) { |
|
321 | - $prev_data_prep_value = $this->prepModelForQuery(); |
|
322 | - $where_params = ['Event.EVT_ID' => absint($EVT_ID)]; |
|
323 | - $query_params[0] = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired); |
|
324 | - $query_params = $this->addDefaultWhereConditions($query_params); |
|
325 | - $query_params = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order'); |
|
326 | - return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value); |
|
327 | - } |
|
328 | - |
|
329 | - |
|
330 | - /** |
|
331 | - * Gets the datetimes for the event (with the given limit), and orders them by "importance". |
|
332 | - * By importance, we mean that the primary datetimes are most important (DEPRECATED FOR NOW), |
|
333 | - * and then the earlier datetimes are the most important. |
|
334 | - * Maybe we'll want this to take into account datetimes that haven't already passed, but we don't yet. |
|
335 | - * |
|
336 | - * @param int $EVT_ID |
|
337 | - * @param int $limit |
|
338 | - * @return EE_Datetime[]|EE_Base_Class[] |
|
339 | - * @throws EE_Error |
|
340 | - */ |
|
341 | - public function get_datetimes_for_event_ordered_by_importance(int $EVT_ID, $limit = 0) |
|
342 | - { |
|
343 | - $query_params[0] = ['Event.EVT_ID' => absint($EVT_ID)]; |
|
344 | - $query_params = $this->addDefaultWhereConditions($query_params); |
|
345 | - $query_params = $this->addDefaultQueryParams($query_params, $limit); |
|
346 | - return $this->get_all($query_params); |
|
347 | - } |
|
348 | - |
|
349 | - |
|
350 | - /** |
|
351 | - * @param int $EVT_ID |
|
352 | - * @param boolean $include_expired |
|
353 | - * @param boolean $include_deleted |
|
354 | - * @return EE_Datetime |
|
355 | - * @throws EE_Error |
|
356 | - */ |
|
357 | - public function get_oldest_datetime_for_event( |
|
358 | - int $EVT_ID, |
|
359 | - bool $include_expired = false, |
|
360 | - bool $include_deleted = false |
|
361 | - ) { |
|
362 | - $results = $this->get_datetimes_for_event_ordered_by_start_time( |
|
363 | - $EVT_ID, |
|
364 | - $include_expired, |
|
365 | - $include_deleted, |
|
366 | - 1 |
|
367 | - ); |
|
368 | - if ($results) { |
|
369 | - return array_shift($results); |
|
370 | - } |
|
371 | - return null; |
|
372 | - } |
|
373 | - |
|
374 | - |
|
375 | - /** |
|
376 | - * Gets the 'primary' datetime for an event. |
|
377 | - * |
|
378 | - * @param int $EVT_ID |
|
379 | - * @param bool $try_to_exclude_expired |
|
380 | - * @param bool $try_to_exclude_deleted |
|
381 | - * @return EE_Datetime |
|
382 | - * @throws EE_Error |
|
383 | - */ |
|
384 | - public function get_primary_datetime_for_event( |
|
385 | - int $EVT_ID, |
|
386 | - bool $try_to_exclude_expired = true, |
|
387 | - bool $try_to_exclude_deleted = true |
|
388 | - ) { |
|
389 | - if ($try_to_exclude_expired) { |
|
390 | - $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false); |
|
391 | - if ($non_expired) { |
|
392 | - return $non_expired; |
|
393 | - } |
|
394 | - } |
|
395 | - if ($try_to_exclude_deleted) { |
|
396 | - $expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true); |
|
397 | - if ($expired_even) { |
|
398 | - return $expired_even; |
|
399 | - } |
|
400 | - } |
|
401 | - return $this->get_oldest_datetime_for_event($EVT_ID, true, true); |
|
402 | - } |
|
403 | - |
|
404 | - |
|
405 | - /** |
|
406 | - * Gets ALL the datetimes for an event (including trashed ones, for now), ordered |
|
407 | - * only by start date |
|
408 | - * |
|
409 | - * @param int $EVT_ID |
|
410 | - * @param boolean $include_expired |
|
411 | - * @param boolean $include_deleted |
|
412 | - * @param int $limit |
|
413 | - * @return EE_Datetime[] |
|
414 | - * @throws EE_Error |
|
415 | - */ |
|
416 | - public function get_datetimes_for_event_ordered_by_start_time( |
|
417 | - int $EVT_ID, |
|
418 | - bool $include_expired = true, |
|
419 | - bool $include_deleted = true, |
|
420 | - $limit = 0 |
|
421 | - ) { |
|
422 | - $prev_data_prep_value = $this->prepModelForQuery(); |
|
423 | - $where_params = ['Event.EVT_ID' => absint($EVT_ID)]; |
|
424 | - $query_params[0] = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired); |
|
425 | - $query_params = $this->addDefaultWhereConditions( |
|
426 | - $query_params, |
|
427 | - EEM_Base::default_where_conditions_this_only |
|
428 | - ); |
|
429 | - $query_params = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order'); |
|
430 | - return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value); |
|
431 | - } |
|
432 | - |
|
433 | - |
|
434 | - /** |
|
435 | - * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered |
|
436 | - * only by start date |
|
437 | - * |
|
438 | - * @param int $TKT_ID |
|
439 | - * @param boolean $include_expired |
|
440 | - * @param boolean $include_deleted |
|
441 | - * @param int $limit |
|
442 | - * @return EE_Datetime[] |
|
443 | - * @throws EE_Error |
|
444 | - */ |
|
445 | - public function get_datetimes_for_ticket_ordered_by_start_time( |
|
446 | - int $TKT_ID, |
|
447 | - bool $include_expired = true, |
|
448 | - bool $include_deleted = true, |
|
449 | - $limit = 0 |
|
450 | - ) { |
|
451 | - $prev_data_prep_value = $this->prepModelForQuery(); |
|
452 | - $where_params = ['Ticket.TKT_ID' => absint($TKT_ID)]; |
|
453 | - $query_params[0] = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired); |
|
454 | - $query_params = $this->addDefaultQueryParams($query_params, $limit); |
|
455 | - return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value); |
|
456 | - } |
|
457 | - |
|
458 | - |
|
459 | - /** |
|
460 | - * Gets all the datetimes for a ticket (including trashed ones, for now), ordered by the DTT_order for the |
|
461 | - * datetimes. |
|
462 | - * |
|
463 | - * @param int $TKT_ID ID of ticket to retrieve the datetimes for |
|
464 | - * @param boolean $include_expired whether to include expired datetimes or not |
|
465 | - * @param boolean $include_deleted whether to include trashed datetimes or not. |
|
466 | - * @param int|null $limit if null, no limit, if int then limit results by |
|
467 | - * that number |
|
468 | - * @return EE_Datetime[] |
|
469 | - * @throws EE_Error |
|
470 | - */ |
|
471 | - public function get_datetimes_for_ticket_ordered_by_DTT_order( |
|
472 | - int $TKT_ID, |
|
473 | - bool $include_expired = true, |
|
474 | - bool $include_deleted = true, |
|
475 | - $limit = 0 |
|
476 | - ) { |
|
477 | - $prev_data_prep_value = $this->prepModelForQuery(); |
|
478 | - $where_params = ['Ticket.TKT_ID' => absint($TKT_ID)]; |
|
479 | - $query_params[0] = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired); |
|
480 | - $query_params = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order'); |
|
481 | - return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value); |
|
482 | - } |
|
483 | - |
|
484 | - |
|
485 | - /** |
|
486 | - * Gets the most important datetime for a particular event (ie, the primary event usually. But if for some WACK |
|
487 | - * reason it doesn't exist, we consider the earliest event the most important) |
|
488 | - * |
|
489 | - * @param int $EVT_ID |
|
490 | - * @return EE_Datetime |
|
491 | - * @throws EE_Error |
|
492 | - */ |
|
493 | - public function get_most_important_datetime_for_event(int $EVT_ID) |
|
494 | - { |
|
495 | - $results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1); |
|
496 | - if ($results) { |
|
497 | - return array_shift($results); |
|
498 | - } |
|
499 | - return null; |
|
500 | - } |
|
501 | - |
|
502 | - |
|
503 | - /** |
|
504 | - * This returns a wpdb->results Array of all DTT month and years matching the incoming query params and |
|
505 | - * grouped by month and year. |
|
506 | - * |
|
507 | - * @param array $where_params @see |
|
508 | - * https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md#0-where-conditions |
|
509 | - * @param string $evt_active_status A string representing the evt active status to filter the months by. |
|
510 | - * Can be: |
|
511 | - * - '' = no filter |
|
512 | - * - upcoming = Published events with at least one upcoming datetime. |
|
513 | - * - expired = Events with all datetimes expired. |
|
514 | - * - active = Events that are published and have at least one datetime that |
|
515 | - * starts before now and ends after now. |
|
516 | - * - inactive = Events that are either not published. |
|
517 | - * @return EE_Base_Class[] |
|
518 | - * @throws EE_Error |
|
519 | - * @throws InvalidArgumentException |
|
520 | - * @throws InvalidArgumentException |
|
521 | - */ |
|
522 | - public function get_dtt_months_and_years(array $where_params, $evt_active_status = '') |
|
523 | - { |
|
524 | - $current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start'); |
|
525 | - $current_time_for_DTT_EVT_end = $this->current_time_for_query('DTT_EVT_end'); |
|
526 | - switch ($evt_active_status) { |
|
527 | - case 'upcoming': |
|
528 | - $where_params['Event.status'] = 'publish'; |
|
529 | - // if there are already query_params matching DTT_EVT_start then we need to modify that to add them. |
|
530 | - if (isset($where_params['DTT_EVT_start'])) { |
|
531 | - $where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start']; |
|
532 | - } |
|
533 | - $where_params['DTT_EVT_start'] = ['>', $current_time_for_DTT_EVT_start]; |
|
534 | - break; |
|
535 | - case 'expired': |
|
536 | - if (isset($where_params['Event.status'])) { |
|
537 | - unset($where_params['Event.status']); |
|
538 | - } |
|
539 | - // get events to exclude |
|
540 | - $exclude_query[0] = array_merge( |
|
541 | - $where_params, |
|
542 | - ['DTT_EVT_end' => ['>', $current_time_for_DTT_EVT_end]] |
|
543 | - ); |
|
544 | - // first get all events that have datetimes where its not expired. |
|
545 | - $event_ids = $this->_get_all_wpdb_results( |
|
546 | - $exclude_query, |
|
547 | - OBJECT_K, |
|
548 | - 'Datetime.EVT_ID' |
|
549 | - ); |
|
550 | - $event_ids = array_keys($event_ids); |
|
551 | - if (isset($where_params['DTT_EVT_end'])) { |
|
552 | - $where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
|
553 | - } |
|
554 | - $where_params['DTT_EVT_end'] = ['<', $current_time_for_DTT_EVT_end]; |
|
555 | - $where_params['Event.EVT_ID'] = ['NOT IN', $event_ids]; |
|
556 | - break; |
|
557 | - case 'active': |
|
558 | - $where_params['Event.status'] = 'publish'; |
|
559 | - if (isset($where_params['DTT_EVT_start'])) { |
|
560 | - $where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start']; |
|
561 | - } |
|
562 | - if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
563 | - $where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end']; |
|
564 | - } |
|
565 | - $where_params['DTT_EVT_start'] = ['<', $current_time_for_DTT_EVT_start]; |
|
566 | - $where_params['DTT_EVT_end'] = ['>', $current_time_for_DTT_EVT_end]; |
|
567 | - break; |
|
568 | - case 'inactive': |
|
569 | - if (isset($where_params['Event.status'])) { |
|
570 | - unset($where_params['Event.status']); |
|
571 | - } |
|
572 | - if (isset($where_params['OR'])) { |
|
573 | - $where_params['AND']['OR'] = $where_params['OR']; |
|
574 | - } |
|
575 | - if (isset($where_params['DTT_EVT_end'])) { |
|
576 | - $where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
|
577 | - unset($where_params['DTT_EVT_end']); |
|
578 | - } |
|
579 | - if (isset($where_params['DTT_EVT_start'])) { |
|
580 | - $where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start']; |
|
581 | - unset($where_params['DTT_EVT_start']); |
|
582 | - } |
|
583 | - $where_params['AND']['Event.status'] = ['!=', 'publish']; |
|
584 | - break; |
|
585 | - } |
|
586 | - $query_params[0] = $where_params; |
|
587 | - $query_params['group_by'] = ['dtt_year', 'dtt_month']; |
|
588 | - $query_params = $this->addOrderByQueryParams($query_params, 'DTT_EVT_start', 'DESC'); |
|
589 | - |
|
590 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( |
|
591 | - $this->get_timezone(), |
|
592 | - 'DTT_EVT_start' |
|
593 | - ); |
|
594 | - $columns_to_select = [ |
|
595 | - 'dtt_year' => ['YEAR(' . $query_interval . ')', '%s'], |
|
596 | - 'dtt_month' => ['MONTHNAME(' . $query_interval . ')', '%s'], |
|
597 | - 'dtt_month_num' => ['MONTH(' . $query_interval . ')', '%s'], |
|
598 | - ]; |
|
599 | - return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
600 | - } |
|
601 | - |
|
602 | - |
|
603 | - /** |
|
604 | - * Updates the DTT_sold attribute on each datetime (based on the registrations |
|
605 | - * for the tickets for each datetime) |
|
606 | - * |
|
607 | - * @param EE_Base_Class[]|EE_Datetime[] $datetimes |
|
608 | - * @throws EE_Error |
|
609 | - * @throws ReflectionException |
|
610 | - */ |
|
611 | - public function update_sold(array $datetimes) |
|
612 | - { |
|
613 | - EE_Error::doing_it_wrong( |
|
614 | - __FUNCTION__, |
|
615 | - esc_html__( |
|
616 | - 'Please use \EEM_Ticket::update_tickets_sold() instead which will in turn correctly update both the Ticket AND Datetime counts.', |
|
617 | - 'event_espresso' |
|
618 | - ), |
|
619 | - '4.9.32.rc.005' |
|
620 | - ); |
|
621 | - foreach ($datetimes as $datetime) { |
|
622 | - $datetime->update_sold(); |
|
623 | - } |
|
624 | - } |
|
625 | - |
|
626 | - |
|
627 | - /** |
|
628 | - * Gets the total number of tickets available at a particular datetime |
|
629 | - * (does NOT take into account the datetime's spaces available) |
|
630 | - * |
|
631 | - * @param int $DTT_ID |
|
632 | - * @param array $query_params |
|
633 | - * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF, IF there are NO |
|
634 | - * tickets attached to datetime then FALSE is returned. |
|
635 | - * @throws EE_Error |
|
636 | - * @throws ReflectionException |
|
637 | - */ |
|
638 | - public function sum_tickets_currently_available_at_datetime(int $DTT_ID, array $query_params = []) |
|
639 | - { |
|
640 | - $datetime = $this->get_one_by_ID($DTT_ID); |
|
641 | - if ($datetime instanceof EE_Datetime) { |
|
642 | - return $datetime->tickets_remaining($query_params); |
|
643 | - } |
|
644 | - return 0; |
|
645 | - } |
|
646 | - |
|
647 | - |
|
648 | - /** |
|
649 | - * This returns an array of counts of datetimes in the database for each Datetime status that can be queried. |
|
650 | - * |
|
651 | - * @param array $stati_to_include If included you can restrict the statuses we return counts for by including the |
|
652 | - * stati you want counts for as values in the array. An empty array returns counts |
|
653 | - * for all valid stati. |
|
654 | - * @param array $query_params If included can be used to refine the conditions for returning the count (i.e. |
|
655 | - * only for Datetimes connected to a specific event, or specific ticket. |
|
656 | - * @return array The value returned is an array indexed by Datetime Status and the values are the counts. The |
|
657 | - * @throws EE_Error |
|
658 | - * stati used as index keys are: EE_Datetime::active EE_Datetime::upcoming |
|
659 | - * EE_Datetime::expired |
|
660 | - */ |
|
661 | - public function get_datetime_counts_by_status(array $stati_to_include = [], array $query_params = []) |
|
662 | - { |
|
663 | - // only accept where conditions for this query. |
|
664 | - $_where = isset($query_params[0]) ? $query_params[0] : []; |
|
665 | - $status_query_args = [ |
|
666 | - EE_Datetime::active => array_merge( |
|
667 | - $_where, |
|
668 | - ['DTT_EVT_start' => ['<', time()], 'DTT_EVT_end' => ['>', time()]] |
|
669 | - ), |
|
670 | - EE_Datetime::upcoming => array_merge( |
|
671 | - $_where, |
|
672 | - ['DTT_EVT_start' => ['>', time()]] |
|
673 | - ), |
|
674 | - EE_Datetime::expired => array_merge( |
|
675 | - $_where, |
|
676 | - ['DTT_EVT_end' => ['<', time()]] |
|
677 | - ), |
|
678 | - ]; |
|
679 | - if (! empty($stati_to_include)) { |
|
680 | - foreach (array_keys($status_query_args) as $status) { |
|
681 | - if (! in_array($status, $stati_to_include, true)) { |
|
682 | - unset($status_query_args[ $status ]); |
|
683 | - } |
|
684 | - } |
|
685 | - } |
|
686 | - // loop through and query counts for each stati. |
|
687 | - $status_query_results = []; |
|
688 | - foreach ($status_query_args as $status => $status_where_conditions) { |
|
689 | - $status_query_results[ $status ] = EEM_Datetime::count( |
|
690 | - [$status_where_conditions], |
|
691 | - 'DTT_ID', |
|
692 | - true |
|
693 | - ); |
|
694 | - } |
|
695 | - return $status_query_results; |
|
696 | - } |
|
697 | - |
|
698 | - |
|
699 | - /** |
|
700 | - * Returns the specific count for a given Datetime status matching any given query_params. |
|
701 | - * |
|
702 | - * @param string $status Valid string representation for Datetime status requested. (Defaults to Active). |
|
703 | - * @param array $query_params |
|
704 | - * @return int |
|
705 | - * @throws EE_Error |
|
706 | - */ |
|
707 | - public function get_datetime_count_for_status($status = EE_Datetime::active, array $query_params = []) |
|
708 | - { |
|
709 | - $count = $this->get_datetime_counts_by_status([$status], $query_params); |
|
710 | - return ! empty($count[ $status ]) ? $count[ $status ] : 0; |
|
711 | - } |
|
712 | - |
|
713 | - |
|
714 | - /** |
|
715 | - * @return bool|int |
|
716 | - * @since $VID:$ |
|
717 | - */ |
|
718 | - private function prepModelForQuery() |
|
719 | - { |
|
720 | - $prev_data_prep_value = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
|
721 | - $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
722 | - return $prev_data_prep_value; |
|
723 | - } |
|
724 | - |
|
725 | - |
|
726 | - /** |
|
727 | - * @param array $query_params |
|
728 | - * @param bool|int $prev_data_prep_value |
|
729 | - * @return EE_Base_Class[]|EE_Datetime[] |
|
730 | - * @throws EE_Error |
|
731 | - * @since $VID:$ |
|
732 | - */ |
|
733 | - private function getDatetimesAndRestoreModel(array $query_params, $prev_data_prep_value) |
|
734 | - { |
|
735 | - $result = $this->get_all($query_params); |
|
736 | - $this->assume_values_already_prepared_by_model_object($prev_data_prep_value); |
|
737 | - return $result; |
|
738 | - } |
|
739 | - |
|
740 | - |
|
741 | - /** |
|
742 | - * @param array $query_params |
|
743 | - * @param int $limit |
|
744 | - * @param string $order_by |
|
745 | - * @param string $order |
|
746 | - * @return array |
|
747 | - * @since $VID:$ |
|
748 | - */ |
|
749 | - private function addDefaultQueryParams(array $query_params, $limit = 0, $order_by = 'DTT_EVT_start', $order = 'ASC') |
|
750 | - { |
|
751 | - $query_params = $this->addOrderByQueryParams($query_params, $order_by, $order); |
|
752 | - $query_params = $this->addLimitQueryParams($query_params, $limit); |
|
753 | - return $query_params; |
|
754 | - } |
|
755 | - |
|
756 | - |
|
757 | - /** |
|
758 | - * @param array $query_params |
|
759 | - * @param string $default_where_conditions |
|
760 | - * @return array |
|
761 | - * @since $VID:$ |
|
762 | - */ |
|
763 | - private function addDefaultWhereConditions( |
|
764 | - array $query_params, |
|
765 | - $default_where_conditions = EEM_Base::default_where_conditions_none |
|
766 | - ) { |
|
767 | - $query_params['default_where_conditions'] = $default_where_conditions; |
|
768 | - return $query_params; |
|
769 | - } |
|
770 | - |
|
771 | - |
|
772 | - /** |
|
773 | - * @param array $where_params |
|
774 | - * @param bool $include_deleted |
|
775 | - * @param bool $include_expired |
|
776 | - * @return array |
|
777 | - * @since $VID:$ |
|
778 | - */ |
|
779 | - private function addDefaultWhereParams(array $where_params, bool $include_deleted = true, bool $include_expired = true) |
|
780 | - { |
|
781 | - $where_params = $this->addExpiredWhereParams($where_params, $include_expired); |
|
782 | - $where_params = $this->addDeletedWhereParams($where_params, $include_deleted); |
|
783 | - return $where_params; |
|
784 | - } |
|
785 | - |
|
786 | - |
|
787 | - /** |
|
788 | - * @param array $where_params |
|
789 | - * @param bool $include_deleted |
|
790 | - * @return array |
|
791 | - * @since $VID:$ |
|
792 | - */ |
|
793 | - private function addDeletedWhereParams(array $where_params, bool $include_deleted = true) |
|
794 | - { |
|
795 | - $deleted = $include_deleted ? [true, false] : [false]; |
|
796 | - $where_params['DTT_deleted'] = ['IN', $deleted]; |
|
797 | - return $where_params; |
|
798 | - } |
|
799 | - |
|
800 | - |
|
801 | - /** |
|
802 | - * @param array $where_params |
|
803 | - * @param bool $include_expired |
|
804 | - * @return array |
|
805 | - * @since $VID:$ |
|
806 | - */ |
|
807 | - private function addExpiredWhereParams(array $where_params, bool $include_expired = true) |
|
808 | - { |
|
809 | - if (! $include_expired) { |
|
810 | - $where_params['DTT_EVT_end'] = ['>=', current_time('mysql', true)]; |
|
811 | - } |
|
812 | - return $where_params; |
|
813 | - } |
|
814 | - |
|
815 | - |
|
816 | - /** |
|
817 | - * @param array $query_params |
|
818 | - * @param int $limit |
|
819 | - * @return array |
|
820 | - * @since $VID:$ |
|
821 | - */ |
|
822 | - private function addLimitQueryParams(array $query_params, $limit = 0) |
|
823 | - { |
|
824 | - if ($limit) { |
|
825 | - $query_params['limit'] = $limit; |
|
826 | - } |
|
827 | - return $query_params; |
|
828 | - } |
|
829 | - |
|
830 | - |
|
831 | - /** |
|
832 | - * @param array $query_params |
|
833 | - * @param string $order_by |
|
834 | - * @param string $order |
|
835 | - * @return array |
|
836 | - * @since $VID:$ |
|
837 | - */ |
|
838 | - private function addOrderByQueryParams(array $query_params, $order_by = 'DTT_EVT_start', $order = 'ASC') |
|
839 | - { |
|
840 | - $order = $order === 'ASC' ? 'ASC' : 'DESC'; |
|
841 | - $valid_order_columns = ['DTT_ID', 'DTT_EVT_start', 'DTT_EVT_end', 'DTT_order']; |
|
842 | - $order_by = in_array($order_by, $valid_order_columns, true) ? $order_by : 'DTT_EVT_start'; |
|
843 | - $query_params['order_by'] = [$order_by => $order]; |
|
844 | - return $query_params; |
|
845 | - } |
|
16 | + /** |
|
17 | + * @var EEM_Datetime $_instance |
|
18 | + */ |
|
19 | + protected static $_instance; |
|
20 | + |
|
21 | + |
|
22 | + /** |
|
23 | + * private constructor to prevent direct creation |
|
24 | + * |
|
25 | + * @param string $timezone A string representing the timezone we want to set for returned Date Time Strings |
|
26 | + * (and any incoming timezone data that gets saved). |
|
27 | + * Note this just sends the timezone info to the date time model field objects. |
|
28 | + * Default is NULL |
|
29 | + * (and will be assumed using the set timezone in the 'timezone_string' wp option) |
|
30 | + * @throws EE_Error |
|
31 | + * @throws InvalidArgumentException |
|
32 | + * @throws InvalidArgumentException |
|
33 | + */ |
|
34 | + protected function __construct($timezone) |
|
35 | + { |
|
36 | + $this->singular_item = esc_html__('Datetime', 'event_espresso'); |
|
37 | + $this->plural_item = esc_html__('Datetimes', 'event_espresso'); |
|
38 | + $this->_tables = [ |
|
39 | + 'Datetime' => new EE_Primary_Table('esp_datetime', 'DTT_ID'), |
|
40 | + ]; |
|
41 | + $this->_fields = [ |
|
42 | + 'Datetime' => [ |
|
43 | + 'DTT_ID' => new EE_Primary_Key_Int_Field( |
|
44 | + 'DTT_ID', |
|
45 | + esc_html__('Datetime ID', 'event_espresso') |
|
46 | + ), |
|
47 | + 'EVT_ID' => new EE_Foreign_Key_Int_Field( |
|
48 | + 'EVT_ID', |
|
49 | + esc_html__('Event ID', 'event_espresso'), |
|
50 | + false, |
|
51 | + 0, |
|
52 | + 'Event' |
|
53 | + ), |
|
54 | + 'DTT_name' => new EE_Plain_Text_Field( |
|
55 | + 'DTT_name', |
|
56 | + esc_html__('Datetime Name', 'event_espresso'), |
|
57 | + false, |
|
58 | + '' |
|
59 | + ), |
|
60 | + 'DTT_description' => new EE_Post_Content_Field( |
|
61 | + 'DTT_description', |
|
62 | + esc_html__('Description for Datetime', 'event_espresso'), |
|
63 | + false, |
|
64 | + '' |
|
65 | + ), |
|
66 | + 'DTT_EVT_start' => new EE_Datetime_Field( |
|
67 | + 'DTT_EVT_start', |
|
68 | + esc_html__('Start time/date of Event', 'event_espresso'), |
|
69 | + false, |
|
70 | + EE_Datetime_Field::now, |
|
71 | + $timezone |
|
72 | + ), |
|
73 | + 'DTT_EVT_end' => new EE_Datetime_Field( |
|
74 | + 'DTT_EVT_end', |
|
75 | + esc_html__('End time/date of Event', 'event_espresso'), |
|
76 | + false, |
|
77 | + EE_Datetime_Field::now, |
|
78 | + $timezone |
|
79 | + ), |
|
80 | + 'DTT_reg_limit' => new EE_Infinite_Integer_Field( |
|
81 | + 'DTT_reg_limit', |
|
82 | + esc_html__('Registration Limit for this time', 'event_espresso'), |
|
83 | + true, |
|
84 | + EE_INF |
|
85 | + ), |
|
86 | + 'DTT_sold' => new EE_Integer_Field( |
|
87 | + 'DTT_sold', |
|
88 | + esc_html__('How many sales for this Datetime that have occurred', 'event_espresso'), |
|
89 | + true, |
|
90 | + 0 |
|
91 | + ), |
|
92 | + 'DTT_reserved' => new EE_Integer_Field( |
|
93 | + 'DTT_reserved', |
|
94 | + esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso'), |
|
95 | + false, |
|
96 | + 0 |
|
97 | + ), |
|
98 | + 'DTT_is_primary' => new EE_Boolean_Field( |
|
99 | + 'DTT_is_primary', |
|
100 | + esc_html__('Flag indicating datetime is primary one for event', 'event_espresso'), |
|
101 | + false, |
|
102 | + false |
|
103 | + ), |
|
104 | + 'DTT_order' => new EE_Integer_Field( |
|
105 | + 'DTT_order', |
|
106 | + esc_html__('The order in which the Datetime is displayed', 'event_espresso'), |
|
107 | + false, |
|
108 | + 0 |
|
109 | + ), |
|
110 | + 'DTT_parent' => new EE_Integer_Field( |
|
111 | + 'DTT_parent', |
|
112 | + esc_html__('Indicates what DTT_ID is the parent of this DTT_ID', 'event_espresso'), |
|
113 | + true, |
|
114 | + 0 |
|
115 | + ), |
|
116 | + 'DTT_deleted' => new EE_Trashed_Flag_Field( |
|
117 | + 'DTT_deleted', |
|
118 | + esc_html__('Flag indicating datetime is archived', 'event_espresso'), |
|
119 | + false, |
|
120 | + false |
|
121 | + ), |
|
122 | + ], |
|
123 | + ]; |
|
124 | + $this->_model_relations = [ |
|
125 | + 'Ticket' => new EE_HABTM_Relation('Datetime_Ticket'), |
|
126 | + 'Event' => new EE_Belongs_To_Relation(), |
|
127 | + 'Checkin' => new EE_Has_Many_Relation(), |
|
128 | + 'Datetime_Ticket' => new EE_Has_Many_Relation(), |
|
129 | + ]; |
|
130 | + $path_to_event_model = 'Event'; |
|
131 | + $this->model_chain_to_password = $path_to_event_model; |
|
132 | + $this->_model_chain_to_wp_user = $path_to_event_model; |
|
133 | + // this model is generally available for reading |
|
134 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = |
|
135 | + new EE_Restriction_Generator_Event_Related_Public( |
|
136 | + $path_to_event_model |
|
137 | + ); |
|
138 | + $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = |
|
139 | + new EE_Restriction_Generator_Event_Related_Protected( |
|
140 | + $path_to_event_model |
|
141 | + ); |
|
142 | + $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = |
|
143 | + new EE_Restriction_Generator_Event_Related_Protected( |
|
144 | + $path_to_event_model |
|
145 | + ); |
|
146 | + $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = |
|
147 | + new EE_Restriction_Generator_Event_Related_Protected( |
|
148 | + $path_to_event_model, |
|
149 | + EEM_Base::caps_edit |
|
150 | + ); |
|
151 | + parent::__construct($timezone); |
|
152 | + } |
|
153 | + |
|
154 | + |
|
155 | + /** |
|
156 | + * create new blank datetime |
|
157 | + * |
|
158 | + * @access public |
|
159 | + * @return EE_Datetime[] array on success, FALSE on fail |
|
160 | + * @throws EE_Error |
|
161 | + * @throws InvalidArgumentException |
|
162 | + * @throws InvalidDataTypeException |
|
163 | + * @throws ReflectionException |
|
164 | + * @throws InvalidInterfaceException |
|
165 | + */ |
|
166 | + public function create_new_blank_datetime() |
|
167 | + { |
|
168 | + // makes sure timezone is always set. |
|
169 | + $timezone_string = $this->get_timezone(); |
|
170 | + /** |
|
171 | + * Filters the initial start date for the new datetime. |
|
172 | + * Any time included in this value will be overridden later so use additional filters to modify the time. |
|
173 | + * |
|
174 | + * @param int $start_date Unix timestamp representing now + 30 days in seconds. |
|
175 | + * @return int Unix timestamp |
|
176 | + */ |
|
177 | + $start_date = apply_filters( |
|
178 | + 'FHEE__EEM_Datetime__create_new_blank_datetime__start_date', |
|
179 | + $this->current_time_for_query('DTT_EVT_start', true) + MONTH_IN_SECONDS |
|
180 | + ); |
|
181 | + /** |
|
182 | + * Filters the initial end date for the new datetime. |
|
183 | + * Any time included in this value will be overridden later so use additional filters to modify the time. |
|
184 | + * |
|
185 | + * @param int $end_data Unix timestamp representing now + 30 days in seconds. |
|
186 | + * @return int Unix timestamp |
|
187 | + */ |
|
188 | + $end_date = apply_filters( |
|
189 | + 'FHEE__EEM_Datetime__create_new_blank_datetime__end_date', |
|
190 | + $this->current_time_for_query('DTT_EVT_end', true) + MONTH_IN_SECONDS |
|
191 | + ); |
|
192 | + $blank_datetime = EE_Datetime::new_instance( |
|
193 | + [ |
|
194 | + 'DTT_EVT_start' => $start_date, |
|
195 | + 'DTT_EVT_end' => $end_date, |
|
196 | + 'DTT_order' => 1, |
|
197 | + 'DTT_reg_limit' => EE_INF, |
|
198 | + ], |
|
199 | + $timezone_string |
|
200 | + ); |
|
201 | + /** |
|
202 | + * Filters the initial start time and format for the new EE_Datetime instance. |
|
203 | + * |
|
204 | + * @param array $start_time An array having size 2. First element is the time, second element is the time |
|
205 | + * format. |
|
206 | + * @return array |
|
207 | + */ |
|
208 | + $start_time = apply_filters( |
|
209 | + 'FHEE__EEM_Datetime__create_new_blank_datetime__start_time', |
|
210 | + ['8am', 'ga'] |
|
211 | + ); |
|
212 | + /** |
|
213 | + * Filters the initial end time and format for the new EE_Datetime instance. |
|
214 | + * |
|
215 | + * @param array $end_time An array having size 2. First element is the time, second element is the time |
|
216 | + * format |
|
217 | + * @return array |
|
218 | + */ |
|
219 | + $end_time = apply_filters( |
|
220 | + 'FHEE__EEM_Datetime__create_new_blank_datetime__end_time', |
|
221 | + ['5pm', 'ga'] |
|
222 | + ); |
|
223 | + $this->validateStartAndEndTimeForBlankDate($start_time, $end_time); |
|
224 | + $blank_datetime->set_start_time( |
|
225 | + $this->convert_datetime_for_query( |
|
226 | + 'DTT_EVT_start', |
|
227 | + $start_time[0], |
|
228 | + $start_time[1], |
|
229 | + $timezone_string |
|
230 | + ) |
|
231 | + ); |
|
232 | + $blank_datetime->set_end_time( |
|
233 | + $this->convert_datetime_for_query( |
|
234 | + 'DTT_EVT_end', |
|
235 | + $end_time[0], |
|
236 | + $end_time[1], |
|
237 | + $timezone_string |
|
238 | + ) |
|
239 | + ); |
|
240 | + return [$blank_datetime]; |
|
241 | + } |
|
242 | + |
|
243 | + |
|
244 | + /** |
|
245 | + * Validates whether the start_time and end_time are in the expected format. |
|
246 | + * |
|
247 | + * @param array $start_time |
|
248 | + * @param array $end_time |
|
249 | + * @throws InvalidArgumentException |
|
250 | + * @throws InvalidDataTypeException |
|
251 | + */ |
|
252 | + private function validateStartAndEndTimeForBlankDate(array $start_time, array $end_time) |
|
253 | + { |
|
254 | + if (! is_array($start_time)) { |
|
255 | + throw new InvalidDataTypeException('start_time', $start_time, 'array'); |
|
256 | + } |
|
257 | + if (! is_array($end_time)) { |
|
258 | + throw new InvalidDataTypeException('end_time', $end_time, 'array'); |
|
259 | + } |
|
260 | + if (count($start_time) !== 2) { |
|
261 | + throw new InvalidArgumentException( |
|
262 | + sprintf( |
|
263 | + 'The variable %1$s is expected to be an array with two elements. The first item in the ' |
|
264 | + . 'array should be a valid time string, the second item in the array should be a valid time format', |
|
265 | + '$start_time' |
|
266 | + ) |
|
267 | + ); |
|
268 | + } |
|
269 | + if (count($end_time) !== 2) { |
|
270 | + throw new InvalidArgumentException( |
|
271 | + sprintf( |
|
272 | + 'The variable %1$s is expected to be an array with two elements. The first item in the ' |
|
273 | + . 'array should be a valid time string, the second item in the array should be a valid time format', |
|
274 | + '$end_time' |
|
275 | + ) |
|
276 | + ); |
|
277 | + } |
|
278 | + } |
|
279 | + |
|
280 | + |
|
281 | + /** |
|
282 | + * get event start date from db |
|
283 | + * |
|
284 | + * @access public |
|
285 | + * @param int $EVT_ID |
|
286 | + * @return EE_Datetime[] array on success, FALSE on fail |
|
287 | + * @throws EE_Error |
|
288 | + * @throws ReflectionException |
|
289 | + */ |
|
290 | + public function get_all_event_dates($EVT_ID = 0) |
|
291 | + { |
|
292 | + if (! $EVT_ID) { // on add_new_event event_id gets set to 0 |
|
293 | + return $this->create_new_blank_datetime(); |
|
294 | + } |
|
295 | + $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
296 | + if (empty($results)) { |
|
297 | + return $this->create_new_blank_datetime(); |
|
298 | + } |
|
299 | + return $results; |
|
300 | + } |
|
301 | + |
|
302 | + |
|
303 | + /** |
|
304 | + * get all datetimes attached to an event ordered by the DTT_order field |
|
305 | + * |
|
306 | + * @public |
|
307 | + * @param int $EVT_ID event id |
|
308 | + * @param boolean $include_expired |
|
309 | + * @param boolean $include_deleted |
|
310 | + * @param int $limit If included then limit the count of results by |
|
311 | + * the given number |
|
312 | + * @return EE_Datetime[] |
|
313 | + * @throws EE_Error |
|
314 | + */ |
|
315 | + public function get_datetimes_for_event_ordered_by_DTT_order( |
|
316 | + int $EVT_ID, |
|
317 | + bool $include_expired = true, |
|
318 | + bool $include_deleted = true, |
|
319 | + $limit = 0 |
|
320 | + ) { |
|
321 | + $prev_data_prep_value = $this->prepModelForQuery(); |
|
322 | + $where_params = ['Event.EVT_ID' => absint($EVT_ID)]; |
|
323 | + $query_params[0] = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired); |
|
324 | + $query_params = $this->addDefaultWhereConditions($query_params); |
|
325 | + $query_params = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order'); |
|
326 | + return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value); |
|
327 | + } |
|
328 | + |
|
329 | + |
|
330 | + /** |
|
331 | + * Gets the datetimes for the event (with the given limit), and orders them by "importance". |
|
332 | + * By importance, we mean that the primary datetimes are most important (DEPRECATED FOR NOW), |
|
333 | + * and then the earlier datetimes are the most important. |
|
334 | + * Maybe we'll want this to take into account datetimes that haven't already passed, but we don't yet. |
|
335 | + * |
|
336 | + * @param int $EVT_ID |
|
337 | + * @param int $limit |
|
338 | + * @return EE_Datetime[]|EE_Base_Class[] |
|
339 | + * @throws EE_Error |
|
340 | + */ |
|
341 | + public function get_datetimes_for_event_ordered_by_importance(int $EVT_ID, $limit = 0) |
|
342 | + { |
|
343 | + $query_params[0] = ['Event.EVT_ID' => absint($EVT_ID)]; |
|
344 | + $query_params = $this->addDefaultWhereConditions($query_params); |
|
345 | + $query_params = $this->addDefaultQueryParams($query_params, $limit); |
|
346 | + return $this->get_all($query_params); |
|
347 | + } |
|
348 | + |
|
349 | + |
|
350 | + /** |
|
351 | + * @param int $EVT_ID |
|
352 | + * @param boolean $include_expired |
|
353 | + * @param boolean $include_deleted |
|
354 | + * @return EE_Datetime |
|
355 | + * @throws EE_Error |
|
356 | + */ |
|
357 | + public function get_oldest_datetime_for_event( |
|
358 | + int $EVT_ID, |
|
359 | + bool $include_expired = false, |
|
360 | + bool $include_deleted = false |
|
361 | + ) { |
|
362 | + $results = $this->get_datetimes_for_event_ordered_by_start_time( |
|
363 | + $EVT_ID, |
|
364 | + $include_expired, |
|
365 | + $include_deleted, |
|
366 | + 1 |
|
367 | + ); |
|
368 | + if ($results) { |
|
369 | + return array_shift($results); |
|
370 | + } |
|
371 | + return null; |
|
372 | + } |
|
373 | + |
|
374 | + |
|
375 | + /** |
|
376 | + * Gets the 'primary' datetime for an event. |
|
377 | + * |
|
378 | + * @param int $EVT_ID |
|
379 | + * @param bool $try_to_exclude_expired |
|
380 | + * @param bool $try_to_exclude_deleted |
|
381 | + * @return EE_Datetime |
|
382 | + * @throws EE_Error |
|
383 | + */ |
|
384 | + public function get_primary_datetime_for_event( |
|
385 | + int $EVT_ID, |
|
386 | + bool $try_to_exclude_expired = true, |
|
387 | + bool $try_to_exclude_deleted = true |
|
388 | + ) { |
|
389 | + if ($try_to_exclude_expired) { |
|
390 | + $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false); |
|
391 | + if ($non_expired) { |
|
392 | + return $non_expired; |
|
393 | + } |
|
394 | + } |
|
395 | + if ($try_to_exclude_deleted) { |
|
396 | + $expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true); |
|
397 | + if ($expired_even) { |
|
398 | + return $expired_even; |
|
399 | + } |
|
400 | + } |
|
401 | + return $this->get_oldest_datetime_for_event($EVT_ID, true, true); |
|
402 | + } |
|
403 | + |
|
404 | + |
|
405 | + /** |
|
406 | + * Gets ALL the datetimes for an event (including trashed ones, for now), ordered |
|
407 | + * only by start date |
|
408 | + * |
|
409 | + * @param int $EVT_ID |
|
410 | + * @param boolean $include_expired |
|
411 | + * @param boolean $include_deleted |
|
412 | + * @param int $limit |
|
413 | + * @return EE_Datetime[] |
|
414 | + * @throws EE_Error |
|
415 | + */ |
|
416 | + public function get_datetimes_for_event_ordered_by_start_time( |
|
417 | + int $EVT_ID, |
|
418 | + bool $include_expired = true, |
|
419 | + bool $include_deleted = true, |
|
420 | + $limit = 0 |
|
421 | + ) { |
|
422 | + $prev_data_prep_value = $this->prepModelForQuery(); |
|
423 | + $where_params = ['Event.EVT_ID' => absint($EVT_ID)]; |
|
424 | + $query_params[0] = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired); |
|
425 | + $query_params = $this->addDefaultWhereConditions( |
|
426 | + $query_params, |
|
427 | + EEM_Base::default_where_conditions_this_only |
|
428 | + ); |
|
429 | + $query_params = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order'); |
|
430 | + return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value); |
|
431 | + } |
|
432 | + |
|
433 | + |
|
434 | + /** |
|
435 | + * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered |
|
436 | + * only by start date |
|
437 | + * |
|
438 | + * @param int $TKT_ID |
|
439 | + * @param boolean $include_expired |
|
440 | + * @param boolean $include_deleted |
|
441 | + * @param int $limit |
|
442 | + * @return EE_Datetime[] |
|
443 | + * @throws EE_Error |
|
444 | + */ |
|
445 | + public function get_datetimes_for_ticket_ordered_by_start_time( |
|
446 | + int $TKT_ID, |
|
447 | + bool $include_expired = true, |
|
448 | + bool $include_deleted = true, |
|
449 | + $limit = 0 |
|
450 | + ) { |
|
451 | + $prev_data_prep_value = $this->prepModelForQuery(); |
|
452 | + $where_params = ['Ticket.TKT_ID' => absint($TKT_ID)]; |
|
453 | + $query_params[0] = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired); |
|
454 | + $query_params = $this->addDefaultQueryParams($query_params, $limit); |
|
455 | + return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value); |
|
456 | + } |
|
457 | + |
|
458 | + |
|
459 | + /** |
|
460 | + * Gets all the datetimes for a ticket (including trashed ones, for now), ordered by the DTT_order for the |
|
461 | + * datetimes. |
|
462 | + * |
|
463 | + * @param int $TKT_ID ID of ticket to retrieve the datetimes for |
|
464 | + * @param boolean $include_expired whether to include expired datetimes or not |
|
465 | + * @param boolean $include_deleted whether to include trashed datetimes or not. |
|
466 | + * @param int|null $limit if null, no limit, if int then limit results by |
|
467 | + * that number |
|
468 | + * @return EE_Datetime[] |
|
469 | + * @throws EE_Error |
|
470 | + */ |
|
471 | + public function get_datetimes_for_ticket_ordered_by_DTT_order( |
|
472 | + int $TKT_ID, |
|
473 | + bool $include_expired = true, |
|
474 | + bool $include_deleted = true, |
|
475 | + $limit = 0 |
|
476 | + ) { |
|
477 | + $prev_data_prep_value = $this->prepModelForQuery(); |
|
478 | + $where_params = ['Ticket.TKT_ID' => absint($TKT_ID)]; |
|
479 | + $query_params[0] = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired); |
|
480 | + $query_params = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order'); |
|
481 | + return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value); |
|
482 | + } |
|
483 | + |
|
484 | + |
|
485 | + /** |
|
486 | + * Gets the most important datetime for a particular event (ie, the primary event usually. But if for some WACK |
|
487 | + * reason it doesn't exist, we consider the earliest event the most important) |
|
488 | + * |
|
489 | + * @param int $EVT_ID |
|
490 | + * @return EE_Datetime |
|
491 | + * @throws EE_Error |
|
492 | + */ |
|
493 | + public function get_most_important_datetime_for_event(int $EVT_ID) |
|
494 | + { |
|
495 | + $results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1); |
|
496 | + if ($results) { |
|
497 | + return array_shift($results); |
|
498 | + } |
|
499 | + return null; |
|
500 | + } |
|
501 | + |
|
502 | + |
|
503 | + /** |
|
504 | + * This returns a wpdb->results Array of all DTT month and years matching the incoming query params and |
|
505 | + * grouped by month and year. |
|
506 | + * |
|
507 | + * @param array $where_params @see |
|
508 | + * https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md#0-where-conditions |
|
509 | + * @param string $evt_active_status A string representing the evt active status to filter the months by. |
|
510 | + * Can be: |
|
511 | + * - '' = no filter |
|
512 | + * - upcoming = Published events with at least one upcoming datetime. |
|
513 | + * - expired = Events with all datetimes expired. |
|
514 | + * - active = Events that are published and have at least one datetime that |
|
515 | + * starts before now and ends after now. |
|
516 | + * - inactive = Events that are either not published. |
|
517 | + * @return EE_Base_Class[] |
|
518 | + * @throws EE_Error |
|
519 | + * @throws InvalidArgumentException |
|
520 | + * @throws InvalidArgumentException |
|
521 | + */ |
|
522 | + public function get_dtt_months_and_years(array $where_params, $evt_active_status = '') |
|
523 | + { |
|
524 | + $current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start'); |
|
525 | + $current_time_for_DTT_EVT_end = $this->current_time_for_query('DTT_EVT_end'); |
|
526 | + switch ($evt_active_status) { |
|
527 | + case 'upcoming': |
|
528 | + $where_params['Event.status'] = 'publish'; |
|
529 | + // if there are already query_params matching DTT_EVT_start then we need to modify that to add them. |
|
530 | + if (isset($where_params['DTT_EVT_start'])) { |
|
531 | + $where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start']; |
|
532 | + } |
|
533 | + $where_params['DTT_EVT_start'] = ['>', $current_time_for_DTT_EVT_start]; |
|
534 | + break; |
|
535 | + case 'expired': |
|
536 | + if (isset($where_params['Event.status'])) { |
|
537 | + unset($where_params['Event.status']); |
|
538 | + } |
|
539 | + // get events to exclude |
|
540 | + $exclude_query[0] = array_merge( |
|
541 | + $where_params, |
|
542 | + ['DTT_EVT_end' => ['>', $current_time_for_DTT_EVT_end]] |
|
543 | + ); |
|
544 | + // first get all events that have datetimes where its not expired. |
|
545 | + $event_ids = $this->_get_all_wpdb_results( |
|
546 | + $exclude_query, |
|
547 | + OBJECT_K, |
|
548 | + 'Datetime.EVT_ID' |
|
549 | + ); |
|
550 | + $event_ids = array_keys($event_ids); |
|
551 | + if (isset($where_params['DTT_EVT_end'])) { |
|
552 | + $where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
|
553 | + } |
|
554 | + $where_params['DTT_EVT_end'] = ['<', $current_time_for_DTT_EVT_end]; |
|
555 | + $where_params['Event.EVT_ID'] = ['NOT IN', $event_ids]; |
|
556 | + break; |
|
557 | + case 'active': |
|
558 | + $where_params['Event.status'] = 'publish'; |
|
559 | + if (isset($where_params['DTT_EVT_start'])) { |
|
560 | + $where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start']; |
|
561 | + } |
|
562 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
563 | + $where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end']; |
|
564 | + } |
|
565 | + $where_params['DTT_EVT_start'] = ['<', $current_time_for_DTT_EVT_start]; |
|
566 | + $where_params['DTT_EVT_end'] = ['>', $current_time_for_DTT_EVT_end]; |
|
567 | + break; |
|
568 | + case 'inactive': |
|
569 | + if (isset($where_params['Event.status'])) { |
|
570 | + unset($where_params['Event.status']); |
|
571 | + } |
|
572 | + if (isset($where_params['OR'])) { |
|
573 | + $where_params['AND']['OR'] = $where_params['OR']; |
|
574 | + } |
|
575 | + if (isset($where_params['DTT_EVT_end'])) { |
|
576 | + $where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
|
577 | + unset($where_params['DTT_EVT_end']); |
|
578 | + } |
|
579 | + if (isset($where_params['DTT_EVT_start'])) { |
|
580 | + $where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start']; |
|
581 | + unset($where_params['DTT_EVT_start']); |
|
582 | + } |
|
583 | + $where_params['AND']['Event.status'] = ['!=', 'publish']; |
|
584 | + break; |
|
585 | + } |
|
586 | + $query_params[0] = $where_params; |
|
587 | + $query_params['group_by'] = ['dtt_year', 'dtt_month']; |
|
588 | + $query_params = $this->addOrderByQueryParams($query_params, 'DTT_EVT_start', 'DESC'); |
|
589 | + |
|
590 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( |
|
591 | + $this->get_timezone(), |
|
592 | + 'DTT_EVT_start' |
|
593 | + ); |
|
594 | + $columns_to_select = [ |
|
595 | + 'dtt_year' => ['YEAR(' . $query_interval . ')', '%s'], |
|
596 | + 'dtt_month' => ['MONTHNAME(' . $query_interval . ')', '%s'], |
|
597 | + 'dtt_month_num' => ['MONTH(' . $query_interval . ')', '%s'], |
|
598 | + ]; |
|
599 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
600 | + } |
|
601 | + |
|
602 | + |
|
603 | + /** |
|
604 | + * Updates the DTT_sold attribute on each datetime (based on the registrations |
|
605 | + * for the tickets for each datetime) |
|
606 | + * |
|
607 | + * @param EE_Base_Class[]|EE_Datetime[] $datetimes |
|
608 | + * @throws EE_Error |
|
609 | + * @throws ReflectionException |
|
610 | + */ |
|
611 | + public function update_sold(array $datetimes) |
|
612 | + { |
|
613 | + EE_Error::doing_it_wrong( |
|
614 | + __FUNCTION__, |
|
615 | + esc_html__( |
|
616 | + 'Please use \EEM_Ticket::update_tickets_sold() instead which will in turn correctly update both the Ticket AND Datetime counts.', |
|
617 | + 'event_espresso' |
|
618 | + ), |
|
619 | + '4.9.32.rc.005' |
|
620 | + ); |
|
621 | + foreach ($datetimes as $datetime) { |
|
622 | + $datetime->update_sold(); |
|
623 | + } |
|
624 | + } |
|
625 | + |
|
626 | + |
|
627 | + /** |
|
628 | + * Gets the total number of tickets available at a particular datetime |
|
629 | + * (does NOT take into account the datetime's spaces available) |
|
630 | + * |
|
631 | + * @param int $DTT_ID |
|
632 | + * @param array $query_params |
|
633 | + * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF, IF there are NO |
|
634 | + * tickets attached to datetime then FALSE is returned. |
|
635 | + * @throws EE_Error |
|
636 | + * @throws ReflectionException |
|
637 | + */ |
|
638 | + public function sum_tickets_currently_available_at_datetime(int $DTT_ID, array $query_params = []) |
|
639 | + { |
|
640 | + $datetime = $this->get_one_by_ID($DTT_ID); |
|
641 | + if ($datetime instanceof EE_Datetime) { |
|
642 | + return $datetime->tickets_remaining($query_params); |
|
643 | + } |
|
644 | + return 0; |
|
645 | + } |
|
646 | + |
|
647 | + |
|
648 | + /** |
|
649 | + * This returns an array of counts of datetimes in the database for each Datetime status that can be queried. |
|
650 | + * |
|
651 | + * @param array $stati_to_include If included you can restrict the statuses we return counts for by including the |
|
652 | + * stati you want counts for as values in the array. An empty array returns counts |
|
653 | + * for all valid stati. |
|
654 | + * @param array $query_params If included can be used to refine the conditions for returning the count (i.e. |
|
655 | + * only for Datetimes connected to a specific event, or specific ticket. |
|
656 | + * @return array The value returned is an array indexed by Datetime Status and the values are the counts. The |
|
657 | + * @throws EE_Error |
|
658 | + * stati used as index keys are: EE_Datetime::active EE_Datetime::upcoming |
|
659 | + * EE_Datetime::expired |
|
660 | + */ |
|
661 | + public function get_datetime_counts_by_status(array $stati_to_include = [], array $query_params = []) |
|
662 | + { |
|
663 | + // only accept where conditions for this query. |
|
664 | + $_where = isset($query_params[0]) ? $query_params[0] : []; |
|
665 | + $status_query_args = [ |
|
666 | + EE_Datetime::active => array_merge( |
|
667 | + $_where, |
|
668 | + ['DTT_EVT_start' => ['<', time()], 'DTT_EVT_end' => ['>', time()]] |
|
669 | + ), |
|
670 | + EE_Datetime::upcoming => array_merge( |
|
671 | + $_where, |
|
672 | + ['DTT_EVT_start' => ['>', time()]] |
|
673 | + ), |
|
674 | + EE_Datetime::expired => array_merge( |
|
675 | + $_where, |
|
676 | + ['DTT_EVT_end' => ['<', time()]] |
|
677 | + ), |
|
678 | + ]; |
|
679 | + if (! empty($stati_to_include)) { |
|
680 | + foreach (array_keys($status_query_args) as $status) { |
|
681 | + if (! in_array($status, $stati_to_include, true)) { |
|
682 | + unset($status_query_args[ $status ]); |
|
683 | + } |
|
684 | + } |
|
685 | + } |
|
686 | + // loop through and query counts for each stati. |
|
687 | + $status_query_results = []; |
|
688 | + foreach ($status_query_args as $status => $status_where_conditions) { |
|
689 | + $status_query_results[ $status ] = EEM_Datetime::count( |
|
690 | + [$status_where_conditions], |
|
691 | + 'DTT_ID', |
|
692 | + true |
|
693 | + ); |
|
694 | + } |
|
695 | + return $status_query_results; |
|
696 | + } |
|
697 | + |
|
698 | + |
|
699 | + /** |
|
700 | + * Returns the specific count for a given Datetime status matching any given query_params. |
|
701 | + * |
|
702 | + * @param string $status Valid string representation for Datetime status requested. (Defaults to Active). |
|
703 | + * @param array $query_params |
|
704 | + * @return int |
|
705 | + * @throws EE_Error |
|
706 | + */ |
|
707 | + public function get_datetime_count_for_status($status = EE_Datetime::active, array $query_params = []) |
|
708 | + { |
|
709 | + $count = $this->get_datetime_counts_by_status([$status], $query_params); |
|
710 | + return ! empty($count[ $status ]) ? $count[ $status ] : 0; |
|
711 | + } |
|
712 | + |
|
713 | + |
|
714 | + /** |
|
715 | + * @return bool|int |
|
716 | + * @since $VID:$ |
|
717 | + */ |
|
718 | + private function prepModelForQuery() |
|
719 | + { |
|
720 | + $prev_data_prep_value = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
|
721 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
722 | + return $prev_data_prep_value; |
|
723 | + } |
|
724 | + |
|
725 | + |
|
726 | + /** |
|
727 | + * @param array $query_params |
|
728 | + * @param bool|int $prev_data_prep_value |
|
729 | + * @return EE_Base_Class[]|EE_Datetime[] |
|
730 | + * @throws EE_Error |
|
731 | + * @since $VID:$ |
|
732 | + */ |
|
733 | + private function getDatetimesAndRestoreModel(array $query_params, $prev_data_prep_value) |
|
734 | + { |
|
735 | + $result = $this->get_all($query_params); |
|
736 | + $this->assume_values_already_prepared_by_model_object($prev_data_prep_value); |
|
737 | + return $result; |
|
738 | + } |
|
739 | + |
|
740 | + |
|
741 | + /** |
|
742 | + * @param array $query_params |
|
743 | + * @param int $limit |
|
744 | + * @param string $order_by |
|
745 | + * @param string $order |
|
746 | + * @return array |
|
747 | + * @since $VID:$ |
|
748 | + */ |
|
749 | + private function addDefaultQueryParams(array $query_params, $limit = 0, $order_by = 'DTT_EVT_start', $order = 'ASC') |
|
750 | + { |
|
751 | + $query_params = $this->addOrderByQueryParams($query_params, $order_by, $order); |
|
752 | + $query_params = $this->addLimitQueryParams($query_params, $limit); |
|
753 | + return $query_params; |
|
754 | + } |
|
755 | + |
|
756 | + |
|
757 | + /** |
|
758 | + * @param array $query_params |
|
759 | + * @param string $default_where_conditions |
|
760 | + * @return array |
|
761 | + * @since $VID:$ |
|
762 | + */ |
|
763 | + private function addDefaultWhereConditions( |
|
764 | + array $query_params, |
|
765 | + $default_where_conditions = EEM_Base::default_where_conditions_none |
|
766 | + ) { |
|
767 | + $query_params['default_where_conditions'] = $default_where_conditions; |
|
768 | + return $query_params; |
|
769 | + } |
|
770 | + |
|
771 | + |
|
772 | + /** |
|
773 | + * @param array $where_params |
|
774 | + * @param bool $include_deleted |
|
775 | + * @param bool $include_expired |
|
776 | + * @return array |
|
777 | + * @since $VID:$ |
|
778 | + */ |
|
779 | + private function addDefaultWhereParams(array $where_params, bool $include_deleted = true, bool $include_expired = true) |
|
780 | + { |
|
781 | + $where_params = $this->addExpiredWhereParams($where_params, $include_expired); |
|
782 | + $where_params = $this->addDeletedWhereParams($where_params, $include_deleted); |
|
783 | + return $where_params; |
|
784 | + } |
|
785 | + |
|
786 | + |
|
787 | + /** |
|
788 | + * @param array $where_params |
|
789 | + * @param bool $include_deleted |
|
790 | + * @return array |
|
791 | + * @since $VID:$ |
|
792 | + */ |
|
793 | + private function addDeletedWhereParams(array $where_params, bool $include_deleted = true) |
|
794 | + { |
|
795 | + $deleted = $include_deleted ? [true, false] : [false]; |
|
796 | + $where_params['DTT_deleted'] = ['IN', $deleted]; |
|
797 | + return $where_params; |
|
798 | + } |
|
799 | + |
|
800 | + |
|
801 | + /** |
|
802 | + * @param array $where_params |
|
803 | + * @param bool $include_expired |
|
804 | + * @return array |
|
805 | + * @since $VID:$ |
|
806 | + */ |
|
807 | + private function addExpiredWhereParams(array $where_params, bool $include_expired = true) |
|
808 | + { |
|
809 | + if (! $include_expired) { |
|
810 | + $where_params['DTT_EVT_end'] = ['>=', current_time('mysql', true)]; |
|
811 | + } |
|
812 | + return $where_params; |
|
813 | + } |
|
814 | + |
|
815 | + |
|
816 | + /** |
|
817 | + * @param array $query_params |
|
818 | + * @param int $limit |
|
819 | + * @return array |
|
820 | + * @since $VID:$ |
|
821 | + */ |
|
822 | + private function addLimitQueryParams(array $query_params, $limit = 0) |
|
823 | + { |
|
824 | + if ($limit) { |
|
825 | + $query_params['limit'] = $limit; |
|
826 | + } |
|
827 | + return $query_params; |
|
828 | + } |
|
829 | + |
|
830 | + |
|
831 | + /** |
|
832 | + * @param array $query_params |
|
833 | + * @param string $order_by |
|
834 | + * @param string $order |
|
835 | + * @return array |
|
836 | + * @since $VID:$ |
|
837 | + */ |
|
838 | + private function addOrderByQueryParams(array $query_params, $order_by = 'DTT_EVT_start', $order = 'ASC') |
|
839 | + { |
|
840 | + $order = $order === 'ASC' ? 'ASC' : 'DESC'; |
|
841 | + $valid_order_columns = ['DTT_ID', 'DTT_EVT_start', 'DTT_EVT_end', 'DTT_order']; |
|
842 | + $order_by = in_array($order_by, $valid_order_columns, true) ? $order_by : 'DTT_EVT_start'; |
|
843 | + $query_params['order_by'] = [$order_by => $order]; |
|
844 | + return $query_params; |
|
845 | + } |
|
846 | 846 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | ), |
122 | 122 | ], |
123 | 123 | ]; |
124 | - $this->_model_relations = [ |
|
124 | + $this->_model_relations = [ |
|
125 | 125 | 'Ticket' => new EE_HABTM_Relation('Datetime_Ticket'), |
126 | 126 | 'Event' => new EE_Belongs_To_Relation(), |
127 | 127 | 'Checkin' => new EE_Has_Many_Relation(), |
@@ -131,19 +131,19 @@ discard block |
||
131 | 131 | $this->model_chain_to_password = $path_to_event_model; |
132 | 132 | $this->_model_chain_to_wp_user = $path_to_event_model; |
133 | 133 | // this model is generally available for reading |
134 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = |
|
134 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = |
|
135 | 135 | new EE_Restriction_Generator_Event_Related_Public( |
136 | 136 | $path_to_event_model |
137 | 137 | ); |
138 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = |
|
138 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = |
|
139 | 139 | new EE_Restriction_Generator_Event_Related_Protected( |
140 | 140 | $path_to_event_model |
141 | 141 | ); |
142 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = |
|
142 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = |
|
143 | 143 | new EE_Restriction_Generator_Event_Related_Protected( |
144 | 144 | $path_to_event_model |
145 | 145 | ); |
146 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = |
|
146 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = |
|
147 | 147 | new EE_Restriction_Generator_Event_Related_Protected( |
148 | 148 | $path_to_event_model, |
149 | 149 | EEM_Base::caps_edit |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @param int $end_data Unix timestamp representing now + 30 days in seconds. |
186 | 186 | * @return int Unix timestamp |
187 | 187 | */ |
188 | - $end_date = apply_filters( |
|
188 | + $end_date = apply_filters( |
|
189 | 189 | 'FHEE__EEM_Datetime__create_new_blank_datetime__end_date', |
190 | 190 | $this->current_time_for_query('DTT_EVT_end', true) + MONTH_IN_SECONDS |
191 | 191 | ); |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | */ |
252 | 252 | private function validateStartAndEndTimeForBlankDate(array $start_time, array $end_time) |
253 | 253 | { |
254 | - if (! is_array($start_time)) { |
|
254 | + if ( ! is_array($start_time)) { |
|
255 | 255 | throw new InvalidDataTypeException('start_time', $start_time, 'array'); |
256 | 256 | } |
257 | - if (! is_array($end_time)) { |
|
257 | + if ( ! is_array($end_time)) { |
|
258 | 258 | throw new InvalidDataTypeException('end_time', $end_time, 'array'); |
259 | 259 | } |
260 | 260 | if (count($start_time) !== 2) { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function get_all_event_dates($EVT_ID = 0) |
291 | 291 | { |
292 | - if (! $EVT_ID) { // on add_new_event event_id gets set to 0 |
|
292 | + if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0 |
|
293 | 293 | return $this->create_new_blank_datetime(); |
294 | 294 | } |
295 | 295 | $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | $query_params, |
427 | 427 | EEM_Base::default_where_conditions_this_only |
428 | 428 | ); |
429 | - $query_params = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order'); |
|
429 | + $query_params = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order'); |
|
430 | 430 | return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value); |
431 | 431 | } |
432 | 432 | |
@@ -587,14 +587,14 @@ discard block |
||
587 | 587 | $query_params['group_by'] = ['dtt_year', 'dtt_month']; |
588 | 588 | $query_params = $this->addOrderByQueryParams($query_params, 'DTT_EVT_start', 'DESC'); |
589 | 589 | |
590 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( |
|
590 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( |
|
591 | 591 | $this->get_timezone(), |
592 | 592 | 'DTT_EVT_start' |
593 | 593 | ); |
594 | 594 | $columns_to_select = [ |
595 | - 'dtt_year' => ['YEAR(' . $query_interval . ')', '%s'], |
|
596 | - 'dtt_month' => ['MONTHNAME(' . $query_interval . ')', '%s'], |
|
597 | - 'dtt_month_num' => ['MONTH(' . $query_interval . ')', '%s'], |
|
595 | + 'dtt_year' => ['YEAR('.$query_interval.')', '%s'], |
|
596 | + 'dtt_month' => ['MONTHNAME('.$query_interval.')', '%s'], |
|
597 | + 'dtt_month_num' => ['MONTH('.$query_interval.')', '%s'], |
|
598 | 598 | ]; |
599 | 599 | return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
600 | 600 | } |
@@ -676,17 +676,17 @@ discard block |
||
676 | 676 | ['DTT_EVT_end' => ['<', time()]] |
677 | 677 | ), |
678 | 678 | ]; |
679 | - if (! empty($stati_to_include)) { |
|
679 | + if ( ! empty($stati_to_include)) { |
|
680 | 680 | foreach (array_keys($status_query_args) as $status) { |
681 | - if (! in_array($status, $stati_to_include, true)) { |
|
682 | - unset($status_query_args[ $status ]); |
|
681 | + if ( ! in_array($status, $stati_to_include, true)) { |
|
682 | + unset($status_query_args[$status]); |
|
683 | 683 | } |
684 | 684 | } |
685 | 685 | } |
686 | 686 | // loop through and query counts for each stati. |
687 | 687 | $status_query_results = []; |
688 | 688 | foreach ($status_query_args as $status => $status_where_conditions) { |
689 | - $status_query_results[ $status ] = EEM_Datetime::count( |
|
689 | + $status_query_results[$status] = EEM_Datetime::count( |
|
690 | 690 | [$status_where_conditions], |
691 | 691 | 'DTT_ID', |
692 | 692 | true |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | public function get_datetime_count_for_status($status = EE_Datetime::active, array $query_params = []) |
708 | 708 | { |
709 | 709 | $count = $this->get_datetime_counts_by_status([$status], $query_params); |
710 | - return ! empty($count[ $status ]) ? $count[ $status ] : 0; |
|
710 | + return ! empty($count[$status]) ? $count[$status] : 0; |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | */ |
807 | 807 | private function addExpiredWhereParams(array $where_params, bool $include_expired = true) |
808 | 808 | { |
809 | - if (! $include_expired) { |
|
809 | + if ( ! $include_expired) { |
|
810 | 810 | $where_params['DTT_EVT_end'] = ['>=', current_time('mysql', true)]; |
811 | 811 | } |
812 | 812 | return $where_params; |
@@ -25,905 +25,905 @@ |
||
25 | 25 | class EEH_File extends EEH_Base implements EEHI_File |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * @var string $_credentials_form |
|
30 | - */ |
|
31 | - private static $_credentials_form; |
|
32 | - |
|
33 | - /** |
|
34 | - * @var WP_Filesystem_Base $_wp_filesystem |
|
35 | - */ |
|
36 | - protected static $_wp_filesystem; |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * @param string|null $filepath the filepath we want to work in. If its in the |
|
41 | - * wp uploads directory, we'll want to just use the filesystem directly. |
|
42 | - * If not provided, we have to assume its not in the uploads directory |
|
43 | - * @return WP_Filesystem_Base |
|
44 | - */ |
|
45 | - private static function _get_wp_filesystem($filepath = null) |
|
46 | - { |
|
47 | - if (apply_filters( |
|
48 | - 'FHEE__EEH_File___get_wp_filesystem__allow_using_filesystem_direct', |
|
49 | - $filepath && EEH_File::is_in_uploads_folder($filepath), |
|
50 | - $filepath |
|
51 | - )) { |
|
52 | - return EEH_File::loadAlternateWpFileSystem(); |
|
53 | - } |
|
54 | - return EEH_File::loadWpFileSystem(); |
|
55 | - } |
|
56 | - |
|
57 | - |
|
58 | - /** |
|
59 | - * @return WP_Filesystem_Base |
|
60 | - */ |
|
61 | - private static function loadAlternateWpFileSystem() |
|
62 | - { |
|
63 | - if (! EEH_File::$_wp_filesystem instanceof WP_Filesystem_Base) { |
|
64 | - require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); |
|
65 | - $method = 'direct'; |
|
66 | - $wp_filesystem_file = |
|
67 | - apply_filters( |
|
68 | - 'filesystem_method_file', |
|
69 | - ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', |
|
70 | - $method |
|
71 | - ); |
|
72 | - // added the following validation logic |
|
73 | - // because we allow the filesystem filepath to be filtered, |
|
74 | - // and are loading whatever file the path pointed to, |
|
75 | - // but we were not validating things in any way :scream_emoji: |
|
76 | - $valid_wp_filesystem_types = [ |
|
77 | - 'direct' => 'WP_Filesystem_Direct', |
|
78 | - 'ftpext' => 'WP_Filesystem_FTPext', |
|
79 | - 'ftpsockets' => 'WP_Filesystem_ftpsockets', |
|
80 | - 'ssh2' => 'WP_Filesystem_SSH2', |
|
81 | - ]; |
|
82 | - $valid = false; |
|
83 | - $wp_filesystem_class = ''; |
|
84 | - foreach ($valid_wp_filesystem_types as $method => $filesystem_class) { |
|
85 | - // if file path matches for one of valid types, then toggle $valid to true |
|
86 | - if (strpos($wp_filesystem_file, $method) > 0) { |
|
87 | - $valid = true; |
|
88 | - $wp_filesystem_class = $filesystem_class; |
|
89 | - } |
|
90 | - } |
|
91 | - if (! $valid || ! file_exists($wp_filesystem_file)) { |
|
92 | - EE_Error::add_error( |
|
93 | - sprintf( |
|
94 | - __( |
|
95 | - 'The supplied WP Filesystem filepath "%1$s" is either missing or invalid.', |
|
96 | - 'event_espresso' |
|
97 | - ), |
|
98 | - $wp_filesystem_file |
|
99 | - ), |
|
100 | - __FILE__, |
|
101 | - __FUNCTION__, |
|
102 | - __LINE__ |
|
103 | - ); |
|
104 | - } |
|
105 | - // check constants defined, just like in the wp-admin/includes/file.php WP_Filesystem() |
|
106 | - if (! defined('FS_CHMOD_DIR')) { |
|
107 | - define('FS_CHMOD_DIR', (fileperms(ABSPATH) & 0775 | 0755)); |
|
108 | - } |
|
109 | - if (! defined('FS_CHMOD_FILE')) { |
|
110 | - define('FS_CHMOD_FILE', (fileperms(ABSPATH . 'index.php') & 0775 | 0644)); |
|
111 | - } |
|
112 | - require_once($wp_filesystem_file); |
|
113 | - EEH_File::$_wp_filesystem = new $wp_filesystem_class([]); |
|
114 | - } |
|
115 | - return EEH_File::$_wp_filesystem; |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * @return WP_Filesystem_Base |
|
121 | - */ |
|
122 | - private static function loadWpFileSystem() |
|
123 | - { |
|
124 | - global $wp_filesystem; |
|
125 | - // no filesystem setup ??? |
|
126 | - if (! $wp_filesystem instanceof WP_Filesystem_Base) { |
|
127 | - // if some eager beaver's just trying to get in there too early... |
|
128 | - // let them do it, because we are one of those eager beavers! :P |
|
129 | - /** |
|
130 | - * more explanations are probably merited. http://codex.wordpress.org/Filesystem_API#Initializing_WP_Filesystem_Base |
|
131 | - * says WP_Filesystem should be used after 'wp_loaded', but currently EE's activation process |
|
132 | - * is setup to mostly happen on 'init', and refactoring to have it happen on |
|
133 | - * 'wp_loaded' is too much work on a BETA milestone. |
|
134 | - * So this fix is expected to work if the WP files are owned by the server user, |
|
135 | - * but probably not if the user needs to enter their FTP credentials to modify files |
|
136 | - * and there may be troubles if the WP files are owned by a different user |
|
137 | - * than the server user. But both of these issues should exist in 4.4 and earlier too |
|
138 | - */ |
|
139 | - if (false && ! did_action('wp_loaded')) { |
|
140 | - $msg = |
|
141 | - __( |
|
142 | - 'An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', |
|
143 | - 'event_espresso' |
|
144 | - ); |
|
145 | - if (WP_DEBUG) { |
|
146 | - $msg .= '<br />' . __( |
|
147 | - 'The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', |
|
148 | - 'event_espresso' |
|
149 | - ); |
|
150 | - } |
|
151 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
152 | - } |
|
153 | - // should be loaded if we are past the wp_loaded hook... |
|
154 | - if (! function_exists('WP_Filesystem') || ! function_exists('submit_button')) { |
|
155 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
156 | - require_once(ABSPATH . 'wp-admin/includes/template.php'); |
|
157 | - } |
|
158 | - // turn on output buffering so that we can capture the credentials form |
|
159 | - ob_start(); |
|
160 | - $credentials = request_filesystem_credentials(false); |
|
161 | - // store credentials form for the time being |
|
162 | - EEH_File::$_credentials_form = ob_get_clean(); |
|
163 | - // if credentials do NOT exist |
|
164 | - if ($credentials === false) { |
|
165 | - add_action('admin_notices', ['EEH_File', 'display_request_filesystem_credentials_form'], 999); |
|
166 | - EE_Error::add_error( |
|
167 | - __( |
|
168 | - 'An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', |
|
169 | - 'event_espresso' |
|
170 | - ), |
|
171 | - __FILE__, |
|
172 | - __FUNCTION__, |
|
173 | - __LINE__ |
|
174 | - ); |
|
175 | - } |
|
176 | - // basically check for direct or previously configured access |
|
177 | - if (! WP_Filesystem($credentials) |
|
178 | - && is_wp_error($wp_filesystem->errors) |
|
179 | - && $wp_filesystem->errors->get_error_code() |
|
180 | - ) { |
|
181 | - add_action('admin_notices', ['EEH_File', 'display_request_filesystem_credentials_form'], 999); |
|
182 | - EE_Error::add_error( |
|
183 | - sprintf( |
|
184 | - __('WP Filesystem Error: $1%s', 'event_espresso'), |
|
185 | - $wp_filesystem->errors->get_error_message() |
|
186 | - ), |
|
187 | - __FILE__, |
|
188 | - __FUNCTION__, |
|
189 | - __LINE__ |
|
190 | - ); |
|
191 | - } |
|
192 | - } |
|
193 | - return $wp_filesystem; |
|
194 | - } |
|
195 | - |
|
196 | - |
|
197 | - /** |
|
198 | - * display_request_filesystem_credentials_form |
|
199 | - */ |
|
200 | - public static function display_request_filesystem_credentials_form() |
|
201 | - { |
|
202 | - if (! empty(EEH_File::$_credentials_form)) { |
|
203 | - echo '<div class="updated espresso-notices-attention"><p>' . EEH_File::$_credentials_form . '</p></div>'; |
|
204 | - } |
|
205 | - } |
|
206 | - |
|
207 | - |
|
208 | - /** |
|
209 | - * verify_filepath_and_permissions |
|
210 | - * checks that a file is readable and has sufficient file permissions set to access |
|
211 | - * |
|
212 | - * @access public |
|
213 | - * @param string $full_file_path - full server path to the folder or file |
|
214 | - * @param string $file_name - name of file if checking a file |
|
215 | - * @param string $file_ext - file extension (ie: "php") if checking a file |
|
216 | - * @param string $type_of_file - general type of file (ie: "module"), this is only used to improve error messages |
|
217 | - * @return bool |
|
218 | - */ |
|
219 | - public static function verify_filepath_and_permissions( |
|
220 | - $full_file_path = '', |
|
221 | - $file_name = '', |
|
222 | - $file_ext = '', |
|
223 | - $type_of_file = '' |
|
224 | - ) { |
|
225 | - // load WP_Filesystem and set file permissions |
|
226 | - $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
227 | - $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
228 | - if (! $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
229 | - $file_name = ! empty($type_of_file) ? $file_name . ' ' . $type_of_file : $file_name; |
|
230 | - $file_name .= ! empty($file_ext) ? ' file' : ' folder'; |
|
231 | - $msg = sprintf( |
|
232 | - __( |
|
233 | - 'The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', |
|
234 | - 'event_espresso' |
|
235 | - ), |
|
236 | - $file_name, |
|
237 | - '<br />' |
|
238 | - ); |
|
239 | - if (EEH_File::exists($full_file_path)) { |
|
240 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, $type_of_file); |
|
241 | - } else { |
|
242 | - // no file permissions means the file was not found |
|
243 | - $msg .= sprintf( |
|
244 | - __('Please ensure the following path is correct: "%s".', 'event_espresso'), |
|
245 | - $full_file_path |
|
246 | - ); |
|
247 | - } |
|
248 | - if (defined('WP_DEBUG') && WP_DEBUG) { |
|
249 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
250 | - } |
|
251 | - return false; |
|
252 | - } |
|
253 | - return true; |
|
254 | - } |
|
255 | - |
|
256 | - |
|
257 | - /** |
|
258 | - * _permissions_error_for_unreadable_filepath - attempts to determine why permissions are set incorrectly for a |
|
259 | - * file or folder |
|
260 | - * |
|
261 | - * @access private |
|
262 | - * @param string $full_file_path - full server path to the folder or file |
|
263 | - * @param string $type_of_file - general type of file (ie: "module"), this is only used to improve error messages |
|
264 | - * @return string |
|
265 | - */ |
|
266 | - private static function _permissions_error_for_unreadable_filepath($full_file_path = '', $type_of_file = '') |
|
267 | - { |
|
268 | - // load WP_Filesystem and set file permissions |
|
269 | - $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
270 | - // check file permissions |
|
271 | - $perms = $wp_filesystem->getchmod(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
272 | - if ($perms) { |
|
273 | - // file permissions exist, but way be set incorrectly |
|
274 | - $type_of_file = ! empty($type_of_file) ? $type_of_file . ' ' : ''; |
|
275 | - $type_of_file .= ! empty($type_of_file) ? 'file' : 'folder'; |
|
276 | - return ' ' . sprintf( |
|
277 | - __( |
|
278 | - 'File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', |
|
279 | - 'event_espresso' |
|
280 | - ), |
|
281 | - $type_of_file, |
|
282 | - $perms |
|
283 | - ); |
|
284 | - } else { |
|
285 | - // file exists but file permissions could not be read ?!?! |
|
286 | - return ' ' . sprintf( |
|
287 | - __( |
|
288 | - 'Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', |
|
289 | - 'event_espresso' |
|
290 | - ), |
|
291 | - $full_file_path |
|
292 | - ); |
|
293 | - } |
|
294 | - } |
|
295 | - |
|
296 | - |
|
297 | - /** |
|
298 | - * ensure_folder_exists_and_is_writable |
|
299 | - * ensures that a folder exists and is writable, will attempt to create folder if it does not exist |
|
300 | - * Also ensures all the parent folders exist, and if not tries to create them. |
|
301 | - * Also, if this function creates the folder, adds a .htaccess file and index.html file |
|
302 | - * |
|
303 | - * @param string $folder |
|
304 | - * @return bool false if folder isn't writable; true if it exists and is writeable, |
|
305 | - */ |
|
306 | - public static function ensure_folder_exists_and_is_writable($folder = '') |
|
307 | - { |
|
308 | - if (empty($folder)) { |
|
309 | - return false; |
|
310 | - } |
|
311 | - // remove ending / |
|
312 | - $folder = EEH_File::standardise_directory_separators(rtrim($folder, '/\\')); |
|
313 | - $parent_folder = EEH_File::get_parent_folder($folder); |
|
314 | - // add / to folder |
|
315 | - $folder = EEH_File::end_with_directory_separator($folder); |
|
316 | - $wp_filesystem = EEH_File::_get_wp_filesystem($folder); |
|
317 | - $remote_dir = EEH_File::convert_local_filepath_to_remote_filepath($folder); |
|
318 | - if (! $wp_filesystem->is_dir($remote_dir)) { |
|
319 | - // ok so it doesn't exist. Does its parent? Can we write to it? |
|
320 | - if (! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
321 | - return false; |
|
322 | - } |
|
323 | - if (! EEH_File::verify_is_writable($parent_folder, 'folder')) { |
|
324 | - return false; |
|
325 | - } |
|
326 | - if (! $wp_filesystem->mkdir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) { |
|
327 | - if (defined('WP_DEBUG') && WP_DEBUG) { |
|
328 | - $msg = sprintf(__('"%s" could not be created.', 'event_espresso'), $folder); |
|
329 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath($folder); |
|
330 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
331 | - } |
|
332 | - return false; |
|
333 | - } |
|
334 | - EEH_File::add_index_file($folder); |
|
335 | - } elseif (! EEH_File::verify_is_writable($folder, 'folder')) { |
|
336 | - return false; |
|
337 | - } |
|
338 | - return true; |
|
339 | - } |
|
340 | - |
|
341 | - |
|
342 | - /** |
|
343 | - * verify_is_writable - checks if a file or folder is writable |
|
344 | - * |
|
345 | - * @param string $full_path - full server path to file or folder |
|
346 | - * @param string $file_or_folder - whether checking a file or folder |
|
347 | - * @return bool |
|
348 | - */ |
|
349 | - public static function verify_is_writable($full_path = '', $file_or_folder = 'folder') |
|
350 | - { |
|
351 | - // load WP_Filesystem and set file permissions |
|
352 | - $wp_filesystem = EEH_File::_get_wp_filesystem($full_path); |
|
353 | - $full_path = EEH_File::standardise_directory_separators($full_path); |
|
354 | - $remote_path = EEH_File::convert_local_filepath_to_remote_filepath($full_path); |
|
355 | - $remote_path = rtrim($remote_path, '/\\'); |
|
356 | - if (! $wp_filesystem->is_writable($remote_path)) { |
|
357 | - if (defined('WP_DEBUG') && WP_DEBUG) { |
|
358 | - $msg = sprintf(__('The "%1$s" %2$s is not writable.', 'event_espresso'), $full_path, $file_or_folder); |
|
359 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_path); |
|
360 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
361 | - } |
|
362 | - return false; |
|
363 | - } |
|
364 | - return true; |
|
365 | - } |
|
366 | - |
|
367 | - |
|
368 | - /** |
|
369 | - * ensure_file_exists_and_is_writable |
|
370 | - * ensures that a file exists and is writable, will attempt to create file if it does not exist. |
|
371 | - * Also ensures all the parent folders exist, and if not tries to create them. |
|
372 | - * |
|
373 | - * @param string $full_file_path |
|
374 | - * @return bool |
|
375 | - */ |
|
376 | - public static function ensure_file_exists_and_is_writable($full_file_path = '') |
|
377 | - { |
|
378 | - // load WP_Filesystem and set file permissions |
|
379 | - $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
380 | - $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
381 | - $parent_folder = EEH_File::get_parent_folder($full_file_path); |
|
382 | - if (! EEH_File::exists($full_file_path)) { |
|
383 | - if (! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
384 | - return false; |
|
385 | - } |
|
386 | - if (! $wp_filesystem->touch(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
387 | - if (defined('WP_DEBUG') && WP_DEBUG) { |
|
388 | - $msg = sprintf(__('The "%s" file could not be created.', 'event_espresso'), $full_file_path); |
|
389 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path); |
|
390 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
391 | - } |
|
392 | - return false; |
|
393 | - } |
|
394 | - } |
|
395 | - if (! EEH_File::verify_is_writable($full_file_path, 'file')) { |
|
396 | - return false; |
|
397 | - } |
|
398 | - return true; |
|
399 | - } |
|
400 | - |
|
401 | - |
|
402 | - /** |
|
403 | - * Gets the parent folder. If provided with file, gets the folder that contains it. |
|
404 | - * If provided a folder, gets its parent folder. |
|
405 | - * |
|
406 | - * @param string $file_or_folder_path |
|
407 | - * @return string parent folder, ENDING with a directory separator |
|
408 | - */ |
|
409 | - public static function get_parent_folder($file_or_folder_path) |
|
410 | - { |
|
411 | - // find the last /, ignoring a / on the very end |
|
412 | - // eg if given "/var/something/somewhere/", we want to get "somewhere"'s |
|
413 | - // parent folder, "/var/something/" |
|
414 | - $ds = strlen($file_or_folder_path) > 1 |
|
415 | - ? strrpos($file_or_folder_path, '/', -2) |
|
416 | - : strlen($file_or_folder_path); |
|
417 | - return substr($file_or_folder_path, 0, $ds + 1); |
|
418 | - } |
|
419 | - |
|
420 | - |
|
421 | - /** |
|
422 | - * get_file_contents |
|
423 | - * |
|
424 | - * @param string $full_file_path |
|
425 | - * @return string |
|
426 | - */ |
|
427 | - public static function get_file_contents($full_file_path = '') |
|
428 | - { |
|
429 | - $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
430 | - if (EEH_File::verify_filepath_and_permissions( |
|
431 | - $full_file_path, |
|
432 | - EEH_File::get_filename_from_filepath($full_file_path), |
|
433 | - EEH_File::get_file_extension($full_file_path) |
|
434 | - )) { |
|
435 | - // load WP_Filesystem and set file permissions |
|
436 | - $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
437 | - return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
438 | - } |
|
439 | - return ''; |
|
440 | - } |
|
441 | - |
|
442 | - |
|
443 | - /** |
|
444 | - * write_file |
|
445 | - * |
|
446 | - * @param string $full_file_path |
|
447 | - * @param string $file_contents - the content to be written to the file |
|
448 | - * @param string $file_type |
|
449 | - * @return bool |
|
450 | - */ |
|
451 | - public static function write_to_file($full_file_path = '', $file_contents = '', $file_type = '') |
|
452 | - { |
|
453 | - $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
454 | - $file_type = ! empty($file_type) ? rtrim($file_type, ' ') . ' ' : ''; |
|
455 | - $folder = EEH_File::remove_filename_from_filepath($full_file_path); |
|
456 | - if (! EEH_File::verify_is_writable($folder, 'folder')) { |
|
457 | - if (defined('WP_DEBUG') && WP_DEBUG) { |
|
458 | - $msg = |
|
459 | - sprintf( |
|
460 | - __('The %1$sfile located at "%2$s" is not writable.', 'event_espresso'), |
|
461 | - $file_type, |
|
462 | - $full_file_path |
|
463 | - ); |
|
464 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path); |
|
465 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
466 | - } |
|
467 | - return false; |
|
468 | - } |
|
469 | - // load WP_Filesystem and set file permissions |
|
470 | - $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
471 | - // write the file |
|
472 | - if (! $wp_filesystem->put_contents( |
|
473 | - EEH_File::convert_local_filepath_to_remote_filepath($full_file_path), |
|
474 | - $file_contents |
|
475 | - )) { |
|
476 | - if (defined('WP_DEBUG') && WP_DEBUG) { |
|
477 | - $msg = |
|
478 | - sprintf( |
|
479 | - __('The %1$sfile located at "%2$s" could not be written to.', 'event_espresso'), |
|
480 | - $file_type, |
|
481 | - $full_file_path |
|
482 | - ); |
|
483 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, 'f'); |
|
484 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
485 | - } |
|
486 | - return false; |
|
487 | - } |
|
488 | - return true; |
|
489 | - } |
|
490 | - |
|
491 | - |
|
492 | - /** |
|
493 | - * Wrapper for WP_Filesystem_Base::delete |
|
494 | - * |
|
495 | - * @param string $filepath |
|
496 | - * @param boolean $recursive |
|
497 | - * @param boolean|string $type 'd' for directory, 'f' for file |
|
498 | - * @return boolean |
|
499 | - */ |
|
500 | - public static function delete($filepath, $recursive = false, $type = false) |
|
501 | - { |
|
502 | - $wp_filesystem = EEH_File::_get_wp_filesystem(); |
|
503 | - return $wp_filesystem->delete($filepath, $recursive, $type); |
|
504 | - } |
|
505 | - |
|
506 | - |
|
507 | - /** |
|
508 | - * exists |
|
509 | - * checks if a file exists using the WP filesystem |
|
510 | - * |
|
511 | - * @param string $full_file_path |
|
512 | - * @return bool |
|
513 | - */ |
|
514 | - public static function exists($full_file_path = '') |
|
515 | - { |
|
516 | - $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
517 | - return $wp_filesystem->exists(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
518 | - } |
|
519 | - |
|
520 | - |
|
521 | - /** |
|
522 | - * is_readable |
|
523 | - * checks if a file is_readable using the WP filesystem |
|
524 | - * |
|
525 | - * @param string $full_file_path |
|
526 | - * @return bool |
|
527 | - */ |
|
528 | - public static function is_readable($full_file_path = '') |
|
529 | - { |
|
530 | - $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
531 | - return $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
532 | - } |
|
533 | - |
|
534 | - |
|
535 | - /** |
|
536 | - * remove_filename_from_filepath |
|
537 | - * given a full path to a file including the filename itself, this removes the filename and returns the path, up |
|
538 | - * to, but NOT including the filename OR slash |
|
539 | - * |
|
540 | - * @param string $full_file_path |
|
541 | - * @return string |
|
542 | - */ |
|
543 | - public static function remove_filename_from_filepath($full_file_path = '') |
|
544 | - { |
|
545 | - return pathinfo($full_file_path, PATHINFO_DIRNAME); |
|
546 | - } |
|
547 | - |
|
548 | - |
|
549 | - /** |
|
550 | - * get_filename_from_filepath. Arguably the same as basename() |
|
551 | - * |
|
552 | - * @param string $full_file_path |
|
553 | - * @return string |
|
554 | - */ |
|
555 | - public static function get_filename_from_filepath($full_file_path = '') |
|
556 | - { |
|
557 | - return pathinfo($full_file_path, PATHINFO_BASENAME); |
|
558 | - } |
|
559 | - |
|
560 | - |
|
561 | - /** |
|
562 | - * get_file_extension |
|
563 | - * |
|
564 | - * @param string $full_file_path |
|
565 | - * @return string |
|
566 | - */ |
|
567 | - public static function get_file_extension($full_file_path = '') |
|
568 | - { |
|
569 | - return pathinfo($full_file_path, PATHINFO_EXTENSION); |
|
570 | - } |
|
571 | - |
|
572 | - |
|
573 | - /** |
|
574 | - * add_htaccess_deny_from_all so the web server cannot access this folder |
|
575 | - * |
|
576 | - * @param string $folder |
|
577 | - * @return bool |
|
578 | - */ |
|
579 | - public static function add_htaccess_deny_from_all($folder = '') |
|
580 | - { |
|
581 | - $folder = EEH_File::standardise_and_end_with_directory_separator($folder); |
|
582 | - if (! EEH_File::exists($folder . '.htaccess')) { |
|
583 | - if (! EEH_File::write_to_file($folder . '.htaccess', 'deny from all', '.htaccess')) { |
|
584 | - return false; |
|
585 | - } |
|
586 | - } |
|
587 | - |
|
588 | - return true; |
|
589 | - } |
|
590 | - |
|
591 | - |
|
592 | - /** |
|
593 | - * Adds an index file to this folder, so folks can't list all the file's contents |
|
594 | - * |
|
595 | - * @param string $folder |
|
596 | - * @return boolean |
|
597 | - */ |
|
598 | - public static function add_index_file($folder) |
|
599 | - { |
|
600 | - $folder = EEH_File::standardise_and_end_with_directory_separator($folder); |
|
601 | - if (! EEH_File::exists($folder . 'index.php')) { |
|
602 | - if (! EEH_File::write_to_file( |
|
603 | - $folder . 'index.php', |
|
604 | - 'You are not permitted to read from this folder', |
|
605 | - '.php' |
|
606 | - )) { |
|
607 | - return false; |
|
608 | - } |
|
609 | - } |
|
610 | - return true; |
|
611 | - } |
|
612 | - |
|
613 | - |
|
614 | - /** |
|
615 | - * Given that the file in $file_path has the normal name, (ie, CLASSNAME.whatever.php), |
|
616 | - * extract that classname. |
|
617 | - * |
|
618 | - * @param string $file_path |
|
619 | - * @return string |
|
620 | - */ |
|
621 | - public static function get_classname_from_filepath_with_standard_filename($file_path) |
|
622 | - { |
|
623 | - // extract file from path |
|
624 | - $filename = basename($file_path); |
|
625 | - // now remove the first period and everything after |
|
626 | - $pos_of_first_period = strpos($filename, '.'); |
|
627 | - return substr($filename, 0, $pos_of_first_period); |
|
628 | - } |
|
629 | - |
|
630 | - |
|
631 | - /** |
|
632 | - * standardise_directory_separators |
|
633 | - * convert all directory separators in a file path. |
|
634 | - * |
|
635 | - * @param string $file_path |
|
636 | - * @param bool $rtrim will remove trailing backslash |
|
637 | - * @return string |
|
638 | - */ |
|
639 | - public static function standardise_directory_separators($file_path, $rtrim = false) |
|
640 | - { |
|
641 | - $file_path = $rtrim ? rtrim($file_path, '/\\') : $file_path; |
|
642 | - return str_replace(['\\', '/'], '/', $file_path); |
|
643 | - } |
|
644 | - |
|
645 | - |
|
646 | - /** |
|
647 | - * end_with_directory_separator |
|
648 | - * ensures that file path ends with '/' |
|
649 | - * |
|
650 | - * @param string $file_path |
|
651 | - * @return string |
|
652 | - */ |
|
653 | - public static function end_with_directory_separator($file_path) |
|
654 | - { |
|
655 | - return rtrim($file_path, '/\\') . '/'; |
|
656 | - } |
|
657 | - |
|
658 | - |
|
659 | - /** |
|
660 | - * shorthand for both EEH_FIle::end_with_directory_separator AND EEH_File::standardise_directory_separators |
|
661 | - * |
|
662 | - * @param $file_path |
|
663 | - * @return string |
|
664 | - */ |
|
665 | - public static function standardise_and_end_with_directory_separator($file_path) |
|
666 | - { |
|
667 | - return self::end_with_directory_separator(self::standardise_directory_separators($file_path)); |
|
668 | - } |
|
669 | - |
|
670 | - |
|
671 | - /** |
|
672 | - * takes the folder name (with or without trailing slash) and finds the files it in, |
|
673 | - * and what the class's name inside of each should be. |
|
674 | - * |
|
675 | - * @param array $folder_paths |
|
676 | - * @param boolean $index_numerically if TRUE, the returned array will be indexed numerically; |
|
677 | - * if FALSE (Default), returned array will be indexed by the filenames minus |
|
678 | - * extensions. Set it TRUE if you know there are files in the directory with the |
|
679 | - * same name but different extensions |
|
680 | - * @return array if $index_numerically == TRUE keys are numeric , |
|
681 | - * if $index_numerically == FALSE (Default) keys are what the class names SHOULD |
|
682 | - * be; and values are their file paths |
|
683 | - */ |
|
684 | - public static function get_contents_of_folders($folder_paths = [], $index_numerically = false) |
|
685 | - { |
|
686 | - $class_to_folder_path = []; |
|
687 | - foreach ($folder_paths as $folder_path) { |
|
688 | - $folder_path = self::standardise_and_end_with_directory_separator($folder_path); |
|
689 | - // load WP_Filesystem and set file permissions |
|
690 | - $files_in_folder = glob($folder_path . '*.php'); |
|
691 | - $class_to_folder_path = []; |
|
692 | - if ($files_in_folder) { |
|
693 | - foreach ($files_in_folder as $file_path) { |
|
694 | - // only add files, not folders |
|
695 | - if (! is_dir($file_path)) { |
|
696 | - if ($index_numerically) { |
|
697 | - $class_to_folder_path[] = $file_path; |
|
698 | - } else { |
|
699 | - $classname = |
|
700 | - self::get_classname_from_filepath_with_standard_filename($file_path); |
|
701 | - $class_to_folder_path[ $classname ] = $file_path; |
|
702 | - } |
|
703 | - } |
|
704 | - } |
|
705 | - } |
|
706 | - } |
|
707 | - return $class_to_folder_path; |
|
708 | - } |
|
709 | - |
|
710 | - |
|
711 | - /** |
|
712 | - * Copies a file. Mostly a wrapper of WP_Filesystem::copy |
|
713 | - * |
|
714 | - * @param string $source_file |
|
715 | - * @param string $destination_file |
|
716 | - * @param boolean $overwrite |
|
717 | - * @return boolean success |
|
718 | - */ |
|
719 | - public static function copy($source_file, $destination_file, $overwrite = false) |
|
720 | - { |
|
721 | - $source_file = EEH_File::validateFileForCopyOrMove($source_file); |
|
722 | - $destination_file = EEH_File::validateFolderForCopyOrMove($destination_file); |
|
723 | - if (! $source_file || ! $destination_file) { |
|
724 | - return false; |
|
725 | - } |
|
726 | - // load WP_Filesystem and set file permissions |
|
727 | - $wp_filesystem = EEH_File::_get_wp_filesystem($destination_file); |
|
728 | - // write the file |
|
729 | - $copied = $wp_filesystem->copy( |
|
730 | - EEH_File::convert_local_filepath_to_remote_filepath($source_file), |
|
731 | - EEH_File::convert_local_filepath_to_remote_filepath($destination_file), |
|
732 | - $overwrite |
|
733 | - ); |
|
734 | - if (! $copied) { |
|
735 | - if (defined('WP_DEBUG') && WP_DEBUG) { |
|
736 | - $msg = sprintf( |
|
737 | - __( |
|
738 | - 'Attempted writing to file %1$s, but could not, probably because of permissions issues', |
|
739 | - 'event_espresso' |
|
740 | - ), |
|
741 | - $source_file |
|
742 | - ); |
|
743 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath($source_file, 'f'); |
|
744 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
745 | - } |
|
746 | - return false; |
|
747 | - } |
|
748 | - return true; |
|
749 | - } |
|
750 | - |
|
751 | - |
|
752 | - /** |
|
753 | - * Reports whether or not the filepath is in the EE uploads folder or not |
|
754 | - * |
|
755 | - * @param string $filepath |
|
756 | - * @return boolean |
|
757 | - */ |
|
758 | - public static function is_in_uploads_folder($filepath) |
|
759 | - { |
|
760 | - $uploads = wp_upload_dir(); |
|
761 | - return strpos($filepath, $uploads['basedir']) === 0; |
|
762 | - } |
|
763 | - |
|
764 | - |
|
765 | - /** |
|
766 | - * Given a "local" filepath (what you probably thought was the only filepath), |
|
767 | - * converts it into a "remote" filepath (the filepath the currently-in-use |
|
768 | - * $wp_filesystem needs to use access the folder or file). |
|
769 | - * See http://wordpress.stackexchange.com/questions/124900/using-wp-filesystem-in-plugins |
|
770 | - * |
|
771 | - * @param string $local_filepath the filepath to the folder/file locally |
|
772 | - * @return string the remote filepath (eg the filepath the filesystem method, eg |
|
773 | - * ftp or ssh, will use to access the folder |
|
774 | - */ |
|
775 | - public static function convert_local_filepath_to_remote_filepath($local_filepath) |
|
776 | - { |
|
777 | - $wp_filesystem = EEH_File::_get_wp_filesystem($local_filepath); |
|
778 | - return str_replace(WP_CONTENT_DIR . '/', $wp_filesystem->wp_content_dir(), $local_filepath); |
|
779 | - } |
|
780 | - |
|
781 | - |
|
782 | - /** |
|
783 | - * wrapper for WP_Filesystem::chmod() |
|
784 | - * |
|
785 | - * @param string $file Path to the file. |
|
786 | - * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, |
|
787 | - * 0755 for directories. Default false. |
|
788 | - * @param bool $recursive Optional. If set to true, changes file permissions recursively. |
|
789 | - * Default false. |
|
790 | - * @return bool True on success, false on failure. |
|
791 | - */ |
|
792 | - public static function chmod($file, $mode = false, $recursive = false) |
|
793 | - { |
|
794 | - $wp_filesystem = EEH_File::_get_wp_filesystem($file); |
|
795 | - return $wp_filesystem->chmod($file, $mode, $recursive); |
|
796 | - } |
|
797 | - |
|
798 | - |
|
799 | - /** |
|
800 | - * wrapper for WP_Filesystem::getchmod() |
|
801 | - * |
|
802 | - * @param string $file Path to the file. |
|
803 | - * @return string Mode of the file (the last 3 digits). |
|
804 | - */ |
|
805 | - public static function permissions($file) |
|
806 | - { |
|
807 | - $wp_filesystem = EEH_File::_get_wp_filesystem($file); |
|
808 | - return $wp_filesystem->getchmod($file); |
|
809 | - } |
|
810 | - |
|
811 | - |
|
812 | - /** |
|
813 | - * wrapper for WP_Filesystem::owner() |
|
814 | - * |
|
815 | - * @param string $file Path to the file. |
|
816 | - * @return string|false Username of the owner on success, false on failure. |
|
817 | - */ |
|
818 | - public static function owner($file) |
|
819 | - { |
|
820 | - $wp_filesystem = EEH_File::_get_wp_filesystem($file); |
|
821 | - return $wp_filesystem->owner($file); |
|
822 | - } |
|
823 | - |
|
824 | - |
|
825 | - /** |
|
826 | - * wrapper for WP_Filesystem::group() |
|
827 | - * |
|
828 | - * @param string $file Path to the file. |
|
829 | - * @return string|false The group on success, false on failure. |
|
830 | - */ |
|
831 | - public static function group($file) |
|
832 | - { |
|
833 | - $wp_filesystem = EEH_File::_get_wp_filesystem($file); |
|
834 | - return $wp_filesystem->group($file); |
|
835 | - } |
|
836 | - |
|
837 | - |
|
838 | - /** |
|
839 | - * wrapper for WP_Filesystem::move() |
|
840 | - * |
|
841 | - * @param string $source Path to the source file. |
|
842 | - * @param string $destination Path to the destination file. |
|
843 | - * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. |
|
844 | - * Default false. |
|
845 | - * @return bool True on success, false on failure. |
|
846 | - */ |
|
847 | - public static function move($source, $destination, $overwrite = false) |
|
848 | - { |
|
849 | - // throw new RuntimeException("source: {$source} && destination: {$destination}"); |
|
850 | - $source = EEH_File::validateFileForCopyOrMove($source); |
|
851 | - $destination = EEH_File::validateFolderForCopyOrMove($destination); |
|
852 | - if (! $source || ! $destination) { |
|
853 | - return false; |
|
854 | - } |
|
855 | - $wp_filesystem = EEH_File::_get_wp_filesystem($source); |
|
856 | - if ($wp_filesystem->move($source, $destination, $overwrite)) { |
|
857 | - return true; |
|
858 | - } |
|
859 | - if (defined('WP_DEBUG') && WP_DEBUG) { |
|
860 | - $file = EEH_File::convert_local_filepath_to_remote_filepath($source); |
|
861 | - $owner = EEH_File::owner($file); |
|
862 | - $group = EEH_File::group($file); |
|
863 | - $permissions = EEH_File::permissions($file); |
|
864 | - EE_Error::add_error( |
|
865 | - sprintf( |
|
866 | - esc_html__( |
|
867 | - 'Unable to move the file "%1$s" to new location (possible permissions errors). The existing "owner:group permissions" for the file are: "%2$s"', |
|
868 | - 'event_espresso' |
|
869 | - ), |
|
870 | - $destination, |
|
871 | - "{$owner}:{$group} $permissions" |
|
872 | - ), |
|
873 | - __FILE__, |
|
874 | - __FUNCTION__, |
|
875 | - __LINE__ |
|
876 | - ); |
|
877 | - } |
|
878 | - return false; |
|
879 | - } |
|
880 | - |
|
881 | - |
|
882 | - /** |
|
883 | - * @param string $source_file |
|
884 | - * @return string |
|
885 | - */ |
|
886 | - private static function validateFileForCopyOrMove($source_file) |
|
887 | - { |
|
888 | - $full_source_path = EEH_File::standardise_directory_separators($source_file); |
|
889 | - if (! EEH_File::exists($full_source_path)) { |
|
890 | - if (defined('WP_DEBUG') && WP_DEBUG) { |
|
891 | - $msg = |
|
892 | - sprintf( |
|
893 | - __('The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso'), |
|
894 | - '', |
|
895 | - $full_source_path |
|
896 | - ); |
|
897 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path); |
|
898 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
899 | - } |
|
900 | - return ''; |
|
901 | - } |
|
902 | - return $full_source_path; |
|
903 | - } |
|
904 | - |
|
905 | - |
|
906 | - /** |
|
907 | - * @param string $destination_file |
|
908 | - * @return string |
|
909 | - */ |
|
910 | - private static function validateFolderForCopyOrMove($destination_file) |
|
911 | - { |
|
912 | - $full_dest_path = EEH_File::standardise_directory_separators($destination_file); |
|
913 | - $folder = EEH_File::remove_filename_from_filepath($full_dest_path); |
|
914 | - EEH_File::ensure_folder_exists_and_is_writable($folder); |
|
915 | - if (! EEH_File::verify_is_writable($folder, 'folder')) { |
|
916 | - if (defined('WP_DEBUG') && WP_DEBUG) { |
|
917 | - $msg = sprintf( |
|
918 | - __('The file located at "%2$s" is not writable.', 'event_espresso'), |
|
919 | - '', |
|
920 | - $full_dest_path |
|
921 | - ); |
|
922 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_dest_path); |
|
923 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
924 | - } |
|
925 | - return ''; |
|
926 | - } |
|
927 | - return $full_dest_path; |
|
928 | - } |
|
28 | + /** |
|
29 | + * @var string $_credentials_form |
|
30 | + */ |
|
31 | + private static $_credentials_form; |
|
32 | + |
|
33 | + /** |
|
34 | + * @var WP_Filesystem_Base $_wp_filesystem |
|
35 | + */ |
|
36 | + protected static $_wp_filesystem; |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * @param string|null $filepath the filepath we want to work in. If its in the |
|
41 | + * wp uploads directory, we'll want to just use the filesystem directly. |
|
42 | + * If not provided, we have to assume its not in the uploads directory |
|
43 | + * @return WP_Filesystem_Base |
|
44 | + */ |
|
45 | + private static function _get_wp_filesystem($filepath = null) |
|
46 | + { |
|
47 | + if (apply_filters( |
|
48 | + 'FHEE__EEH_File___get_wp_filesystem__allow_using_filesystem_direct', |
|
49 | + $filepath && EEH_File::is_in_uploads_folder($filepath), |
|
50 | + $filepath |
|
51 | + )) { |
|
52 | + return EEH_File::loadAlternateWpFileSystem(); |
|
53 | + } |
|
54 | + return EEH_File::loadWpFileSystem(); |
|
55 | + } |
|
56 | + |
|
57 | + |
|
58 | + /** |
|
59 | + * @return WP_Filesystem_Base |
|
60 | + */ |
|
61 | + private static function loadAlternateWpFileSystem() |
|
62 | + { |
|
63 | + if (! EEH_File::$_wp_filesystem instanceof WP_Filesystem_Base) { |
|
64 | + require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); |
|
65 | + $method = 'direct'; |
|
66 | + $wp_filesystem_file = |
|
67 | + apply_filters( |
|
68 | + 'filesystem_method_file', |
|
69 | + ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', |
|
70 | + $method |
|
71 | + ); |
|
72 | + // added the following validation logic |
|
73 | + // because we allow the filesystem filepath to be filtered, |
|
74 | + // and are loading whatever file the path pointed to, |
|
75 | + // but we were not validating things in any way :scream_emoji: |
|
76 | + $valid_wp_filesystem_types = [ |
|
77 | + 'direct' => 'WP_Filesystem_Direct', |
|
78 | + 'ftpext' => 'WP_Filesystem_FTPext', |
|
79 | + 'ftpsockets' => 'WP_Filesystem_ftpsockets', |
|
80 | + 'ssh2' => 'WP_Filesystem_SSH2', |
|
81 | + ]; |
|
82 | + $valid = false; |
|
83 | + $wp_filesystem_class = ''; |
|
84 | + foreach ($valid_wp_filesystem_types as $method => $filesystem_class) { |
|
85 | + // if file path matches for one of valid types, then toggle $valid to true |
|
86 | + if (strpos($wp_filesystem_file, $method) > 0) { |
|
87 | + $valid = true; |
|
88 | + $wp_filesystem_class = $filesystem_class; |
|
89 | + } |
|
90 | + } |
|
91 | + if (! $valid || ! file_exists($wp_filesystem_file)) { |
|
92 | + EE_Error::add_error( |
|
93 | + sprintf( |
|
94 | + __( |
|
95 | + 'The supplied WP Filesystem filepath "%1$s" is either missing or invalid.', |
|
96 | + 'event_espresso' |
|
97 | + ), |
|
98 | + $wp_filesystem_file |
|
99 | + ), |
|
100 | + __FILE__, |
|
101 | + __FUNCTION__, |
|
102 | + __LINE__ |
|
103 | + ); |
|
104 | + } |
|
105 | + // check constants defined, just like in the wp-admin/includes/file.php WP_Filesystem() |
|
106 | + if (! defined('FS_CHMOD_DIR')) { |
|
107 | + define('FS_CHMOD_DIR', (fileperms(ABSPATH) & 0775 | 0755)); |
|
108 | + } |
|
109 | + if (! defined('FS_CHMOD_FILE')) { |
|
110 | + define('FS_CHMOD_FILE', (fileperms(ABSPATH . 'index.php') & 0775 | 0644)); |
|
111 | + } |
|
112 | + require_once($wp_filesystem_file); |
|
113 | + EEH_File::$_wp_filesystem = new $wp_filesystem_class([]); |
|
114 | + } |
|
115 | + return EEH_File::$_wp_filesystem; |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * @return WP_Filesystem_Base |
|
121 | + */ |
|
122 | + private static function loadWpFileSystem() |
|
123 | + { |
|
124 | + global $wp_filesystem; |
|
125 | + // no filesystem setup ??? |
|
126 | + if (! $wp_filesystem instanceof WP_Filesystem_Base) { |
|
127 | + // if some eager beaver's just trying to get in there too early... |
|
128 | + // let them do it, because we are one of those eager beavers! :P |
|
129 | + /** |
|
130 | + * more explanations are probably merited. http://codex.wordpress.org/Filesystem_API#Initializing_WP_Filesystem_Base |
|
131 | + * says WP_Filesystem should be used after 'wp_loaded', but currently EE's activation process |
|
132 | + * is setup to mostly happen on 'init', and refactoring to have it happen on |
|
133 | + * 'wp_loaded' is too much work on a BETA milestone. |
|
134 | + * So this fix is expected to work if the WP files are owned by the server user, |
|
135 | + * but probably not if the user needs to enter their FTP credentials to modify files |
|
136 | + * and there may be troubles if the WP files are owned by a different user |
|
137 | + * than the server user. But both of these issues should exist in 4.4 and earlier too |
|
138 | + */ |
|
139 | + if (false && ! did_action('wp_loaded')) { |
|
140 | + $msg = |
|
141 | + __( |
|
142 | + 'An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', |
|
143 | + 'event_espresso' |
|
144 | + ); |
|
145 | + if (WP_DEBUG) { |
|
146 | + $msg .= '<br />' . __( |
|
147 | + 'The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', |
|
148 | + 'event_espresso' |
|
149 | + ); |
|
150 | + } |
|
151 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
152 | + } |
|
153 | + // should be loaded if we are past the wp_loaded hook... |
|
154 | + if (! function_exists('WP_Filesystem') || ! function_exists('submit_button')) { |
|
155 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
156 | + require_once(ABSPATH . 'wp-admin/includes/template.php'); |
|
157 | + } |
|
158 | + // turn on output buffering so that we can capture the credentials form |
|
159 | + ob_start(); |
|
160 | + $credentials = request_filesystem_credentials(false); |
|
161 | + // store credentials form for the time being |
|
162 | + EEH_File::$_credentials_form = ob_get_clean(); |
|
163 | + // if credentials do NOT exist |
|
164 | + if ($credentials === false) { |
|
165 | + add_action('admin_notices', ['EEH_File', 'display_request_filesystem_credentials_form'], 999); |
|
166 | + EE_Error::add_error( |
|
167 | + __( |
|
168 | + 'An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', |
|
169 | + 'event_espresso' |
|
170 | + ), |
|
171 | + __FILE__, |
|
172 | + __FUNCTION__, |
|
173 | + __LINE__ |
|
174 | + ); |
|
175 | + } |
|
176 | + // basically check for direct or previously configured access |
|
177 | + if (! WP_Filesystem($credentials) |
|
178 | + && is_wp_error($wp_filesystem->errors) |
|
179 | + && $wp_filesystem->errors->get_error_code() |
|
180 | + ) { |
|
181 | + add_action('admin_notices', ['EEH_File', 'display_request_filesystem_credentials_form'], 999); |
|
182 | + EE_Error::add_error( |
|
183 | + sprintf( |
|
184 | + __('WP Filesystem Error: $1%s', 'event_espresso'), |
|
185 | + $wp_filesystem->errors->get_error_message() |
|
186 | + ), |
|
187 | + __FILE__, |
|
188 | + __FUNCTION__, |
|
189 | + __LINE__ |
|
190 | + ); |
|
191 | + } |
|
192 | + } |
|
193 | + return $wp_filesystem; |
|
194 | + } |
|
195 | + |
|
196 | + |
|
197 | + /** |
|
198 | + * display_request_filesystem_credentials_form |
|
199 | + */ |
|
200 | + public static function display_request_filesystem_credentials_form() |
|
201 | + { |
|
202 | + if (! empty(EEH_File::$_credentials_form)) { |
|
203 | + echo '<div class="updated espresso-notices-attention"><p>' . EEH_File::$_credentials_form . '</p></div>'; |
|
204 | + } |
|
205 | + } |
|
206 | + |
|
207 | + |
|
208 | + /** |
|
209 | + * verify_filepath_and_permissions |
|
210 | + * checks that a file is readable and has sufficient file permissions set to access |
|
211 | + * |
|
212 | + * @access public |
|
213 | + * @param string $full_file_path - full server path to the folder or file |
|
214 | + * @param string $file_name - name of file if checking a file |
|
215 | + * @param string $file_ext - file extension (ie: "php") if checking a file |
|
216 | + * @param string $type_of_file - general type of file (ie: "module"), this is only used to improve error messages |
|
217 | + * @return bool |
|
218 | + */ |
|
219 | + public static function verify_filepath_and_permissions( |
|
220 | + $full_file_path = '', |
|
221 | + $file_name = '', |
|
222 | + $file_ext = '', |
|
223 | + $type_of_file = '' |
|
224 | + ) { |
|
225 | + // load WP_Filesystem and set file permissions |
|
226 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
227 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
228 | + if (! $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
229 | + $file_name = ! empty($type_of_file) ? $file_name . ' ' . $type_of_file : $file_name; |
|
230 | + $file_name .= ! empty($file_ext) ? ' file' : ' folder'; |
|
231 | + $msg = sprintf( |
|
232 | + __( |
|
233 | + 'The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', |
|
234 | + 'event_espresso' |
|
235 | + ), |
|
236 | + $file_name, |
|
237 | + '<br />' |
|
238 | + ); |
|
239 | + if (EEH_File::exists($full_file_path)) { |
|
240 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, $type_of_file); |
|
241 | + } else { |
|
242 | + // no file permissions means the file was not found |
|
243 | + $msg .= sprintf( |
|
244 | + __('Please ensure the following path is correct: "%s".', 'event_espresso'), |
|
245 | + $full_file_path |
|
246 | + ); |
|
247 | + } |
|
248 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
249 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
250 | + } |
|
251 | + return false; |
|
252 | + } |
|
253 | + return true; |
|
254 | + } |
|
255 | + |
|
256 | + |
|
257 | + /** |
|
258 | + * _permissions_error_for_unreadable_filepath - attempts to determine why permissions are set incorrectly for a |
|
259 | + * file or folder |
|
260 | + * |
|
261 | + * @access private |
|
262 | + * @param string $full_file_path - full server path to the folder or file |
|
263 | + * @param string $type_of_file - general type of file (ie: "module"), this is only used to improve error messages |
|
264 | + * @return string |
|
265 | + */ |
|
266 | + private static function _permissions_error_for_unreadable_filepath($full_file_path = '', $type_of_file = '') |
|
267 | + { |
|
268 | + // load WP_Filesystem and set file permissions |
|
269 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
270 | + // check file permissions |
|
271 | + $perms = $wp_filesystem->getchmod(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
272 | + if ($perms) { |
|
273 | + // file permissions exist, but way be set incorrectly |
|
274 | + $type_of_file = ! empty($type_of_file) ? $type_of_file . ' ' : ''; |
|
275 | + $type_of_file .= ! empty($type_of_file) ? 'file' : 'folder'; |
|
276 | + return ' ' . sprintf( |
|
277 | + __( |
|
278 | + 'File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', |
|
279 | + 'event_espresso' |
|
280 | + ), |
|
281 | + $type_of_file, |
|
282 | + $perms |
|
283 | + ); |
|
284 | + } else { |
|
285 | + // file exists but file permissions could not be read ?!?! |
|
286 | + return ' ' . sprintf( |
|
287 | + __( |
|
288 | + 'Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', |
|
289 | + 'event_espresso' |
|
290 | + ), |
|
291 | + $full_file_path |
|
292 | + ); |
|
293 | + } |
|
294 | + } |
|
295 | + |
|
296 | + |
|
297 | + /** |
|
298 | + * ensure_folder_exists_and_is_writable |
|
299 | + * ensures that a folder exists and is writable, will attempt to create folder if it does not exist |
|
300 | + * Also ensures all the parent folders exist, and if not tries to create them. |
|
301 | + * Also, if this function creates the folder, adds a .htaccess file and index.html file |
|
302 | + * |
|
303 | + * @param string $folder |
|
304 | + * @return bool false if folder isn't writable; true if it exists and is writeable, |
|
305 | + */ |
|
306 | + public static function ensure_folder_exists_and_is_writable($folder = '') |
|
307 | + { |
|
308 | + if (empty($folder)) { |
|
309 | + return false; |
|
310 | + } |
|
311 | + // remove ending / |
|
312 | + $folder = EEH_File::standardise_directory_separators(rtrim($folder, '/\\')); |
|
313 | + $parent_folder = EEH_File::get_parent_folder($folder); |
|
314 | + // add / to folder |
|
315 | + $folder = EEH_File::end_with_directory_separator($folder); |
|
316 | + $wp_filesystem = EEH_File::_get_wp_filesystem($folder); |
|
317 | + $remote_dir = EEH_File::convert_local_filepath_to_remote_filepath($folder); |
|
318 | + if (! $wp_filesystem->is_dir($remote_dir)) { |
|
319 | + // ok so it doesn't exist. Does its parent? Can we write to it? |
|
320 | + if (! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
321 | + return false; |
|
322 | + } |
|
323 | + if (! EEH_File::verify_is_writable($parent_folder, 'folder')) { |
|
324 | + return false; |
|
325 | + } |
|
326 | + if (! $wp_filesystem->mkdir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) { |
|
327 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
328 | + $msg = sprintf(__('"%s" could not be created.', 'event_espresso'), $folder); |
|
329 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($folder); |
|
330 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
331 | + } |
|
332 | + return false; |
|
333 | + } |
|
334 | + EEH_File::add_index_file($folder); |
|
335 | + } elseif (! EEH_File::verify_is_writable($folder, 'folder')) { |
|
336 | + return false; |
|
337 | + } |
|
338 | + return true; |
|
339 | + } |
|
340 | + |
|
341 | + |
|
342 | + /** |
|
343 | + * verify_is_writable - checks if a file or folder is writable |
|
344 | + * |
|
345 | + * @param string $full_path - full server path to file or folder |
|
346 | + * @param string $file_or_folder - whether checking a file or folder |
|
347 | + * @return bool |
|
348 | + */ |
|
349 | + public static function verify_is_writable($full_path = '', $file_or_folder = 'folder') |
|
350 | + { |
|
351 | + // load WP_Filesystem and set file permissions |
|
352 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_path); |
|
353 | + $full_path = EEH_File::standardise_directory_separators($full_path); |
|
354 | + $remote_path = EEH_File::convert_local_filepath_to_remote_filepath($full_path); |
|
355 | + $remote_path = rtrim($remote_path, '/\\'); |
|
356 | + if (! $wp_filesystem->is_writable($remote_path)) { |
|
357 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
358 | + $msg = sprintf(__('The "%1$s" %2$s is not writable.', 'event_espresso'), $full_path, $file_or_folder); |
|
359 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_path); |
|
360 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
361 | + } |
|
362 | + return false; |
|
363 | + } |
|
364 | + return true; |
|
365 | + } |
|
366 | + |
|
367 | + |
|
368 | + /** |
|
369 | + * ensure_file_exists_and_is_writable |
|
370 | + * ensures that a file exists and is writable, will attempt to create file if it does not exist. |
|
371 | + * Also ensures all the parent folders exist, and if not tries to create them. |
|
372 | + * |
|
373 | + * @param string $full_file_path |
|
374 | + * @return bool |
|
375 | + */ |
|
376 | + public static function ensure_file_exists_and_is_writable($full_file_path = '') |
|
377 | + { |
|
378 | + // load WP_Filesystem and set file permissions |
|
379 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
380 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
381 | + $parent_folder = EEH_File::get_parent_folder($full_file_path); |
|
382 | + if (! EEH_File::exists($full_file_path)) { |
|
383 | + if (! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
384 | + return false; |
|
385 | + } |
|
386 | + if (! $wp_filesystem->touch(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
387 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
388 | + $msg = sprintf(__('The "%s" file could not be created.', 'event_espresso'), $full_file_path); |
|
389 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path); |
|
390 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
391 | + } |
|
392 | + return false; |
|
393 | + } |
|
394 | + } |
|
395 | + if (! EEH_File::verify_is_writable($full_file_path, 'file')) { |
|
396 | + return false; |
|
397 | + } |
|
398 | + return true; |
|
399 | + } |
|
400 | + |
|
401 | + |
|
402 | + /** |
|
403 | + * Gets the parent folder. If provided with file, gets the folder that contains it. |
|
404 | + * If provided a folder, gets its parent folder. |
|
405 | + * |
|
406 | + * @param string $file_or_folder_path |
|
407 | + * @return string parent folder, ENDING with a directory separator |
|
408 | + */ |
|
409 | + public static function get_parent_folder($file_or_folder_path) |
|
410 | + { |
|
411 | + // find the last /, ignoring a / on the very end |
|
412 | + // eg if given "/var/something/somewhere/", we want to get "somewhere"'s |
|
413 | + // parent folder, "/var/something/" |
|
414 | + $ds = strlen($file_or_folder_path) > 1 |
|
415 | + ? strrpos($file_or_folder_path, '/', -2) |
|
416 | + : strlen($file_or_folder_path); |
|
417 | + return substr($file_or_folder_path, 0, $ds + 1); |
|
418 | + } |
|
419 | + |
|
420 | + |
|
421 | + /** |
|
422 | + * get_file_contents |
|
423 | + * |
|
424 | + * @param string $full_file_path |
|
425 | + * @return string |
|
426 | + */ |
|
427 | + public static function get_file_contents($full_file_path = '') |
|
428 | + { |
|
429 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
430 | + if (EEH_File::verify_filepath_and_permissions( |
|
431 | + $full_file_path, |
|
432 | + EEH_File::get_filename_from_filepath($full_file_path), |
|
433 | + EEH_File::get_file_extension($full_file_path) |
|
434 | + )) { |
|
435 | + // load WP_Filesystem and set file permissions |
|
436 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
437 | + return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
438 | + } |
|
439 | + return ''; |
|
440 | + } |
|
441 | + |
|
442 | + |
|
443 | + /** |
|
444 | + * write_file |
|
445 | + * |
|
446 | + * @param string $full_file_path |
|
447 | + * @param string $file_contents - the content to be written to the file |
|
448 | + * @param string $file_type |
|
449 | + * @return bool |
|
450 | + */ |
|
451 | + public static function write_to_file($full_file_path = '', $file_contents = '', $file_type = '') |
|
452 | + { |
|
453 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
454 | + $file_type = ! empty($file_type) ? rtrim($file_type, ' ') . ' ' : ''; |
|
455 | + $folder = EEH_File::remove_filename_from_filepath($full_file_path); |
|
456 | + if (! EEH_File::verify_is_writable($folder, 'folder')) { |
|
457 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
458 | + $msg = |
|
459 | + sprintf( |
|
460 | + __('The %1$sfile located at "%2$s" is not writable.', 'event_espresso'), |
|
461 | + $file_type, |
|
462 | + $full_file_path |
|
463 | + ); |
|
464 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path); |
|
465 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
466 | + } |
|
467 | + return false; |
|
468 | + } |
|
469 | + // load WP_Filesystem and set file permissions |
|
470 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
471 | + // write the file |
|
472 | + if (! $wp_filesystem->put_contents( |
|
473 | + EEH_File::convert_local_filepath_to_remote_filepath($full_file_path), |
|
474 | + $file_contents |
|
475 | + )) { |
|
476 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
477 | + $msg = |
|
478 | + sprintf( |
|
479 | + __('The %1$sfile located at "%2$s" could not be written to.', 'event_espresso'), |
|
480 | + $file_type, |
|
481 | + $full_file_path |
|
482 | + ); |
|
483 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, 'f'); |
|
484 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
485 | + } |
|
486 | + return false; |
|
487 | + } |
|
488 | + return true; |
|
489 | + } |
|
490 | + |
|
491 | + |
|
492 | + /** |
|
493 | + * Wrapper for WP_Filesystem_Base::delete |
|
494 | + * |
|
495 | + * @param string $filepath |
|
496 | + * @param boolean $recursive |
|
497 | + * @param boolean|string $type 'd' for directory, 'f' for file |
|
498 | + * @return boolean |
|
499 | + */ |
|
500 | + public static function delete($filepath, $recursive = false, $type = false) |
|
501 | + { |
|
502 | + $wp_filesystem = EEH_File::_get_wp_filesystem(); |
|
503 | + return $wp_filesystem->delete($filepath, $recursive, $type); |
|
504 | + } |
|
505 | + |
|
506 | + |
|
507 | + /** |
|
508 | + * exists |
|
509 | + * checks if a file exists using the WP filesystem |
|
510 | + * |
|
511 | + * @param string $full_file_path |
|
512 | + * @return bool |
|
513 | + */ |
|
514 | + public static function exists($full_file_path = '') |
|
515 | + { |
|
516 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
517 | + return $wp_filesystem->exists(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
518 | + } |
|
519 | + |
|
520 | + |
|
521 | + /** |
|
522 | + * is_readable |
|
523 | + * checks if a file is_readable using the WP filesystem |
|
524 | + * |
|
525 | + * @param string $full_file_path |
|
526 | + * @return bool |
|
527 | + */ |
|
528 | + public static function is_readable($full_file_path = '') |
|
529 | + { |
|
530 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
531 | + return $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
532 | + } |
|
533 | + |
|
534 | + |
|
535 | + /** |
|
536 | + * remove_filename_from_filepath |
|
537 | + * given a full path to a file including the filename itself, this removes the filename and returns the path, up |
|
538 | + * to, but NOT including the filename OR slash |
|
539 | + * |
|
540 | + * @param string $full_file_path |
|
541 | + * @return string |
|
542 | + */ |
|
543 | + public static function remove_filename_from_filepath($full_file_path = '') |
|
544 | + { |
|
545 | + return pathinfo($full_file_path, PATHINFO_DIRNAME); |
|
546 | + } |
|
547 | + |
|
548 | + |
|
549 | + /** |
|
550 | + * get_filename_from_filepath. Arguably the same as basename() |
|
551 | + * |
|
552 | + * @param string $full_file_path |
|
553 | + * @return string |
|
554 | + */ |
|
555 | + public static function get_filename_from_filepath($full_file_path = '') |
|
556 | + { |
|
557 | + return pathinfo($full_file_path, PATHINFO_BASENAME); |
|
558 | + } |
|
559 | + |
|
560 | + |
|
561 | + /** |
|
562 | + * get_file_extension |
|
563 | + * |
|
564 | + * @param string $full_file_path |
|
565 | + * @return string |
|
566 | + */ |
|
567 | + public static function get_file_extension($full_file_path = '') |
|
568 | + { |
|
569 | + return pathinfo($full_file_path, PATHINFO_EXTENSION); |
|
570 | + } |
|
571 | + |
|
572 | + |
|
573 | + /** |
|
574 | + * add_htaccess_deny_from_all so the web server cannot access this folder |
|
575 | + * |
|
576 | + * @param string $folder |
|
577 | + * @return bool |
|
578 | + */ |
|
579 | + public static function add_htaccess_deny_from_all($folder = '') |
|
580 | + { |
|
581 | + $folder = EEH_File::standardise_and_end_with_directory_separator($folder); |
|
582 | + if (! EEH_File::exists($folder . '.htaccess')) { |
|
583 | + if (! EEH_File::write_to_file($folder . '.htaccess', 'deny from all', '.htaccess')) { |
|
584 | + return false; |
|
585 | + } |
|
586 | + } |
|
587 | + |
|
588 | + return true; |
|
589 | + } |
|
590 | + |
|
591 | + |
|
592 | + /** |
|
593 | + * Adds an index file to this folder, so folks can't list all the file's contents |
|
594 | + * |
|
595 | + * @param string $folder |
|
596 | + * @return boolean |
|
597 | + */ |
|
598 | + public static function add_index_file($folder) |
|
599 | + { |
|
600 | + $folder = EEH_File::standardise_and_end_with_directory_separator($folder); |
|
601 | + if (! EEH_File::exists($folder . 'index.php')) { |
|
602 | + if (! EEH_File::write_to_file( |
|
603 | + $folder . 'index.php', |
|
604 | + 'You are not permitted to read from this folder', |
|
605 | + '.php' |
|
606 | + )) { |
|
607 | + return false; |
|
608 | + } |
|
609 | + } |
|
610 | + return true; |
|
611 | + } |
|
612 | + |
|
613 | + |
|
614 | + /** |
|
615 | + * Given that the file in $file_path has the normal name, (ie, CLASSNAME.whatever.php), |
|
616 | + * extract that classname. |
|
617 | + * |
|
618 | + * @param string $file_path |
|
619 | + * @return string |
|
620 | + */ |
|
621 | + public static function get_classname_from_filepath_with_standard_filename($file_path) |
|
622 | + { |
|
623 | + // extract file from path |
|
624 | + $filename = basename($file_path); |
|
625 | + // now remove the first period and everything after |
|
626 | + $pos_of_first_period = strpos($filename, '.'); |
|
627 | + return substr($filename, 0, $pos_of_first_period); |
|
628 | + } |
|
629 | + |
|
630 | + |
|
631 | + /** |
|
632 | + * standardise_directory_separators |
|
633 | + * convert all directory separators in a file path. |
|
634 | + * |
|
635 | + * @param string $file_path |
|
636 | + * @param bool $rtrim will remove trailing backslash |
|
637 | + * @return string |
|
638 | + */ |
|
639 | + public static function standardise_directory_separators($file_path, $rtrim = false) |
|
640 | + { |
|
641 | + $file_path = $rtrim ? rtrim($file_path, '/\\') : $file_path; |
|
642 | + return str_replace(['\\', '/'], '/', $file_path); |
|
643 | + } |
|
644 | + |
|
645 | + |
|
646 | + /** |
|
647 | + * end_with_directory_separator |
|
648 | + * ensures that file path ends with '/' |
|
649 | + * |
|
650 | + * @param string $file_path |
|
651 | + * @return string |
|
652 | + */ |
|
653 | + public static function end_with_directory_separator($file_path) |
|
654 | + { |
|
655 | + return rtrim($file_path, '/\\') . '/'; |
|
656 | + } |
|
657 | + |
|
658 | + |
|
659 | + /** |
|
660 | + * shorthand for both EEH_FIle::end_with_directory_separator AND EEH_File::standardise_directory_separators |
|
661 | + * |
|
662 | + * @param $file_path |
|
663 | + * @return string |
|
664 | + */ |
|
665 | + public static function standardise_and_end_with_directory_separator($file_path) |
|
666 | + { |
|
667 | + return self::end_with_directory_separator(self::standardise_directory_separators($file_path)); |
|
668 | + } |
|
669 | + |
|
670 | + |
|
671 | + /** |
|
672 | + * takes the folder name (with or without trailing slash) and finds the files it in, |
|
673 | + * and what the class's name inside of each should be. |
|
674 | + * |
|
675 | + * @param array $folder_paths |
|
676 | + * @param boolean $index_numerically if TRUE, the returned array will be indexed numerically; |
|
677 | + * if FALSE (Default), returned array will be indexed by the filenames minus |
|
678 | + * extensions. Set it TRUE if you know there are files in the directory with the |
|
679 | + * same name but different extensions |
|
680 | + * @return array if $index_numerically == TRUE keys are numeric , |
|
681 | + * if $index_numerically == FALSE (Default) keys are what the class names SHOULD |
|
682 | + * be; and values are their file paths |
|
683 | + */ |
|
684 | + public static function get_contents_of_folders($folder_paths = [], $index_numerically = false) |
|
685 | + { |
|
686 | + $class_to_folder_path = []; |
|
687 | + foreach ($folder_paths as $folder_path) { |
|
688 | + $folder_path = self::standardise_and_end_with_directory_separator($folder_path); |
|
689 | + // load WP_Filesystem and set file permissions |
|
690 | + $files_in_folder = glob($folder_path . '*.php'); |
|
691 | + $class_to_folder_path = []; |
|
692 | + if ($files_in_folder) { |
|
693 | + foreach ($files_in_folder as $file_path) { |
|
694 | + // only add files, not folders |
|
695 | + if (! is_dir($file_path)) { |
|
696 | + if ($index_numerically) { |
|
697 | + $class_to_folder_path[] = $file_path; |
|
698 | + } else { |
|
699 | + $classname = |
|
700 | + self::get_classname_from_filepath_with_standard_filename($file_path); |
|
701 | + $class_to_folder_path[ $classname ] = $file_path; |
|
702 | + } |
|
703 | + } |
|
704 | + } |
|
705 | + } |
|
706 | + } |
|
707 | + return $class_to_folder_path; |
|
708 | + } |
|
709 | + |
|
710 | + |
|
711 | + /** |
|
712 | + * Copies a file. Mostly a wrapper of WP_Filesystem::copy |
|
713 | + * |
|
714 | + * @param string $source_file |
|
715 | + * @param string $destination_file |
|
716 | + * @param boolean $overwrite |
|
717 | + * @return boolean success |
|
718 | + */ |
|
719 | + public static function copy($source_file, $destination_file, $overwrite = false) |
|
720 | + { |
|
721 | + $source_file = EEH_File::validateFileForCopyOrMove($source_file); |
|
722 | + $destination_file = EEH_File::validateFolderForCopyOrMove($destination_file); |
|
723 | + if (! $source_file || ! $destination_file) { |
|
724 | + return false; |
|
725 | + } |
|
726 | + // load WP_Filesystem and set file permissions |
|
727 | + $wp_filesystem = EEH_File::_get_wp_filesystem($destination_file); |
|
728 | + // write the file |
|
729 | + $copied = $wp_filesystem->copy( |
|
730 | + EEH_File::convert_local_filepath_to_remote_filepath($source_file), |
|
731 | + EEH_File::convert_local_filepath_to_remote_filepath($destination_file), |
|
732 | + $overwrite |
|
733 | + ); |
|
734 | + if (! $copied) { |
|
735 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
736 | + $msg = sprintf( |
|
737 | + __( |
|
738 | + 'Attempted writing to file %1$s, but could not, probably because of permissions issues', |
|
739 | + 'event_espresso' |
|
740 | + ), |
|
741 | + $source_file |
|
742 | + ); |
|
743 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($source_file, 'f'); |
|
744 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
745 | + } |
|
746 | + return false; |
|
747 | + } |
|
748 | + return true; |
|
749 | + } |
|
750 | + |
|
751 | + |
|
752 | + /** |
|
753 | + * Reports whether or not the filepath is in the EE uploads folder or not |
|
754 | + * |
|
755 | + * @param string $filepath |
|
756 | + * @return boolean |
|
757 | + */ |
|
758 | + public static function is_in_uploads_folder($filepath) |
|
759 | + { |
|
760 | + $uploads = wp_upload_dir(); |
|
761 | + return strpos($filepath, $uploads['basedir']) === 0; |
|
762 | + } |
|
763 | + |
|
764 | + |
|
765 | + /** |
|
766 | + * Given a "local" filepath (what you probably thought was the only filepath), |
|
767 | + * converts it into a "remote" filepath (the filepath the currently-in-use |
|
768 | + * $wp_filesystem needs to use access the folder or file). |
|
769 | + * See http://wordpress.stackexchange.com/questions/124900/using-wp-filesystem-in-plugins |
|
770 | + * |
|
771 | + * @param string $local_filepath the filepath to the folder/file locally |
|
772 | + * @return string the remote filepath (eg the filepath the filesystem method, eg |
|
773 | + * ftp or ssh, will use to access the folder |
|
774 | + */ |
|
775 | + public static function convert_local_filepath_to_remote_filepath($local_filepath) |
|
776 | + { |
|
777 | + $wp_filesystem = EEH_File::_get_wp_filesystem($local_filepath); |
|
778 | + return str_replace(WP_CONTENT_DIR . '/', $wp_filesystem->wp_content_dir(), $local_filepath); |
|
779 | + } |
|
780 | + |
|
781 | + |
|
782 | + /** |
|
783 | + * wrapper for WP_Filesystem::chmod() |
|
784 | + * |
|
785 | + * @param string $file Path to the file. |
|
786 | + * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, |
|
787 | + * 0755 for directories. Default false. |
|
788 | + * @param bool $recursive Optional. If set to true, changes file permissions recursively. |
|
789 | + * Default false. |
|
790 | + * @return bool True on success, false on failure. |
|
791 | + */ |
|
792 | + public static function chmod($file, $mode = false, $recursive = false) |
|
793 | + { |
|
794 | + $wp_filesystem = EEH_File::_get_wp_filesystem($file); |
|
795 | + return $wp_filesystem->chmod($file, $mode, $recursive); |
|
796 | + } |
|
797 | + |
|
798 | + |
|
799 | + /** |
|
800 | + * wrapper for WP_Filesystem::getchmod() |
|
801 | + * |
|
802 | + * @param string $file Path to the file. |
|
803 | + * @return string Mode of the file (the last 3 digits). |
|
804 | + */ |
|
805 | + public static function permissions($file) |
|
806 | + { |
|
807 | + $wp_filesystem = EEH_File::_get_wp_filesystem($file); |
|
808 | + return $wp_filesystem->getchmod($file); |
|
809 | + } |
|
810 | + |
|
811 | + |
|
812 | + /** |
|
813 | + * wrapper for WP_Filesystem::owner() |
|
814 | + * |
|
815 | + * @param string $file Path to the file. |
|
816 | + * @return string|false Username of the owner on success, false on failure. |
|
817 | + */ |
|
818 | + public static function owner($file) |
|
819 | + { |
|
820 | + $wp_filesystem = EEH_File::_get_wp_filesystem($file); |
|
821 | + return $wp_filesystem->owner($file); |
|
822 | + } |
|
823 | + |
|
824 | + |
|
825 | + /** |
|
826 | + * wrapper for WP_Filesystem::group() |
|
827 | + * |
|
828 | + * @param string $file Path to the file. |
|
829 | + * @return string|false The group on success, false on failure. |
|
830 | + */ |
|
831 | + public static function group($file) |
|
832 | + { |
|
833 | + $wp_filesystem = EEH_File::_get_wp_filesystem($file); |
|
834 | + return $wp_filesystem->group($file); |
|
835 | + } |
|
836 | + |
|
837 | + |
|
838 | + /** |
|
839 | + * wrapper for WP_Filesystem::move() |
|
840 | + * |
|
841 | + * @param string $source Path to the source file. |
|
842 | + * @param string $destination Path to the destination file. |
|
843 | + * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. |
|
844 | + * Default false. |
|
845 | + * @return bool True on success, false on failure. |
|
846 | + */ |
|
847 | + public static function move($source, $destination, $overwrite = false) |
|
848 | + { |
|
849 | + // throw new RuntimeException("source: {$source} && destination: {$destination}"); |
|
850 | + $source = EEH_File::validateFileForCopyOrMove($source); |
|
851 | + $destination = EEH_File::validateFolderForCopyOrMove($destination); |
|
852 | + if (! $source || ! $destination) { |
|
853 | + return false; |
|
854 | + } |
|
855 | + $wp_filesystem = EEH_File::_get_wp_filesystem($source); |
|
856 | + if ($wp_filesystem->move($source, $destination, $overwrite)) { |
|
857 | + return true; |
|
858 | + } |
|
859 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
860 | + $file = EEH_File::convert_local_filepath_to_remote_filepath($source); |
|
861 | + $owner = EEH_File::owner($file); |
|
862 | + $group = EEH_File::group($file); |
|
863 | + $permissions = EEH_File::permissions($file); |
|
864 | + EE_Error::add_error( |
|
865 | + sprintf( |
|
866 | + esc_html__( |
|
867 | + 'Unable to move the file "%1$s" to new location (possible permissions errors). The existing "owner:group permissions" for the file are: "%2$s"', |
|
868 | + 'event_espresso' |
|
869 | + ), |
|
870 | + $destination, |
|
871 | + "{$owner}:{$group} $permissions" |
|
872 | + ), |
|
873 | + __FILE__, |
|
874 | + __FUNCTION__, |
|
875 | + __LINE__ |
|
876 | + ); |
|
877 | + } |
|
878 | + return false; |
|
879 | + } |
|
880 | + |
|
881 | + |
|
882 | + /** |
|
883 | + * @param string $source_file |
|
884 | + * @return string |
|
885 | + */ |
|
886 | + private static function validateFileForCopyOrMove($source_file) |
|
887 | + { |
|
888 | + $full_source_path = EEH_File::standardise_directory_separators($source_file); |
|
889 | + if (! EEH_File::exists($full_source_path)) { |
|
890 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
891 | + $msg = |
|
892 | + sprintf( |
|
893 | + __('The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso'), |
|
894 | + '', |
|
895 | + $full_source_path |
|
896 | + ); |
|
897 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path); |
|
898 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
899 | + } |
|
900 | + return ''; |
|
901 | + } |
|
902 | + return $full_source_path; |
|
903 | + } |
|
904 | + |
|
905 | + |
|
906 | + /** |
|
907 | + * @param string $destination_file |
|
908 | + * @return string |
|
909 | + */ |
|
910 | + private static function validateFolderForCopyOrMove($destination_file) |
|
911 | + { |
|
912 | + $full_dest_path = EEH_File::standardise_directory_separators($destination_file); |
|
913 | + $folder = EEH_File::remove_filename_from_filepath($full_dest_path); |
|
914 | + EEH_File::ensure_folder_exists_and_is_writable($folder); |
|
915 | + if (! EEH_File::verify_is_writable($folder, 'folder')) { |
|
916 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
917 | + $msg = sprintf( |
|
918 | + __('The file located at "%2$s" is not writable.', 'event_espresso'), |
|
919 | + '', |
|
920 | + $full_dest_path |
|
921 | + ); |
|
922 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_dest_path); |
|
923 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
924 | + } |
|
925 | + return ''; |
|
926 | + } |
|
927 | + return $full_dest_path; |
|
928 | + } |
|
929 | 929 | } |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | */ |
61 | 61 | private static function loadAlternateWpFileSystem() |
62 | 62 | { |
63 | - if (! EEH_File::$_wp_filesystem instanceof WP_Filesystem_Base) { |
|
64 | - require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); |
|
63 | + if ( ! EEH_File::$_wp_filesystem instanceof WP_Filesystem_Base) { |
|
64 | + require_once(ABSPATH.'wp-admin/includes/class-wp-filesystem-base.php'); |
|
65 | 65 | $method = 'direct'; |
66 | 66 | $wp_filesystem_file = |
67 | 67 | apply_filters( |
68 | 68 | 'filesystem_method_file', |
69 | - ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', |
|
69 | + ABSPATH.'wp-admin/includes/class-wp-filesystem-'.$method.'.php', |
|
70 | 70 | $method |
71 | 71 | ); |
72 | 72 | // added the following validation logic |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $wp_filesystem_class = $filesystem_class; |
89 | 89 | } |
90 | 90 | } |
91 | - if (! $valid || ! file_exists($wp_filesystem_file)) { |
|
91 | + if ( ! $valid || ! file_exists($wp_filesystem_file)) { |
|
92 | 92 | EE_Error::add_error( |
93 | 93 | sprintf( |
94 | 94 | __( |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | ); |
104 | 104 | } |
105 | 105 | // check constants defined, just like in the wp-admin/includes/file.php WP_Filesystem() |
106 | - if (! defined('FS_CHMOD_DIR')) { |
|
106 | + if ( ! defined('FS_CHMOD_DIR')) { |
|
107 | 107 | define('FS_CHMOD_DIR', (fileperms(ABSPATH) & 0775 | 0755)); |
108 | 108 | } |
109 | - if (! defined('FS_CHMOD_FILE')) { |
|
110 | - define('FS_CHMOD_FILE', (fileperms(ABSPATH . 'index.php') & 0775 | 0644)); |
|
109 | + if ( ! defined('FS_CHMOD_FILE')) { |
|
110 | + define('FS_CHMOD_FILE', (fileperms(ABSPATH.'index.php') & 0775 | 0644)); |
|
111 | 111 | } |
112 | 112 | require_once($wp_filesystem_file); |
113 | 113 | EEH_File::$_wp_filesystem = new $wp_filesystem_class([]); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | { |
124 | 124 | global $wp_filesystem; |
125 | 125 | // no filesystem setup ??? |
126 | - if (! $wp_filesystem instanceof WP_Filesystem_Base) { |
|
126 | + if ( ! $wp_filesystem instanceof WP_Filesystem_Base) { |
|
127 | 127 | // if some eager beaver's just trying to get in there too early... |
128 | 128 | // let them do it, because we are one of those eager beavers! :P |
129 | 129 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | 'event_espresso' |
144 | 144 | ); |
145 | 145 | if (WP_DEBUG) { |
146 | - $msg .= '<br />' . __( |
|
146 | + $msg .= '<br />'.__( |
|
147 | 147 | 'The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', |
148 | 148 | 'event_espresso' |
149 | 149 | ); |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
152 | 152 | } |
153 | 153 | // should be loaded if we are past the wp_loaded hook... |
154 | - if (! function_exists('WP_Filesystem') || ! function_exists('submit_button')) { |
|
155 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
156 | - require_once(ABSPATH . 'wp-admin/includes/template.php'); |
|
154 | + if ( ! function_exists('WP_Filesystem') || ! function_exists('submit_button')) { |
|
155 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
156 | + require_once(ABSPATH.'wp-admin/includes/template.php'); |
|
157 | 157 | } |
158 | 158 | // turn on output buffering so that we can capture the credentials form |
159 | 159 | ob_start(); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | ); |
175 | 175 | } |
176 | 176 | // basically check for direct or previously configured access |
177 | - if (! WP_Filesystem($credentials) |
|
177 | + if ( ! WP_Filesystem($credentials) |
|
178 | 178 | && is_wp_error($wp_filesystem->errors) |
179 | 179 | && $wp_filesystem->errors->get_error_code() |
180 | 180 | ) { |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public static function display_request_filesystem_credentials_form() |
201 | 201 | { |
202 | - if (! empty(EEH_File::$_credentials_form)) { |
|
203 | - echo '<div class="updated espresso-notices-attention"><p>' . EEH_File::$_credentials_form . '</p></div>'; |
|
202 | + if ( ! empty(EEH_File::$_credentials_form)) { |
|
203 | + echo '<div class="updated espresso-notices-attention"><p>'.EEH_File::$_credentials_form.'</p></div>'; |
|
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | // load WP_Filesystem and set file permissions |
226 | 226 | $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
227 | 227 | $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
228 | - if (! $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
229 | - $file_name = ! empty($type_of_file) ? $file_name . ' ' . $type_of_file : $file_name; |
|
228 | + if ( ! $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
229 | + $file_name = ! empty($type_of_file) ? $file_name.' '.$type_of_file : $file_name; |
|
230 | 230 | $file_name .= ! empty($file_ext) ? ' file' : ' folder'; |
231 | 231 | $msg = sprintf( |
232 | 232 | __( |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | ); |
247 | 247 | } |
248 | 248 | if (defined('WP_DEBUG') && WP_DEBUG) { |
249 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
249 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
250 | 250 | } |
251 | 251 | return false; |
252 | 252 | } |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | $perms = $wp_filesystem->getchmod(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
272 | 272 | if ($perms) { |
273 | 273 | // file permissions exist, but way be set incorrectly |
274 | - $type_of_file = ! empty($type_of_file) ? $type_of_file . ' ' : ''; |
|
274 | + $type_of_file = ! empty($type_of_file) ? $type_of_file.' ' : ''; |
|
275 | 275 | $type_of_file .= ! empty($type_of_file) ? 'file' : 'folder'; |
276 | - return ' ' . sprintf( |
|
276 | + return ' '.sprintf( |
|
277 | 277 | __( |
278 | 278 | 'File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', |
279 | 279 | 'event_espresso' |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | ); |
284 | 284 | } else { |
285 | 285 | // file exists but file permissions could not be read ?!?! |
286 | - return ' ' . sprintf( |
|
286 | + return ' '.sprintf( |
|
287 | 287 | __( |
288 | 288 | 'Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', |
289 | 289 | 'event_espresso' |
@@ -315,15 +315,15 @@ discard block |
||
315 | 315 | $folder = EEH_File::end_with_directory_separator($folder); |
316 | 316 | $wp_filesystem = EEH_File::_get_wp_filesystem($folder); |
317 | 317 | $remote_dir = EEH_File::convert_local_filepath_to_remote_filepath($folder); |
318 | - if (! $wp_filesystem->is_dir($remote_dir)) { |
|
318 | + if ( ! $wp_filesystem->is_dir($remote_dir)) { |
|
319 | 319 | // ok so it doesn't exist. Does its parent? Can we write to it? |
320 | - if (! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
320 | + if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
321 | 321 | return false; |
322 | 322 | } |
323 | - if (! EEH_File::verify_is_writable($parent_folder, 'folder')) { |
|
323 | + if ( ! EEH_File::verify_is_writable($parent_folder, 'folder')) { |
|
324 | 324 | return false; |
325 | 325 | } |
326 | - if (! $wp_filesystem->mkdir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) { |
|
326 | + if ( ! $wp_filesystem->mkdir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) { |
|
327 | 327 | if (defined('WP_DEBUG') && WP_DEBUG) { |
328 | 328 | $msg = sprintf(__('"%s" could not be created.', 'event_espresso'), $folder); |
329 | 329 | $msg .= EEH_File::_permissions_error_for_unreadable_filepath($folder); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | return false; |
333 | 333 | } |
334 | 334 | EEH_File::add_index_file($folder); |
335 | - } elseif (! EEH_File::verify_is_writable($folder, 'folder')) { |
|
335 | + } elseif ( ! EEH_File::verify_is_writable($folder, 'folder')) { |
|
336 | 336 | return false; |
337 | 337 | } |
338 | 338 | return true; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $full_path = EEH_File::standardise_directory_separators($full_path); |
354 | 354 | $remote_path = EEH_File::convert_local_filepath_to_remote_filepath($full_path); |
355 | 355 | $remote_path = rtrim($remote_path, '/\\'); |
356 | - if (! $wp_filesystem->is_writable($remote_path)) { |
|
356 | + if ( ! $wp_filesystem->is_writable($remote_path)) { |
|
357 | 357 | if (defined('WP_DEBUG') && WP_DEBUG) { |
358 | 358 | $msg = sprintf(__('The "%1$s" %2$s is not writable.', 'event_espresso'), $full_path, $file_or_folder); |
359 | 359 | $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_path); |
@@ -379,11 +379,11 @@ discard block |
||
379 | 379 | $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
380 | 380 | $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
381 | 381 | $parent_folder = EEH_File::get_parent_folder($full_file_path); |
382 | - if (! EEH_File::exists($full_file_path)) { |
|
383 | - if (! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
382 | + if ( ! EEH_File::exists($full_file_path)) { |
|
383 | + if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
384 | 384 | return false; |
385 | 385 | } |
386 | - if (! $wp_filesystem->touch(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
386 | + if ( ! $wp_filesystem->touch(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
387 | 387 | if (defined('WP_DEBUG') && WP_DEBUG) { |
388 | 388 | $msg = sprintf(__('The "%s" file could not be created.', 'event_espresso'), $full_file_path); |
389 | 389 | $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | return false; |
393 | 393 | } |
394 | 394 | } |
395 | - if (! EEH_File::verify_is_writable($full_file_path, 'file')) { |
|
395 | + if ( ! EEH_File::verify_is_writable($full_file_path, 'file')) { |
|
396 | 396 | return false; |
397 | 397 | } |
398 | 398 | return true; |
@@ -451,9 +451,9 @@ discard block |
||
451 | 451 | public static function write_to_file($full_file_path = '', $file_contents = '', $file_type = '') |
452 | 452 | { |
453 | 453 | $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
454 | - $file_type = ! empty($file_type) ? rtrim($file_type, ' ') . ' ' : ''; |
|
454 | + $file_type = ! empty($file_type) ? rtrim($file_type, ' ').' ' : ''; |
|
455 | 455 | $folder = EEH_File::remove_filename_from_filepath($full_file_path); |
456 | - if (! EEH_File::verify_is_writable($folder, 'folder')) { |
|
456 | + if ( ! EEH_File::verify_is_writable($folder, 'folder')) { |
|
457 | 457 | if (defined('WP_DEBUG') && WP_DEBUG) { |
458 | 458 | $msg = |
459 | 459 | sprintf( |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | // load WP_Filesystem and set file permissions |
470 | 470 | $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
471 | 471 | // write the file |
472 | - if (! $wp_filesystem->put_contents( |
|
472 | + if ( ! $wp_filesystem->put_contents( |
|
473 | 473 | EEH_File::convert_local_filepath_to_remote_filepath($full_file_path), |
474 | 474 | $file_contents |
475 | 475 | )) { |
@@ -579,8 +579,8 @@ discard block |
||
579 | 579 | public static function add_htaccess_deny_from_all($folder = '') |
580 | 580 | { |
581 | 581 | $folder = EEH_File::standardise_and_end_with_directory_separator($folder); |
582 | - if (! EEH_File::exists($folder . '.htaccess')) { |
|
583 | - if (! EEH_File::write_to_file($folder . '.htaccess', 'deny from all', '.htaccess')) { |
|
582 | + if ( ! EEH_File::exists($folder.'.htaccess')) { |
|
583 | + if ( ! EEH_File::write_to_file($folder.'.htaccess', 'deny from all', '.htaccess')) { |
|
584 | 584 | return false; |
585 | 585 | } |
586 | 586 | } |
@@ -598,9 +598,9 @@ discard block |
||
598 | 598 | public static function add_index_file($folder) |
599 | 599 | { |
600 | 600 | $folder = EEH_File::standardise_and_end_with_directory_separator($folder); |
601 | - if (! EEH_File::exists($folder . 'index.php')) { |
|
602 | - if (! EEH_File::write_to_file( |
|
603 | - $folder . 'index.php', |
|
601 | + if ( ! EEH_File::exists($folder.'index.php')) { |
|
602 | + if ( ! EEH_File::write_to_file( |
|
603 | + $folder.'index.php', |
|
604 | 604 | 'You are not permitted to read from this folder', |
605 | 605 | '.php' |
606 | 606 | )) { |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | */ |
653 | 653 | public static function end_with_directory_separator($file_path) |
654 | 654 | { |
655 | - return rtrim($file_path, '/\\') . '/'; |
|
655 | + return rtrim($file_path, '/\\').'/'; |
|
656 | 656 | } |
657 | 657 | |
658 | 658 | |
@@ -687,18 +687,18 @@ discard block |
||
687 | 687 | foreach ($folder_paths as $folder_path) { |
688 | 688 | $folder_path = self::standardise_and_end_with_directory_separator($folder_path); |
689 | 689 | // load WP_Filesystem and set file permissions |
690 | - $files_in_folder = glob($folder_path . '*.php'); |
|
690 | + $files_in_folder = glob($folder_path.'*.php'); |
|
691 | 691 | $class_to_folder_path = []; |
692 | 692 | if ($files_in_folder) { |
693 | 693 | foreach ($files_in_folder as $file_path) { |
694 | 694 | // only add files, not folders |
695 | - if (! is_dir($file_path)) { |
|
695 | + if ( ! is_dir($file_path)) { |
|
696 | 696 | if ($index_numerically) { |
697 | 697 | $class_to_folder_path[] = $file_path; |
698 | 698 | } else { |
699 | 699 | $classname = |
700 | 700 | self::get_classname_from_filepath_with_standard_filename($file_path); |
701 | - $class_to_folder_path[ $classname ] = $file_path; |
|
701 | + $class_to_folder_path[$classname] = $file_path; |
|
702 | 702 | } |
703 | 703 | } |
704 | 704 | } |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | { |
721 | 721 | $source_file = EEH_File::validateFileForCopyOrMove($source_file); |
722 | 722 | $destination_file = EEH_File::validateFolderForCopyOrMove($destination_file); |
723 | - if (! $source_file || ! $destination_file) { |
|
723 | + if ( ! $source_file || ! $destination_file) { |
|
724 | 724 | return false; |
725 | 725 | } |
726 | 726 | // load WP_Filesystem and set file permissions |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | EEH_File::convert_local_filepath_to_remote_filepath($destination_file), |
732 | 732 | $overwrite |
733 | 733 | ); |
734 | - if (! $copied) { |
|
734 | + if ( ! $copied) { |
|
735 | 735 | if (defined('WP_DEBUG') && WP_DEBUG) { |
736 | 736 | $msg = sprintf( |
737 | 737 | __( |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | public static function convert_local_filepath_to_remote_filepath($local_filepath) |
776 | 776 | { |
777 | 777 | $wp_filesystem = EEH_File::_get_wp_filesystem($local_filepath); |
778 | - return str_replace(WP_CONTENT_DIR . '/', $wp_filesystem->wp_content_dir(), $local_filepath); |
|
778 | + return str_replace(WP_CONTENT_DIR.'/', $wp_filesystem->wp_content_dir(), $local_filepath); |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | // throw new RuntimeException("source: {$source} && destination: {$destination}"); |
850 | 850 | $source = EEH_File::validateFileForCopyOrMove($source); |
851 | 851 | $destination = EEH_File::validateFolderForCopyOrMove($destination); |
852 | - if (! $source || ! $destination) { |
|
852 | + if ( ! $source || ! $destination) { |
|
853 | 853 | return false; |
854 | 854 | } |
855 | 855 | $wp_filesystem = EEH_File::_get_wp_filesystem($source); |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | private static function validateFileForCopyOrMove($source_file) |
887 | 887 | { |
888 | 888 | $full_source_path = EEH_File::standardise_directory_separators($source_file); |
889 | - if (! EEH_File::exists($full_source_path)) { |
|
889 | + if ( ! EEH_File::exists($full_source_path)) { |
|
890 | 890 | if (defined('WP_DEBUG') && WP_DEBUG) { |
891 | 891 | $msg = |
892 | 892 | sprintf( |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | $full_dest_path = EEH_File::standardise_directory_separators($destination_file); |
913 | 913 | $folder = EEH_File::remove_filename_from_filepath($full_dest_path); |
914 | 914 | EEH_File::ensure_folder_exists_and_is_writable($folder); |
915 | - if (! EEH_File::verify_is_writable($folder, 'folder')) { |
|
915 | + if ( ! EEH_File::verify_is_writable($folder, 'folder')) { |
|
916 | 916 | if (defined('WP_DEBUG') && WP_DEBUG) { |
917 | 917 | $msg = sprintf( |
918 | 918 | __('The file located at "%2$s" is not writable.', 'event_espresso'), |
@@ -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 |
@@ -2,240 +2,240 @@ discard block |
||
2 | 2 | /* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ |
3 | 3 | $generated_i18n_strings = array( |
4 | 4 | // Reference: packages/components/src/Pagination/constants.ts:6 |
5 | - __( '2', 'event_espresso' ), |
|
5 | + __('2', 'event_espresso'), |
|
6 | 6 | |
7 | 7 | // Reference: packages/components/src/Pagination/constants.ts:7 |
8 | - __( '6', 'event_espresso' ), |
|
8 | + __('6', 'event_espresso'), |
|
9 | 9 | |
10 | 10 | // Reference: packages/components/src/Pagination/constants.ts:8 |
11 | - __( '12', 'event_espresso' ), |
|
11 | + __('12', 'event_espresso'), |
|
12 | 12 | |
13 | 13 | // Reference: packages/components/src/Pagination/constants.ts:9 |
14 | - __( '24', 'event_espresso' ), |
|
14 | + __('24', 'event_espresso'), |
|
15 | 15 | |
16 | 16 | // Reference: packages/components/src/Pagination/constants.ts:10 |
17 | - __( '48', 'event_espresso' ), |
|
17 | + __('48', 'event_espresso'), |
|
18 | 18 | |
19 | 19 | // Reference: domains/blocks/src/components/AvatarImage.tsx:27 |
20 | - __( 'contact avatar', 'event_espresso' ), |
|
20 | + __('contact avatar', 'event_espresso'), |
|
21 | 21 | |
22 | 22 | // Reference: domains/blocks/src/components/OrderByControl.tsx:13 |
23 | - __( 'Order by', 'event_espresso' ), |
|
23 | + __('Order by', 'event_espresso'), |
|
24 | 24 | |
25 | 25 | // Reference: domains/blocks/src/components/RegStatusControl.tsx:18 |
26 | 26 | // Reference: domains/blocks/src/event-attendees/controls/SelectStatus.tsx:12 |
27 | - __( 'Select Registration Status', 'event_espresso' ), |
|
27 | + __('Select Registration Status', 'event_espresso'), |
|
28 | 28 | |
29 | 29 | // Reference: domains/blocks/src/components/SortOrderControl.tsx:15 |
30 | - __( 'Ascending', 'event_espresso' ), |
|
30 | + __('Ascending', 'event_espresso'), |
|
31 | 31 | |
32 | 32 | // Reference: domains/blocks/src/components/SortOrderControl.tsx:19 |
33 | - __( 'Descending', 'event_espresso' ), |
|
33 | + __('Descending', 'event_espresso'), |
|
34 | 34 | |
35 | 35 | // Reference: domains/blocks/src/components/SortOrderControl.tsx:25 |
36 | - __( 'Sort order:', 'event_espresso' ), |
|
36 | + __('Sort order:', 'event_espresso'), |
|
37 | 37 | |
38 | 38 | // Reference: domains/blocks/src/event-attendees/AttendeesDisplay.tsx:40 |
39 | - __( 'There was some error fetching attendees list', 'event_espresso' ), |
|
39 | + __('There was some error fetching attendees list', 'event_espresso'), |
|
40 | 40 | |
41 | 41 | // Reference: domains/blocks/src/event-attendees/AttendeesDisplay.tsx:46 |
42 | - __( 'To get started, select what event you want to show attendees from in the block settings.', 'event_espresso' ), |
|
42 | + __('To get started, select what event you want to show attendees from in the block settings.', 'event_espresso'), |
|
43 | 43 | |
44 | 44 | // Reference: domains/blocks/src/event-attendees/AttendeesDisplay.tsx:52 |
45 | - __( 'There are no attendees for selected options.', 'event_espresso' ), |
|
45 | + __('There are no attendees for selected options.', 'event_espresso'), |
|
46 | 46 | |
47 | 47 | // Reference: domains/blocks/src/event-attendees/controls/ArchiveSettings.tsx:11 |
48 | - __( 'Display on Archives', 'event_espresso' ), |
|
48 | + __('Display on Archives', 'event_espresso'), |
|
49 | 49 | |
50 | 50 | // Reference: domains/blocks/src/event-attendees/controls/ArchiveSettings.tsx:16 |
51 | - __( 'Attendees are shown whenever this post is listed in an archive view.', 'event_espresso' ), |
|
51 | + __('Attendees are shown whenever this post is listed in an archive view.', 'event_espresso'), |
|
52 | 52 | |
53 | 53 | // Reference: domains/blocks/src/event-attendees/controls/ArchiveSettings.tsx:17 |
54 | - __( 'Attendees are hidden whenever this post is listed in an archive view.', 'event_espresso' ), |
|
54 | + __('Attendees are hidden whenever this post is listed in an archive view.', 'event_espresso'), |
|
55 | 55 | |
56 | 56 | // Reference: domains/blocks/src/event-attendees/controls/AttendeeLimit.tsx:28 |
57 | - __( 'Number of Attendees to Display:', 'event_espresso' ), |
|
57 | + __('Number of Attendees to Display:', 'event_espresso'), |
|
58 | 58 | |
59 | 59 | // Reference: domains/blocks/src/event-attendees/controls/AttendeeLimit.tsx:33 |
60 | 60 | /* translators: %d attendees count */ |
61 | - _n_noop( 'Used to adjust the number of attendees displayed (There is %d total attendee for the current filter settings).', 'Used to adjust the number of attendees displayed (There are %d total attendees for the current filter settings).', 'event_espresso' ), |
|
61 | + _n_noop('Used to adjust the number of attendees displayed (There is %d total attendee for the current filter settings).', 'Used to adjust the number of attendees displayed (There are %d total attendees for the current filter settings).', 'event_espresso'), |
|
62 | 62 | |
63 | 63 | // Reference: domains/blocks/src/event-attendees/controls/GravatarSettings.tsx:26 |
64 | - __( 'Display Gravatar', 'event_espresso' ), |
|
64 | + __('Display Gravatar', 'event_espresso'), |
|
65 | 65 | |
66 | 66 | // Reference: domains/blocks/src/event-attendees/controls/GravatarSettings.tsx:31 |
67 | - __( 'Gravatar images are shown for each attendee.', 'event_espresso' ), |
|
67 | + __('Gravatar images are shown for each attendee.', 'event_espresso'), |
|
68 | 68 | |
69 | 69 | // Reference: domains/blocks/src/event-attendees/controls/GravatarSettings.tsx:32 |
70 | - __( 'No gravatar images are shown for each attendee.', 'event_espresso' ), |
|
70 | + __('No gravatar images are shown for each attendee.', 'event_espresso'), |
|
71 | 71 | |
72 | 72 | // Reference: domains/blocks/src/event-attendees/controls/GravatarSettings.tsx:37 |
73 | - __( 'Size of Gravatar', 'event_espresso' ), |
|
73 | + __('Size of Gravatar', 'event_espresso'), |
|
74 | 74 | |
75 | 75 | // Reference: domains/blocks/src/event-attendees/controls/SelectDatetime.tsx:21 |
76 | - __( 'Select Datetime', 'event_espresso' ), |
|
76 | + __('Select Datetime', 'event_espresso'), |
|
77 | 77 | |
78 | 78 | // Reference: domains/blocks/src/event-attendees/controls/SelectEvent.tsx:21 |
79 | - __( 'Select Event', 'event_espresso' ), |
|
79 | + __('Select Event', 'event_espresso'), |
|
80 | 80 | |
81 | 81 | // Reference: domains/blocks/src/event-attendees/controls/SelectOrderBy.tsx:10 |
82 | - __( 'Attendee id', 'event_espresso' ), |
|
82 | + __('Attendee id', 'event_espresso'), |
|
83 | 83 | |
84 | 84 | // Reference: domains/blocks/src/event-attendees/controls/SelectOrderBy.tsx:14 |
85 | - __( 'Last name only', 'event_espresso' ), |
|
85 | + __('Last name only', 'event_espresso'), |
|
86 | 86 | |
87 | 87 | // Reference: domains/blocks/src/event-attendees/controls/SelectOrderBy.tsx:18 |
88 | - __( 'First name only', 'event_espresso' ), |
|
88 | + __('First name only', 'event_espresso'), |
|
89 | 89 | |
90 | 90 | // Reference: domains/blocks/src/event-attendees/controls/SelectOrderBy.tsx:22 |
91 | - __( 'First, then Last name', 'event_espresso' ), |
|
91 | + __('First, then Last name', 'event_espresso'), |
|
92 | 92 | |
93 | 93 | // Reference: domains/blocks/src/event-attendees/controls/SelectOrderBy.tsx:26 |
94 | - __( 'Last, then First name', 'event_espresso' ), |
|
94 | + __('Last, then First name', 'event_espresso'), |
|
95 | 95 | |
96 | 96 | // Reference: domains/blocks/src/event-attendees/controls/SelectOrderBy.tsx:40 |
97 | - __( 'Order Attendees by:', 'event_espresso' ), |
|
97 | + __('Order Attendees by:', 'event_espresso'), |
|
98 | 98 | |
99 | 99 | // Reference: domains/blocks/src/event-attendees/controls/SelectTicket.tsx:21 |
100 | - __( 'Select Ticket', 'event_espresso' ), |
|
100 | + __('Select Ticket', 'event_espresso'), |
|
101 | 101 | |
102 | 102 | // Reference: domains/blocks/src/event-attendees/controls/index.tsx:22 |
103 | - __( 'Filter By Settings', 'event_espresso' ), |
|
103 | + __('Filter By Settings', 'event_espresso'), |
|
104 | 104 | |
105 | 105 | // Reference: domains/blocks/src/event-attendees/controls/index.tsx:37 |
106 | - __( 'Gravatar Setttings', 'event_espresso' ), |
|
106 | + __('Gravatar Setttings', 'event_espresso'), |
|
107 | 107 | |
108 | 108 | // Reference: domains/blocks/src/event-attendees/controls/index.tsx:40 |
109 | - __( 'Archive Settings', 'event_espresso' ), |
|
109 | + __('Archive Settings', 'event_espresso'), |
|
110 | 110 | |
111 | 111 | // Reference: domains/blocks/src/event-attendees/index.tsx:10 |
112 | - __( 'Event Attendees', 'event_espresso' ), |
|
112 | + __('Event Attendees', 'event_espresso'), |
|
113 | 113 | |
114 | 114 | // Reference: domains/blocks/src/event-attendees/index.tsx:11 |
115 | - __( 'Displays a list of people that have registered for the specified event', 'event_espresso' ), |
|
115 | + __('Displays a list of people that have registered for the specified event', 'event_espresso'), |
|
116 | 116 | |
117 | 117 | // Reference: domains/blocks/src/event-attendees/index.tsx:14 |
118 | - __( 'event', 'event_espresso' ), |
|
118 | + __('event', 'event_espresso'), |
|
119 | 119 | |
120 | 120 | // Reference: domains/blocks/src/event-attendees/index.tsx:14 |
121 | - __( 'attendees', 'event_espresso' ), |
|
121 | + __('attendees', 'event_espresso'), |
|
122 | 122 | |
123 | 123 | // Reference: domains/blocks/src/event-attendees/index.tsx:14 |
124 | - __( 'list', 'event_espresso' ), |
|
124 | + __('list', 'event_espresso'), |
|
125 | 125 | |
126 | 126 | // Reference: domains/blocks/src/services/utils.ts:11 |
127 | - __( 'Loading…', 'event_espresso' ), |
|
127 | + __('Loading…', 'event_espresso'), |
|
128 | 128 | |
129 | 129 | // Reference: domains/blocks/src/services/utils.ts:19 |
130 | 130 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:32 |
131 | - __( 'Error', 'event_espresso' ), |
|
131 | + __('Error', 'event_espresso'), |
|
132 | 132 | |
133 | 133 | // Reference: domains/blocks/src/services/utils.ts:26 |
134 | - __( 'Select…', 'event_espresso' ), |
|
134 | + __('Select…', 'event_espresso'), |
|
135 | 135 | |
136 | 136 | // Reference: domains/eventEditor/src/ui/EventRegistrationOptions/ActiveStatus.tsx:34 |
137 | - __( 'Active Status', 'event_espresso' ), |
|
137 | + __('Active Status', 'event_espresso'), |
|
138 | 138 | |
139 | 139 | // Reference: domains/eventEditor/src/ui/EventRegistrationOptions/AltRegPage.tsx:37 |
140 | - __( 'Alternative Registration Page', 'event_espresso' ), |
|
140 | + __('Alternative Registration Page', 'event_espresso'), |
|
141 | 141 | |
142 | 142 | // Reference: domains/eventEditor/src/ui/EventRegistrationOptions/DefaultRegistrationStatus.tsx:17 |
143 | - __( 'Default Registration Status', 'event_espresso' ), |
|
143 | + __('Default Registration Status', 'event_espresso'), |
|
144 | 144 | |
145 | 145 | // Reference: domains/eventEditor/src/ui/EventRegistrationOptions/Donations.tsx:19 |
146 | - __( 'Disable Donations', 'event_espresso' ), |
|
146 | + __('Disable Donations', 'event_espresso'), |
|
147 | 147 | |
148 | 148 | // Reference: domains/eventEditor/src/ui/EventRegistrationOptions/Donations.tsx:19 |
149 | - __( 'Enable Donations', 'event_espresso' ), |
|
149 | + __('Enable Donations', 'event_espresso'), |
|
150 | 150 | |
151 | 151 | // Reference: domains/eventEditor/src/ui/EventRegistrationOptions/EventManager.tsx:37 |
152 | - __( 'Event Manager', 'event_espresso' ), |
|
152 | + __('Event Manager', 'event_espresso'), |
|
153 | 153 | |
154 | 154 | // Reference: domains/eventEditor/src/ui/EventRegistrationOptions/EventPhoneNumber.tsx:26 |
155 | - __( 'Event Phone Number', 'event_espresso' ), |
|
155 | + __('Event Phone Number', 'event_espresso'), |
|
156 | 156 | |
157 | 157 | // Reference: domains/eventEditor/src/ui/EventRegistrationOptions/MaxRegistrations.tsx:35 |
158 | - __( 'Maximum Number of Registrations Allowed per Transaction', 'event_espresso' ), |
|
158 | + __('Maximum Number of Registrations Allowed per Transaction', 'event_espresso'), |
|
159 | 159 | |
160 | 160 | // Reference: domains/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:20 |
161 | - __( 'hide ticket selector', 'event_espresso' ), |
|
161 | + __('hide ticket selector', 'event_espresso'), |
|
162 | 162 | |
163 | 163 | // Reference: domains/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:20 |
164 | - __( 'show ticket selector', 'event_espresso' ), |
|
164 | + __('show ticket selector', 'event_espresso'), |
|
165 | 165 | |
166 | 166 | // Reference: domains/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:24 |
167 | - __( 'Display Ticket Selector', 'event_espresso' ), |
|
167 | + __('Display Ticket Selector', 'event_espresso'), |
|
168 | 168 | |
169 | 169 | // Reference: domains/eventEditor/src/ui/EventRegistrationOptions/index.tsx:22 |
170 | - __( 'Registration Options', 'event_espresso' ), |
|
170 | + __('Registration Options', 'event_espresso'), |
|
171 | 171 | |
172 | 172 | // Reference: domains/eventEditor/src/ui/datetimes/DateRegistrationsLink.tsx:17 |
173 | - __( 'view ALL registrations for this date.', 'event_espresso' ), |
|
173 | + __('view ALL registrations for this date.', 'event_espresso'), |
|
174 | 174 | |
175 | 175 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/formValidation.ts:15 |
176 | 176 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/formValidation.ts:15 |
177 | - __( 'Name is required', 'event_espresso' ), |
|
177 | + __('Name is required', 'event_espresso'), |
|
178 | 178 | |
179 | 179 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/formValidation.ts:16 |
180 | 180 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/formValidation.ts:12 |
181 | 181 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/formValidation.ts:16 |
182 | 182 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/formValidation.ts:12 |
183 | - __( 'Name must be at least three characters', 'event_espresso' ), |
|
183 | + __('Name must be at least three characters', 'event_espresso'), |
|
184 | 184 | |
185 | 185 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/Container.tsx:22 |
186 | 186 | /* translators: %s datetime id */ |
187 | - __( 'Edit datetime %s', 'event_espresso' ), |
|
187 | + __('Edit datetime %s', 'event_espresso'), |
|
188 | 188 | |
189 | 189 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/Container.tsx:25 |
190 | - __( 'New Datetime', 'event_espresso' ), |
|
190 | + __('New Datetime', 'event_espresso'), |
|
191 | 191 | |
192 | 192 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/ContentBody.tsx:40 |
193 | - __( 'Save and assign tickets', 'event_espresso' ), |
|
193 | + __('Save and assign tickets', 'event_espresso'), |
|
194 | 194 | |
195 | 195 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:11 |
196 | - __( 'primary information about the date', 'event_espresso' ), |
|
196 | + __('primary information about the date', 'event_espresso'), |
|
197 | 197 | |
198 | 198 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:11 |
199 | - __( 'Date Details', 'event_espresso' ), |
|
199 | + __('Date Details', 'event_espresso'), |
|
200 | 200 | |
201 | 201 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:12 |
202 | 202 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:17 |
203 | - __( 'relations between tickets and dates', 'event_espresso' ), |
|
203 | + __('relations between tickets and dates', 'event_espresso'), |
|
204 | 204 | |
205 | 205 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:12 |
206 | - __( 'Assign Tickets', 'event_espresso' ), |
|
206 | + __('Assign Tickets', 'event_espresso'), |
|
207 | 207 | |
208 | 208 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:102 |
209 | 209 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:63 |
210 | 210 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:115 |
211 | - __( 'End Date', 'event_espresso' ), |
|
211 | + __('End Date', 'event_espresso'), |
|
212 | 212 | |
213 | 213 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:111 |
214 | 214 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:108 |
215 | 215 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:124 |
216 | 216 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:108 |
217 | - __( 'Details', 'event_espresso' ), |
|
217 | + __('Details', 'event_espresso'), |
|
218 | 218 | |
219 | 219 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:115 |
220 | 220 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:112 |
221 | 221 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:75 |
222 | - __( 'Capacity', 'event_espresso' ), |
|
222 | + __('Capacity', 'event_espresso'), |
|
223 | 223 | |
224 | 224 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:120 |
225 | - __( 'The maximum number of registrants that can attend the event at this particular date.', 'event_espresso' ), |
|
225 | + __('The maximum number of registrants that can attend the event at this particular date.', 'event_espresso'), |
|
226 | 226 | |
227 | 227 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:124 |
228 | - __( 'Set to 0 to close registration or leave blank for no limit.', 'event_espresso' ), |
|
228 | + __('Set to 0 to close registration or leave blank for no limit.', 'event_espresso'), |
|
229 | 229 | |
230 | 230 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:129 |
231 | 231 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:203 |
232 | - __( 'Trash', 'event_espresso' ), |
|
232 | + __('Trash', 'event_espresso'), |
|
233 | 233 | |
234 | 234 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:73 |
235 | 235 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:45 |
236 | 236 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:86 |
237 | 237 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:45 |
238 | - __( 'Basics', 'event_espresso' ), |
|
238 | + __('Basics', 'event_espresso'), |
|
239 | 239 | |
240 | 240 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:77 |
241 | 241 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:49 |
@@ -243,217 +243,217 @@ discard block |
||
243 | 243 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:90 |
244 | 244 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:49 |
245 | 245 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:42 |
246 | - __( 'Name', 'event_espresso' ), |
|
246 | + __('Name', 'event_espresso'), |
|
247 | 247 | |
248 | 248 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:84 |
249 | 249 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:55 |
250 | 250 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:97 |
251 | 251 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:55 |
252 | 252 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:41 |
253 | - __( 'Description', 'event_espresso' ), |
|
253 | + __('Description', 'event_espresso'), |
|
254 | 254 | |
255 | 255 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:92 |
256 | 256 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:63 |
257 | 257 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:63 |
258 | - __( 'Dates', 'event_espresso' ), |
|
258 | + __('Dates', 'event_espresso'), |
|
259 | 259 | |
260 | 260 | // Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:96 |
261 | 261 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:52 |
262 | 262 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:109 |
263 | - __( 'Start Date', 'event_espresso' ), |
|
263 | + __('Start Date', 'event_espresso'), |
|
264 | 264 | |
265 | 265 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/DatesList.tsx:34 |
266 | 266 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/TableView.tsx:42 |
267 | - __( 'Event Dates', 'event_espresso' ), |
|
267 | + __('Event Dates', 'event_espresso'), |
|
268 | 268 | |
269 | 269 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/DatesList.tsx:37 |
270 | - __( 'loading event dates…', 'event_espresso' ), |
|
270 | + __('loading event dates…', 'event_espresso'), |
|
271 | 271 | |
272 | 272 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/DatesListButtons.tsx:22 |
273 | - __( 'Ticket Assignments', 'event_espresso' ), |
|
273 | + __('Ticket Assignments', 'event_espresso'), |
|
274 | 274 | |
275 | 275 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:27 |
276 | - __( 'Number of related tickets', 'event_espresso' ), |
|
276 | + __('Number of related tickets', 'event_espresso'), |
|
277 | 277 | |
278 | 278 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:28 |
279 | - __( 'There are no tickets assigned to this datetime. Please click the ticket icon to update the assignments.', 'event_espresso' ), |
|
279 | + __('There are no tickets assigned to this datetime. Please click the ticket icon to update the assignments.', 'event_espresso'), |
|
280 | 280 | |
281 | 281 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:42 |
282 | - __( 'assign tickets', 'event_espresso' ), |
|
282 | + __('assign tickets', 'event_espresso'), |
|
283 | 283 | |
284 | 284 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:19 |
285 | - __( 'Permanently delete Datetime?', 'event_espresso' ), |
|
285 | + __('Permanently delete Datetime?', 'event_espresso'), |
|
286 | 286 | |
287 | 287 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:19 |
288 | - __( 'Move Datetime to Trash?', 'event_espresso' ), |
|
288 | + __('Move Datetime to Trash?', 'event_espresso'), |
|
289 | 289 | |
290 | 290 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:21 |
291 | - __( 'Are you sure you want to permanently delete this datetime? This action is permanent and can not be undone.', 'event_espresso' ), |
|
291 | + __('Are you sure you want to permanently delete this datetime? This action is permanent and can not be undone.', 'event_espresso'), |
|
292 | 292 | |
293 | 293 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:24 |
294 | - __( 'Are you sure you want to move this datetime to the trash? You can "untrash" this datetime later if you need to.', 'event_espresso' ), |
|
294 | + __('Are you sure you want to move this datetime to the trash? You can "untrash" this datetime later if you need to.', 'event_espresso'), |
|
295 | 295 | |
296 | 296 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:34 |
297 | - __( 'event date main menu', 'event_espresso' ), |
|
297 | + __('event date main menu', 'event_espresso'), |
|
298 | 298 | |
299 | 299 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:38 |
300 | 300 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:37 |
301 | - __( 'delete permanently', 'event_espresso' ), |
|
301 | + __('delete permanently', 'event_espresso'), |
|
302 | 302 | |
303 | 303 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:38 |
304 | - __( 'trash datetime', 'event_espresso' ), |
|
304 | + __('trash datetime', 'event_espresso'), |
|
305 | 305 | |
306 | 306 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:49 |
307 | - __( 'edit datetime', 'event_espresso' ), |
|
307 | + __('edit datetime', 'event_espresso'), |
|
308 | 308 | |
309 | 309 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:50 |
310 | - __( 'copy datetime', 'event_espresso' ), |
|
310 | + __('copy datetime', 'event_espresso'), |
|
311 | 311 | |
312 | 312 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:30 |
313 | - __( 'edit datetime details', 'event_espresso' ), |
|
313 | + __('edit datetime details', 'event_espresso'), |
|
314 | 314 | |
315 | 315 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:34 |
316 | - __( 'delete datetimes', 'event_espresso' ), |
|
316 | + __('delete datetimes', 'event_espresso'), |
|
317 | 317 | |
318 | 318 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:34 |
319 | - __( 'trash datetimes', 'event_espresso' ), |
|
319 | + __('trash datetimes', 'event_espresso'), |
|
320 | 320 | |
321 | 321 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:13 |
322 | - __( 'Are you sure you want to permanently delete these datetimes? This action can NOT be undone!', 'event_espresso' ), |
|
322 | + __('Are you sure you want to permanently delete these datetimes? This action can NOT be undone!', 'event_espresso'), |
|
323 | 323 | |
324 | 324 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:14 |
325 | - __( 'Are you sure you want to trash these datetimes?', 'event_espresso' ), |
|
325 | + __('Are you sure you want to trash these datetimes?', 'event_espresso'), |
|
326 | 326 | |
327 | 327 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:15 |
328 | - __( 'Delete datetimes permanently', 'event_espresso' ), |
|
328 | + __('Delete datetimes permanently', 'event_espresso'), |
|
329 | 329 | |
330 | 330 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:15 |
331 | - __( 'Trash datetimes', 'event_espresso' ), |
|
331 | + __('Trash datetimes', 'event_espresso'), |
|
332 | 332 | |
333 | 333 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/EditDetails.tsx:22 |
334 | - __( 'Bulk edit date details', 'event_espresso' ), |
|
334 | + __('Bulk edit date details', 'event_espresso'), |
|
335 | 335 | |
336 | 336 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/EditDetails.tsx:23 |
337 | - __( 'any changes will be applied to ALL of the selected dates.', 'event_espresso' ), |
|
337 | + __('any changes will be applied to ALL of the selected dates.', 'event_espresso'), |
|
338 | 338 | |
339 | 339 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:67 |
340 | 340 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:67 |
341 | - __( 'Shift dates', 'event_espresso' ), |
|
341 | + __('Shift dates', 'event_espresso'), |
|
342 | 342 | |
343 | 343 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:92 |
344 | 344 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:92 |
345 | - __( 'earlier', 'event_espresso' ), |
|
345 | + __('earlier', 'event_espresso'), |
|
346 | 346 | |
347 | 347 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:96 |
348 | 348 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:96 |
349 | - __( 'later', 'event_espresso' ), |
|
349 | + __('later', 'event_espresso'), |
|
350 | 350 | |
351 | 351 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/DateCapacity.tsx:35 |
352 | - __( 'edit capacity (registration limit)…', 'event_espresso' ), |
|
352 | + __('edit capacity (registration limit)…', 'event_espresso'), |
|
353 | 353 | |
354 | 354 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:37 |
355 | - __( 'Edit Event Date', 'event_espresso' ), |
|
355 | + __('Edit Event Date', 'event_espresso'), |
|
356 | 356 | |
357 | 357 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:40 |
358 | - __( 'edit start and end dates', 'event_espresso' ), |
|
358 | + __('edit start and end dates', 'event_espresso'), |
|
359 | 359 | |
360 | 360 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:14 |
361 | 361 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:14 |
362 | - __( 'sold', 'event_espresso' ), |
|
362 | + __('sold', 'event_espresso'), |
|
363 | 363 | |
364 | 364 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:27 |
365 | - __( 'capacity', 'event_espresso' ), |
|
365 | + __('capacity', 'event_espresso'), |
|
366 | 366 | |
367 | 367 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:33 |
368 | 368 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:32 |
369 | - __( 'reg list', 'event_espresso' ), |
|
369 | + __('reg list', 'event_espresso'), |
|
370 | 370 | |
371 | 371 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:42 |
372 | 372 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:40 |
373 | - __( 'Edit description', 'event_espresso' ), |
|
373 | + __('Edit description', 'event_espresso'), |
|
374 | 374 | |
375 | 375 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:43 |
376 | 376 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:41 |
377 | - __( 'edit description…', 'event_espresso' ), |
|
377 | + __('edit description…', 'event_espresso'), |
|
378 | 378 | |
379 | 379 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/config.ts:13 |
380 | - __( 'Active', 'event_espresso' ), |
|
380 | + __('Active', 'event_espresso'), |
|
381 | 381 | |
382 | 382 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/config.ts:14 |
383 | 383 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/config.ts:13 |
384 | - __( 'Trashed', 'event_espresso' ), |
|
384 | + __('Trashed', 'event_espresso'), |
|
385 | 385 | |
386 | 386 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/config.ts:15 |
387 | 387 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/config.ts:14 |
388 | - __( 'Expired', 'event_espresso' ), |
|
388 | + __('Expired', 'event_espresso'), |
|
389 | 389 | |
390 | 390 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/config.ts:16 |
391 | 391 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/config.ts:16 |
392 | - __( 'Sold Out', 'event_espresso' ), |
|
392 | + __('Sold Out', 'event_espresso'), |
|
393 | 393 | |
394 | 394 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/config.ts:17 |
395 | - __( 'Upcoming', 'event_espresso' ), |
|
395 | + __('Upcoming', 'event_espresso'), |
|
396 | 396 | |
397 | 397 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/editable/EditableName.tsx:17 |
398 | 398 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/editable/EditableName.tsx:27 |
399 | - __( 'edit title…', 'event_espresso' ), |
|
399 | + __('edit title…', 'event_espresso'), |
|
400 | 400 | |
401 | 401 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/ActiveDatesFilters.tsx:25 |
402 | 402 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/ActiveTicketsFilters.tsx:25 |
403 | - __( 'ON', 'event_espresso' ), |
|
403 | + __('ON', 'event_espresso'), |
|
404 | 404 | |
405 | 405 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:10 |
406 | - __( 'end dates only', 'event_espresso' ), |
|
406 | + __('end dates only', 'event_espresso'), |
|
407 | 407 | |
408 | 408 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:11 |
409 | - __( 'start and end dates', 'event_espresso' ), |
|
409 | + __('start and end dates', 'event_espresso'), |
|
410 | 410 | |
411 | 411 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:16 |
412 | - __( 'dates above 90% capacity', 'event_espresso' ), |
|
412 | + __('dates above 90% capacity', 'event_espresso'), |
|
413 | 413 | |
414 | 414 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:17 |
415 | - __( 'dates above 75% capacity', 'event_espresso' ), |
|
415 | + __('dates above 75% capacity', 'event_espresso'), |
|
416 | 416 | |
417 | 417 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:18 |
418 | - __( 'dates above 50% capacity', 'event_espresso' ), |
|
418 | + __('dates above 50% capacity', 'event_espresso'), |
|
419 | 419 | |
420 | 420 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:19 |
421 | - __( 'dates below 50% capacity', 'event_espresso' ), |
|
421 | + __('dates below 50% capacity', 'event_espresso'), |
|
422 | 422 | |
423 | 423 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:23 |
424 | - __( 'all dates', 'event_espresso' ), |
|
424 | + __('all dates', 'event_espresso'), |
|
425 | 425 | |
426 | 426 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:24 |
427 | - __( 'all active and upcoming', 'event_espresso' ), |
|
427 | + __('all active and upcoming', 'event_espresso'), |
|
428 | 428 | |
429 | 429 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:25 |
430 | - __( 'active dates only', 'event_espresso' ), |
|
430 | + __('active dates only', 'event_espresso'), |
|
431 | 431 | |
432 | 432 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:26 |
433 | - __( 'upcoming dates only', 'event_espresso' ), |
|
433 | + __('upcoming dates only', 'event_espresso'), |
|
434 | 434 | |
435 | 435 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:27 |
436 | - __( 'next active or upcoming only', 'event_espresso' ), |
|
436 | + __('next active or upcoming only', 'event_espresso'), |
|
437 | 437 | |
438 | 438 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:28 |
439 | - __( 'sold out dates only', 'event_espresso' ), |
|
439 | + __('sold out dates only', 'event_espresso'), |
|
440 | 440 | |
441 | 441 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:29 |
442 | - __( 'recently expired dates', 'event_espresso' ), |
|
442 | + __('recently expired dates', 'event_espresso'), |
|
443 | 443 | |
444 | 444 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:30 |
445 | - __( 'all expired dates', 'event_espresso' ), |
|
445 | + __('all expired dates', 'event_espresso'), |
|
446 | 446 | |
447 | 447 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:31 |
448 | - __( 'trashed dates only', 'event_espresso' ), |
|
448 | + __('trashed dates only', 'event_espresso'), |
|
449 | 449 | |
450 | 450 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:35 |
451 | 451 | // Reference: packages/dates/src/DateRangePicker/DateRangePickerLegend.tsx:10 |
452 | 452 | // Reference: packages/dates/src/DateRangePicker/index.tsx:42 |
453 | - __( 'start date', 'event_espresso' ), |
|
453 | + __('start date', 'event_espresso'), |
|
454 | 454 | |
455 | 455 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:36 |
456 | - __( 'name', 'event_espresso' ), |
|
456 | + __('name', 'event_espresso'), |
|
457 | 457 | |
458 | 458 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:37 |
459 | 459 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:38 |
@@ -461,103 +461,103 @@ discard block |
||
461 | 461 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/table/HeaderCell.tsx:20 |
462 | 462 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:36 |
463 | 463 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:23 |
464 | - __( 'ID', 'event_espresso' ), |
|
464 | + __('ID', 'event_espresso'), |
|
465 | 465 | |
466 | 466 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:38 |
467 | 467 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:47 |
468 | - __( 'custom order', 'event_espresso' ), |
|
468 | + __('custom order', 'event_espresso'), |
|
469 | 469 | |
470 | 470 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:42 |
471 | 471 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:52 |
472 | - __( 'display', 'event_espresso' ), |
|
472 | + __('display', 'event_espresso'), |
|
473 | 473 | |
474 | 474 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:43 |
475 | - __( 'recurrence', 'event_espresso' ), |
|
475 | + __('recurrence', 'event_espresso'), |
|
476 | 476 | |
477 | 477 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:44 |
478 | 478 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:54 |
479 | - __( 'sales', 'event_espresso' ), |
|
479 | + __('sales', 'event_espresso'), |
|
480 | 480 | |
481 | 481 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:45 |
482 | 482 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:56 |
483 | - __( 'sort by', 'event_espresso' ), |
|
483 | + __('sort by', 'event_espresso'), |
|
484 | 484 | |
485 | 485 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:46 |
486 | 486 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:55 |
487 | 487 | // Reference: packages/components/src/EntityList/filterBar/EntityListFilterBar.tsx:73 |
488 | - __( 'search', 'event_espresso' ), |
|
488 | + __('search', 'event_espresso'), |
|
489 | 489 | |
490 | 490 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:47 |
491 | 491 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:57 |
492 | - __( 'status', 'event_espresso' ), |
|
492 | + __('status', 'event_espresso'), |
|
493 | 493 | |
494 | 494 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:9 |
495 | - __( 'start dates only', 'event_espresso' ), |
|
495 | + __('start dates only', 'event_espresso'), |
|
496 | 496 | |
497 | 497 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:20 |
498 | 498 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/newDateOptions/NewDateModal.tsx:15 |
499 | 499 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/newDateOptions/OptionsModalButton.tsx:11 |
500 | - __( 'Add New Date', 'event_espresso' ), |
|
500 | + __('Add New Date', 'event_espresso'), |
|
501 | 501 | |
502 | 502 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:20 |
503 | - __( 'Add Single Date', 'event_espresso' ), |
|
503 | + __('Add Single Date', 'event_espresso'), |
|
504 | 504 | |
505 | 505 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:34 |
506 | - __( 'Add a single date that only occurs once', 'event_espresso' ), |
|
506 | + __('Add a single date that only occurs once', 'event_espresso'), |
|
507 | 507 | |
508 | 508 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:36 |
509 | - __( 'Single Date', 'event_espresso' ), |
|
509 | + __('Single Date', 'event_espresso'), |
|
510 | 510 | |
511 | 511 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:105 |
512 | 512 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:103 |
513 | 513 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:53 |
514 | - __( 'Actions', 'event_espresso' ), |
|
514 | + __('Actions', 'event_espresso'), |
|
515 | 515 | |
516 | 516 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:53 |
517 | - __( 'Start', 'event_espresso' ), |
|
517 | + __('Start', 'event_espresso'), |
|
518 | 518 | |
519 | 519 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:64 |
520 | - __( 'End', 'event_espresso' ), |
|
520 | + __('End', 'event_espresso'), |
|
521 | 521 | |
522 | 522 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:76 |
523 | - __( 'Cap', 'event_espresso' ), |
|
523 | + __('Cap', 'event_espresso'), |
|
524 | 524 | |
525 | 525 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:84 |
526 | 526 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:85 |
527 | - __( 'Sold', 'event_espresso' ), |
|
527 | + __('Sold', 'event_espresso'), |
|
528 | 528 | |
529 | 529 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:93 |
530 | - __( 'Reg list', 'event_espresso' ), |
|
530 | + __('Reg list', 'event_espresso'), |
|
531 | 531 | |
532 | 532 | // Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:94 |
533 | 533 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:95 |
534 | - __( 'Regs', 'event_espresso' ), |
|
534 | + __('Regs', 'event_espresso'), |
|
535 | 535 | |
536 | 536 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:18 |
537 | - __( 'Tickets must always have at least one date assigned to them but one or more of the tickets below does not have any. Please correct the assignments for the highlighted cells.', 'event_espresso' ), |
|
537 | + __('Tickets must always have at least one date assigned to them but one or more of the tickets below does not have any. Please correct the assignments for the highlighted cells.', 'event_espresso'), |
|
538 | 538 | |
539 | 539 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:22 |
540 | - __( 'Event Dates must always have at least one Ticket assigned to them but one or more of the Event Dates below does not have any. Please correct the assignments for the highlighted cells.', 'event_espresso' ), |
|
540 | + __('Event Dates must always have at least one Ticket assigned to them but one or more of the Event Dates below does not have any. Please correct the assignments for the highlighted cells.', 'event_espresso'), |
|
541 | 541 | |
542 | 542 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:25 |
543 | - __( 'There seem to be some dates/tickets which have no tickets/dates assigned. Do you want to fix them now?', 'event_espresso' ), |
|
543 | + __('There seem to be some dates/tickets which have no tickets/dates assigned. Do you want to fix them now?', 'event_espresso'), |
|
544 | 544 | |
545 | 545 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:28 |
546 | 546 | // Reference: packages/components/src/Modal/ModalWithAlert.tsx:23 |
547 | - __( 'Alert!', 'event_espresso' ), |
|
547 | + __('Alert!', 'event_espresso'), |
|
548 | 548 | |
549 | 549 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:41 |
550 | 550 | /* translators: 1 entity id, 2 entity name */ |
551 | - __( 'Ticket Assignment Manager for Datetime: %1$s - %2$s', 'event_espresso' ), |
|
551 | + __('Ticket Assignment Manager for Datetime: %1$s - %2$s', 'event_espresso'), |
|
552 | 552 | |
553 | 553 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:48 |
554 | 554 | /* translators: 1 entity id, 2 entity name */ |
555 | - __( 'Ticket Assignment Manager for Ticket: %1$s - %2$s', 'event_espresso' ), |
|
555 | + __('Ticket Assignment Manager for Ticket: %1$s - %2$s', 'event_espresso'), |
|
556 | 556 | |
557 | 557 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/TicketAssignmentsManagerModal/buttons/useCancelButtonProps.tsx:18 |
558 | 558 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:16 |
559 | 559 | // Reference: packages/components/src/Modal/useCancelButtonProps.tsx:10 |
560 | - __( 'Cancel', 'event_espresso' ), |
|
560 | + __('Cancel', 'event_espresso'), |
|
561 | 561 | |
562 | 562 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/TicketAssignmentsManagerModal/buttons/useSubmitButtonProps.tsx:25 |
563 | 563 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:17 |
@@ -566,770 +566,770 @@ discard block |
||
566 | 566 | // Reference: packages/components/src/bulkEdit/details/Submit.tsx:38 |
567 | 567 | // Reference: packages/form/src/Submit.tsx:26 |
568 | 568 | // Reference: packages/tpc/src/buttons/useSubmitButtonProps.tsx:25 |
569 | - __( 'Submit', 'event_espresso' ), |
|
569 | + __('Submit', 'event_espresso'), |
|
570 | 570 | |
571 | 571 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/TicketAssignmentsManagerModal/index.tsx:30 |
572 | 572 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/table/Table.tsx:14 |
573 | - __( 'Ticket Assignment Manager', 'event_espresso' ), |
|
573 | + __('Ticket Assignment Manager', 'event_espresso'), |
|
574 | 574 | |
575 | 575 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/table/BodyCell.tsx:24 |
576 | - __( 'assign ticket', 'event_espresso' ), |
|
576 | + __('assign ticket', 'event_espresso'), |
|
577 | 577 | |
578 | 578 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/DatesByMonthControl.tsx:19 |
579 | - __( 'All Dates', 'event_espresso' ), |
|
579 | + __('All Dates', 'event_espresso'), |
|
580 | 580 | |
581 | 581 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/DatesByMonthControl.tsx:26 |
582 | - __( 'dates by month', 'event_espresso' ), |
|
582 | + __('dates by month', 'event_espresso'), |
|
583 | 583 | |
584 | 584 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowExpiredTicketsControl.tsx:14 |
585 | - __( 'show expired tickets', 'event_espresso' ), |
|
585 | + __('show expired tickets', 'event_espresso'), |
|
586 | 586 | |
587 | 587 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowTrashedDatesControl.tsx:10 |
588 | - __( 'show trashed dates', 'event_espresso' ), |
|
588 | + __('show trashed dates', 'event_espresso'), |
|
589 | 589 | |
590 | 590 | // Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowTrashedTicketsControl.tsx:14 |
591 | - __( 'show trashed tickets', 'event_espresso' ), |
|
591 | + __('show trashed tickets', 'event_espresso'), |
|
592 | 592 | |
593 | 593 | // Reference: domains/eventEditor/src/ui/tickets/TicketRegistrationsLink.tsx:17 |
594 | - __( 'total registrations.', 'event_espresso' ), |
|
594 | + __('total registrations.', 'event_espresso'), |
|
595 | 595 | |
596 | 596 | // Reference: domains/eventEditor/src/ui/tickets/TicketRegistrationsLink.tsx:18 |
597 | - __( 'view ALL registrations for this ticket.', 'event_espresso' ), |
|
597 | + __('view ALL registrations for this ticket.', 'event_espresso'), |
|
598 | 598 | |
599 | 599 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/Container.tsx:21 |
600 | 600 | /* translators: %s ticket id */ |
601 | - __( 'Edit ticket %s', 'event_espresso' ), |
|
601 | + __('Edit ticket %s', 'event_espresso'), |
|
602 | 602 | |
603 | 603 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/Container.tsx:24 |
604 | - __( 'New Ticket Details', 'event_espresso' ), |
|
604 | + __('New Ticket Details', 'event_espresso'), |
|
605 | 605 | |
606 | 606 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/ContentBody.tsx:47 |
607 | - __( 'Set ticket prices', 'event_espresso' ), |
|
607 | + __('Set ticket prices', 'event_espresso'), |
|
608 | 608 | |
609 | 609 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/ContentBody.tsx:54 |
610 | - __( 'Skip prices - assign dates', 'event_espresso' ), |
|
610 | + __('Skip prices - assign dates', 'event_espresso'), |
|
611 | 611 | |
612 | 612 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/ContentBody.tsx:70 |
613 | - __( 'Save and assign dates', 'event_espresso' ), |
|
613 | + __('Save and assign dates', 'event_espresso'), |
|
614 | 614 | |
615 | 615 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/ContentBody.tsx:83 |
616 | - __( 'Ticket details', 'event_espresso' ), |
|
616 | + __('Ticket details', 'event_espresso'), |
|
617 | 617 | |
618 | 618 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:11 |
619 | - __( 'primary information about the ticket', 'event_espresso' ), |
|
619 | + __('primary information about the ticket', 'event_espresso'), |
|
620 | 620 | |
621 | 621 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:11 |
622 | - __( 'Ticket Details', 'event_espresso' ), |
|
622 | + __('Ticket Details', 'event_espresso'), |
|
623 | 623 | |
624 | 624 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:13 |
625 | - __( 'apply ticket price modifiers and taxes', 'event_espresso' ), |
|
625 | + __('apply ticket price modifiers and taxes', 'event_espresso'), |
|
626 | 626 | |
627 | 627 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:15 |
628 | - __( 'Price Calculator', 'event_espresso' ), |
|
628 | + __('Price Calculator', 'event_espresso'), |
|
629 | 629 | |
630 | 630 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:17 |
631 | - __( 'Assign Dates', 'event_espresso' ), |
|
631 | + __('Assign Dates', 'event_espresso'), |
|
632 | 632 | |
633 | 633 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:105 |
634 | - __( 'Ticket Sales', 'event_espresso' ), |
|
634 | + __('Ticket Sales', 'event_espresso'), |
|
635 | 635 | |
636 | 636 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:128 |
637 | 637 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:112 |
638 | - __( 'Quantity For Sale', 'event_espresso' ), |
|
638 | + __('Quantity For Sale', 'event_espresso'), |
|
639 | 639 | |
640 | 640 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:134 |
641 | - __( 'The maximum number of this ticket available for sale.', 'event_espresso' ), |
|
641 | + __('The maximum number of this ticket available for sale.', 'event_espresso'), |
|
642 | 642 | |
643 | 643 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:136 |
644 | - __( 'Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso' ), |
|
644 | + __('Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso'), |
|
645 | 645 | |
646 | 646 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:141 |
647 | 647 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:121 |
648 | - __( 'Number of Uses', 'event_espresso' ), |
|
648 | + __('Number of Uses', 'event_espresso'), |
|
649 | 649 | |
650 | 650 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:147 |
651 | - __( 'Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso' ), |
|
651 | + __('Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso'), |
|
652 | 652 | |
653 | 653 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:151 |
654 | - __( 'Example: A ticket might have access to 4 different dates, but setting this field to 2 would mean that the ticket could only be used twice. Leave blank for no limit.', 'event_espresso' ), |
|
654 | + __('Example: A ticket might have access to 4 different dates, but setting this field to 2 would mean that the ticket could only be used twice. Leave blank for no limit.', 'event_espresso'), |
|
655 | 655 | |
656 | 656 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:158 |
657 | 657 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:129 |
658 | - __( 'Minimum Quantity', 'event_espresso' ), |
|
658 | + __('Minimum Quantity', 'event_espresso'), |
|
659 | 659 | |
660 | 660 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:163 |
661 | - __( 'The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ), |
|
661 | + __('The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'), |
|
662 | 662 | |
663 | 663 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:167 |
664 | - __( 'Leave blank for no minimum.', 'event_espresso' ), |
|
664 | + __('Leave blank for no minimum.', 'event_espresso'), |
|
665 | 665 | |
666 | 666 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:172 |
667 | 667 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:137 |
668 | - __( 'Maximum Quantity', 'event_espresso' ), |
|
668 | + __('Maximum Quantity', 'event_espresso'), |
|
669 | 669 | |
670 | 670 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:178 |
671 | - __( 'The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ), |
|
671 | + __('The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'), |
|
672 | 672 | |
673 | 673 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:182 |
674 | - __( 'Leave blank for no maximum.', 'event_espresso' ), |
|
674 | + __('Leave blank for no maximum.', 'event_espresso'), |
|
675 | 675 | |
676 | 676 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:187 |
677 | 677 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:146 |
678 | - __( 'Required Ticket', 'event_espresso' ), |
|
678 | + __('Required Ticket', 'event_espresso'), |
|
679 | 679 | |
680 | 680 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:189 |
681 | - __( 'If enabled, the ticket must be selected and will appear first in frontend ticket lists.', 'event_espresso' ), |
|
681 | + __('If enabled, the ticket must be selected and will appear first in frontend ticket lists.', 'event_espresso'), |
|
682 | 682 | |
683 | 683 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:196 |
684 | - __( 'Default Ticket', 'event_espresso' ), |
|
684 | + __('Default Ticket', 'event_espresso'), |
|
685 | 685 | |
686 | 686 | // Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:198 |
687 | - __( 'If enabled, the ticket will appear on all new events.', 'event_espresso' ), |
|
687 | + __('If enabled, the ticket will appear on all new events.', 'event_espresso'), |
|
688 | 688 | |
689 | 689 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/TicketsList.tsx:35 |
690 | - __( 'Available Tickets', 'event_espresso' ), |
|
690 | + __('Available Tickets', 'event_espresso'), |
|
691 | 691 | |
692 | 692 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/TicketsList.tsx:38 |
693 | - __( 'loading tickets…', 'event_espresso' ), |
|
693 | + __('loading tickets…', 'event_espresso'), |
|
694 | 694 | |
695 | 695 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:27 |
696 | - __( 'Number of related dates', 'event_espresso' ), |
|
696 | + __('Number of related dates', 'event_espresso'), |
|
697 | 697 | |
698 | 698 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:28 |
699 | - __( 'There are no event dates assigned to this ticket. Please click the calendar icon to update the assignments.', 'event_espresso' ), |
|
699 | + __('There are no event dates assigned to this ticket. Please click the calendar icon to update the assignments.', 'event_espresso'), |
|
700 | 700 | |
701 | 701 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:44 |
702 | - __( 'assign dates', 'event_espresso' ), |
|
702 | + __('assign dates', 'event_espresso'), |
|
703 | 703 | |
704 | 704 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:19 |
705 | - __( 'Permanently delete Ticket?', 'event_espresso' ), |
|
705 | + __('Permanently delete Ticket?', 'event_espresso'), |
|
706 | 706 | |
707 | 707 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:19 |
708 | - __( 'Move Ticket to Trash?', 'event_espresso' ), |
|
708 | + __('Move Ticket to Trash?', 'event_espresso'), |
|
709 | 709 | |
710 | 710 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:21 |
711 | - __( 'Are you sure you want to permanently delete this ticket? This action is permanent and can not be undone.', 'event_espresso' ), |
|
711 | + __('Are you sure you want to permanently delete this ticket? This action is permanent and can not be undone.', 'event_espresso'), |
|
712 | 712 | |
713 | 713 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:22 |
714 | - __( 'Are you sure you want to move this ticket to the trash? You can "untrash" this ticket later if you need to.', 'event_espresso' ), |
|
714 | + __('Are you sure you want to move this ticket to the trash? You can "untrash" this ticket later if you need to.', 'event_espresso'), |
|
715 | 715 | |
716 | 716 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:33 |
717 | - __( 'ticket main menu', 'event_espresso' ), |
|
717 | + __('ticket main menu', 'event_espresso'), |
|
718 | 718 | |
719 | 719 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:37 |
720 | - __( 'trash ticket', 'event_espresso' ), |
|
720 | + __('trash ticket', 'event_espresso'), |
|
721 | 721 | |
722 | 722 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:48 |
723 | - __( 'edit ticket', 'event_espresso' ), |
|
723 | + __('edit ticket', 'event_espresso'), |
|
724 | 724 | |
725 | 725 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:49 |
726 | - __( 'copy ticket', 'event_espresso' ), |
|
726 | + __('copy ticket', 'event_espresso'), |
|
727 | 727 | |
728 | 728 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:39 |
729 | 729 | // Reference: packages/components/src/bulkEdit/BulkActions.tsx:44 |
730 | - __( 'bulk actions', 'event_espresso' ), |
|
730 | + __('bulk actions', 'event_espresso'), |
|
731 | 731 | |
732 | 732 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:43 |
733 | - __( 'edit ticket details', 'event_espresso' ), |
|
733 | + __('edit ticket details', 'event_espresso'), |
|
734 | 734 | |
735 | 735 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:47 |
736 | - __( 'delete tickets', 'event_espresso' ), |
|
736 | + __('delete tickets', 'event_espresso'), |
|
737 | 737 | |
738 | 738 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:47 |
739 | - __( 'trash tickets', 'event_espresso' ), |
|
739 | + __('trash tickets', 'event_espresso'), |
|
740 | 740 | |
741 | 741 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:51 |
742 | - __( 'edit ticket prices', 'event_espresso' ), |
|
742 | + __('edit ticket prices', 'event_espresso'), |
|
743 | 743 | |
744 | 744 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:13 |
745 | - __( 'Are you sure you want to permanently delete these tickets? This action can NOT be undone!', 'event_espresso' ), |
|
745 | + __('Are you sure you want to permanently delete these tickets? This action can NOT be undone!', 'event_espresso'), |
|
746 | 746 | |
747 | 747 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:14 |
748 | - __( 'Are you sure you want to trash these tickets?', 'event_espresso' ), |
|
748 | + __('Are you sure you want to trash these tickets?', 'event_espresso'), |
|
749 | 749 | |
750 | 750 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:15 |
751 | - __( 'Delete tickets permanently', 'event_espresso' ), |
|
751 | + __('Delete tickets permanently', 'event_espresso'), |
|
752 | 752 | |
753 | 753 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:15 |
754 | - __( 'Trash tickets', 'event_espresso' ), |
|
754 | + __('Trash tickets', 'event_espresso'), |
|
755 | 755 | |
756 | 756 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/EditDetails.tsx:22 |
757 | - __( 'Bulk edit ticket details', 'event_espresso' ), |
|
757 | + __('Bulk edit ticket details', 'event_espresso'), |
|
758 | 758 | |
759 | 759 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/EditDetails.tsx:23 |
760 | - __( 'any changes will be applied to ALL of the selected tickets.', 'event_espresso' ), |
|
760 | + __('any changes will be applied to ALL of the selected tickets.', 'event_espresso'), |
|
761 | 761 | |
762 | 762 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/EditPrices.tsx:18 |
763 | - __( 'Bulk edit ticket prices', 'event_espresso' ), |
|
763 | + __('Bulk edit ticket prices', 'event_espresso'), |
|
764 | 764 | |
765 | 765 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:19 |
766 | - __( 'Edit all prices together', 'event_espresso' ), |
|
766 | + __('Edit all prices together', 'event_espresso'), |
|
767 | 767 | |
768 | 768 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:20 |
769 | - __( 'Edit all the selected ticket prices dynamically', 'event_espresso' ), |
|
769 | + __('Edit all the selected ticket prices dynamically', 'event_espresso'), |
|
770 | 770 | |
771 | 771 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:24 |
772 | - __( 'Edit prices individually', 'event_espresso' ), |
|
772 | + __('Edit prices individually', 'event_espresso'), |
|
773 | 773 | |
774 | 774 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:25 |
775 | - __( 'Edit prices for each ticket individually', 'event_espresso' ), |
|
775 | + __('Edit prices for each ticket individually', 'event_espresso'), |
|
776 | 776 | |
777 | 777 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:15 |
778 | 778 | // Reference: packages/components/src/bulkEdit/details/Submit.tsx:45 |
779 | 779 | // Reference: packages/form/src/ResetButton.tsx:17 |
780 | 780 | // Reference: packages/tpc/src/buttons/useResetButtonProps.tsx:12 |
781 | - __( 'Reset', 'event_espresso' ), |
|
781 | + __('Reset', 'event_espresso'), |
|
782 | 782 | |
783 | 783 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/editSeparately/TPCInstance.tsx:25 |
784 | 784 | /* translators: %s ticket name */ |
785 | - __( 'Edit prices for Ticket: %s', 'event_espresso' ), |
|
785 | + __('Edit prices for Ticket: %s', 'event_espresso'), |
|
786 | 786 | |
787 | 787 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:36 |
788 | - __( 'Edit Ticket Sale Dates', 'event_espresso' ), |
|
788 | + __('Edit Ticket Sale Dates', 'event_espresso'), |
|
789 | 789 | |
790 | 790 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:38 |
791 | - __( 'edit ticket sales start and end dates', 'event_espresso' ), |
|
791 | + __('edit ticket sales start and end dates', 'event_espresso'), |
|
792 | 792 | |
793 | 793 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:27 |
794 | - __( 'quantity', 'event_espresso' ), |
|
794 | + __('quantity', 'event_espresso'), |
|
795 | 795 | |
796 | 796 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/TicketQuantity.tsx:26 |
797 | - __( 'edit quantity of tickets available…', 'event_espresso' ), |
|
797 | + __('edit quantity of tickets available…', 'event_espresso'), |
|
798 | 798 | |
799 | 799 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/config.ts:15 |
800 | 800 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:51 |
801 | - __( 'On Sale', 'event_espresso' ), |
|
801 | + __('On Sale', 'event_espresso'), |
|
802 | 802 | |
803 | 803 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/config.ts:17 |
804 | - __( 'Pending', 'event_espresso' ), |
|
804 | + __('Pending', 'event_espresso'), |
|
805 | 805 | |
806 | 806 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/editable/EditablePrice.tsx:32 |
807 | - __( 'edit ticket total…', 'event_espresso' ), |
|
807 | + __('edit ticket total…', 'event_espresso'), |
|
808 | 808 | |
809 | 809 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/editable/EditablePrice.tsx:42 |
810 | - __( 'set price…', 'event_espresso' ), |
|
810 | + __('set price…', 'event_espresso'), |
|
811 | 811 | |
812 | 812 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/IsChainedButton.tsx:24 |
813 | - __( 'tickets list is linked to dates list and is showing tickets for above dates only', 'event_espresso' ), |
|
813 | + __('tickets list is linked to dates list and is showing tickets for above dates only', 'event_espresso'), |
|
814 | 814 | |
815 | 815 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/IsChainedButton.tsx:25 |
816 | - __( 'tickets list is unlinked and is showing tickets for all event dates', 'event_espresso' ), |
|
816 | + __('tickets list is unlinked and is showing tickets for all event dates', 'event_espresso'), |
|
817 | 817 | |
818 | 818 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:10 |
819 | - __( 'ticket sales start and end dates', 'event_espresso' ), |
|
819 | + __('ticket sales start and end dates', 'event_espresso'), |
|
820 | 820 | |
821 | 821 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:15 |
822 | - __( 'tickets with 90% or more sold', 'event_espresso' ), |
|
822 | + __('tickets with 90% or more sold', 'event_espresso'), |
|
823 | 823 | |
824 | 824 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:16 |
825 | - __( 'tickets with 75% or more sold', 'event_espresso' ), |
|
825 | + __('tickets with 75% or more sold', 'event_espresso'), |
|
826 | 826 | |
827 | 827 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:17 |
828 | - __( 'tickets with 50% or more sold', 'event_espresso' ), |
|
828 | + __('tickets with 50% or more sold', 'event_espresso'), |
|
829 | 829 | |
830 | 830 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:19 |
831 | - __( 'tickets with less than 50% sold', 'event_espresso' ), |
|
831 | + __('tickets with less than 50% sold', 'event_espresso'), |
|
832 | 832 | |
833 | 833 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:28 |
834 | - __( 'all tickets for all dates', 'event_espresso' ), |
|
834 | + __('all tickets for all dates', 'event_espresso'), |
|
835 | 835 | |
836 | 836 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:29 |
837 | - __( 'all on sale and sale pending', 'event_espresso' ), |
|
837 | + __('all on sale and sale pending', 'event_espresso'), |
|
838 | 838 | |
839 | 839 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:30 |
840 | - __( 'on sale tickets only', 'event_espresso' ), |
|
840 | + __('on sale tickets only', 'event_espresso'), |
|
841 | 841 | |
842 | 842 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:31 |
843 | - __( 'sale pending tickets only', 'event_espresso' ), |
|
843 | + __('sale pending tickets only', 'event_espresso'), |
|
844 | 844 | |
845 | 845 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:32 |
846 | - __( 'next on sale or sale pending only', 'event_espresso' ), |
|
846 | + __('next on sale or sale pending only', 'event_espresso'), |
|
847 | 847 | |
848 | 848 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:33 |
849 | - __( 'sold out tickets only', 'event_espresso' ), |
|
849 | + __('sold out tickets only', 'event_espresso'), |
|
850 | 850 | |
851 | 851 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:34 |
852 | - __( 'expired tickets only', 'event_espresso' ), |
|
852 | + __('expired tickets only', 'event_espresso'), |
|
853 | 853 | |
854 | 854 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:35 |
855 | - __( 'trashed tickets only', 'event_espresso' ), |
|
855 | + __('trashed tickets only', 'event_espresso'), |
|
856 | 856 | |
857 | 857 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:40 |
858 | - __( 'all tickets for above dates', 'event_espresso' ), |
|
858 | + __('all tickets for above dates', 'event_espresso'), |
|
859 | 859 | |
860 | 860 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:44 |
861 | - __( 'ticket sale date', 'event_espresso' ), |
|
861 | + __('ticket sale date', 'event_espresso'), |
|
862 | 862 | |
863 | 863 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:45 |
864 | - __( 'ticket name', 'event_espresso' ), |
|
864 | + __('ticket name', 'event_espresso'), |
|
865 | 865 | |
866 | 866 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:46 |
867 | - __( 'ticket ID', 'event_espresso' ), |
|
867 | + __('ticket ID', 'event_espresso'), |
|
868 | 868 | |
869 | 869 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:53 |
870 | - __( 'link', 'event_espresso' ), |
|
870 | + __('link', 'event_espresso'), |
|
871 | 871 | |
872 | 872 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:8 |
873 | - __( 'ticket sales start date only', 'event_espresso' ), |
|
873 | + __('ticket sales start date only', 'event_espresso'), |
|
874 | 874 | |
875 | 875 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:9 |
876 | - __( 'ticket sales end date only', 'event_espresso' ), |
|
876 | + __('ticket sales end date only', 'event_espresso'), |
|
877 | 877 | |
878 | 878 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:19 |
879 | - __( 'Add New Ticket', 'event_espresso' ), |
|
879 | + __('Add New Ticket', 'event_espresso'), |
|
880 | 880 | |
881 | 881 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:31 |
882 | - __( 'Single Ticket', 'event_espresso' ), |
|
882 | + __('Single Ticket', 'event_espresso'), |
|
883 | 883 | |
884 | 884 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:33 |
885 | - __( 'Add a single ticket and assign the dates to it', 'event_espresso' ), |
|
885 | + __('Add a single ticket and assign the dates to it', 'event_espresso'), |
|
886 | 886 | |
887 | 887 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/TableView.tsx:40 |
888 | - __( 'Tickets', 'event_espresso' ), |
|
888 | + __('Tickets', 'event_espresso'), |
|
889 | 889 | |
890 | 890 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:50 |
891 | - __( 'Goes on Sale', 'event_espresso' ), |
|
891 | + __('Goes on Sale', 'event_espresso'), |
|
892 | 892 | |
893 | 893 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:61 |
894 | - __( 'Sale Ends', 'event_espresso' ), |
|
894 | + __('Sale Ends', 'event_espresso'), |
|
895 | 895 | |
896 | 896 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:62 |
897 | - __( 'Ends', 'event_espresso' ), |
|
897 | + __('Ends', 'event_espresso'), |
|
898 | 898 | |
899 | 899 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:71 |
900 | - __( 'Price', 'event_espresso' ), |
|
900 | + __('Price', 'event_espresso'), |
|
901 | 901 | |
902 | 902 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:78 |
903 | - __( 'Quantity', 'event_espresso' ), |
|
903 | + __('Quantity', 'event_espresso'), |
|
904 | 904 | |
905 | 905 | // Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:94 |
906 | - __( 'Registrations', 'event_espresso' ), |
|
906 | + __('Registrations', 'event_espresso'), |
|
907 | 907 | |
908 | 908 | // Reference: domains/wpPluginsPage/src/exitSurvey/Popup.tsx:28 |
909 | - __( 'Do you have a moment to share why you are deactivating Event Espresso?', 'event_espresso' ), |
|
909 | + __('Do you have a moment to share why you are deactivating Event Espresso?', 'event_espresso'), |
|
910 | 910 | |
911 | 911 | // Reference: domains/wpPluginsPage/src/exitSurvey/Popup.tsx:39 |
912 | - __( 'Skip', 'event_espresso' ), |
|
912 | + __('Skip', 'event_espresso'), |
|
913 | 913 | |
914 | 914 | // Reference: domains/wpPluginsPage/src/exitSurvey/Popup.tsx:41 |
915 | - __( 'Sure I\'ll help', 'event_espresso' ), |
|
915 | + __('Sure I\'ll help', 'event_espresso'), |
|
916 | 916 | |
917 | 917 | // Reference: packages/adapters/src/Pagination/Pagination.tsx:24 |
918 | - __( 'pagination', 'event_espresso' ), |
|
918 | + __('pagination', 'event_espresso'), |
|
919 | 919 | |
920 | 920 | // Reference: packages/components/src/ActiveFilters/ActiveFilters.tsx:9 |
921 | - __( 'active filters:', 'event_espresso' ), |
|
921 | + __('active filters:', 'event_espresso'), |
|
922 | 922 | |
923 | 923 | // Reference: packages/components/src/ActiveFilters/FilterTag.tsx:11 |
924 | 924 | /* translators: %s filter name */ |
925 | - __( 'remove filter - %s', 'event_espresso' ), |
|
925 | + __('remove filter - %s', 'event_espresso'), |
|
926 | 926 | |
927 | 927 | // Reference: packages/components/src/CalendarDateRange/CalendarDateRange.tsx:39 |
928 | - __( 'to', 'event_espresso' ), |
|
928 | + __('to', 'event_espresso'), |
|
929 | 929 | |
930 | 930 | // Reference: packages/components/src/CalendarDateSwitcher/CalendarDateSwitcher.tsx:33 |
931 | - __( 'starts', 'event_espresso' ), |
|
931 | + __('starts', 'event_espresso'), |
|
932 | 932 | |
933 | 933 | // Reference: packages/components/src/CalendarDateSwitcher/CalendarDateSwitcher.tsx:45 |
934 | - __( 'ends', 'event_espresso' ), |
|
934 | + __('ends', 'event_espresso'), |
|
935 | 935 | |
936 | 936 | // Reference: packages/components/src/CalendarPageDate/CalendarPageDate.tsx:57 |
937 | - __( 'TO', 'event_espresso' ), |
|
937 | + __('TO', 'event_espresso'), |
|
938 | 938 | |
939 | 939 | // Reference: packages/components/src/Confirm/ConfirmClose.tsx:8 |
940 | 940 | // Reference: packages/components/src/Modal/ModalWithAlert.tsx:24 |
941 | - __( 'Are you sure you want to close this?', 'event_espresso' ), |
|
941 | + __('Are you sure you want to close this?', 'event_espresso'), |
|
942 | 942 | |
943 | 943 | // Reference: packages/components/src/Confirm/ConfirmDelete.tsx:8 |
944 | - __( 'Are you sure you want to delete this?', 'event_espresso' ), |
|
944 | + __('Are you sure you want to delete this?', 'event_espresso'), |
|
945 | 945 | |
946 | 946 | // Reference: packages/components/src/Confirm/useConfirmWithButton.tsx:11 |
947 | - __( 'Please confirm this action.', 'event_espresso' ), |
|
947 | + __('Please confirm this action.', 'event_espresso'), |
|
948 | 948 | |
949 | 949 | // Reference: packages/components/src/Confirm/useConfirmationDialog.tsx:32 |
950 | - __( 'No', 'event_espresso' ), |
|
950 | + __('No', 'event_espresso'), |
|
951 | 951 | |
952 | 952 | // Reference: packages/components/src/Confirm/useConfirmationDialog.tsx:33 |
953 | - __( 'Yes', 'event_espresso' ), |
|
953 | + __('Yes', 'event_espresso'), |
|
954 | 954 | |
955 | 955 | // Reference: packages/components/src/DateTimeRangePicker/index.tsx:74 |
956 | 956 | // Reference: packages/components/src/Popover/PopoverForm/PopoverForm.tsx:42 |
957 | - __( 'save', 'event_espresso' ), |
|
957 | + __('save', 'event_espresso'), |
|
958 | 958 | |
959 | 959 | // Reference: packages/components/src/DebugInfo/DebugInfo.tsx:38 |
960 | - __( 'Hide Debug Info', 'event_espresso' ), |
|
960 | + __('Hide Debug Info', 'event_espresso'), |
|
961 | 961 | |
962 | 962 | // Reference: packages/components/src/DebugInfo/DebugInfo.tsx:38 |
963 | - __( 'Show Debug Info', 'event_espresso' ), |
|
963 | + __('Show Debug Info', 'event_espresso'), |
|
964 | 964 | |
965 | 965 | // Reference: packages/components/src/EditDateRangeButton/index.tsx:41 |
966 | - __( 'Edit Start and End Dates and Times', 'event_espresso' ), |
|
966 | + __('Edit Start and End Dates and Times', 'event_espresso'), |
|
967 | 967 | |
968 | 968 | // Reference: packages/components/src/EntityActionsMenu/entityMenuItems/Copy.tsx:9 |
969 | - __( 'copy', 'event_espresso' ), |
|
969 | + __('copy', 'event_espresso'), |
|
970 | 970 | |
971 | 971 | // Reference: packages/components/src/EntityActionsMenu/entityMenuItems/Edit.tsx:9 |
972 | - __( 'edit', 'event_espresso' ), |
|
972 | + __('edit', 'event_espresso'), |
|
973 | 973 | |
974 | 974 | // Reference: packages/components/src/EntityActionsMenu/entityMenuItems/Trash.tsx:9 |
975 | - __( 'trash', 'event_espresso' ), |
|
975 | + __('trash', 'event_espresso'), |
|
976 | 976 | |
977 | 977 | // Reference: packages/components/src/EntityDetailsPanel/EntityDetailsPanelSold.tsx:36 |
978 | - __( 'view approved registrations for this date.', 'event_espresso' ), |
|
978 | + __('view approved registrations for this date.', 'event_espresso'), |
|
979 | 979 | |
980 | 980 | // Reference: packages/components/src/EntityDetailsPanel/EntityDetailsPanelSold.tsx:37 |
981 | - __( 'view approved registrations for this ticket.', 'event_espresso' ), |
|
981 | + __('view approved registrations for this ticket.', 'event_espresso'), |
|
982 | 982 | |
983 | 983 | // Reference: packages/components/src/EntityList/EntityList.tsx:36 |
984 | - __( 'no results found', 'event_espresso' ), |
|
984 | + __('no results found', 'event_espresso'), |
|
985 | 985 | |
986 | 986 | // Reference: packages/components/src/EntityList/EntityList.tsx:37 |
987 | - __( 'try changing filter settings', 'event_espresso' ), |
|
987 | + __('try changing filter settings', 'event_espresso'), |
|
988 | 988 | |
989 | 989 | // Reference: packages/components/src/EntityList/filterBar/buttons/CardViewFilterButton.tsx:22 |
990 | - __( 'card view', 'event_espresso' ), |
|
990 | + __('card view', 'event_espresso'), |
|
991 | 991 | |
992 | 992 | // Reference: packages/components/src/EntityList/filterBar/buttons/TableViewFilterButton.tsx:22 |
993 | - __( 'table view', 'event_espresso' ), |
|
993 | + __('table view', 'event_espresso'), |
|
994 | 994 | |
995 | 995 | // Reference: packages/components/src/EntityList/filterBar/buttons/ToggleFiltersButton.tsx:11 |
996 | - __( 'hide filters', 'event_espresso' ), |
|
996 | + __('hide filters', 'event_espresso'), |
|
997 | 997 | |
998 | 998 | // Reference: packages/components/src/EntityList/filterBar/buttons/ToggleFiltersButton.tsx:11 |
999 | - __( 'show filters', 'event_espresso' ), |
|
999 | + __('show filters', 'event_espresso'), |
|
1000 | 1000 | |
1001 | 1001 | // Reference: packages/components/src/EntityList/filterBar/buttons/ToggleSortingButton.tsx:28 |
1002 | - __( 'disable sorting', 'event_espresso' ), |
|
1002 | + __('disable sorting', 'event_espresso'), |
|
1003 | 1003 | |
1004 | 1004 | // Reference: packages/components/src/EntityList/filterBar/buttons/ToggleSortingButton.tsx:28 |
1005 | - __( 'enable sorting', 'event_espresso' ), |
|
1005 | + __('enable sorting', 'event_espresso'), |
|
1006 | 1006 | |
1007 | 1007 | // Reference: packages/components/src/Legend/ToggleLegendButton.tsx:27 |
1008 | - __( 'hide legend', 'event_espresso' ), |
|
1008 | + __('hide legend', 'event_espresso'), |
|
1009 | 1009 | |
1010 | 1010 | // Reference: packages/components/src/Legend/ToggleLegendButton.tsx:27 |
1011 | - __( 'show legend', 'event_espresso' ), |
|
1011 | + __('show legend', 'event_espresso'), |
|
1012 | 1012 | |
1013 | 1013 | // Reference: packages/components/src/LoadingNotice/LoadingNotice.tsx:12 |
1014 | - __( 'loading…', 'event_espresso' ), |
|
1014 | + __('loading…', 'event_espresso'), |
|
1015 | 1015 | |
1016 | 1016 | // Reference: packages/components/src/Modal/Modal.tsx:59 |
1017 | - __( 'close modal', 'event_espresso' ), |
|
1017 | + __('close modal', 'event_espresso'), |
|
1018 | 1018 | |
1019 | 1019 | // Reference: packages/components/src/Pagination/ItemRender.tsx:10 |
1020 | - __( 'next', 'event_espresso' ), |
|
1020 | + __('next', 'event_espresso'), |
|
1021 | 1021 | |
1022 | 1022 | // Reference: packages/components/src/Pagination/ItemRender.tsx:11 |
1023 | - __( 'jump to previous', 'event_espresso' ), |
|
1023 | + __('jump to previous', 'event_espresso'), |
|
1024 | 1024 | |
1025 | 1025 | // Reference: packages/components/src/Pagination/ItemRender.tsx:12 |
1026 | - __( 'jump to next', 'event_espresso' ), |
|
1026 | + __('jump to next', 'event_espresso'), |
|
1027 | 1027 | |
1028 | 1028 | // Reference: packages/components/src/Pagination/ItemRender.tsx:13 |
1029 | - __( 'page', 'event_espresso' ), |
|
1029 | + __('page', 'event_espresso'), |
|
1030 | 1030 | |
1031 | 1031 | // Reference: packages/components/src/Pagination/ItemRender.tsx:9 |
1032 | - __( 'previous', 'event_espresso' ), |
|
1032 | + __('previous', 'event_espresso'), |
|
1033 | 1033 | |
1034 | 1034 | // Reference: packages/components/src/Pagination/PerPage.tsx:37 |
1035 | - __( 'items per page', 'event_espresso' ), |
|
1035 | + __('items per page', 'event_espresso'), |
|
1036 | 1036 | |
1037 | 1037 | // Reference: packages/components/src/Pagination/constants.ts:10 |
1038 | 1038 | /* translators: %s is per page value */ |
1039 | - __( '%s / page', 'event_espresso' ), |
|
1039 | + __('%s / page', 'event_espresso'), |
|
1040 | 1040 | |
1041 | 1041 | // Reference: packages/components/src/Pagination/constants.ts:13 |
1042 | - __( 'Next Page', 'event_espresso' ), |
|
1042 | + __('Next Page', 'event_espresso'), |
|
1043 | 1043 | |
1044 | 1044 | // Reference: packages/components/src/Pagination/constants.ts:14 |
1045 | - __( 'Previous Page', 'event_espresso' ), |
|
1045 | + __('Previous Page', 'event_espresso'), |
|
1046 | 1046 | |
1047 | 1047 | // Reference: packages/components/src/PercentSign/index.tsx:11 |
1048 | - __( '%', 'event_espresso' ), |
|
1048 | + __('%', 'event_espresso'), |
|
1049 | 1049 | |
1050 | 1050 | // Reference: packages/components/src/Stepper/buttons/Next.tsx:12 |
1051 | - __( 'Next', 'event_espresso' ), |
|
1051 | + __('Next', 'event_espresso'), |
|
1052 | 1052 | |
1053 | 1053 | // Reference: packages/components/src/Stepper/buttons/Previous.tsx:12 |
1054 | - __( 'Previous', 'event_espresso' ), |
|
1054 | + __('Previous', 'event_espresso'), |
|
1055 | 1055 | |
1056 | 1056 | // Reference: packages/components/src/Steps/Steps.tsx:30 |
1057 | - __( 'Steps', 'event_espresso' ), |
|
1057 | + __('Steps', 'event_espresso'), |
|
1058 | 1058 | |
1059 | 1059 | // Reference: packages/components/src/TabbableText/index.tsx:19 |
1060 | - __( 'Click to edit…', 'event_espresso' ), |
|
1060 | + __('Click to edit…', 'event_espresso'), |
|
1061 | 1061 | |
1062 | 1062 | // Reference: packages/components/src/TimezoneTimeInfo/Content.tsx:16 |
1063 | - __( 'Your Local Time Zone', 'event_espresso' ), |
|
1063 | + __('Your Local Time Zone', 'event_espresso'), |
|
1064 | 1064 | |
1065 | 1065 | // Reference: packages/components/src/TimezoneTimeInfo/Content.tsx:21 |
1066 | - __( 'The Website\'s Time Zone', 'event_espresso' ), |
|
1066 | + __('The Website\'s Time Zone', 'event_espresso'), |
|
1067 | 1067 | |
1068 | 1068 | // Reference: packages/components/src/TimezoneTimeInfo/Content.tsx:26 |
1069 | - __( 'UTC (Greenwich Mean Time)', 'event_espresso' ), |
|
1069 | + __('UTC (Greenwich Mean Time)', 'event_espresso'), |
|
1070 | 1070 | |
1071 | 1071 | // Reference: packages/components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:22 |
1072 | - __( 'This Date Converted To:', 'event_espresso' ), |
|
1072 | + __('This Date Converted To:', 'event_espresso'), |
|
1073 | 1073 | |
1074 | 1074 | // Reference: packages/components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:23 |
1075 | - __( 'click for timezone information', 'event_espresso' ), |
|
1075 | + __('click for timezone information', 'event_espresso'), |
|
1076 | 1076 | |
1077 | 1077 | // Reference: packages/components/src/bulkEdit/ActionCheckbox.tsx:38 |
1078 | 1078 | /* translators: %d entity id */ |
1079 | - __( 'select entity with id %d', 'event_espresso' ), |
|
1079 | + __('select entity with id %d', 'event_espresso'), |
|
1080 | 1080 | |
1081 | 1081 | // Reference: packages/components/src/bulkEdit/ActionCheckbox.tsx:41 |
1082 | - __( 'select all entities', 'event_espresso' ), |
|
1082 | + __('select all entities', 'event_espresso'), |
|
1083 | 1083 | |
1084 | 1084 | // Reference: packages/components/src/bulkEdit/BulkActions.tsx:52 |
1085 | - __( 'select all', 'event_espresso' ), |
|
1085 | + __('select all', 'event_espresso'), |
|
1086 | 1086 | |
1087 | 1087 | // Reference: packages/components/src/bulkEdit/BulkActions.tsx:54 |
1088 | - __( 'apply', 'event_espresso' ), |
|
1088 | + __('apply', 'event_espresso'), |
|
1089 | 1089 | |
1090 | 1090 | // Reference: packages/components/src/bulkEdit/details/BulkEditDetailsProps.tsx:20 |
1091 | - __( 'Note: ', 'event_espresso' ), |
|
1091 | + __('Note: ', 'event_espresso'), |
|
1092 | 1092 | |
1093 | 1093 | // Reference: packages/components/src/bulkEdit/details/BulkEditDetailsProps.tsx:20 |
1094 | - __( 'any changes will be applied to ALL of the selected entities.', 'event_espresso' ), |
|
1094 | + __('any changes will be applied to ALL of the selected entities.', 'event_espresso'), |
|
1095 | 1095 | |
1096 | 1096 | // Reference: packages/components/src/bulkEdit/details/BulkEditDetailsProps.tsx:26 |
1097 | - __( 'Bulk edit details', 'event_espresso' ), |
|
1097 | + __('Bulk edit details', 'event_espresso'), |
|
1098 | 1098 | |
1099 | 1099 | // Reference: packages/components/src/bulkEdit/details/Submit.tsx:28 |
1100 | - __( 'Are you sure you want to bulk update the details?', 'event_espresso' ), |
|
1100 | + __('Are you sure you want to bulk update the details?', 'event_espresso'), |
|
1101 | 1101 | |
1102 | 1102 | // Reference: packages/components/src/bulkEdit/details/Submit.tsx:29 |
1103 | - __( 'Bulk update details', 'event_espresso' ), |
|
1103 | + __('Bulk update details', 'event_espresso'), |
|
1104 | 1104 | |
1105 | 1105 | // Reference: packages/dates/src/DateRangePicker/DateRangePickerLegend.tsx:14 |
1106 | - __( 'day in range', 'event_espresso' ), |
|
1106 | + __('day in range', 'event_espresso'), |
|
1107 | 1107 | |
1108 | 1108 | // Reference: packages/dates/src/DateRangePicker/DateRangePickerLegend.tsx:18 |
1109 | 1109 | // Reference: packages/dates/src/DateRangePicker/index.tsx:60 |
1110 | - __( 'end date', 'event_espresso' ), |
|
1110 | + __('end date', 'event_espresso'), |
|
1111 | 1111 | |
1112 | 1112 | // Reference: packages/dates/src/DateTimePicker.tsx:13 |
1113 | 1113 | // Reference: packages/dates/src/TimePicker.tsx:14 |
1114 | - __( 'time', 'event_espresso' ), |
|
1114 | + __('time', 'event_espresso'), |
|
1115 | 1115 | |
1116 | 1116 | // Reference: packages/dates/src/constants.ts:5 |
1117 | - __( 'End Date & Time must be set later than the Start Date & Time', 'event_espresso' ), |
|
1117 | + __('End Date & Time must be set later than the Start Date & Time', 'event_espresso'), |
|
1118 | 1118 | |
1119 | 1119 | // Reference: packages/dates/src/constants.ts:7 |
1120 | - __( 'Start Date & Time must be set before the End Date & Time', 'event_espresso' ), |
|
1120 | + __('Start Date & Time must be set before the End Date & Time', 'event_espresso'), |
|
1121 | 1121 | |
1122 | 1122 | // Reference: packages/dates/src/utils/misc.ts:14 |
1123 | - __( 'month(s)', 'event_espresso' ), |
|
1123 | + __('month(s)', 'event_espresso'), |
|
1124 | 1124 | |
1125 | 1125 | // Reference: packages/dates/src/utils/misc.ts:15 |
1126 | - __( 'week(s)', 'event_espresso' ), |
|
1126 | + __('week(s)', 'event_espresso'), |
|
1127 | 1127 | |
1128 | 1128 | // Reference: packages/dates/src/utils/misc.ts:16 |
1129 | - __( 'day(s)', 'event_espresso' ), |
|
1129 | + __('day(s)', 'event_espresso'), |
|
1130 | 1130 | |
1131 | 1131 | // Reference: packages/dates/src/utils/misc.ts:17 |
1132 | - __( 'hour(s)', 'event_espresso' ), |
|
1132 | + __('hour(s)', 'event_espresso'), |
|
1133 | 1133 | |
1134 | 1134 | // Reference: packages/dates/src/utils/misc.ts:18 |
1135 | - __( 'minute(s)', 'event_espresso' ), |
|
1135 | + __('minute(s)', 'event_espresso'), |
|
1136 | 1136 | |
1137 | 1137 | // Reference: packages/edtr-services/src/apollo/initialization/useCacheRehydration.ts:104 |
1138 | - __( 'price types initialized', 'event_espresso' ), |
|
1138 | + __('price types initialized', 'event_espresso'), |
|
1139 | 1139 | |
1140 | 1140 | // Reference: packages/edtr-services/src/apollo/initialization/useCacheRehydration.ts:114 |
1141 | - __( 'datetimes initialized', 'event_espresso' ), |
|
1141 | + __('datetimes initialized', 'event_espresso'), |
|
1142 | 1142 | |
1143 | 1143 | // Reference: packages/edtr-services/src/apollo/initialization/useCacheRehydration.ts:124 |
1144 | - __( 'tickets initialized', 'event_espresso' ), |
|
1144 | + __('tickets initialized', 'event_espresso'), |
|
1145 | 1145 | |
1146 | 1146 | // Reference: packages/edtr-services/src/apollo/initialization/useCacheRehydration.ts:134 |
1147 | - __( 'prices initialized', 'event_espresso' ), |
|
1147 | + __('prices initialized', 'event_espresso'), |
|
1148 | 1148 | |
1149 | 1149 | // Reference: packages/edtr-services/src/utils/dateAndTime.ts:22 |
1150 | - __( 'End date has been set one hour after start date', 'event_espresso' ), |
|
1150 | + __('End date has been set one hour after start date', 'event_espresso'), |
|
1151 | 1151 | |
1152 | 1152 | // Reference: packages/edtr-services/src/utils/dateAndTime.ts:35 |
1153 | - __( 'Start date has been set one hour before end date', 'event_espresso' ), |
|
1153 | + __('Start date has been set one hour before end date', 'event_espresso'), |
|
1154 | 1154 | |
1155 | 1155 | // Reference: packages/edtr-services/src/utils/dateAndTime.ts:47 |
1156 | - __( 'Required', 'event_espresso' ), |
|
1156 | + __('Required', 'event_espresso'), |
|
1157 | 1157 | |
1158 | 1158 | // Reference: packages/edtr-services/src/utils/dateAndTime.ts:52 |
1159 | - __( 'Start Date is required', 'event_espresso' ), |
|
1159 | + __('Start Date is required', 'event_espresso'), |
|
1160 | 1160 | |
1161 | 1161 | // Reference: packages/edtr-services/src/utils/dateAndTime.ts:56 |
1162 | - __( 'End Date is required', 'event_espresso' ), |
|
1162 | + __('End Date is required', 'event_espresso'), |
|
1163 | 1163 | |
1164 | 1164 | // Reference: packages/form/src/renderers/RepeatableRenderer.tsx:35 |
1165 | 1165 | /* translators: %d the entry number */ |
1166 | - __( 'Entry %d', 'event_espresso' ), |
|
1166 | + __('Entry %d', 'event_espresso'), |
|
1167 | 1167 | |
1168 | 1168 | // Reference: packages/form/src/renderers/RepeatableRenderer.tsx:51 |
1169 | - __( 'Add', 'event_espresso' ), |
|
1169 | + __('Add', 'event_espresso'), |
|
1170 | 1170 | |
1171 | 1171 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:11 |
1172 | 1172 | // Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:17 |
1173 | - __( 'sold out', 'event_espresso' ), |
|
1173 | + __('sold out', 'event_espresso'), |
|
1174 | 1174 | |
1175 | 1175 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:14 |
1176 | 1176 | // Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:14 |
1177 | - __( 'expired', 'event_espresso' ), |
|
1177 | + __('expired', 'event_espresso'), |
|
1178 | 1178 | |
1179 | 1179 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:17 |
1180 | - __( 'upcoming', 'event_espresso' ), |
|
1180 | + __('upcoming', 'event_espresso'), |
|
1181 | 1181 | |
1182 | 1182 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:20 |
1183 | - __( 'active', 'event_espresso' ), |
|
1183 | + __('active', 'event_espresso'), |
|
1184 | 1184 | |
1185 | 1185 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:23 |
1186 | 1186 | // Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:11 |
1187 | - __( 'trashed', 'event_espresso' ), |
|
1187 | + __('trashed', 'event_espresso'), |
|
1188 | 1188 | |
1189 | 1189 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:26 |
1190 | - __( 'cancelled', 'event_espresso' ), |
|
1190 | + __('cancelled', 'event_espresso'), |
|
1191 | 1191 | |
1192 | 1192 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:29 |
1193 | - __( 'postponed', 'event_espresso' ), |
|
1193 | + __('postponed', 'event_espresso'), |
|
1194 | 1194 | |
1195 | 1195 | // Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:33 |
1196 | - __( 'inactive', 'event_espresso' ), |
|
1196 | + __('inactive', 'event_espresso'), |
|
1197 | 1197 | |
1198 | 1198 | // Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:20 |
1199 | - __( 'pending', 'event_espresso' ), |
|
1199 | + __('pending', 'event_espresso'), |
|
1200 | 1200 | |
1201 | 1201 | // Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:23 |
1202 | - __( 'on sale', 'event_espresso' ), |
|
1202 | + __('on sale', 'event_espresso'), |
|
1203 | 1203 | |
1204 | 1204 | // Reference: packages/predicates/src/registration/statusOptions.ts:10 |
1205 | - __( 'Cancelled', 'event_espresso' ), |
|
1205 | + __('Cancelled', 'event_espresso'), |
|
1206 | 1206 | |
1207 | 1207 | // Reference: packages/predicates/src/registration/statusOptions.ts:14 |
1208 | - __( 'Declined', 'event_espresso' ), |
|
1208 | + __('Declined', 'event_espresso'), |
|
1209 | 1209 | |
1210 | 1210 | // Reference: packages/predicates/src/registration/statusOptions.ts:18 |
1211 | - __( 'Incomplete', 'event_espresso' ), |
|
1211 | + __('Incomplete', 'event_espresso'), |
|
1212 | 1212 | |
1213 | 1213 | // Reference: packages/predicates/src/registration/statusOptions.ts:22 |
1214 | - __( 'Not Approved', 'event_espresso' ), |
|
1214 | + __('Not Approved', 'event_espresso'), |
|
1215 | 1215 | |
1216 | 1216 | // Reference: packages/predicates/src/registration/statusOptions.ts:26 |
1217 | - __( 'Pending Payment', 'event_espresso' ), |
|
1217 | + __('Pending Payment', 'event_espresso'), |
|
1218 | 1218 | |
1219 | 1219 | // Reference: packages/predicates/src/registration/statusOptions.ts:30 |
1220 | - __( 'Wait List', 'event_espresso' ), |
|
1220 | + __('Wait List', 'event_espresso'), |
|
1221 | 1221 | |
1222 | 1222 | // Reference: packages/predicates/src/registration/statusOptions.ts:6 |
1223 | - __( 'Approved', 'event_espresso' ), |
|
1223 | + __('Approved', 'event_espresso'), |
|
1224 | 1224 | |
1225 | 1225 | // Reference: packages/tpc/src/buttons/AddPriceModifierButton.tsx:15 |
1226 | - __( 'add new price modifier after this row', 'event_espresso' ), |
|
1226 | + __('add new price modifier after this row', 'event_espresso'), |
|
1227 | 1227 | |
1228 | 1228 | // Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:13 |
1229 | - __( 'Delete all prices', 'event_espresso' ), |
|
1229 | + __('Delete all prices', 'event_espresso'), |
|
1230 | 1230 | |
1231 | 1231 | // Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:26 |
1232 | - __( 'Are you sure you want to delete all of this ticket\'s prices and make it free? This action is permanent and can not be undone.', 'event_espresso' ), |
|
1232 | + __('Are you sure you want to delete all of this ticket\'s prices and make it free? This action is permanent and can not be undone.', 'event_espresso'), |
|
1233 | 1233 | |
1234 | 1234 | // Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:30 |
1235 | - __( 'Delete all prices?', 'event_espresso' ), |
|
1235 | + __('Delete all prices?', 'event_espresso'), |
|
1236 | 1236 | |
1237 | 1237 | // Reference: packages/tpc/src/buttons/DeletePriceModifierButton.tsx:12 |
1238 | - __( 'delete price modifier', 'event_espresso' ), |
|
1238 | + __('delete price modifier', 'event_espresso'), |
|
1239 | 1239 | |
1240 | 1240 | // Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:15 |
1241 | - __( 'Ticket base price is being reverse calculated from bottom to top starting with the ticket total. Entering a new ticket total will reverse calculate the ticket base price after applying all price modifiers in reverse. Click to turn off reverse calculations', 'event_espresso' ), |
|
1241 | + __('Ticket base price is being reverse calculated from bottom to top starting with the ticket total. Entering a new ticket total will reverse calculate the ticket base price after applying all price modifiers in reverse. Click to turn off reverse calculations', 'event_espresso'), |
|
1242 | 1242 | |
1243 | 1243 | // Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:18 |
1244 | - __( 'Ticket total is being calculated normally from top to bottom starting from the base price. Entering a new ticket base price will recalculate the ticket total after applying all price modifiers. Click to turn on reverse calculations', 'event_espresso' ), |
|
1244 | + __('Ticket total is being calculated normally from top to bottom starting from the base price. Entering a new ticket base price will recalculate the ticket total after applying all price modifiers. Click to turn on reverse calculations', 'event_espresso'), |
|
1245 | 1245 | |
1246 | 1246 | // Reference: packages/tpc/src/buttons/TicketPriceCalculatorButton.tsx:29 |
1247 | - __( 'ticket price calculator', 'event_espresso' ), |
|
1247 | + __('ticket price calculator', 'event_espresso'), |
|
1248 | 1248 | |
1249 | 1249 | // Reference: packages/tpc/src/buttons/taxes/AddDefaultTaxesButton.tsx:10 |
1250 | - __( 'Add default taxes', 'event_espresso' ), |
|
1250 | + __('Add default taxes', 'event_espresso'), |
|
1251 | 1251 | |
1252 | 1252 | // Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:11 |
1253 | - __( 'Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso' ), |
|
1253 | + __('Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso'), |
|
1254 | 1254 | |
1255 | 1255 | // Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:15 |
1256 | - __( 'Remove all taxes?', 'event_espresso' ), |
|
1256 | + __('Remove all taxes?', 'event_espresso'), |
|
1257 | 1257 | |
1258 | 1258 | // Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:8 |
1259 | - __( 'Remove taxes', 'event_espresso' ), |
|
1259 | + __('Remove taxes', 'event_espresso'), |
|
1260 | 1260 | |
1261 | 1261 | // Reference: packages/tpc/src/components/DefaultPricesInfo.tsx:28 |
1262 | - __( 'Modify default prices.', 'event_espresso' ), |
|
1262 | + __('Modify default prices.', 'event_espresso'), |
|
1263 | 1263 | |
1264 | 1264 | // Reference: packages/tpc/src/components/DefaultTaxesInfo.tsx:28 |
1265 | - __( 'New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso' ), |
|
1265 | + __('New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso'), |
|
1266 | 1266 | |
1267 | 1267 | // Reference: packages/tpc/src/components/NoPricesBanner/AddDefaultPricesButton.tsx:10 |
1268 | - __( 'Add default prices', 'event_espresso' ), |
|
1268 | + __('Add default prices', 'event_espresso'), |
|
1269 | 1269 | |
1270 | 1270 | // Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:14 |
1271 | - __( 'This Ticket is Currently Free', 'event_espresso' ), |
|
1271 | + __('This Ticket is Currently Free', 'event_espresso'), |
|
1272 | 1272 | |
1273 | 1273 | // Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:22 |
1274 | 1274 | /* translators: %s default prices */ |
1275 | - __( 'Click the button below to load your %s into the calculator.', 'event_espresso' ), |
|
1275 | + __('Click the button below to load your %s into the calculator.', 'event_espresso'), |
|
1276 | 1276 | |
1277 | 1277 | // Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:23 |
1278 | - __( 'default prices', 'event_espresso' ), |
|
1278 | + __('default prices', 'event_espresso'), |
|
1279 | 1279 | |
1280 | 1280 | // Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:30 |
1281 | - __( 'Additional ticket price modifiers can be added or removed.', 'event_espresso' ), |
|
1281 | + __('Additional ticket price modifiers can be added or removed.', 'event_espresso'), |
|
1282 | 1282 | |
1283 | 1283 | // Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:33 |
1284 | - __( 'Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso' ), |
|
1284 | + __('Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso'), |
|
1285 | 1285 | |
1286 | 1286 | // Reference: packages/tpc/src/components/TicketPriceCalculatorModal.tsx:31 |
1287 | 1287 | /* translators: %s ticket name */ |
1288 | - __( 'Price Calculator for Ticket: %s', 'event_espresso' ), |
|
1288 | + __('Price Calculator for Ticket: %s', 'event_espresso'), |
|
1289 | 1289 | |
1290 | 1290 | // Reference: packages/tpc/src/components/table/Table.tsx:43 |
1291 | - __( 'Ticket Price Calculator', 'event_espresso' ), |
|
1291 | + __('Ticket Price Calculator', 'event_espresso'), |
|
1292 | 1292 | |
1293 | 1293 | // Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:41 |
1294 | - __( 'Total', 'event_espresso' ), |
|
1294 | + __('Total', 'event_espresso'), |
|
1295 | 1295 | |
1296 | 1296 | // Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:50 |
1297 | - __( 'ticket total', 'event_espresso' ), |
|
1297 | + __('ticket total', 'event_espresso'), |
|
1298 | 1298 | |
1299 | 1299 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:29 |
1300 | - __( 'Price Type', 'event_espresso' ), |
|
1300 | + __('Price Type', 'event_espresso'), |
|
1301 | 1301 | |
1302 | 1302 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:35 |
1303 | - __( 'Label', 'event_espresso' ), |
|
1303 | + __('Label', 'event_espresso'), |
|
1304 | 1304 | |
1305 | 1305 | // Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:47 |
1306 | - __( 'Amount', 'event_espresso' ), |
|
1306 | + __('Amount', 'event_espresso'), |
|
1307 | 1307 | |
1308 | 1308 | // Reference: packages/tpc/src/inputs/PriceAmountInput.tsx:31 |
1309 | - __( 'amount', 'event_espresso' ), |
|
1309 | + __('amount', 'event_espresso'), |
|
1310 | 1310 | |
1311 | 1311 | // Reference: packages/tpc/src/inputs/PriceAmountInput.tsx:42 |
1312 | - __( 'amount…', 'event_espresso' ), |
|
1312 | + __('amount…', 'event_espresso'), |
|
1313 | 1313 | |
1314 | 1314 | // Reference: packages/tpc/src/inputs/PriceDescriptionInput.tsx:10 |
1315 | - __( 'price description', 'event_espresso' ), |
|
1315 | + __('price description', 'event_espresso'), |
|
1316 | 1316 | |
1317 | 1317 | // Reference: packages/tpc/src/inputs/PriceDescriptionInput.tsx:15 |
1318 | - __( 'description…', 'event_espresso' ), |
|
1318 | + __('description…', 'event_espresso'), |
|
1319 | 1319 | |
1320 | 1320 | // Reference: packages/tpc/src/inputs/PriceIdInput.tsx:9 |
1321 | - __( 'price id', 'event_espresso' ), |
|
1321 | + __('price id', 'event_espresso'), |
|
1322 | 1322 | |
1323 | 1323 | // Reference: packages/tpc/src/inputs/PriceNameInput.tsx:10 |
1324 | - __( 'price name', 'event_espresso' ), |
|
1324 | + __('price name', 'event_espresso'), |
|
1325 | 1325 | |
1326 | 1326 | // Reference: packages/tpc/src/inputs/PriceNameInput.tsx:15 |
1327 | - __( 'label…', 'event_espresso' ), |
|
1327 | + __('label…', 'event_espresso'), |
|
1328 | 1328 | |
1329 | 1329 | // Reference: packages/tpc/src/inputs/PriceTypeInput.tsx:16 |
1330 | - __( 'price type', 'event_espresso' ), |
|
1330 | + __('price type', 'event_espresso'), |
|
1331 | 1331 | |
1332 | 1332 | // Reference: packages/tpc/src/utils/constants.ts:13 |
1333 | - __( 'Ticket price modifications are blocked for Tickets that have already been sold to registrants, because doing so would negatively affect internal accounting for the event. If you still need to modify ticket prices, then create a copy of those tickets, edit the prices for the new tickets, and then archive the old tickets.', 'event_espresso' ) |
|
1333 | + __('Ticket price modifications are blocked for Tickets that have already been sold to registrants, because doing so would negatively affect internal accounting for the event. If you still need to modify ticket prices, then create a copy of those tickets, edit the prices for the new tickets, and then archive the old tickets.', 'event_espresso') |
|
1334 | 1334 | ); |
1335 | 1335 | /* THIS IS THE END OF THE GENERATED FILE */ |