@@ -18,497 +18,497 @@ |
||
18 | 18 | */ |
19 | 19 | abstract class EE_Admin_Page_Init extends EE_Base |
20 | 20 | { |
21 | - // identity properties (set in _set_defaults and _set_init_properties) |
|
22 | - public $label; |
|
21 | + // identity properties (set in _set_defaults and _set_init_properties) |
|
22 | + public $label; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Menu map has a capability. However, this allows admin pages to have separate capability requirements for menus |
|
26 | - * and accessing pages. If capability is NOT set, then it defaults to the menu_map capability. |
|
27 | - * |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - public $capability; |
|
24 | + /** |
|
25 | + * Menu map has a capability. However, this allows admin pages to have separate capability requirements for menus |
|
26 | + * and accessing pages. If capability is NOT set, then it defaults to the menu_map capability. |
|
27 | + * |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + public $capability; |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * This holds the menu map object for this admin page. |
|
35 | - * |
|
36 | - * @var AdminMenuItem |
|
37 | - */ |
|
38 | - protected $_menu_map = null; |
|
39 | - |
|
40 | - /** |
|
41 | - * deprecated |
|
42 | - */ |
|
43 | - public $menu_label; |
|
44 | - |
|
45 | - public $menu_slug; |
|
46 | - |
|
47 | - |
|
48 | - // set in _set_defaults |
|
49 | - protected $_folder_name; |
|
50 | - |
|
51 | - protected $_folder_path; |
|
52 | - |
|
53 | - protected $_file_name; |
|
54 | - |
|
55 | - public $hook_file; |
|
56 | - |
|
57 | - protected $_wp_page_slug; |
|
58 | - |
|
59 | - protected $_routing; |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * This holds the page object. |
|
64 | - * |
|
65 | - * @var EE_Admin_Page |
|
66 | - */ |
|
67 | - protected $_loaded_page_object; |
|
68 | - |
|
69 | - |
|
70 | - // for caf |
|
71 | - protected $_files_hooked; |
|
72 | - |
|
73 | - protected $_hook_paths; |
|
74 | - |
|
75 | - // load_page? |
|
76 | - private $_load_page; |
|
77 | - |
|
78 | - /** |
|
79 | - * @var LoaderInterface |
|
80 | - */ |
|
81 | - protected $loader; |
|
82 | - |
|
83 | - /** |
|
84 | - * @var RequestInterface |
|
85 | - */ |
|
86 | - protected $request; |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * @throws InvalidArgumentException |
|
91 | - * @throws InvalidDataTypeException |
|
92 | - * @throws InvalidInterfaceException |
|
93 | - */ |
|
94 | - public function __construct(RequestInterface $request = null) |
|
95 | - { |
|
96 | - $this->loader = LoaderFactory::getLoader(); |
|
97 | - $this->request = $request instanceof RequestInterface |
|
98 | - ? $request |
|
99 | - : $this->loader->getShared(RequestInterface::class); |
|
100 | - // set global defaults |
|
101 | - $this->_set_defaults(); |
|
102 | - // set properties that are always available with objects. |
|
103 | - $this->_set_init_properties(); |
|
104 | - // global styles/scripts across all wp admin pages |
|
105 | - add_action('admin_enqueue_scripts', [$this, 'load_wp_global_scripts_styles'], 5); |
|
106 | - // load initial stuff. |
|
107 | - $this->_set_file_and_folder_name(); |
|
108 | - } |
|
109 | - |
|
110 | - |
|
111 | - /** |
|
112 | - * _set_init_properties |
|
113 | - * Child classes use to set the following properties: |
|
114 | - * $label |
|
115 | - * |
|
116 | - * @abstract |
|
117 | - * @return void |
|
118 | - */ |
|
119 | - abstract protected function _set_init_properties(); |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @return AdminMenuItem|null |
|
124 | - * @since 4.4.0 |
|
125 | - * @deprecated $VID:$ |
|
126 | - */ |
|
127 | - public function get_menu_map() |
|
128 | - { |
|
129 | - return $this->adminMenu(); |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * _set_menu_map is a function that child classes use to set the menu_map property (which should be an instance of |
|
135 | - * EE_Admin_Page_Menu_Map. Their menu can either be EE_Admin_Page_Main_Menu or AdminMenuSubItem. |
|
136 | - * |
|
137 | - * @since 4.4.0 |
|
138 | - * @deprecated $VID:$ |
|
139 | - */ |
|
140 | - protected function _set_menu_map() |
|
141 | - { |
|
142 | - $this->_menu_map = null; |
|
143 | - } |
|
144 | - |
|
145 | - |
|
146 | - /** |
|
147 | - * @since $VID:$ |
|
148 | - */ |
|
149 | - public function setupLegacyAdminMenuItem() |
|
150 | - { |
|
151 | - // will be overridden by child classes not using new system |
|
152 | - $this->_set_menu_map(); |
|
153 | - } |
|
154 | - |
|
155 | - |
|
156 | - /** |
|
157 | - * Child classes should return an array of properties used to construct the AdminMenuItem |
|
158 | - * |
|
159 | - * @return array |
|
160 | - * @since $VID:$ |
|
161 | - */ |
|
162 | - public function getMenuProperties(): array |
|
163 | - { |
|
164 | - return []; |
|
165 | - } |
|
166 | - |
|
167 | - |
|
168 | - /** |
|
169 | - * @param AdminMenuItem $menu |
|
170 | - * @return void |
|
171 | - * @since $VID:$ |
|
172 | - */ |
|
173 | - public function setAdminMenu(AdminMenuItem $menu): void |
|
174 | - { |
|
175 | - $this->_menu_map = $menu; |
|
176 | - } |
|
177 | - |
|
178 | - |
|
179 | - /** |
|
180 | - * returns the menu map for this admin page |
|
181 | - * |
|
182 | - * @return AdminMenuItem|null |
|
183 | - * @since $VID:$ |
|
184 | - */ |
|
185 | - public function adminMenu(): ?AdminMenuItem |
|
186 | - { |
|
187 | - return $this->_menu_map; |
|
188 | - } |
|
189 | - |
|
190 | - |
|
191 | - /** |
|
192 | - * @param string $wp_page_slug |
|
193 | - * @since $VID:$ |
|
194 | - */ |
|
195 | - public function setWpPageSlug(string $wp_page_slug): void |
|
196 | - { |
|
197 | - $this->_wp_page_slug = $wp_page_slug; |
|
198 | - } |
|
199 | - |
|
200 | - |
|
201 | - /** |
|
202 | - * This loads scripts and styles for the EE_Admin system |
|
203 | - * that must be available on ALL WP admin pages (i.e. EE_menu items) |
|
204 | - * |
|
205 | - * @return void |
|
206 | - */ |
|
207 | - public function load_wp_global_scripts_styles() |
|
208 | - { |
|
209 | - wp_register_style( |
|
210 | - 'espresso_menu', |
|
211 | - EE_ADMIN_URL . 'assets/admin-menu-styles.css', |
|
212 | - ['dashicons'], |
|
213 | - EVENT_ESPRESSO_VERSION |
|
214 | - ); |
|
215 | - wp_enqueue_style('espresso_menu'); |
|
216 | - } |
|
217 | - |
|
218 | - |
|
219 | - /** |
|
220 | - * this sets default properties (might be overridden in _set_init_properties); |
|
221 | - * |
|
222 | - * @return void |
|
223 | - */ |
|
224 | - private function _set_defaults() |
|
225 | - { |
|
226 | - $this->_file_name = $this->_folder_name = $this->_wp_page_slug = $this->capability = null; |
|
227 | - $this->_routing = true; |
|
228 | - $this->_load_page = false; |
|
229 | - $this->_files_hooked = $this->_hook_paths = []; |
|
230 | - } |
|
231 | - |
|
232 | - |
|
233 | - public function setCapability($capability, $menu_slug) |
|
234 | - { |
|
235 | - $this->capability = apply_filters('FHEE_' . $menu_slug . '_capability', $capability); |
|
236 | - } |
|
237 | - |
|
238 | - |
|
239 | - /** |
|
240 | - * @deprecated $VID:$ |
|
241 | - */ |
|
242 | - protected function _set_capability() |
|
243 | - { |
|
244 | - if ($this->_menu_map instanceof AdminMenuItem) { |
|
245 | - $this->setCapability($this->_menu_map->capability(), $this->_menu_map->menuSlug()); |
|
246 | - } |
|
247 | - } |
|
248 | - |
|
249 | - |
|
250 | - /** |
|
251 | - * initialize_admin_page |
|
252 | - * This method is what executes the loading of the specific page class for the given dir_name as called by the |
|
253 | - * EE_Admin_Init class. |
|
254 | - * |
|
255 | - * @return void |
|
256 | - * @throws EE_Error |
|
257 | - * @throws ReflectionException |
|
258 | - */ |
|
259 | - public function initialize_admin_page() |
|
260 | - { |
|
261 | - // let's check user access first |
|
262 | - $this->_check_user_access(); |
|
263 | - if (! is_object($this->_loaded_page_object)) { |
|
264 | - return; |
|
265 | - } |
|
266 | - $this->_loaded_page_object->route_admin_request(); |
|
267 | - } |
|
268 | - |
|
269 | - |
|
270 | - /** |
|
271 | - * @param string $wp_page_slug |
|
272 | - * @throws EE_Error |
|
273 | - */ |
|
274 | - public function set_page_dependencies(string $wp_page_slug) |
|
275 | - { |
|
276 | - if (! $this->_load_page) { |
|
277 | - return; |
|
278 | - } |
|
279 | - if (! is_object($this->_loaded_page_object)) { |
|
280 | - $msg[] = esc_html__( |
|
281 | - 'We can\'t load the page because we\'re missing a valid page object that tells us what to load', |
|
282 | - 'event_espresso' |
|
283 | - ); |
|
284 | - $msg[] = $msg[0] . "\r\n" |
|
285 | - . sprintf( |
|
286 | - esc_html__( |
|
287 | - 'The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory', |
|
288 | - 'event_espresso' |
|
289 | - ), |
|
290 | - $this->_file_name, |
|
291 | - $this->_file_name, |
|
292 | - $this->_folder_path . $this->_file_name, |
|
293 | - $this->_menu_map->menuSlug() |
|
294 | - ); |
|
295 | - throw new EE_Error(implode('||', $msg)); |
|
296 | - } |
|
297 | - $this->_loaded_page_object->set_wp_page_slug($wp_page_slug); |
|
298 | - $page_hook = "load-$wp_page_slug"; |
|
299 | - // hook into page load hook so all page specific stuff gets loaded. |
|
300 | - if (! empty($wp_page_slug)) { |
|
301 | - add_action($page_hook, [$this->_loaded_page_object, 'load_page_dependencies']); |
|
302 | - } |
|
303 | - } |
|
304 | - |
|
305 | - |
|
306 | - /** |
|
307 | - * This executes the initial page loads for EE_Admin pages to take care of any ajax or other code needing to run |
|
308 | - * before the load-page... hook. Note, the page loads are happening around the wp_init hook. |
|
309 | - * |
|
310 | - * @return void |
|
311 | - * @throws InvalidArgumentException |
|
312 | - * @throws InvalidDataTypeException |
|
313 | - * @throws InvalidInterfaceException |
|
314 | - * @throws EE_Error |
|
315 | - * @throws ReflectionException |
|
316 | - */ |
|
317 | - public function do_initial_loads() |
|
318 | - { |
|
319 | - // no loading or initializing if menu map is setup incorrectly. |
|
320 | - if (! $this->_menu_map instanceof AdminMenuItem) { |
|
321 | - return; |
|
322 | - } |
|
323 | - $this->_initialize_admin_page(); |
|
324 | - } |
|
325 | - |
|
326 | - |
|
327 | - /** |
|
328 | - * all we're doing here is setting the $_file_name property for later use. |
|
329 | - * |
|
330 | - * @return void |
|
331 | - */ |
|
332 | - private function _set_file_and_folder_name() |
|
333 | - { |
|
334 | - $bt = debug_backtrace(); |
|
335 | - // for more reliable determination of folder name |
|
336 | - // we're using this to get the actual folder name of the CALLING class (i.e. the child class that extends this). Why? Because $this->menu_slug may be different than the folder name (to avoid conflicts with other plugins) |
|
337 | - $class = get_class($this); |
|
338 | - foreach ($bt as $index => $values) { |
|
339 | - if (isset($values['class']) && $values['class'] == $class) { |
|
340 | - $file_index = $index - 1; |
|
341 | - $this->_folder_name = basename(dirname($bt[ $file_index ]['file'])); |
|
342 | - if (! empty($this->_folder_name)) { |
|
343 | - break; |
|
344 | - } |
|
345 | - } |
|
346 | - } |
|
347 | - $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/'; |
|
348 | - $this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name); |
|
349 | - $this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name)); |
|
350 | - $this->_file_name = str_replace(' ', '_', $this->_file_name); |
|
351 | - } |
|
352 | - |
|
353 | - |
|
354 | - /** |
|
355 | - * This automatically checks if we have a hook class in the loaded child directory. If we DO then we will register |
|
356 | - * it with the appropriate pages. That way all we have to do is make sure the file is named correctly and |
|
357 | - * "dropped" in. Example: if we wanted to set this up for Messages hooking into Events then we would do: |
|
358 | - * events_Messages_Hooks.class.php |
|
359 | - * |
|
360 | - * @param bool $extend This indicates whether we're checking the extend directory for any register_hooks |
|
361 | - * files/classes |
|
362 | - * @return array |
|
363 | - */ |
|
364 | - public function register_hooks(bool $extend = false): array |
|
365 | - { |
|
366 | - // get a list of files in the directory that have the "Hook" in their name an |
|
367 | - // if this is an extended check (i.e. caf is active) then we will scan the caffeinated/extend directory first and any hook files that are found will be have their reference added to the $_files_hook array property. Then, we make sure that when we loop through the core decaf directories to find hook files that we skip over any hooks files that have already been set by caf. |
|
368 | - if ($extend) { |
|
369 | - $hook_files_glob_path = apply_filters( |
|
370 | - 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', |
|
371 | - EE_CORE_CAF_ADMIN_EXTEND |
|
372 | - . $this->_folder_name |
|
373 | - . '/*' |
|
374 | - . $this->_file_name |
|
375 | - . '_Hooks_Extend.class.php' |
|
376 | - ); |
|
377 | - $this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend); |
|
378 | - } |
|
379 | - // loop through decaf folders |
|
380 | - $hook_files_glob_path = apply_filters( |
|
381 | - 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', |
|
382 | - $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php' |
|
383 | - ); |
|
384 | - $this->_hook_paths = array_merge( |
|
385 | - $this->_register_hook_files($hook_files_glob_path), |
|
386 | - $this->_hook_paths |
|
387 | - ); // making sure any extended hook paths are later in the array than the core hook paths! |
|
388 | - return $this->_hook_paths; |
|
389 | - } |
|
390 | - |
|
391 | - |
|
392 | - protected function _register_hook_files($hook_files_glob_path, $extend = false): array |
|
393 | - { |
|
394 | - $hook_paths = glob($hook_files_glob_path); |
|
395 | - if (empty($hook_paths)) { |
|
396 | - return []; |
|
397 | - } |
|
398 | - foreach ($hook_paths as $file) { |
|
399 | - // lets get the linked admin. |
|
400 | - $hook_file = $extend |
|
401 | - ? str_replace(EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . '/', '', $file) |
|
402 | - : str_replace($this->_folder_path, '', $file); |
|
403 | - $replace = $extend |
|
404 | - ? '_' . $this->_file_name . '_Hooks_Extend.class.php' |
|
405 | - : '_' . $this->_file_name . '_Hooks.class.php'; |
|
406 | - $rel_admin = str_replace($replace, '', $hook_file); |
|
407 | - $rel_admin = strtolower($rel_admin); |
|
408 | - // make sure we haven't already got a hook setup for this page path |
|
409 | - if (in_array($rel_admin, $this->_files_hooked)) { |
|
410 | - continue; |
|
411 | - } |
|
412 | - require_once $file; |
|
413 | - $this->hook_file = $hook_file; |
|
414 | - $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin; |
|
415 | - add_filter($rel_admin_hook, [$this, 'load_admin_hook']); |
|
416 | - $this->_files_hooked[] = $rel_admin; |
|
417 | - } |
|
418 | - return $hook_paths; |
|
419 | - } |
|
420 | - |
|
421 | - |
|
422 | - public function load_admin_hook($registered_pages) |
|
423 | - { |
|
424 | - return array_merge((array) $this->hook_file, $registered_pages); |
|
425 | - } |
|
426 | - |
|
427 | - |
|
428 | - /** |
|
429 | - * _initialize_admin_page |
|
430 | - * |
|
431 | - * @throws EE_Error |
|
432 | - * @throws ReflectionException |
|
433 | - * @see initialize_admin_page() for info |
|
434 | - */ |
|
435 | - protected function _initialize_admin_page() |
|
436 | - { |
|
437 | - // JUST CHECK WE'RE ON RIGHT PAGE. |
|
438 | - $page = $this->request->getRequestParam('page'); |
|
439 | - $page = $this->request->getRequestParam('current_page', $page); |
|
440 | - $menu_slug = $this->_menu_map->menuSlug(); |
|
441 | - |
|
442 | - |
|
443 | - if ($this->_routing && ($page === '' || $page !== $menu_slug)) { |
|
444 | - // not on the right page so let's get out. |
|
445 | - return; |
|
446 | - } |
|
447 | - $this->_load_page = true; |
|
448 | - |
|
449 | - // we don't need to do a page_request check here because it's only called via WP menu system. |
|
450 | - $admin_page = $this->_file_name . '_Admin_Page'; |
|
451 | - $hook_suffix = "{$menu_slug}_$admin_page"; |
|
452 | - $admin_page = apply_filters( |
|
453 | - "FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__$hook_suffix", |
|
454 | - $admin_page |
|
455 | - ); |
|
456 | - if (empty($admin_page)) { |
|
457 | - return; |
|
458 | - } |
|
459 | - // define requested admin page class name then load the file and instantiate |
|
460 | - $path_to_file = str_replace(['\\', '/'], '/', $this->_folder_path . $admin_page . '.core.php'); |
|
461 | - // so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be: |
|
462 | - // FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page |
|
463 | - $path_to_file = apply_filters( |
|
464 | - "FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__$hook_suffix", |
|
465 | - $path_to_file |
|
466 | - ); |
|
467 | - if (! is_readable($path_to_file)) { |
|
468 | - return; |
|
469 | - } |
|
470 | - // This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place |
|
471 | - do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization'); |
|
472 | - do_action("AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_$menu_slug"); |
|
473 | - require_once($path_to_file); |
|
474 | - $this->_loaded_page_object = $this->loader->getShared($admin_page, [$this->_routing]); |
|
475 | - $this->_loaded_page_object->initializePage(); |
|
476 | - |
|
477 | - do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization'); |
|
478 | - do_action("AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_$menu_slug"); |
|
479 | - } |
|
480 | - |
|
481 | - |
|
482 | - public function get_admin_page_name(): string |
|
483 | - { |
|
484 | - return $this->_file_name . '_Admin_Page'; |
|
485 | - } |
|
486 | - |
|
487 | - |
|
488 | - /** |
|
489 | - * @return EE_Admin_Page |
|
490 | - */ |
|
491 | - public function loaded_page_object(): EE_Admin_Page |
|
492 | - { |
|
493 | - return $this->_loaded_page_object; |
|
494 | - } |
|
495 | - |
|
496 | - |
|
497 | - /** |
|
498 | - * _check_user_access |
|
499 | - * verifies user access for this admin page. If no user access is available then let's gracefully exit with a |
|
500 | - * WordPress die message. |
|
501 | - * |
|
502 | - * @return void wp_die if fail |
|
503 | - */ |
|
504 | - private function _check_user_access() |
|
505 | - { |
|
506 | - if (! $this->_menu_map->currentUserHasAccess()) { |
|
507 | - wp_die( |
|
508 | - esc_html__('You don\'t have access to this page.', 'event_espresso'), |
|
509 | - '', |
|
510 | - ['back_link' => true] |
|
511 | - ); |
|
512 | - } |
|
513 | - } |
|
33 | + /** |
|
34 | + * This holds the menu map object for this admin page. |
|
35 | + * |
|
36 | + * @var AdminMenuItem |
|
37 | + */ |
|
38 | + protected $_menu_map = null; |
|
39 | + |
|
40 | + /** |
|
41 | + * deprecated |
|
42 | + */ |
|
43 | + public $menu_label; |
|
44 | + |
|
45 | + public $menu_slug; |
|
46 | + |
|
47 | + |
|
48 | + // set in _set_defaults |
|
49 | + protected $_folder_name; |
|
50 | + |
|
51 | + protected $_folder_path; |
|
52 | + |
|
53 | + protected $_file_name; |
|
54 | + |
|
55 | + public $hook_file; |
|
56 | + |
|
57 | + protected $_wp_page_slug; |
|
58 | + |
|
59 | + protected $_routing; |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * This holds the page object. |
|
64 | + * |
|
65 | + * @var EE_Admin_Page |
|
66 | + */ |
|
67 | + protected $_loaded_page_object; |
|
68 | + |
|
69 | + |
|
70 | + // for caf |
|
71 | + protected $_files_hooked; |
|
72 | + |
|
73 | + protected $_hook_paths; |
|
74 | + |
|
75 | + // load_page? |
|
76 | + private $_load_page; |
|
77 | + |
|
78 | + /** |
|
79 | + * @var LoaderInterface |
|
80 | + */ |
|
81 | + protected $loader; |
|
82 | + |
|
83 | + /** |
|
84 | + * @var RequestInterface |
|
85 | + */ |
|
86 | + protected $request; |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * @throws InvalidArgumentException |
|
91 | + * @throws InvalidDataTypeException |
|
92 | + * @throws InvalidInterfaceException |
|
93 | + */ |
|
94 | + public function __construct(RequestInterface $request = null) |
|
95 | + { |
|
96 | + $this->loader = LoaderFactory::getLoader(); |
|
97 | + $this->request = $request instanceof RequestInterface |
|
98 | + ? $request |
|
99 | + : $this->loader->getShared(RequestInterface::class); |
|
100 | + // set global defaults |
|
101 | + $this->_set_defaults(); |
|
102 | + // set properties that are always available with objects. |
|
103 | + $this->_set_init_properties(); |
|
104 | + // global styles/scripts across all wp admin pages |
|
105 | + add_action('admin_enqueue_scripts', [$this, 'load_wp_global_scripts_styles'], 5); |
|
106 | + // load initial stuff. |
|
107 | + $this->_set_file_and_folder_name(); |
|
108 | + } |
|
109 | + |
|
110 | + |
|
111 | + /** |
|
112 | + * _set_init_properties |
|
113 | + * Child classes use to set the following properties: |
|
114 | + * $label |
|
115 | + * |
|
116 | + * @abstract |
|
117 | + * @return void |
|
118 | + */ |
|
119 | + abstract protected function _set_init_properties(); |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @return AdminMenuItem|null |
|
124 | + * @since 4.4.0 |
|
125 | + * @deprecated $VID:$ |
|
126 | + */ |
|
127 | + public function get_menu_map() |
|
128 | + { |
|
129 | + return $this->adminMenu(); |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * _set_menu_map is a function that child classes use to set the menu_map property (which should be an instance of |
|
135 | + * EE_Admin_Page_Menu_Map. Their menu can either be EE_Admin_Page_Main_Menu or AdminMenuSubItem. |
|
136 | + * |
|
137 | + * @since 4.4.0 |
|
138 | + * @deprecated $VID:$ |
|
139 | + */ |
|
140 | + protected function _set_menu_map() |
|
141 | + { |
|
142 | + $this->_menu_map = null; |
|
143 | + } |
|
144 | + |
|
145 | + |
|
146 | + /** |
|
147 | + * @since $VID:$ |
|
148 | + */ |
|
149 | + public function setupLegacyAdminMenuItem() |
|
150 | + { |
|
151 | + // will be overridden by child classes not using new system |
|
152 | + $this->_set_menu_map(); |
|
153 | + } |
|
154 | + |
|
155 | + |
|
156 | + /** |
|
157 | + * Child classes should return an array of properties used to construct the AdminMenuItem |
|
158 | + * |
|
159 | + * @return array |
|
160 | + * @since $VID:$ |
|
161 | + */ |
|
162 | + public function getMenuProperties(): array |
|
163 | + { |
|
164 | + return []; |
|
165 | + } |
|
166 | + |
|
167 | + |
|
168 | + /** |
|
169 | + * @param AdminMenuItem $menu |
|
170 | + * @return void |
|
171 | + * @since $VID:$ |
|
172 | + */ |
|
173 | + public function setAdminMenu(AdminMenuItem $menu): void |
|
174 | + { |
|
175 | + $this->_menu_map = $menu; |
|
176 | + } |
|
177 | + |
|
178 | + |
|
179 | + /** |
|
180 | + * returns the menu map for this admin page |
|
181 | + * |
|
182 | + * @return AdminMenuItem|null |
|
183 | + * @since $VID:$ |
|
184 | + */ |
|
185 | + public function adminMenu(): ?AdminMenuItem |
|
186 | + { |
|
187 | + return $this->_menu_map; |
|
188 | + } |
|
189 | + |
|
190 | + |
|
191 | + /** |
|
192 | + * @param string $wp_page_slug |
|
193 | + * @since $VID:$ |
|
194 | + */ |
|
195 | + public function setWpPageSlug(string $wp_page_slug): void |
|
196 | + { |
|
197 | + $this->_wp_page_slug = $wp_page_slug; |
|
198 | + } |
|
199 | + |
|
200 | + |
|
201 | + /** |
|
202 | + * This loads scripts and styles for the EE_Admin system |
|
203 | + * that must be available on ALL WP admin pages (i.e. EE_menu items) |
|
204 | + * |
|
205 | + * @return void |
|
206 | + */ |
|
207 | + public function load_wp_global_scripts_styles() |
|
208 | + { |
|
209 | + wp_register_style( |
|
210 | + 'espresso_menu', |
|
211 | + EE_ADMIN_URL . 'assets/admin-menu-styles.css', |
|
212 | + ['dashicons'], |
|
213 | + EVENT_ESPRESSO_VERSION |
|
214 | + ); |
|
215 | + wp_enqueue_style('espresso_menu'); |
|
216 | + } |
|
217 | + |
|
218 | + |
|
219 | + /** |
|
220 | + * this sets default properties (might be overridden in _set_init_properties); |
|
221 | + * |
|
222 | + * @return void |
|
223 | + */ |
|
224 | + private function _set_defaults() |
|
225 | + { |
|
226 | + $this->_file_name = $this->_folder_name = $this->_wp_page_slug = $this->capability = null; |
|
227 | + $this->_routing = true; |
|
228 | + $this->_load_page = false; |
|
229 | + $this->_files_hooked = $this->_hook_paths = []; |
|
230 | + } |
|
231 | + |
|
232 | + |
|
233 | + public function setCapability($capability, $menu_slug) |
|
234 | + { |
|
235 | + $this->capability = apply_filters('FHEE_' . $menu_slug . '_capability', $capability); |
|
236 | + } |
|
237 | + |
|
238 | + |
|
239 | + /** |
|
240 | + * @deprecated $VID:$ |
|
241 | + */ |
|
242 | + protected function _set_capability() |
|
243 | + { |
|
244 | + if ($this->_menu_map instanceof AdminMenuItem) { |
|
245 | + $this->setCapability($this->_menu_map->capability(), $this->_menu_map->menuSlug()); |
|
246 | + } |
|
247 | + } |
|
248 | + |
|
249 | + |
|
250 | + /** |
|
251 | + * initialize_admin_page |
|
252 | + * This method is what executes the loading of the specific page class for the given dir_name as called by the |
|
253 | + * EE_Admin_Init class. |
|
254 | + * |
|
255 | + * @return void |
|
256 | + * @throws EE_Error |
|
257 | + * @throws ReflectionException |
|
258 | + */ |
|
259 | + public function initialize_admin_page() |
|
260 | + { |
|
261 | + // let's check user access first |
|
262 | + $this->_check_user_access(); |
|
263 | + if (! is_object($this->_loaded_page_object)) { |
|
264 | + return; |
|
265 | + } |
|
266 | + $this->_loaded_page_object->route_admin_request(); |
|
267 | + } |
|
268 | + |
|
269 | + |
|
270 | + /** |
|
271 | + * @param string $wp_page_slug |
|
272 | + * @throws EE_Error |
|
273 | + */ |
|
274 | + public function set_page_dependencies(string $wp_page_slug) |
|
275 | + { |
|
276 | + if (! $this->_load_page) { |
|
277 | + return; |
|
278 | + } |
|
279 | + if (! is_object($this->_loaded_page_object)) { |
|
280 | + $msg[] = esc_html__( |
|
281 | + 'We can\'t load the page because we\'re missing a valid page object that tells us what to load', |
|
282 | + 'event_espresso' |
|
283 | + ); |
|
284 | + $msg[] = $msg[0] . "\r\n" |
|
285 | + . sprintf( |
|
286 | + esc_html__( |
|
287 | + 'The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory', |
|
288 | + 'event_espresso' |
|
289 | + ), |
|
290 | + $this->_file_name, |
|
291 | + $this->_file_name, |
|
292 | + $this->_folder_path . $this->_file_name, |
|
293 | + $this->_menu_map->menuSlug() |
|
294 | + ); |
|
295 | + throw new EE_Error(implode('||', $msg)); |
|
296 | + } |
|
297 | + $this->_loaded_page_object->set_wp_page_slug($wp_page_slug); |
|
298 | + $page_hook = "load-$wp_page_slug"; |
|
299 | + // hook into page load hook so all page specific stuff gets loaded. |
|
300 | + if (! empty($wp_page_slug)) { |
|
301 | + add_action($page_hook, [$this->_loaded_page_object, 'load_page_dependencies']); |
|
302 | + } |
|
303 | + } |
|
304 | + |
|
305 | + |
|
306 | + /** |
|
307 | + * This executes the initial page loads for EE_Admin pages to take care of any ajax or other code needing to run |
|
308 | + * before the load-page... hook. Note, the page loads are happening around the wp_init hook. |
|
309 | + * |
|
310 | + * @return void |
|
311 | + * @throws InvalidArgumentException |
|
312 | + * @throws InvalidDataTypeException |
|
313 | + * @throws InvalidInterfaceException |
|
314 | + * @throws EE_Error |
|
315 | + * @throws ReflectionException |
|
316 | + */ |
|
317 | + public function do_initial_loads() |
|
318 | + { |
|
319 | + // no loading or initializing if menu map is setup incorrectly. |
|
320 | + if (! $this->_menu_map instanceof AdminMenuItem) { |
|
321 | + return; |
|
322 | + } |
|
323 | + $this->_initialize_admin_page(); |
|
324 | + } |
|
325 | + |
|
326 | + |
|
327 | + /** |
|
328 | + * all we're doing here is setting the $_file_name property for later use. |
|
329 | + * |
|
330 | + * @return void |
|
331 | + */ |
|
332 | + private function _set_file_and_folder_name() |
|
333 | + { |
|
334 | + $bt = debug_backtrace(); |
|
335 | + // for more reliable determination of folder name |
|
336 | + // we're using this to get the actual folder name of the CALLING class (i.e. the child class that extends this). Why? Because $this->menu_slug may be different than the folder name (to avoid conflicts with other plugins) |
|
337 | + $class = get_class($this); |
|
338 | + foreach ($bt as $index => $values) { |
|
339 | + if (isset($values['class']) && $values['class'] == $class) { |
|
340 | + $file_index = $index - 1; |
|
341 | + $this->_folder_name = basename(dirname($bt[ $file_index ]['file'])); |
|
342 | + if (! empty($this->_folder_name)) { |
|
343 | + break; |
|
344 | + } |
|
345 | + } |
|
346 | + } |
|
347 | + $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/'; |
|
348 | + $this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name); |
|
349 | + $this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name)); |
|
350 | + $this->_file_name = str_replace(' ', '_', $this->_file_name); |
|
351 | + } |
|
352 | + |
|
353 | + |
|
354 | + /** |
|
355 | + * This automatically checks if we have a hook class in the loaded child directory. If we DO then we will register |
|
356 | + * it with the appropriate pages. That way all we have to do is make sure the file is named correctly and |
|
357 | + * "dropped" in. Example: if we wanted to set this up for Messages hooking into Events then we would do: |
|
358 | + * events_Messages_Hooks.class.php |
|
359 | + * |
|
360 | + * @param bool $extend This indicates whether we're checking the extend directory for any register_hooks |
|
361 | + * files/classes |
|
362 | + * @return array |
|
363 | + */ |
|
364 | + public function register_hooks(bool $extend = false): array |
|
365 | + { |
|
366 | + // get a list of files in the directory that have the "Hook" in their name an |
|
367 | + // if this is an extended check (i.e. caf is active) then we will scan the caffeinated/extend directory first and any hook files that are found will be have their reference added to the $_files_hook array property. Then, we make sure that when we loop through the core decaf directories to find hook files that we skip over any hooks files that have already been set by caf. |
|
368 | + if ($extend) { |
|
369 | + $hook_files_glob_path = apply_filters( |
|
370 | + 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', |
|
371 | + EE_CORE_CAF_ADMIN_EXTEND |
|
372 | + . $this->_folder_name |
|
373 | + . '/*' |
|
374 | + . $this->_file_name |
|
375 | + . '_Hooks_Extend.class.php' |
|
376 | + ); |
|
377 | + $this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend); |
|
378 | + } |
|
379 | + // loop through decaf folders |
|
380 | + $hook_files_glob_path = apply_filters( |
|
381 | + 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', |
|
382 | + $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php' |
|
383 | + ); |
|
384 | + $this->_hook_paths = array_merge( |
|
385 | + $this->_register_hook_files($hook_files_glob_path), |
|
386 | + $this->_hook_paths |
|
387 | + ); // making sure any extended hook paths are later in the array than the core hook paths! |
|
388 | + return $this->_hook_paths; |
|
389 | + } |
|
390 | + |
|
391 | + |
|
392 | + protected function _register_hook_files($hook_files_glob_path, $extend = false): array |
|
393 | + { |
|
394 | + $hook_paths = glob($hook_files_glob_path); |
|
395 | + if (empty($hook_paths)) { |
|
396 | + return []; |
|
397 | + } |
|
398 | + foreach ($hook_paths as $file) { |
|
399 | + // lets get the linked admin. |
|
400 | + $hook_file = $extend |
|
401 | + ? str_replace(EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . '/', '', $file) |
|
402 | + : str_replace($this->_folder_path, '', $file); |
|
403 | + $replace = $extend |
|
404 | + ? '_' . $this->_file_name . '_Hooks_Extend.class.php' |
|
405 | + : '_' . $this->_file_name . '_Hooks.class.php'; |
|
406 | + $rel_admin = str_replace($replace, '', $hook_file); |
|
407 | + $rel_admin = strtolower($rel_admin); |
|
408 | + // make sure we haven't already got a hook setup for this page path |
|
409 | + if (in_array($rel_admin, $this->_files_hooked)) { |
|
410 | + continue; |
|
411 | + } |
|
412 | + require_once $file; |
|
413 | + $this->hook_file = $hook_file; |
|
414 | + $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin; |
|
415 | + add_filter($rel_admin_hook, [$this, 'load_admin_hook']); |
|
416 | + $this->_files_hooked[] = $rel_admin; |
|
417 | + } |
|
418 | + return $hook_paths; |
|
419 | + } |
|
420 | + |
|
421 | + |
|
422 | + public function load_admin_hook($registered_pages) |
|
423 | + { |
|
424 | + return array_merge((array) $this->hook_file, $registered_pages); |
|
425 | + } |
|
426 | + |
|
427 | + |
|
428 | + /** |
|
429 | + * _initialize_admin_page |
|
430 | + * |
|
431 | + * @throws EE_Error |
|
432 | + * @throws ReflectionException |
|
433 | + * @see initialize_admin_page() for info |
|
434 | + */ |
|
435 | + protected function _initialize_admin_page() |
|
436 | + { |
|
437 | + // JUST CHECK WE'RE ON RIGHT PAGE. |
|
438 | + $page = $this->request->getRequestParam('page'); |
|
439 | + $page = $this->request->getRequestParam('current_page', $page); |
|
440 | + $menu_slug = $this->_menu_map->menuSlug(); |
|
441 | + |
|
442 | + |
|
443 | + if ($this->_routing && ($page === '' || $page !== $menu_slug)) { |
|
444 | + // not on the right page so let's get out. |
|
445 | + return; |
|
446 | + } |
|
447 | + $this->_load_page = true; |
|
448 | + |
|
449 | + // we don't need to do a page_request check here because it's only called via WP menu system. |
|
450 | + $admin_page = $this->_file_name . '_Admin_Page'; |
|
451 | + $hook_suffix = "{$menu_slug}_$admin_page"; |
|
452 | + $admin_page = apply_filters( |
|
453 | + "FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__$hook_suffix", |
|
454 | + $admin_page |
|
455 | + ); |
|
456 | + if (empty($admin_page)) { |
|
457 | + return; |
|
458 | + } |
|
459 | + // define requested admin page class name then load the file and instantiate |
|
460 | + $path_to_file = str_replace(['\\', '/'], '/', $this->_folder_path . $admin_page . '.core.php'); |
|
461 | + // so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be: |
|
462 | + // FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page |
|
463 | + $path_to_file = apply_filters( |
|
464 | + "FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__$hook_suffix", |
|
465 | + $path_to_file |
|
466 | + ); |
|
467 | + if (! is_readable($path_to_file)) { |
|
468 | + return; |
|
469 | + } |
|
470 | + // This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place |
|
471 | + do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization'); |
|
472 | + do_action("AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_$menu_slug"); |
|
473 | + require_once($path_to_file); |
|
474 | + $this->_loaded_page_object = $this->loader->getShared($admin_page, [$this->_routing]); |
|
475 | + $this->_loaded_page_object->initializePage(); |
|
476 | + |
|
477 | + do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization'); |
|
478 | + do_action("AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_$menu_slug"); |
|
479 | + } |
|
480 | + |
|
481 | + |
|
482 | + public function get_admin_page_name(): string |
|
483 | + { |
|
484 | + return $this->_file_name . '_Admin_Page'; |
|
485 | + } |
|
486 | + |
|
487 | + |
|
488 | + /** |
|
489 | + * @return EE_Admin_Page |
|
490 | + */ |
|
491 | + public function loaded_page_object(): EE_Admin_Page |
|
492 | + { |
|
493 | + return $this->_loaded_page_object; |
|
494 | + } |
|
495 | + |
|
496 | + |
|
497 | + /** |
|
498 | + * _check_user_access |
|
499 | + * verifies user access for this admin page. If no user access is available then let's gracefully exit with a |
|
500 | + * WordPress die message. |
|
501 | + * |
|
502 | + * @return void wp_die if fail |
|
503 | + */ |
|
504 | + private function _check_user_access() |
|
505 | + { |
|
506 | + if (! $this->_menu_map->currentUserHasAccess()) { |
|
507 | + wp_die( |
|
508 | + esc_html__('You don\'t have access to this page.', 'event_espresso'), |
|
509 | + '', |
|
510 | + ['back_link' => true] |
|
511 | + ); |
|
512 | + } |
|
513 | + } |
|
514 | 514 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | { |
209 | 209 | wp_register_style( |
210 | 210 | 'espresso_menu', |
211 | - EE_ADMIN_URL . 'assets/admin-menu-styles.css', |
|
211 | + EE_ADMIN_URL.'assets/admin-menu-styles.css', |
|
212 | 212 | ['dashicons'], |
213 | 213 | EVENT_ESPRESSO_VERSION |
214 | 214 | ); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | public function setCapability($capability, $menu_slug) |
234 | 234 | { |
235 | - $this->capability = apply_filters('FHEE_' . $menu_slug . '_capability', $capability); |
|
235 | + $this->capability = apply_filters('FHEE_'.$menu_slug.'_capability', $capability); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | { |
261 | 261 | // let's check user access first |
262 | 262 | $this->_check_user_access(); |
263 | - if (! is_object($this->_loaded_page_object)) { |
|
263 | + if ( ! is_object($this->_loaded_page_object)) { |
|
264 | 264 | return; |
265 | 265 | } |
266 | 266 | $this->_loaded_page_object->route_admin_request(); |
@@ -273,15 +273,15 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function set_page_dependencies(string $wp_page_slug) |
275 | 275 | { |
276 | - if (! $this->_load_page) { |
|
276 | + if ( ! $this->_load_page) { |
|
277 | 277 | return; |
278 | 278 | } |
279 | - if (! is_object($this->_loaded_page_object)) { |
|
279 | + if ( ! is_object($this->_loaded_page_object)) { |
|
280 | 280 | $msg[] = esc_html__( |
281 | 281 | 'We can\'t load the page because we\'re missing a valid page object that tells us what to load', |
282 | 282 | 'event_espresso' |
283 | 283 | ); |
284 | - $msg[] = $msg[0] . "\r\n" |
|
284 | + $msg[] = $msg[0]."\r\n" |
|
285 | 285 | . sprintf( |
286 | 286 | esc_html__( |
287 | 287 | 'The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory', |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | ), |
290 | 290 | $this->_file_name, |
291 | 291 | $this->_file_name, |
292 | - $this->_folder_path . $this->_file_name, |
|
292 | + $this->_folder_path.$this->_file_name, |
|
293 | 293 | $this->_menu_map->menuSlug() |
294 | 294 | ); |
295 | 295 | throw new EE_Error(implode('||', $msg)); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $this->_loaded_page_object->set_wp_page_slug($wp_page_slug); |
298 | 298 | $page_hook = "load-$wp_page_slug"; |
299 | 299 | // hook into page load hook so all page specific stuff gets loaded. |
300 | - if (! empty($wp_page_slug)) { |
|
300 | + if ( ! empty($wp_page_slug)) { |
|
301 | 301 | add_action($page_hook, [$this->_loaded_page_object, 'load_page_dependencies']); |
302 | 302 | } |
303 | 303 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | public function do_initial_loads() |
318 | 318 | { |
319 | 319 | // no loading or initializing if menu map is setup incorrectly. |
320 | - if (! $this->_menu_map instanceof AdminMenuItem) { |
|
320 | + if ( ! $this->_menu_map instanceof AdminMenuItem) { |
|
321 | 321 | return; |
322 | 322 | } |
323 | 323 | $this->_initialize_admin_page(); |
@@ -338,13 +338,13 @@ discard block |
||
338 | 338 | foreach ($bt as $index => $values) { |
339 | 339 | if (isset($values['class']) && $values['class'] == $class) { |
340 | 340 | $file_index = $index - 1; |
341 | - $this->_folder_name = basename(dirname($bt[ $file_index ]['file'])); |
|
342 | - if (! empty($this->_folder_name)) { |
|
341 | + $this->_folder_name = basename(dirname($bt[$file_index]['file'])); |
|
342 | + if ( ! empty($this->_folder_name)) { |
|
343 | 343 | break; |
344 | 344 | } |
345 | 345 | } |
346 | 346 | } |
347 | - $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/'; |
|
347 | + $this->_folder_path = EE_ADMIN_PAGES.$this->_folder_name.'/'; |
|
348 | 348 | $this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name); |
349 | 349 | $this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name)); |
350 | 350 | $this->_file_name = str_replace(' ', '_', $this->_file_name); |
@@ -374,17 +374,17 @@ discard block |
||
374 | 374 | . $this->_file_name |
375 | 375 | . '_Hooks_Extend.class.php' |
376 | 376 | ); |
377 | - $this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend); |
|
377 | + $this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend); |
|
378 | 378 | } |
379 | 379 | // loop through decaf folders |
380 | 380 | $hook_files_glob_path = apply_filters( |
381 | 381 | 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', |
382 | - $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php' |
|
382 | + $this->_folder_path.'*'.$this->_file_name.'_Hooks.class.php' |
|
383 | 383 | ); |
384 | - $this->_hook_paths = array_merge( |
|
384 | + $this->_hook_paths = array_merge( |
|
385 | 385 | $this->_register_hook_files($hook_files_glob_path), |
386 | 386 | $this->_hook_paths |
387 | - ); // making sure any extended hook paths are later in the array than the core hook paths! |
|
387 | + ); // making sure any extended hook paths are later in the array than the core hook paths! |
|
388 | 388 | return $this->_hook_paths; |
389 | 389 | } |
390 | 390 | |
@@ -398,11 +398,11 @@ discard block |
||
398 | 398 | foreach ($hook_paths as $file) { |
399 | 399 | // lets get the linked admin. |
400 | 400 | $hook_file = $extend |
401 | - ? str_replace(EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . '/', '', $file) |
|
401 | + ? str_replace(EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.'/', '', $file) |
|
402 | 402 | : str_replace($this->_folder_path, '', $file); |
403 | 403 | $replace = $extend |
404 | - ? '_' . $this->_file_name . '_Hooks_Extend.class.php' |
|
405 | - : '_' . $this->_file_name . '_Hooks.class.php'; |
|
404 | + ? '_'.$this->_file_name.'_Hooks_Extend.class.php' |
|
405 | + : '_'.$this->_file_name.'_Hooks.class.php'; |
|
406 | 406 | $rel_admin = str_replace($replace, '', $hook_file); |
407 | 407 | $rel_admin = strtolower($rel_admin); |
408 | 408 | // make sure we haven't already got a hook setup for this page path |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | } |
412 | 412 | require_once $file; |
413 | 413 | $this->hook_file = $hook_file; |
414 | - $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin; |
|
414 | + $rel_admin_hook = 'FHEE_do_other_page_hooks_'.$rel_admin; |
|
415 | 415 | add_filter($rel_admin_hook, [$this, 'load_admin_hook']); |
416 | 416 | $this->_files_hooked[] = $rel_admin; |
417 | 417 | } |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | $this->_load_page = true; |
448 | 448 | |
449 | 449 | // we don't need to do a page_request check here because it's only called via WP menu system. |
450 | - $admin_page = $this->_file_name . '_Admin_Page'; |
|
450 | + $admin_page = $this->_file_name.'_Admin_Page'; |
|
451 | 451 | $hook_suffix = "{$menu_slug}_$admin_page"; |
452 | 452 | $admin_page = apply_filters( |
453 | 453 | "FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__$hook_suffix", |
@@ -457,14 +457,14 @@ discard block |
||
457 | 457 | return; |
458 | 458 | } |
459 | 459 | // define requested admin page class name then load the file and instantiate |
460 | - $path_to_file = str_replace(['\\', '/'], '/', $this->_folder_path . $admin_page . '.core.php'); |
|
460 | + $path_to_file = str_replace(['\\', '/'], '/', $this->_folder_path.$admin_page.'.core.php'); |
|
461 | 461 | // so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be: |
462 | 462 | // FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page |
463 | 463 | $path_to_file = apply_filters( |
464 | 464 | "FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__$hook_suffix", |
465 | 465 | $path_to_file |
466 | 466 | ); |
467 | - if (! is_readable($path_to_file)) { |
|
467 | + if ( ! is_readable($path_to_file)) { |
|
468 | 468 | return; |
469 | 469 | } |
470 | 470 | // This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | |
482 | 482 | public function get_admin_page_name(): string |
483 | 483 | { |
484 | - return $this->_file_name . '_Admin_Page'; |
|
484 | + return $this->_file_name.'_Admin_Page'; |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | */ |
504 | 504 | private function _check_user_access() |
505 | 505 | { |
506 | - if (! $this->_menu_map->currentUserHasAccess()) { |
|
506 | + if ( ! $this->_menu_map->currentUserHasAccess()) { |
|
507 | 507 | wp_die( |
508 | 508 | esc_html__('You don\'t have access to this page.', 'event_espresso'), |
509 | 509 | '', |
@@ -12,12 +12,12 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_Admin_Page_Sub_Menu extends AdminMenuSubItem |
14 | 14 | { |
15 | - /** |
|
16 | - * @return string |
|
17 | - * @deprecated $VID:$ |
|
18 | - */ |
|
19 | - protected function _add_menu_page() |
|
20 | - { |
|
21 | - return $this->registerMenuItem(); |
|
22 | - } |
|
15 | + /** |
|
16 | + * @return string |
|
17 | + * @deprecated $VID:$ |
|
18 | + */ |
|
19 | + protected function _add_menu_page() |
|
20 | + { |
|
21 | + return $this->registerMenuItem(); |
|
22 | + } |
|
23 | 23 | } |
@@ -16,436 +16,436 @@ |
||
16 | 16 | */ |
17 | 17 | class EE_Admin_Page_Loader |
18 | 18 | { |
19 | - /** |
|
20 | - * @var AdminMenuManager $menu_manager |
|
21 | - */ |
|
22 | - protected $menu_manager; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var LoaderInterface $loader |
|
26 | - */ |
|
27 | - protected $loader; |
|
28 | - |
|
29 | - /** |
|
30 | - * _installed_pages |
|
31 | - * objects for page_init objects detected and loaded |
|
32 | - * |
|
33 | - * @access private |
|
34 | - * @var EE_Admin_Page_Init[] |
|
35 | - */ |
|
36 | - private $_installed_pages = []; |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * this is used to hold the registry of menu slugs for all the installed admin pages |
|
41 | - * |
|
42 | - * @var array |
|
43 | - */ |
|
44 | - private $_menu_slugs = []; |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * _caffeinated_extends |
|
49 | - * This array is the generated configuration array for which core EE_Admin pages are extended (and the bits and |
|
50 | - * pieces needed to do so). This property is defined in the _set_caffeinated method. |
|
51 | - * |
|
52 | - * @var array |
|
53 | - */ |
|
54 | - private $_caffeinated_extends = []; |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * This property will hold the hook file for setting up the filter that does all the connections between admin |
|
59 | - * pages. |
|
60 | - * |
|
61 | - * @var string |
|
62 | - */ |
|
63 | - public $hook_file; |
|
64 | - |
|
65 | - /** |
|
66 | - * @var int |
|
67 | - * @since $VID:$ |
|
68 | - */ |
|
69 | - private $maintenance_mode = 0; |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * @throws InvalidArgumentException |
|
74 | - * @throws InvalidDataTypeException |
|
75 | - * @throws InvalidInterfaceException |
|
76 | - */ |
|
77 | - public function __construct(?LoaderInterface $loader) |
|
78 | - { |
|
79 | - $this->loader = $loader instanceof LoaderInterface ? $loader : LoaderFactory::getLoader(); |
|
80 | - $this->menu_manager = $this->loader->getShared(AdminMenuManager::class, [$this->loader]); |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * @throws EE_Error |
|
86 | - * @throws ReflectionException |
|
87 | - * @since $VID:$ |
|
88 | - */ |
|
89 | - public function init() |
|
90 | - { |
|
91 | - $this->menu_manager->initialize(); |
|
92 | - $this->maintenance_mode = EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance; |
|
93 | - // let's do a scan and see what installed pages we have |
|
94 | - $this->findAndLoadAdminPages(); |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - /** |
|
99 | - * When caffeinated system is detected, this method is called to setup the caffeinated directory constants used by |
|
100 | - * files in the caffeinated folder. |
|
101 | - * |
|
102 | - * @access private |
|
103 | - * @return void |
|
104 | - */ |
|
105 | - private function defineCaffeinatedConstants() |
|
106 | - { |
|
107 | - if (! defined('EE_CORE_CAF_ADMIN')) { |
|
108 | - define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH . 'caffeinated/admin/'); |
|
109 | - define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL . 'caffeinated/admin/'); |
|
110 | - define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN . 'new/'); |
|
111 | - define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN . 'extend/'); |
|
112 | - define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL . 'extend/'); |
|
113 | - define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN . 'hooks/'); |
|
114 | - } |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - /** |
|
119 | - * This just gets the list of installed EE_Admin_pages. |
|
120 | - * |
|
121 | - * @access private |
|
122 | - * @return void |
|
123 | - * @throws EE_Error |
|
124 | - * @throws InvalidArgumentException |
|
125 | - * @throws InvalidDataTypeException |
|
126 | - * @throws InvalidInterfaceException |
|
127 | - * @throws ReflectionException |
|
128 | - */ |
|
129 | - private function findAndLoadAdminPages() |
|
130 | - { |
|
131 | - $admin_pages = $this->findAdminPages(); |
|
132 | - // this just checks the caffeinated folder and takes care of setting up any caffeinated stuff. |
|
133 | - $admin_pages = $this->findCaffeinatedAdminPages($admin_pages); |
|
134 | - // then extensions and hooks, although they don't get added to the admin pages array |
|
135 | - $this->findAdminPageExtensions(); |
|
136 | - $this->findAdminPageHooks(); |
|
137 | - // allow plugins to add in their own pages (note at this point they will need to have an autoloader defined for their class) OR hook into EEH_Autoloader::load_admin_page() to add their path.; |
|
138 | - // loop through admin pages and setup the $_installed_pages array. |
|
139 | - $hooks_ref = []; |
|
140 | - $menu_pages = []; |
|
141 | - foreach ($admin_pages as $page => $path) { |
|
142 | - // don't load the page init class IF IT's ALREADY LOADED !!! |
|
143 | - if ( |
|
144 | - isset($this->_installed_pages[ $page ]) |
|
145 | - && $this->_installed_pages[ $page ] instanceof EE_Admin_Page_Init |
|
146 | - ) { |
|
147 | - continue; |
|
148 | - } |
|
149 | - // build list of installed pages |
|
150 | - $admin_page_init = $this->loadAdminPageInit($page); |
|
151 | - $this->_installed_pages[ $page ] = $admin_page_init; |
|
152 | - $admin_menu = $this->menu_manager->getAdminMenu($admin_page_init); |
|
153 | - $admin_page_init->setCapability($admin_menu->capability(), $admin_menu->menuSlug()); |
|
154 | - // skip if in full maintenance mode and maintenance_mode_parent is NOT set |
|
155 | - if ($this->maintenance_mode && ! $admin_menu->maintenanceModeParent()) { |
|
156 | - unset($admin_pages[ $page ]); |
|
157 | - continue; |
|
158 | - } |
|
159 | - $menu_slug = $admin_menu->menuSlug(); |
|
160 | - $this->_menu_slugs[ $menu_slug ] = $page; |
|
161 | - $menu_pages[ $menu_slug ] = $admin_page_init; |
|
162 | - // now that we've got the admin_init objects... |
|
163 | - // lets see if there are any caffeinated pages extending the originals. |
|
164 | - // If there are then let's hook into the init admin filter and load our extend instead. |
|
165 | - // Set flag for register hooks on extended pages b/c extended pages use the default INIT. |
|
166 | - $extended_hooks = $admin_page_init->register_hooks( |
|
167 | - $this->loadCaffeinatedExtensions($admin_page_init, $page, $menu_slug) |
|
168 | - ); |
|
169 | - $hooks_ref += $extended_hooks; |
|
170 | - } |
|
171 | - // the hooks_ref is all the pages where we have $extended _Hooks files |
|
172 | - // that will extend a class in a different folder. |
|
173 | - // So we want to make sure we load the file for the parent. |
|
174 | - // first make sure we've got unique values |
|
175 | - $hooks_ref = array_unique($hooks_ref); |
|
176 | - // now let's loop and require! |
|
177 | - foreach ($hooks_ref as $path) { |
|
178 | - require_once($path); |
|
179 | - } |
|
180 | - // make sure we have menu slugs global setup. Used in EE_Admin_Page->page_setup() to ensure we don't do a full class load for an admin page that isn't requested. |
|
181 | - global $ee_menu_slugs; |
|
182 | - $ee_menu_slugs = $this->_menu_slugs; |
|
183 | - // we need to loop again to run any early code |
|
184 | - foreach ($this->_installed_pages as $page) { |
|
185 | - $page->do_initial_loads(); |
|
186 | - } |
|
187 | - $this->menu_manager->setInstalledPages($menu_pages); |
|
188 | - do_action('AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages); |
|
189 | - } |
|
190 | - |
|
191 | - |
|
192 | - /** |
|
193 | - * @return array |
|
194 | - * @throws EE_Error |
|
195 | - * @since $VID:$ |
|
196 | - */ |
|
197 | - private function findAdminPages(): array |
|
198 | - { |
|
199 | - |
|
200 | - // grab everything in the admin core directory |
|
201 | - $admin_page_folders = $this->findAdminPageFolders(EE_ADMIN_PAGES . '*'); |
|
202 | - $admin_page_folders = apply_filters( |
|
203 | - 'FHEE__EE_Admin_Page_Loader__findAdminPages__admin_page_folders', |
|
204 | - $admin_page_folders |
|
205 | - ); |
|
206 | - if (! empty($admin_page_folders)) { |
|
207 | - return $admin_page_folders; |
|
208 | - } |
|
209 | - $error_msg = esc_html__( |
|
210 | - 'There are no EE_Admin pages detected, it looks like EE did not install properly', |
|
211 | - 'event_espresso' |
|
212 | - ); |
|
213 | - $error_msg .= '||'; |
|
214 | - $error_msg .= sprintf( |
|
215 | - esc_html__( |
|
216 | - 'Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', |
|
217 | - 'event_espresso' |
|
218 | - ), |
|
219 | - EE_ADMIN_PAGES |
|
220 | - ); |
|
221 | - throw new RuntimeException($error_msg); |
|
222 | - } |
|
223 | - |
|
224 | - |
|
225 | - /** |
|
226 | - * get_admin_page_object |
|
227 | - * |
|
228 | - * @param string $page_slug |
|
229 | - * @return EE_Admin_Page |
|
230 | - */ |
|
231 | - public function get_admin_page_object(string $page_slug = ''): ?EE_Admin_Page |
|
232 | - { |
|
233 | - return isset($this->_installed_pages[ $page_slug ]) |
|
234 | - ? $this->_installed_pages[ $page_slug ]->loaded_page_object() |
|
235 | - : null; |
|
236 | - } |
|
237 | - |
|
238 | - |
|
239 | - /** |
|
240 | - * generates an "Admin Page Init" class based on the directory name |
|
241 | - * |
|
242 | - * @param string $dir_name |
|
243 | - * @return string |
|
244 | - */ |
|
245 | - private function getClassnameForAdminPageInit(string $dir_name = ''): string |
|
246 | - { |
|
247 | - $class_name = str_replace('_', ' ', strtolower($dir_name)); |
|
248 | - return str_replace(' ', '_', ucwords($class_name)) . '_Admin_Page_Init'; |
|
249 | - } |
|
250 | - |
|
251 | - |
|
252 | - /** |
|
253 | - * _load_admin_page |
|
254 | - * Loads and instantiates page_init object for a single EE_admin page. |
|
255 | - * |
|
256 | - * @param string $page page_reference |
|
257 | - * @return EE_Admin_Page_Init |
|
258 | - * @throws EE_Error |
|
259 | - */ |
|
260 | - private function loadAdminPageInit(string $page = ''): EE_Admin_Page_Init |
|
261 | - { |
|
262 | - $class_name = $this->getClassnameForAdminPageInit($page); |
|
263 | - if (class_exists($class_name)) { |
|
264 | - $admin_page_init = $this->loader->getShared($class_name); |
|
265 | - // verify returned object |
|
266 | - if ($admin_page_init instanceof EE_Admin_Page_Init) { |
|
267 | - return $admin_page_init; |
|
268 | - } |
|
269 | - } |
|
270 | - $error_msg = sprintf( |
|
271 | - esc_html__('Something went wrong with loading the %s admin page.', 'event_espresso'), |
|
272 | - $page |
|
273 | - ); |
|
274 | - $error_msg .= '||'; // separates public from developer messages |
|
275 | - $error_msg .= "\r\n"; |
|
276 | - $error_msg .= sprintf( |
|
277 | - esc_html__('There is no Init class in place for the %s admin page.', 'event_espresso'), |
|
278 | - $page |
|
279 | - ); |
|
280 | - $error_msg .= '<br />'; |
|
281 | - $error_msg .= sprintf( |
|
282 | - esc_html__( |
|
283 | - 'Make sure you have %1$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', |
|
284 | - 'event_espresso' |
|
285 | - ), |
|
286 | - '<strong>' . $class_name . '</strong>' |
|
287 | - ); |
|
288 | - throw new EE_Error($error_msg); |
|
289 | - } |
|
290 | - |
|
291 | - |
|
292 | - /** |
|
293 | - * This method is the "workhorse" for detecting and setting up caffeinated functionality. |
|
294 | - * In this method there are three checks being done: |
|
295 | - * 1. Do we have any NEW admin page sets. If we do, lets add them into the menu setup (via the $admin_pages |
|
296 | - * array) etc. (new page sets are found in caffeinated/new/{page}) |
|
297 | - * 2. Do we have any EXTENDED page sets. Basically an extended EE_Admin Page extends the core {child}_Admin_Page |
|
298 | - * class. eg. would be caffeinated/extend/events/Extend_Events_Admin_Page.core.php and in there would be a class: |
|
299 | - * Extend_Events_Admin_Page extends Events_Admin_Page. |
|
300 | - * 3. Do we have any files just for setting up hooks into other core pages. The files can be any name in |
|
301 | - * "caffeinated/hooks" EXCEPT they need a ".class.php" extension and the file name must correspond with the |
|
302 | - * classname inside. These classes are instantiated really early so that any hooks in them are run before the |
|
303 | - * corresponding apply_filters/do_actions that are found in any future loaded EE_Admin pages (INCLUDING caffeinated |
|
304 | - * admin_pages) |
|
305 | - * |
|
306 | - * @param array $admin_pages the original installed_refs array that may contain our NEW EE_Admin_Pages to be |
|
307 | - * loaded. |
|
308 | - * @return array |
|
309 | - * @throws EE_Error |
|
310 | - */ |
|
311 | - private function findCaffeinatedAdminPages(array $admin_pages): array |
|
312 | - { |
|
313 | - // first let's check if there IS a caffeinated folder. If there is not then lets get out. |
|
314 | - if ((defined('EE_DECAF') && EE_DECAF) || ! is_dir(EE_PLUGIN_DIR_PATH . 'caffeinated/admin')) { |
|
315 | - return $admin_pages; |
|
316 | - } |
|
317 | - $this->defineCaffeinatedConstants(); |
|
318 | - // okay let's setup an "New" pages first (we'll return installed refs later) |
|
319 | - $admin_pages += $this->findAdminPageFolders(EE_CORE_CAF_ADMIN . 'new/*', ['tickets']); |
|
320 | - |
|
321 | - return apply_filters( |
|
322 | - 'FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', |
|
323 | - $admin_pages |
|
324 | - ); |
|
325 | - } |
|
326 | - |
|
327 | - |
|
328 | - /** |
|
329 | - * @throws EE_Error |
|
330 | - * @since $VID:$ |
|
331 | - */ |
|
332 | - private function findAdminPageExtensions() |
|
333 | - { |
|
334 | - // let's see if there are any EXTENDS to setup in the $_caffeinated_extends array |
|
335 | - // (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page) |
|
336 | - $extensions = $this->findAdminPageFolders(EE_CORE_CAF_ADMIN . 'extend/*'); |
|
337 | - if ($extensions) { |
|
338 | - foreach ($extensions as $folder => $extension) { |
|
339 | - // convert lowercase_snake_case to Uppercase_Snake_Case |
|
340 | - $filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $folder))); |
|
341 | - $filename = "Extend_{$filename}_Admin_Page"; |
|
342 | - $filepath = EE_CORE_CAF_ADMIN . "extend/$folder/$filename.core.php"; |
|
343 | - // save filename and filepath for later |
|
344 | - $this->_caffeinated_extends[ $folder ]['path'] = str_replace(['\\', '/'], '/', $filepath); |
|
345 | - $this->_caffeinated_extends[ $folder ]['admin_page'] = $filename; |
|
346 | - } |
|
347 | - } |
|
348 | - $this->_caffeinated_extends = apply_filters( |
|
349 | - 'FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', |
|
350 | - $this->_caffeinated_extends |
|
351 | - ); |
|
352 | - } |
|
353 | - |
|
354 | - |
|
355 | - private function loadCaffeinatedExtensions( |
|
356 | - EE_Admin_Page_Init $admin_page_init, |
|
357 | - string $page, |
|
358 | - string $menu_slug |
|
359 | - ): bool { |
|
360 | - if (! isset($this->_caffeinated_extends[ $page ])) { |
|
361 | - return false; |
|
362 | - } |
|
363 | - $admin_page_name = $admin_page_init->get_admin_page_name(); |
|
364 | - $caf_path = $this->_caffeinated_extends[ $page ]['path']; |
|
365 | - $caf_admin_page = $this->_caffeinated_extends[ $page ]['admin_page']; |
|
366 | - add_filter( |
|
367 | - "FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$menu_slug}_$admin_page_name", |
|
368 | - static function ($path_to_file) use ($caf_path) { |
|
369 | - return $caf_path; |
|
370 | - } |
|
371 | - ); |
|
372 | - add_filter( |
|
373 | - "FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$menu_slug}_$admin_page_name", |
|
374 | - static function ($admin_page) use ($caf_admin_page) { |
|
375 | - return $caf_admin_page; |
|
376 | - } |
|
377 | - ); |
|
378 | - return true; |
|
379 | - } |
|
380 | - |
|
381 | - |
|
382 | - /** |
|
383 | - * @throws EE_Error |
|
384 | - * @since $VID:$ |
|
385 | - */ |
|
386 | - private function findAdminPageHooks() |
|
387 | - { |
|
388 | - // let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!). |
|
389 | - $ee_admin_hooks = []; |
|
390 | - $admin_page_hooks = $this->findAdminPageFolders(EE_CORE_CAF_ADMIN . 'hooks/*.class.php', [], 0, false); |
|
391 | - if ($admin_page_hooks) { |
|
392 | - foreach ($admin_page_hooks as $hook) { |
|
393 | - if (is_readable($hook)) { |
|
394 | - require_once $hook; |
|
395 | - $classname = str_replace([EE_CORE_CAF_ADMIN . 'hooks/', '.class.php'], '', $hook); |
|
396 | - if (class_exists($classname)) { |
|
397 | - $ee_admin_hooks[] = $this->loader->getShared($classname); |
|
398 | - } |
|
399 | - } |
|
400 | - } |
|
401 | - } |
|
402 | - apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks); |
|
403 | - } |
|
404 | - |
|
405 | - |
|
406 | - /** |
|
407 | - * _default_header_link |
|
408 | - * This is just a dummy method to use with header submenu items |
|
409 | - * |
|
410 | - * @return bool false |
|
411 | - */ |
|
412 | - public function _default_header_link(): bool |
|
413 | - { |
|
414 | - return false; |
|
415 | - } |
|
416 | - |
|
417 | - |
|
418 | - /** |
|
419 | - * @param string $path |
|
420 | - * @param int $flags |
|
421 | - * @param array $exclude |
|
422 | - * @param bool $register_autoloaders |
|
423 | - * @return array |
|
424 | - * @throws EE_Error |
|
425 | - * @since $VID:$ |
|
426 | - */ |
|
427 | - private function findAdminPageFolders( |
|
428 | - string $path, |
|
429 | - array $exclude = [], |
|
430 | - int $flags = GLOB_ONLYDIR, |
|
431 | - bool $register_autoloaders = true |
|
432 | - ): array { |
|
433 | - $folders = []; |
|
434 | - $subfolders = glob($path, $flags); |
|
435 | - if ($subfolders) { |
|
436 | - foreach ($subfolders as $admin_screen) { |
|
437 | - $admin_screen_name = basename($admin_screen); |
|
438 | - // files and anything in the exclude array need not apply |
|
439 | - if (! in_array($admin_screen_name, $exclude, true)) { |
|
440 | - // these folders represent the different EE admin pages |
|
441 | - $folders[ $admin_screen_name ] = $admin_screen; |
|
442 | - if ($register_autoloaders) { |
|
443 | - // set autoloaders for our admin page classes based on included path information |
|
444 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder($admin_screen); |
|
445 | - } |
|
446 | - } |
|
447 | - } |
|
448 | - } |
|
449 | - return $folders; |
|
450 | - } |
|
19 | + /** |
|
20 | + * @var AdminMenuManager $menu_manager |
|
21 | + */ |
|
22 | + protected $menu_manager; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var LoaderInterface $loader |
|
26 | + */ |
|
27 | + protected $loader; |
|
28 | + |
|
29 | + /** |
|
30 | + * _installed_pages |
|
31 | + * objects for page_init objects detected and loaded |
|
32 | + * |
|
33 | + * @access private |
|
34 | + * @var EE_Admin_Page_Init[] |
|
35 | + */ |
|
36 | + private $_installed_pages = []; |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * this is used to hold the registry of menu slugs for all the installed admin pages |
|
41 | + * |
|
42 | + * @var array |
|
43 | + */ |
|
44 | + private $_menu_slugs = []; |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * _caffeinated_extends |
|
49 | + * This array is the generated configuration array for which core EE_Admin pages are extended (and the bits and |
|
50 | + * pieces needed to do so). This property is defined in the _set_caffeinated method. |
|
51 | + * |
|
52 | + * @var array |
|
53 | + */ |
|
54 | + private $_caffeinated_extends = []; |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * This property will hold the hook file for setting up the filter that does all the connections between admin |
|
59 | + * pages. |
|
60 | + * |
|
61 | + * @var string |
|
62 | + */ |
|
63 | + public $hook_file; |
|
64 | + |
|
65 | + /** |
|
66 | + * @var int |
|
67 | + * @since $VID:$ |
|
68 | + */ |
|
69 | + private $maintenance_mode = 0; |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * @throws InvalidArgumentException |
|
74 | + * @throws InvalidDataTypeException |
|
75 | + * @throws InvalidInterfaceException |
|
76 | + */ |
|
77 | + public function __construct(?LoaderInterface $loader) |
|
78 | + { |
|
79 | + $this->loader = $loader instanceof LoaderInterface ? $loader : LoaderFactory::getLoader(); |
|
80 | + $this->menu_manager = $this->loader->getShared(AdminMenuManager::class, [$this->loader]); |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * @throws EE_Error |
|
86 | + * @throws ReflectionException |
|
87 | + * @since $VID:$ |
|
88 | + */ |
|
89 | + public function init() |
|
90 | + { |
|
91 | + $this->menu_manager->initialize(); |
|
92 | + $this->maintenance_mode = EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance; |
|
93 | + // let's do a scan and see what installed pages we have |
|
94 | + $this->findAndLoadAdminPages(); |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + /** |
|
99 | + * When caffeinated system is detected, this method is called to setup the caffeinated directory constants used by |
|
100 | + * files in the caffeinated folder. |
|
101 | + * |
|
102 | + * @access private |
|
103 | + * @return void |
|
104 | + */ |
|
105 | + private function defineCaffeinatedConstants() |
|
106 | + { |
|
107 | + if (! defined('EE_CORE_CAF_ADMIN')) { |
|
108 | + define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH . 'caffeinated/admin/'); |
|
109 | + define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL . 'caffeinated/admin/'); |
|
110 | + define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN . 'new/'); |
|
111 | + define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN . 'extend/'); |
|
112 | + define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL . 'extend/'); |
|
113 | + define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN . 'hooks/'); |
|
114 | + } |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + /** |
|
119 | + * This just gets the list of installed EE_Admin_pages. |
|
120 | + * |
|
121 | + * @access private |
|
122 | + * @return void |
|
123 | + * @throws EE_Error |
|
124 | + * @throws InvalidArgumentException |
|
125 | + * @throws InvalidDataTypeException |
|
126 | + * @throws InvalidInterfaceException |
|
127 | + * @throws ReflectionException |
|
128 | + */ |
|
129 | + private function findAndLoadAdminPages() |
|
130 | + { |
|
131 | + $admin_pages = $this->findAdminPages(); |
|
132 | + // this just checks the caffeinated folder and takes care of setting up any caffeinated stuff. |
|
133 | + $admin_pages = $this->findCaffeinatedAdminPages($admin_pages); |
|
134 | + // then extensions and hooks, although they don't get added to the admin pages array |
|
135 | + $this->findAdminPageExtensions(); |
|
136 | + $this->findAdminPageHooks(); |
|
137 | + // allow plugins to add in their own pages (note at this point they will need to have an autoloader defined for their class) OR hook into EEH_Autoloader::load_admin_page() to add their path.; |
|
138 | + // loop through admin pages and setup the $_installed_pages array. |
|
139 | + $hooks_ref = []; |
|
140 | + $menu_pages = []; |
|
141 | + foreach ($admin_pages as $page => $path) { |
|
142 | + // don't load the page init class IF IT's ALREADY LOADED !!! |
|
143 | + if ( |
|
144 | + isset($this->_installed_pages[ $page ]) |
|
145 | + && $this->_installed_pages[ $page ] instanceof EE_Admin_Page_Init |
|
146 | + ) { |
|
147 | + continue; |
|
148 | + } |
|
149 | + // build list of installed pages |
|
150 | + $admin_page_init = $this->loadAdminPageInit($page); |
|
151 | + $this->_installed_pages[ $page ] = $admin_page_init; |
|
152 | + $admin_menu = $this->menu_manager->getAdminMenu($admin_page_init); |
|
153 | + $admin_page_init->setCapability($admin_menu->capability(), $admin_menu->menuSlug()); |
|
154 | + // skip if in full maintenance mode and maintenance_mode_parent is NOT set |
|
155 | + if ($this->maintenance_mode && ! $admin_menu->maintenanceModeParent()) { |
|
156 | + unset($admin_pages[ $page ]); |
|
157 | + continue; |
|
158 | + } |
|
159 | + $menu_slug = $admin_menu->menuSlug(); |
|
160 | + $this->_menu_slugs[ $menu_slug ] = $page; |
|
161 | + $menu_pages[ $menu_slug ] = $admin_page_init; |
|
162 | + // now that we've got the admin_init objects... |
|
163 | + // lets see if there are any caffeinated pages extending the originals. |
|
164 | + // If there are then let's hook into the init admin filter and load our extend instead. |
|
165 | + // Set flag for register hooks on extended pages b/c extended pages use the default INIT. |
|
166 | + $extended_hooks = $admin_page_init->register_hooks( |
|
167 | + $this->loadCaffeinatedExtensions($admin_page_init, $page, $menu_slug) |
|
168 | + ); |
|
169 | + $hooks_ref += $extended_hooks; |
|
170 | + } |
|
171 | + // the hooks_ref is all the pages where we have $extended _Hooks files |
|
172 | + // that will extend a class in a different folder. |
|
173 | + // So we want to make sure we load the file for the parent. |
|
174 | + // first make sure we've got unique values |
|
175 | + $hooks_ref = array_unique($hooks_ref); |
|
176 | + // now let's loop and require! |
|
177 | + foreach ($hooks_ref as $path) { |
|
178 | + require_once($path); |
|
179 | + } |
|
180 | + // make sure we have menu slugs global setup. Used in EE_Admin_Page->page_setup() to ensure we don't do a full class load for an admin page that isn't requested. |
|
181 | + global $ee_menu_slugs; |
|
182 | + $ee_menu_slugs = $this->_menu_slugs; |
|
183 | + // we need to loop again to run any early code |
|
184 | + foreach ($this->_installed_pages as $page) { |
|
185 | + $page->do_initial_loads(); |
|
186 | + } |
|
187 | + $this->menu_manager->setInstalledPages($menu_pages); |
|
188 | + do_action('AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages); |
|
189 | + } |
|
190 | + |
|
191 | + |
|
192 | + /** |
|
193 | + * @return array |
|
194 | + * @throws EE_Error |
|
195 | + * @since $VID:$ |
|
196 | + */ |
|
197 | + private function findAdminPages(): array |
|
198 | + { |
|
199 | + |
|
200 | + // grab everything in the admin core directory |
|
201 | + $admin_page_folders = $this->findAdminPageFolders(EE_ADMIN_PAGES . '*'); |
|
202 | + $admin_page_folders = apply_filters( |
|
203 | + 'FHEE__EE_Admin_Page_Loader__findAdminPages__admin_page_folders', |
|
204 | + $admin_page_folders |
|
205 | + ); |
|
206 | + if (! empty($admin_page_folders)) { |
|
207 | + return $admin_page_folders; |
|
208 | + } |
|
209 | + $error_msg = esc_html__( |
|
210 | + 'There are no EE_Admin pages detected, it looks like EE did not install properly', |
|
211 | + 'event_espresso' |
|
212 | + ); |
|
213 | + $error_msg .= '||'; |
|
214 | + $error_msg .= sprintf( |
|
215 | + esc_html__( |
|
216 | + 'Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', |
|
217 | + 'event_espresso' |
|
218 | + ), |
|
219 | + EE_ADMIN_PAGES |
|
220 | + ); |
|
221 | + throw new RuntimeException($error_msg); |
|
222 | + } |
|
223 | + |
|
224 | + |
|
225 | + /** |
|
226 | + * get_admin_page_object |
|
227 | + * |
|
228 | + * @param string $page_slug |
|
229 | + * @return EE_Admin_Page |
|
230 | + */ |
|
231 | + public function get_admin_page_object(string $page_slug = ''): ?EE_Admin_Page |
|
232 | + { |
|
233 | + return isset($this->_installed_pages[ $page_slug ]) |
|
234 | + ? $this->_installed_pages[ $page_slug ]->loaded_page_object() |
|
235 | + : null; |
|
236 | + } |
|
237 | + |
|
238 | + |
|
239 | + /** |
|
240 | + * generates an "Admin Page Init" class based on the directory name |
|
241 | + * |
|
242 | + * @param string $dir_name |
|
243 | + * @return string |
|
244 | + */ |
|
245 | + private function getClassnameForAdminPageInit(string $dir_name = ''): string |
|
246 | + { |
|
247 | + $class_name = str_replace('_', ' ', strtolower($dir_name)); |
|
248 | + return str_replace(' ', '_', ucwords($class_name)) . '_Admin_Page_Init'; |
|
249 | + } |
|
250 | + |
|
251 | + |
|
252 | + /** |
|
253 | + * _load_admin_page |
|
254 | + * Loads and instantiates page_init object for a single EE_admin page. |
|
255 | + * |
|
256 | + * @param string $page page_reference |
|
257 | + * @return EE_Admin_Page_Init |
|
258 | + * @throws EE_Error |
|
259 | + */ |
|
260 | + private function loadAdminPageInit(string $page = ''): EE_Admin_Page_Init |
|
261 | + { |
|
262 | + $class_name = $this->getClassnameForAdminPageInit($page); |
|
263 | + if (class_exists($class_name)) { |
|
264 | + $admin_page_init = $this->loader->getShared($class_name); |
|
265 | + // verify returned object |
|
266 | + if ($admin_page_init instanceof EE_Admin_Page_Init) { |
|
267 | + return $admin_page_init; |
|
268 | + } |
|
269 | + } |
|
270 | + $error_msg = sprintf( |
|
271 | + esc_html__('Something went wrong with loading the %s admin page.', 'event_espresso'), |
|
272 | + $page |
|
273 | + ); |
|
274 | + $error_msg .= '||'; // separates public from developer messages |
|
275 | + $error_msg .= "\r\n"; |
|
276 | + $error_msg .= sprintf( |
|
277 | + esc_html__('There is no Init class in place for the %s admin page.', 'event_espresso'), |
|
278 | + $page |
|
279 | + ); |
|
280 | + $error_msg .= '<br />'; |
|
281 | + $error_msg .= sprintf( |
|
282 | + esc_html__( |
|
283 | + 'Make sure you have %1$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', |
|
284 | + 'event_espresso' |
|
285 | + ), |
|
286 | + '<strong>' . $class_name . '</strong>' |
|
287 | + ); |
|
288 | + throw new EE_Error($error_msg); |
|
289 | + } |
|
290 | + |
|
291 | + |
|
292 | + /** |
|
293 | + * This method is the "workhorse" for detecting and setting up caffeinated functionality. |
|
294 | + * In this method there are three checks being done: |
|
295 | + * 1. Do we have any NEW admin page sets. If we do, lets add them into the menu setup (via the $admin_pages |
|
296 | + * array) etc. (new page sets are found in caffeinated/new/{page}) |
|
297 | + * 2. Do we have any EXTENDED page sets. Basically an extended EE_Admin Page extends the core {child}_Admin_Page |
|
298 | + * class. eg. would be caffeinated/extend/events/Extend_Events_Admin_Page.core.php and in there would be a class: |
|
299 | + * Extend_Events_Admin_Page extends Events_Admin_Page. |
|
300 | + * 3. Do we have any files just for setting up hooks into other core pages. The files can be any name in |
|
301 | + * "caffeinated/hooks" EXCEPT they need a ".class.php" extension and the file name must correspond with the |
|
302 | + * classname inside. These classes are instantiated really early so that any hooks in them are run before the |
|
303 | + * corresponding apply_filters/do_actions that are found in any future loaded EE_Admin pages (INCLUDING caffeinated |
|
304 | + * admin_pages) |
|
305 | + * |
|
306 | + * @param array $admin_pages the original installed_refs array that may contain our NEW EE_Admin_Pages to be |
|
307 | + * loaded. |
|
308 | + * @return array |
|
309 | + * @throws EE_Error |
|
310 | + */ |
|
311 | + private function findCaffeinatedAdminPages(array $admin_pages): array |
|
312 | + { |
|
313 | + // first let's check if there IS a caffeinated folder. If there is not then lets get out. |
|
314 | + if ((defined('EE_DECAF') && EE_DECAF) || ! is_dir(EE_PLUGIN_DIR_PATH . 'caffeinated/admin')) { |
|
315 | + return $admin_pages; |
|
316 | + } |
|
317 | + $this->defineCaffeinatedConstants(); |
|
318 | + // okay let's setup an "New" pages first (we'll return installed refs later) |
|
319 | + $admin_pages += $this->findAdminPageFolders(EE_CORE_CAF_ADMIN . 'new/*', ['tickets']); |
|
320 | + |
|
321 | + return apply_filters( |
|
322 | + 'FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', |
|
323 | + $admin_pages |
|
324 | + ); |
|
325 | + } |
|
326 | + |
|
327 | + |
|
328 | + /** |
|
329 | + * @throws EE_Error |
|
330 | + * @since $VID:$ |
|
331 | + */ |
|
332 | + private function findAdminPageExtensions() |
|
333 | + { |
|
334 | + // let's see if there are any EXTENDS to setup in the $_caffeinated_extends array |
|
335 | + // (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page) |
|
336 | + $extensions = $this->findAdminPageFolders(EE_CORE_CAF_ADMIN . 'extend/*'); |
|
337 | + if ($extensions) { |
|
338 | + foreach ($extensions as $folder => $extension) { |
|
339 | + // convert lowercase_snake_case to Uppercase_Snake_Case |
|
340 | + $filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $folder))); |
|
341 | + $filename = "Extend_{$filename}_Admin_Page"; |
|
342 | + $filepath = EE_CORE_CAF_ADMIN . "extend/$folder/$filename.core.php"; |
|
343 | + // save filename and filepath for later |
|
344 | + $this->_caffeinated_extends[ $folder ]['path'] = str_replace(['\\', '/'], '/', $filepath); |
|
345 | + $this->_caffeinated_extends[ $folder ]['admin_page'] = $filename; |
|
346 | + } |
|
347 | + } |
|
348 | + $this->_caffeinated_extends = apply_filters( |
|
349 | + 'FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', |
|
350 | + $this->_caffeinated_extends |
|
351 | + ); |
|
352 | + } |
|
353 | + |
|
354 | + |
|
355 | + private function loadCaffeinatedExtensions( |
|
356 | + EE_Admin_Page_Init $admin_page_init, |
|
357 | + string $page, |
|
358 | + string $menu_slug |
|
359 | + ): bool { |
|
360 | + if (! isset($this->_caffeinated_extends[ $page ])) { |
|
361 | + return false; |
|
362 | + } |
|
363 | + $admin_page_name = $admin_page_init->get_admin_page_name(); |
|
364 | + $caf_path = $this->_caffeinated_extends[ $page ]['path']; |
|
365 | + $caf_admin_page = $this->_caffeinated_extends[ $page ]['admin_page']; |
|
366 | + add_filter( |
|
367 | + "FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$menu_slug}_$admin_page_name", |
|
368 | + static function ($path_to_file) use ($caf_path) { |
|
369 | + return $caf_path; |
|
370 | + } |
|
371 | + ); |
|
372 | + add_filter( |
|
373 | + "FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$menu_slug}_$admin_page_name", |
|
374 | + static function ($admin_page) use ($caf_admin_page) { |
|
375 | + return $caf_admin_page; |
|
376 | + } |
|
377 | + ); |
|
378 | + return true; |
|
379 | + } |
|
380 | + |
|
381 | + |
|
382 | + /** |
|
383 | + * @throws EE_Error |
|
384 | + * @since $VID:$ |
|
385 | + */ |
|
386 | + private function findAdminPageHooks() |
|
387 | + { |
|
388 | + // let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!). |
|
389 | + $ee_admin_hooks = []; |
|
390 | + $admin_page_hooks = $this->findAdminPageFolders(EE_CORE_CAF_ADMIN . 'hooks/*.class.php', [], 0, false); |
|
391 | + if ($admin_page_hooks) { |
|
392 | + foreach ($admin_page_hooks as $hook) { |
|
393 | + if (is_readable($hook)) { |
|
394 | + require_once $hook; |
|
395 | + $classname = str_replace([EE_CORE_CAF_ADMIN . 'hooks/', '.class.php'], '', $hook); |
|
396 | + if (class_exists($classname)) { |
|
397 | + $ee_admin_hooks[] = $this->loader->getShared($classname); |
|
398 | + } |
|
399 | + } |
|
400 | + } |
|
401 | + } |
|
402 | + apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks); |
|
403 | + } |
|
404 | + |
|
405 | + |
|
406 | + /** |
|
407 | + * _default_header_link |
|
408 | + * This is just a dummy method to use with header submenu items |
|
409 | + * |
|
410 | + * @return bool false |
|
411 | + */ |
|
412 | + public function _default_header_link(): bool |
|
413 | + { |
|
414 | + return false; |
|
415 | + } |
|
416 | + |
|
417 | + |
|
418 | + /** |
|
419 | + * @param string $path |
|
420 | + * @param int $flags |
|
421 | + * @param array $exclude |
|
422 | + * @param bool $register_autoloaders |
|
423 | + * @return array |
|
424 | + * @throws EE_Error |
|
425 | + * @since $VID:$ |
|
426 | + */ |
|
427 | + private function findAdminPageFolders( |
|
428 | + string $path, |
|
429 | + array $exclude = [], |
|
430 | + int $flags = GLOB_ONLYDIR, |
|
431 | + bool $register_autoloaders = true |
|
432 | + ): array { |
|
433 | + $folders = []; |
|
434 | + $subfolders = glob($path, $flags); |
|
435 | + if ($subfolders) { |
|
436 | + foreach ($subfolders as $admin_screen) { |
|
437 | + $admin_screen_name = basename($admin_screen); |
|
438 | + // files and anything in the exclude array need not apply |
|
439 | + if (! in_array($admin_screen_name, $exclude, true)) { |
|
440 | + // these folders represent the different EE admin pages |
|
441 | + $folders[ $admin_screen_name ] = $admin_screen; |
|
442 | + if ($register_autoloaders) { |
|
443 | + // set autoloaders for our admin page classes based on included path information |
|
444 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($admin_screen); |
|
445 | + } |
|
446 | + } |
|
447 | + } |
|
448 | + } |
|
449 | + return $folders; |
|
450 | + } |
|
451 | 451 | } |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | */ |
105 | 105 | private function defineCaffeinatedConstants() |
106 | 106 | { |
107 | - if (! defined('EE_CORE_CAF_ADMIN')) { |
|
108 | - define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH . 'caffeinated/admin/'); |
|
109 | - define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL . 'caffeinated/admin/'); |
|
110 | - define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN . 'new/'); |
|
111 | - define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN . 'extend/'); |
|
112 | - define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL . 'extend/'); |
|
113 | - define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN . 'hooks/'); |
|
107 | + if ( ! defined('EE_CORE_CAF_ADMIN')) { |
|
108 | + define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH.'caffeinated/admin/'); |
|
109 | + define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL.'caffeinated/admin/'); |
|
110 | + define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN.'new/'); |
|
111 | + define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN.'extend/'); |
|
112 | + define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL.'extend/'); |
|
113 | + define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN.'hooks/'); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
@@ -141,24 +141,24 @@ discard block |
||
141 | 141 | foreach ($admin_pages as $page => $path) { |
142 | 142 | // don't load the page init class IF IT's ALREADY LOADED !!! |
143 | 143 | if ( |
144 | - isset($this->_installed_pages[ $page ]) |
|
145 | - && $this->_installed_pages[ $page ] instanceof EE_Admin_Page_Init |
|
144 | + isset($this->_installed_pages[$page]) |
|
145 | + && $this->_installed_pages[$page] instanceof EE_Admin_Page_Init |
|
146 | 146 | ) { |
147 | 147 | continue; |
148 | 148 | } |
149 | 149 | // build list of installed pages |
150 | 150 | $admin_page_init = $this->loadAdminPageInit($page); |
151 | - $this->_installed_pages[ $page ] = $admin_page_init; |
|
151 | + $this->_installed_pages[$page] = $admin_page_init; |
|
152 | 152 | $admin_menu = $this->menu_manager->getAdminMenu($admin_page_init); |
153 | 153 | $admin_page_init->setCapability($admin_menu->capability(), $admin_menu->menuSlug()); |
154 | 154 | // skip if in full maintenance mode and maintenance_mode_parent is NOT set |
155 | 155 | if ($this->maintenance_mode && ! $admin_menu->maintenanceModeParent()) { |
156 | - unset($admin_pages[ $page ]); |
|
156 | + unset($admin_pages[$page]); |
|
157 | 157 | continue; |
158 | 158 | } |
159 | 159 | $menu_slug = $admin_menu->menuSlug(); |
160 | - $this->_menu_slugs[ $menu_slug ] = $page; |
|
161 | - $menu_pages[ $menu_slug ] = $admin_page_init; |
|
160 | + $this->_menu_slugs[$menu_slug] = $page; |
|
161 | + $menu_pages[$menu_slug] = $admin_page_init; |
|
162 | 162 | // now that we've got the admin_init objects... |
163 | 163 | // lets see if there are any caffeinated pages extending the originals. |
164 | 164 | // If there are then let's hook into the init admin filter and load our extend instead. |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $extended_hooks = $admin_page_init->register_hooks( |
167 | 167 | $this->loadCaffeinatedExtensions($admin_page_init, $page, $menu_slug) |
168 | 168 | ); |
169 | - $hooks_ref += $extended_hooks; |
|
169 | + $hooks_ref += $extended_hooks; |
|
170 | 170 | } |
171 | 171 | // the hooks_ref is all the pages where we have $extended _Hooks files |
172 | 172 | // that will extend a class in a different folder. |
@@ -198,12 +198,12 @@ discard block |
||
198 | 198 | { |
199 | 199 | |
200 | 200 | // grab everything in the admin core directory |
201 | - $admin_page_folders = $this->findAdminPageFolders(EE_ADMIN_PAGES . '*'); |
|
201 | + $admin_page_folders = $this->findAdminPageFolders(EE_ADMIN_PAGES.'*'); |
|
202 | 202 | $admin_page_folders = apply_filters( |
203 | 203 | 'FHEE__EE_Admin_Page_Loader__findAdminPages__admin_page_folders', |
204 | 204 | $admin_page_folders |
205 | 205 | ); |
206 | - if (! empty($admin_page_folders)) { |
|
206 | + if ( ! empty($admin_page_folders)) { |
|
207 | 207 | return $admin_page_folders; |
208 | 208 | } |
209 | 209 | $error_msg = esc_html__( |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | */ |
231 | 231 | public function get_admin_page_object(string $page_slug = ''): ?EE_Admin_Page |
232 | 232 | { |
233 | - return isset($this->_installed_pages[ $page_slug ]) |
|
234 | - ? $this->_installed_pages[ $page_slug ]->loaded_page_object() |
|
233 | + return isset($this->_installed_pages[$page_slug]) |
|
234 | + ? $this->_installed_pages[$page_slug]->loaded_page_object() |
|
235 | 235 | : null; |
236 | 236 | } |
237 | 237 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | private function getClassnameForAdminPageInit(string $dir_name = ''): string |
246 | 246 | { |
247 | 247 | $class_name = str_replace('_', ' ', strtolower($dir_name)); |
248 | - return str_replace(' ', '_', ucwords($class_name)) . '_Admin_Page_Init'; |
|
248 | + return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page_Init'; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | 'Make sure you have %1$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', |
284 | 284 | 'event_espresso' |
285 | 285 | ), |
286 | - '<strong>' . $class_name . '</strong>' |
|
286 | + '<strong>'.$class_name.'</strong>' |
|
287 | 287 | ); |
288 | 288 | throw new EE_Error($error_msg); |
289 | 289 | } |
@@ -311,12 +311,12 @@ discard block |
||
311 | 311 | private function findCaffeinatedAdminPages(array $admin_pages): array |
312 | 312 | { |
313 | 313 | // first let's check if there IS a caffeinated folder. If there is not then lets get out. |
314 | - if ((defined('EE_DECAF') && EE_DECAF) || ! is_dir(EE_PLUGIN_DIR_PATH . 'caffeinated/admin')) { |
|
314 | + if ((defined('EE_DECAF') && EE_DECAF) || ! is_dir(EE_PLUGIN_DIR_PATH.'caffeinated/admin')) { |
|
315 | 315 | return $admin_pages; |
316 | 316 | } |
317 | 317 | $this->defineCaffeinatedConstants(); |
318 | 318 | // okay let's setup an "New" pages first (we'll return installed refs later) |
319 | - $admin_pages += $this->findAdminPageFolders(EE_CORE_CAF_ADMIN . 'new/*', ['tickets']); |
|
319 | + $admin_pages += $this->findAdminPageFolders(EE_CORE_CAF_ADMIN.'new/*', ['tickets']); |
|
320 | 320 | |
321 | 321 | return apply_filters( |
322 | 322 | 'FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', |
@@ -333,16 +333,16 @@ discard block |
||
333 | 333 | { |
334 | 334 | // let's see if there are any EXTENDS to setup in the $_caffeinated_extends array |
335 | 335 | // (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page) |
336 | - $extensions = $this->findAdminPageFolders(EE_CORE_CAF_ADMIN . 'extend/*'); |
|
336 | + $extensions = $this->findAdminPageFolders(EE_CORE_CAF_ADMIN.'extend/*'); |
|
337 | 337 | if ($extensions) { |
338 | 338 | foreach ($extensions as $folder => $extension) { |
339 | 339 | // convert lowercase_snake_case to Uppercase_Snake_Case |
340 | 340 | $filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $folder))); |
341 | 341 | $filename = "Extend_{$filename}_Admin_Page"; |
342 | - $filepath = EE_CORE_CAF_ADMIN . "extend/$folder/$filename.core.php"; |
|
342 | + $filepath = EE_CORE_CAF_ADMIN."extend/$folder/$filename.core.php"; |
|
343 | 343 | // save filename and filepath for later |
344 | - $this->_caffeinated_extends[ $folder ]['path'] = str_replace(['\\', '/'], '/', $filepath); |
|
345 | - $this->_caffeinated_extends[ $folder ]['admin_page'] = $filename; |
|
344 | + $this->_caffeinated_extends[$folder]['path'] = str_replace(['\\', '/'], '/', $filepath); |
|
345 | + $this->_caffeinated_extends[$folder]['admin_page'] = $filename; |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | $this->_caffeinated_extends = apply_filters( |
@@ -357,21 +357,21 @@ discard block |
||
357 | 357 | string $page, |
358 | 358 | string $menu_slug |
359 | 359 | ): bool { |
360 | - if (! isset($this->_caffeinated_extends[ $page ])) { |
|
360 | + if ( ! isset($this->_caffeinated_extends[$page])) { |
|
361 | 361 | return false; |
362 | 362 | } |
363 | 363 | $admin_page_name = $admin_page_init->get_admin_page_name(); |
364 | - $caf_path = $this->_caffeinated_extends[ $page ]['path']; |
|
365 | - $caf_admin_page = $this->_caffeinated_extends[ $page ]['admin_page']; |
|
364 | + $caf_path = $this->_caffeinated_extends[$page]['path']; |
|
365 | + $caf_admin_page = $this->_caffeinated_extends[$page]['admin_page']; |
|
366 | 366 | add_filter( |
367 | 367 | "FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$menu_slug}_$admin_page_name", |
368 | - static function ($path_to_file) use ($caf_path) { |
|
368 | + static function($path_to_file) use ($caf_path) { |
|
369 | 369 | return $caf_path; |
370 | 370 | } |
371 | 371 | ); |
372 | 372 | add_filter( |
373 | 373 | "FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$menu_slug}_$admin_page_name", |
374 | - static function ($admin_page) use ($caf_admin_page) { |
|
374 | + static function($admin_page) use ($caf_admin_page) { |
|
375 | 375 | return $caf_admin_page; |
376 | 376 | } |
377 | 377 | ); |
@@ -387,12 +387,12 @@ discard block |
||
387 | 387 | { |
388 | 388 | // let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!). |
389 | 389 | $ee_admin_hooks = []; |
390 | - $admin_page_hooks = $this->findAdminPageFolders(EE_CORE_CAF_ADMIN . 'hooks/*.class.php', [], 0, false); |
|
390 | + $admin_page_hooks = $this->findAdminPageFolders(EE_CORE_CAF_ADMIN.'hooks/*.class.php', [], 0, false); |
|
391 | 391 | if ($admin_page_hooks) { |
392 | 392 | foreach ($admin_page_hooks as $hook) { |
393 | 393 | if (is_readable($hook)) { |
394 | 394 | require_once $hook; |
395 | - $classname = str_replace([EE_CORE_CAF_ADMIN . 'hooks/', '.class.php'], '', $hook); |
|
395 | + $classname = str_replace([EE_CORE_CAF_ADMIN.'hooks/', '.class.php'], '', $hook); |
|
396 | 396 | if (class_exists($classname)) { |
397 | 397 | $ee_admin_hooks[] = $this->loader->getShared($classname); |
398 | 398 | } |
@@ -436,9 +436,9 @@ discard block |
||
436 | 436 | foreach ($subfolders as $admin_screen) { |
437 | 437 | $admin_screen_name = basename($admin_screen); |
438 | 438 | // files and anything in the exclude array need not apply |
439 | - if (! in_array($admin_screen_name, $exclude, true)) { |
|
439 | + if ( ! in_array($admin_screen_name, $exclude, true)) { |
|
440 | 440 | // these folders represent the different EE admin pages |
441 | - $folders[ $admin_screen_name ] = $admin_screen; |
|
441 | + $folders[$admin_screen_name] = $admin_screen; |
|
442 | 442 | if ($register_autoloaders) { |
443 | 443 | // set autoloaders for our admin page classes based on included path information |
444 | 444 | EEH_Autoloader::register_autoloaders_for_each_file_in_folder($admin_screen); |
@@ -18,2590 +18,2590 @@ discard block |
||
18 | 18 | */ |
19 | 19 | final class EE_Config implements ResettableInterface |
20 | 20 | { |
21 | - const OPTION_NAME = 'ee_config'; |
|
22 | - |
|
23 | - const LOG_NAME = 'ee_config_log'; |
|
24 | - |
|
25 | - const LOG_LENGTH = 100; |
|
26 | - |
|
27 | - const ADDON_OPTION_NAMES = 'ee_config_option_names'; |
|
28 | - |
|
29 | - /** |
|
30 | - * instance of the EE_Config object |
|
31 | - * |
|
32 | - * @var EE_Config $_instance |
|
33 | - * @access private |
|
34 | - */ |
|
35 | - private static $_instance; |
|
36 | - |
|
37 | - /** |
|
38 | - * @var boolean $_logging_enabled |
|
39 | - */ |
|
40 | - private static $_logging_enabled = false; |
|
41 | - |
|
42 | - /** |
|
43 | - * @var LegacyShortcodesManager $legacy_shortcodes_manager |
|
44 | - */ |
|
45 | - private $legacy_shortcodes_manager; |
|
46 | - |
|
47 | - /** |
|
48 | - * An StdClass whose property names are addon slugs, |
|
49 | - * and values are their config classes |
|
50 | - * |
|
51 | - * @var StdClass |
|
52 | - */ |
|
53 | - public $addons; |
|
54 | - |
|
55 | - /** |
|
56 | - * @var EE_Admin_Config |
|
57 | - */ |
|
58 | - public $admin; |
|
59 | - |
|
60 | - /** |
|
61 | - * @var EE_Core_Config |
|
62 | - */ |
|
63 | - public $core; |
|
64 | - |
|
65 | - /** |
|
66 | - * @var EE_Currency_Config |
|
67 | - */ |
|
68 | - public $currency; |
|
69 | - |
|
70 | - /** |
|
71 | - * @var EE_Organization_Config |
|
72 | - */ |
|
73 | - public $organization; |
|
74 | - |
|
75 | - /** |
|
76 | - * @var EE_Registration_Config |
|
77 | - */ |
|
78 | - public $registration; |
|
79 | - |
|
80 | - /** |
|
81 | - * @var EE_Template_Config |
|
82 | - */ |
|
83 | - public $template_settings; |
|
84 | - |
|
85 | - /** |
|
86 | - * Holds EE environment values. |
|
87 | - * |
|
88 | - * @var EE_Environment_Config |
|
89 | - */ |
|
90 | - public $environment; |
|
91 | - |
|
92 | - /** |
|
93 | - * settings pertaining to Google maps |
|
94 | - * |
|
95 | - * @var EE_Map_Config |
|
96 | - */ |
|
97 | - public $map_settings; |
|
98 | - |
|
99 | - /** |
|
100 | - * settings pertaining to Taxes |
|
101 | - * |
|
102 | - * @var EE_Tax_Config |
|
103 | - */ |
|
104 | - public $tax_settings; |
|
105 | - |
|
106 | - /** |
|
107 | - * Settings pertaining to global messages settings. |
|
108 | - * |
|
109 | - * @var EE_Messages_Config |
|
110 | - */ |
|
111 | - public $messages; |
|
112 | - |
|
113 | - /** |
|
114 | - * @deprecated |
|
115 | - * @var EE_Gateway_Config |
|
116 | - */ |
|
117 | - public $gateway; |
|
118 | - |
|
119 | - /** |
|
120 | - * @var array |
|
121 | - */ |
|
122 | - private $_addon_option_names = array(); |
|
123 | - |
|
124 | - /** |
|
125 | - * @var array |
|
126 | - */ |
|
127 | - private static $_module_route_map = array(); |
|
128 | - |
|
129 | - /** |
|
130 | - * @var array |
|
131 | - */ |
|
132 | - private static $_module_forward_map = array(); |
|
133 | - |
|
134 | - /** |
|
135 | - * @var array |
|
136 | - */ |
|
137 | - private static $_module_view_map = array(); |
|
138 | - |
|
139 | - /** |
|
140 | - * @var bool |
|
141 | - */ |
|
142 | - private static $initialized = false; |
|
143 | - |
|
144 | - |
|
145 | - /** |
|
146 | - * @singleton method used to instantiate class object |
|
147 | - * @access public |
|
148 | - * @return EE_Config instance |
|
149 | - */ |
|
150 | - public static function instance() |
|
151 | - { |
|
152 | - // check if class object is instantiated, and instantiated properly |
|
153 | - if (! self::$_instance instanceof EE_Config) { |
|
154 | - self::$_instance = new self(); |
|
155 | - } |
|
156 | - return self::$_instance; |
|
157 | - } |
|
158 | - |
|
159 | - |
|
160 | - /** |
|
161 | - * Resets the config |
|
162 | - * |
|
163 | - * @param bool $hard_reset if TRUE, sets EE_CONFig back to its original settings in the database. If FALSE |
|
164 | - * (default) leaves the database alone, and merely resets the EE_Config object to |
|
165 | - * reflect its state in the database |
|
166 | - * @param boolean $reinstantiate if TRUE (default) call instance() and return it. Otherwise, just leave |
|
167 | - * $_instance as NULL. Useful in case you want to forget about the old instance on |
|
168 | - * EE_Config, but might not be ready to instantiate EE_Config currently (eg if the |
|
169 | - * site was put into maintenance mode) |
|
170 | - * @return EE_Config |
|
171 | - */ |
|
172 | - public static function reset($hard_reset = false, $reinstantiate = true) |
|
173 | - { |
|
174 | - if (self::$_instance instanceof EE_Config) { |
|
175 | - if ($hard_reset) { |
|
176 | - self::$_instance->legacy_shortcodes_manager = null; |
|
177 | - self::$_instance->_addon_option_names = array(); |
|
178 | - self::$_instance->_initialize_config(); |
|
179 | - self::$_instance->update_espresso_config(); |
|
180 | - } |
|
181 | - self::$_instance->update_addon_option_names(); |
|
182 | - } |
|
183 | - self::$_instance = null; |
|
184 | - self::$initialized = false; |
|
185 | - // we don't need to reset the static properties imo because those should |
|
186 | - // only change when a module is added or removed. Currently we don't |
|
187 | - // support removing a module during a request when it previously existed |
|
188 | - if ($reinstantiate) { |
|
189 | - return self::instance(); |
|
190 | - } else { |
|
191 | - return null; |
|
192 | - } |
|
193 | - } |
|
194 | - |
|
195 | - |
|
196 | - private function __construct() |
|
197 | - { |
|
198 | - if (self::$initialized) { |
|
199 | - return; |
|
200 | - } |
|
201 | - self::$initialized = true; |
|
202 | - do_action('AHEE__EE_Config__construct__begin', $this); |
|
203 | - EE_Config::$_logging_enabled = apply_filters('FHEE__EE_Config___construct__logging_enabled', false); |
|
204 | - // setup empty config classes |
|
205 | - $this->_initialize_config(); |
|
206 | - // load existing EE site settings |
|
207 | - $this->_load_core_config(); |
|
208 | - // confirm everything loaded correctly and set filtered defaults if not |
|
209 | - $this->_verify_config(); |
|
210 | - // register shortcodes and modules |
|
211 | - add_action( |
|
212 | - 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
|
213 | - [$this, 'register_shortcodes_and_modules'], |
|
214 | - 999 |
|
215 | - ); |
|
216 | - // initialize shortcodes and modules |
|
217 | - add_action('AHEE__EE_System__core_loaded_and_ready', [$this, 'initialize_shortcodes_and_modules']); |
|
218 | - // register widgets |
|
219 | - add_action('widgets_init', [$this, 'widgets_init'], 10); |
|
220 | - // shutdown |
|
221 | - add_action('shutdown', [$this, 'shutdown'], 10); |
|
222 | - // construct__end hook |
|
223 | - do_action('AHEE__EE_Config__construct__end', $this); |
|
224 | - // hardcoded hack |
|
225 | - $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
|
226 | - } |
|
227 | - |
|
228 | - |
|
229 | - /** |
|
230 | - * @return boolean |
|
231 | - */ |
|
232 | - public static function logging_enabled() |
|
233 | - { |
|
234 | - return self::$_logging_enabled; |
|
235 | - } |
|
236 | - |
|
237 | - |
|
238 | - /** |
|
239 | - * use to get the current theme if needed from static context |
|
240 | - * |
|
241 | - * @return string current theme set. |
|
242 | - */ |
|
243 | - public static function get_current_theme() |
|
244 | - { |
|
245 | - return self::$_instance->template_settings->current_espresso_theme ?? 'Espresso_Arabica_2014'; |
|
246 | - } |
|
247 | - |
|
248 | - |
|
249 | - /** |
|
250 | - * _initialize_config |
|
251 | - * |
|
252 | - * @access private |
|
253 | - * @return void |
|
254 | - */ |
|
255 | - private function _initialize_config() |
|
256 | - { |
|
257 | - EE_Config::trim_log(); |
|
258 | - // set defaults |
|
259 | - $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
260 | - $this->addons = new stdClass(); |
|
261 | - // set _module_route_map |
|
262 | - EE_Config::$_module_route_map = array(); |
|
263 | - // set _module_forward_map |
|
264 | - EE_Config::$_module_forward_map = array(); |
|
265 | - // set _module_view_map |
|
266 | - EE_Config::$_module_view_map = array(); |
|
267 | - } |
|
268 | - |
|
269 | - |
|
270 | - /** |
|
271 | - * load core plugin configuration |
|
272 | - * |
|
273 | - * @access private |
|
274 | - * @return void |
|
275 | - */ |
|
276 | - private function _load_core_config() |
|
277 | - { |
|
278 | - // load_core_config__start hook |
|
279 | - do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
280 | - $espresso_config = (array) $this->get_espresso_config(); |
|
281 | - // need to move the "addons" element to the end of the config array |
|
282 | - // in case an addon config references one of the other config classes |
|
283 | - $addons = $espresso_config['addons'] ?? new StdClass(); |
|
284 | - unset($espresso_config['addons']); |
|
285 | - $espresso_config['addons'] = $addons; |
|
286 | - foreach ($espresso_config as $config => $settings) { |
|
287 | - // load_core_config__start hook |
|
288 | - $settings = apply_filters( |
|
289 | - 'FHEE__EE_Config___load_core_config__config_settings', |
|
290 | - $settings, |
|
291 | - $config, |
|
292 | - $this |
|
293 | - ); |
|
294 | - if (is_object($settings) && property_exists($this, $config)) { |
|
295 | - $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__' . $config, $settings); |
|
296 | - // call configs populate method to ensure any defaults are set for empty values. |
|
297 | - if (method_exists($settings, 'populate')) { |
|
298 | - $this->{$config}->populate(); |
|
299 | - } |
|
300 | - if (method_exists($settings, 'do_hooks')) { |
|
301 | - $this->{$config}->do_hooks(); |
|
302 | - } |
|
303 | - } |
|
304 | - } |
|
305 | - if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
306 | - $this->update_espresso_config(); |
|
307 | - } |
|
308 | - // load_core_config__end hook |
|
309 | - do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
310 | - } |
|
311 | - |
|
312 | - |
|
313 | - /** |
|
314 | - * _verify_config |
|
315 | - * |
|
316 | - * @access protected |
|
317 | - * @return void |
|
318 | - */ |
|
319 | - protected function _verify_config() |
|
320 | - { |
|
321 | - $this->core = $this->core instanceof EE_Core_Config |
|
322 | - ? $this->core |
|
323 | - : new EE_Core_Config(); |
|
324 | - $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
325 | - $this->organization = $this->organization instanceof EE_Organization_Config |
|
326 | - ? $this->organization |
|
327 | - : new EE_Organization_Config(); |
|
328 | - $this->organization = apply_filters( |
|
329 | - 'FHEE__EE_Config___initialize_config__organization', |
|
330 | - $this->organization |
|
331 | - ); |
|
332 | - $this->currency = $this->currency instanceof EE_Currency_Config |
|
333 | - ? $this->currency |
|
334 | - : new EE_Currency_Config(); |
|
335 | - $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
336 | - $this->registration = $this->registration instanceof EE_Registration_Config |
|
337 | - ? $this->registration |
|
338 | - : new EE_Registration_Config(); |
|
339 | - $this->registration = apply_filters( |
|
340 | - 'FHEE__EE_Config___initialize_config__registration', |
|
341 | - $this->registration |
|
342 | - ); |
|
343 | - $this->admin = $this->admin instanceof EE_Admin_Config |
|
344 | - ? $this->admin |
|
345 | - : new EE_Admin_Config(); |
|
346 | - $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
347 | - $this->template_settings = $this->template_settings instanceof EE_Template_Config |
|
348 | - ? $this->template_settings |
|
349 | - : new EE_Template_Config(); |
|
350 | - $this->template_settings = apply_filters( |
|
351 | - 'FHEE__EE_Config___initialize_config__template_settings', |
|
352 | - $this->template_settings |
|
353 | - ); |
|
354 | - $this->map_settings = $this->map_settings instanceof EE_Map_Config |
|
355 | - ? $this->map_settings |
|
356 | - : new EE_Map_Config(); |
|
357 | - $this->map_settings = apply_filters( |
|
358 | - 'FHEE__EE_Config___initialize_config__map_settings', |
|
359 | - $this->map_settings |
|
360 | - ); |
|
361 | - $this->environment = $this->environment instanceof EE_Environment_Config |
|
362 | - ? $this->environment |
|
363 | - : new EE_Environment_Config(); |
|
364 | - $this->environment = apply_filters( |
|
365 | - 'FHEE__EE_Config___initialize_config__environment', |
|
366 | - $this->environment |
|
367 | - ); |
|
368 | - $this->tax_settings = $this->tax_settings instanceof EE_Tax_Config |
|
369 | - ? $this->tax_settings |
|
370 | - : new EE_Tax_Config(); |
|
371 | - $this->tax_settings = apply_filters( |
|
372 | - 'FHEE__EE_Config___initialize_config__tax_settings', |
|
373 | - $this->tax_settings |
|
374 | - ); |
|
375 | - $this->messages = apply_filters('FHEE__EE_Config__initialize_config__messages', $this->messages); |
|
376 | - $this->messages = $this->messages instanceof EE_Messages_Config |
|
377 | - ? $this->messages |
|
378 | - : new EE_Messages_Config(); |
|
379 | - $this->gateway = $this->gateway instanceof EE_Gateway_Config |
|
380 | - ? $this->gateway |
|
381 | - : new EE_Gateway_Config(); |
|
382 | - $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
383 | - $this->legacy_shortcodes_manager = null; |
|
384 | - } |
|
385 | - |
|
386 | - |
|
387 | - /** |
|
388 | - * get_espresso_config |
|
389 | - * |
|
390 | - * @access public |
|
391 | - * @return array of espresso config stuff |
|
392 | - */ |
|
393 | - public function get_espresso_config() |
|
394 | - { |
|
395 | - // grab espresso configuration |
|
396 | - return apply_filters( |
|
397 | - 'FHEE__EE_Config__get_espresso_config__CFG', |
|
398 | - get_option(EE_Config::OPTION_NAME, array()) |
|
399 | - ); |
|
400 | - } |
|
401 | - |
|
402 | - |
|
403 | - /** |
|
404 | - * double_check_config_comparison |
|
405 | - * |
|
406 | - * @access public |
|
407 | - * @param string $option |
|
408 | - * @param $old_value |
|
409 | - * @param $value |
|
410 | - */ |
|
411 | - public function double_check_config_comparison($option = '', $old_value, $value) |
|
412 | - { |
|
413 | - // make sure we're checking the ee config |
|
414 | - if ($option === EE_Config::OPTION_NAME) { |
|
415 | - // run a loose comparison of the old value against the new value for type and properties, |
|
416 | - // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
|
417 | - if ($value != $old_value) { |
|
418 | - // if they are NOT the same, then remove the hook, |
|
419 | - // which means the subsequent update results will be based solely on the update query results |
|
420 | - // the reason we do this is because, as stated above, |
|
421 | - // WP update_option performs an exact instance comparison (===) on any update values passed to it |
|
422 | - // this happens PRIOR to serialization and any subsequent update. |
|
423 | - // If values are found to match their previous old value, |
|
424 | - // then WP bails before performing any update. |
|
425 | - // Since we are passing the EE_Config object, it is comparing the EXACT instance of the saved version |
|
426 | - // it just pulled from the db, with the one being passed to it (which will not match). |
|
427 | - // HOWEVER, once the object is serialized and passed off to MySQL to update, |
|
428 | - // MySQL MAY ALSO NOT perform the update because |
|
429 | - // the string it sees in the db looks the same as the new one it has been passed!!! |
|
430 | - // This results in the query returning an "affected rows" value of ZERO, |
|
431 | - // which gets returned immediately by WP update_option and looks like an error. |
|
432 | - remove_action('update_option', array($this, 'check_config_updated')); |
|
433 | - } |
|
434 | - } |
|
435 | - } |
|
436 | - |
|
437 | - |
|
438 | - /** |
|
439 | - * update_espresso_config |
|
440 | - * |
|
441 | - * @access public |
|
442 | - */ |
|
443 | - protected function _reset_espresso_addon_config() |
|
444 | - { |
|
445 | - $this->_addon_option_names = array(); |
|
446 | - foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
447 | - $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
448 | - if ($addon_config_obj instanceof EE_Config_Base) { |
|
449 | - $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
450 | - } |
|
451 | - $this->addons->{$addon_name} = null; |
|
452 | - } |
|
453 | - } |
|
454 | - |
|
455 | - |
|
456 | - /** |
|
457 | - * update_espresso_config |
|
458 | - * |
|
459 | - * @access public |
|
460 | - * @param bool $add_success |
|
461 | - * @param bool $add_error |
|
462 | - * @return bool |
|
463 | - */ |
|
464 | - public function update_espresso_config($add_success = false, $add_error = true) |
|
465 | - { |
|
466 | - // don't allow config updates during WP heartbeats |
|
467 | - /** @var RequestInterface $request */ |
|
468 | - $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
469 | - if ($request->isWordPressHeartbeat()) { |
|
470 | - return false; |
|
471 | - } |
|
472 | - // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
|
473 | - // $clone = clone( self::$_instance ); |
|
474 | - // self::$_instance = NULL; |
|
475 | - do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
476 | - $this->_reset_espresso_addon_config(); |
|
477 | - // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
|
478 | - // but BEFORE the actual update occurs |
|
479 | - add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
480 | - // don't want to persist legacy_shortcodes_manager, but don't want to lose it either |
|
481 | - $legacy_shortcodes_manager = $this->legacy_shortcodes_manager; |
|
482 | - $this->legacy_shortcodes_manager = null; |
|
483 | - // now update "ee_config" |
|
484 | - $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
485 | - $this->legacy_shortcodes_manager = $legacy_shortcodes_manager; |
|
486 | - EE_Config::log(EE_Config::OPTION_NAME); |
|
487 | - // if not saved... check if the hook we just added still exists; |
|
488 | - // if it does, it means one of two things: |
|
489 | - // that update_option bailed at the($value === $old_value) conditional, |
|
490 | - // or... |
|
491 | - // the db update query returned 0 rows affected |
|
492 | - // (probably because the data value was the same from it's perspective) |
|
493 | - // so the existence of the hook means that a negative result from update_option is NOT an error, |
|
494 | - // but just means no update occurred, so don't display an error to the user. |
|
495 | - // BUT... if update_option returns FALSE, AND the hook is missing, |
|
496 | - // then it means that something truly went wrong |
|
497 | - $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
498 | - // remove our action since we don't want it in the system anymore |
|
499 | - remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
500 | - do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
501 | - // self::$_instance = $clone; |
|
502 | - // unset( $clone ); |
|
503 | - // if config remains the same or was updated successfully |
|
504 | - if ($saved) { |
|
505 | - if ($add_success) { |
|
506 | - EE_Error::add_success( |
|
507 | - esc_html__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
508 | - __FILE__, |
|
509 | - __FUNCTION__, |
|
510 | - __LINE__ |
|
511 | - ); |
|
512 | - } |
|
513 | - return true; |
|
514 | - } else { |
|
515 | - if ($add_error) { |
|
516 | - EE_Error::add_error( |
|
517 | - esc_html__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
518 | - __FILE__, |
|
519 | - __FUNCTION__, |
|
520 | - __LINE__ |
|
521 | - ); |
|
522 | - } |
|
523 | - return false; |
|
524 | - } |
|
525 | - } |
|
526 | - |
|
527 | - |
|
528 | - /** |
|
529 | - * _verify_config_params |
|
530 | - * |
|
531 | - * @access private |
|
532 | - * @param string $section |
|
533 | - * @param string $name |
|
534 | - * @param string $config_class |
|
535 | - * @param EE_Config_Base $config_obj |
|
536 | - * @param array $tests_to_run |
|
537 | - * @param bool $display_errors |
|
538 | - * @return bool TRUE on success, FALSE on fail |
|
539 | - */ |
|
540 | - private function _verify_config_params( |
|
541 | - $section = '', |
|
542 | - $name = '', |
|
543 | - $config_class = '', |
|
544 | - $config_obj = null, |
|
545 | - $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
546 | - $display_errors = true |
|
547 | - ) { |
|
548 | - try { |
|
549 | - foreach ($tests_to_run as $test) { |
|
550 | - switch ($test) { |
|
551 | - // TEST #1 : check that section was set |
|
552 | - case 1: |
|
553 | - if (empty($section)) { |
|
554 | - if ($display_errors) { |
|
555 | - throw new EE_Error( |
|
556 | - sprintf( |
|
557 | - esc_html__( |
|
558 | - 'No configuration section has been provided while attempting to save "%s".', |
|
559 | - 'event_espresso' |
|
560 | - ), |
|
561 | - $config_class |
|
562 | - ) |
|
563 | - ); |
|
564 | - } |
|
565 | - return false; |
|
566 | - } |
|
567 | - break; |
|
568 | - // TEST #2 : check that settings section exists |
|
569 | - case 2: |
|
570 | - if (! isset($this->{$section})) { |
|
571 | - if ($display_errors) { |
|
572 | - throw new EE_Error( |
|
573 | - sprintf( |
|
574 | - esc_html__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
575 | - $section |
|
576 | - ) |
|
577 | - ); |
|
578 | - } |
|
579 | - return false; |
|
580 | - } |
|
581 | - break; |
|
582 | - // TEST #3 : check that section is the proper format |
|
583 | - case 3: |
|
584 | - if ( |
|
585 | - ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
586 | - ) { |
|
587 | - if ($display_errors) { |
|
588 | - throw new EE_Error( |
|
589 | - sprintf( |
|
590 | - esc_html__( |
|
591 | - 'The "%s" configuration settings have not been formatted correctly.', |
|
592 | - 'event_espresso' |
|
593 | - ), |
|
594 | - $section |
|
595 | - ) |
|
596 | - ); |
|
597 | - } |
|
598 | - return false; |
|
599 | - } |
|
600 | - break; |
|
601 | - // TEST #4 : check that config section name has been set |
|
602 | - case 4: |
|
603 | - if (empty($name)) { |
|
604 | - if ($display_errors) { |
|
605 | - throw new EE_Error( |
|
606 | - esc_html__( |
|
607 | - 'No name has been provided for the specific configuration section.', |
|
608 | - 'event_espresso' |
|
609 | - ) |
|
610 | - ); |
|
611 | - } |
|
612 | - return false; |
|
613 | - } |
|
614 | - break; |
|
615 | - // TEST #5 : check that a config class name has been set |
|
616 | - case 5: |
|
617 | - if (empty($config_class)) { |
|
618 | - if ($display_errors) { |
|
619 | - throw new EE_Error( |
|
620 | - esc_html__( |
|
621 | - 'No class name has been provided for the specific configuration section.', |
|
622 | - 'event_espresso' |
|
623 | - ) |
|
624 | - ); |
|
625 | - } |
|
626 | - return false; |
|
627 | - } |
|
628 | - break; |
|
629 | - // TEST #6 : verify config class is accessible |
|
630 | - case 6: |
|
631 | - if (! class_exists($config_class)) { |
|
632 | - if ($display_errors) { |
|
633 | - throw new EE_Error( |
|
634 | - sprintf( |
|
635 | - esc_html__( |
|
636 | - 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', |
|
637 | - 'event_espresso' |
|
638 | - ), |
|
639 | - $config_class |
|
640 | - ) |
|
641 | - ); |
|
642 | - } |
|
643 | - return false; |
|
644 | - } |
|
645 | - break; |
|
646 | - // TEST #7 : check that config has even been set |
|
647 | - case 7: |
|
648 | - if (! isset($this->{$section}->{$name})) { |
|
649 | - if ($display_errors) { |
|
650 | - throw new EE_Error( |
|
651 | - sprintf( |
|
652 | - esc_html__('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
653 | - $section, |
|
654 | - $name |
|
655 | - ) |
|
656 | - ); |
|
657 | - } |
|
658 | - return false; |
|
659 | - } else { |
|
660 | - // and make sure it's not serialized |
|
661 | - $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name}); |
|
662 | - } |
|
663 | - break; |
|
664 | - // TEST #8 : check that config is the requested type |
|
665 | - case 8: |
|
666 | - if (! $this->{$section}->{$name} instanceof $config_class) { |
|
667 | - if ($display_errors) { |
|
668 | - throw new EE_Error( |
|
669 | - sprintf( |
|
670 | - esc_html__( |
|
671 | - 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', |
|
672 | - 'event_espresso' |
|
673 | - ), |
|
674 | - $section, |
|
675 | - $name, |
|
676 | - $config_class |
|
677 | - ) |
|
678 | - ); |
|
679 | - } |
|
680 | - return false; |
|
681 | - } |
|
682 | - break; |
|
683 | - // TEST #9 : verify config object |
|
684 | - case 9: |
|
685 | - if (! $config_obj instanceof EE_Config_Base) { |
|
686 | - if ($display_errors) { |
|
687 | - throw new EE_Error( |
|
688 | - sprintf( |
|
689 | - esc_html__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
690 | - print_r($config_obj, true) |
|
691 | - ) |
|
692 | - ); |
|
693 | - } |
|
694 | - return false; |
|
695 | - } |
|
696 | - break; |
|
697 | - } |
|
698 | - } |
|
699 | - } catch (EE_Error $e) { |
|
700 | - $e->get_error(); |
|
701 | - } |
|
702 | - // you have successfully run the gauntlet |
|
703 | - return true; |
|
704 | - } |
|
705 | - |
|
706 | - |
|
707 | - /** |
|
708 | - * _generate_config_option_name |
|
709 | - * |
|
710 | - * @access protected |
|
711 | - * @param string $section |
|
712 | - * @param string $name |
|
713 | - * @return string |
|
714 | - */ |
|
715 | - private function _generate_config_option_name($section = '', $name = '') |
|
716 | - { |
|
717 | - return 'ee_config-' . strtolower($section . '-' . str_replace(array('EE_', 'EED_'), '', $name)); |
|
718 | - } |
|
719 | - |
|
720 | - |
|
721 | - /** |
|
722 | - * _set_config_class |
|
723 | - * ensures that a config class is set, either from a passed config class or one generated from the config name |
|
724 | - * |
|
725 | - * @access private |
|
726 | - * @param string $config_class |
|
727 | - * @param string $name |
|
728 | - * @return string |
|
729 | - */ |
|
730 | - private function _set_config_class($config_class = '', $name = '') |
|
731 | - { |
|
732 | - return ! empty($config_class) |
|
733 | - ? $config_class |
|
734 | - : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))) . '_Config'; |
|
735 | - } |
|
736 | - |
|
737 | - |
|
738 | - /** |
|
739 | - * set_config |
|
740 | - * |
|
741 | - * @access protected |
|
742 | - * @param string $section |
|
743 | - * @param string $name |
|
744 | - * @param string $config_class |
|
745 | - * @param EE_Config_Base $config_obj |
|
746 | - * @return EE_Config_Base |
|
747 | - */ |
|
748 | - public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) |
|
749 | - { |
|
750 | - // ensure config class is set to something |
|
751 | - $config_class = $this->_set_config_class($config_class, $name); |
|
752 | - // run tests 1-4, 6, and 7 to verify all config params are set and valid |
|
753 | - if (! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
754 | - return null; |
|
755 | - } |
|
756 | - $config_option_name = $this->_generate_config_option_name($section, $name); |
|
757 | - // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
|
758 | - if (! isset($this->_addon_option_names[ $config_option_name ])) { |
|
759 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
760 | - $this->update_addon_option_names(); |
|
761 | - } |
|
762 | - // verify the incoming config object but suppress errors |
|
763 | - if (! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
764 | - $config_obj = new $config_class(); |
|
765 | - } |
|
766 | - if (get_option($config_option_name)) { |
|
767 | - EE_Config::log($config_option_name); |
|
768 | - update_option($config_option_name, $config_obj); |
|
769 | - $this->{$section}->{$name} = $config_obj; |
|
770 | - return $this->{$section}->{$name}; |
|
771 | - } else { |
|
772 | - // create a wp-option for this config |
|
773 | - if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
774 | - $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
775 | - return $this->{$section}->{$name}; |
|
776 | - } else { |
|
777 | - EE_Error::add_error( |
|
778 | - sprintf(esc_html__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
779 | - __FILE__, |
|
780 | - __FUNCTION__, |
|
781 | - __LINE__ |
|
782 | - ); |
|
783 | - return null; |
|
784 | - } |
|
785 | - } |
|
786 | - } |
|
787 | - |
|
788 | - |
|
789 | - /** |
|
790 | - * update_config |
|
791 | - * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
792 | - * |
|
793 | - * @access public |
|
794 | - * @param string $section |
|
795 | - * @param string $name |
|
796 | - * @param EE_Config_Base|string $config_obj |
|
797 | - * @param bool $throw_errors |
|
798 | - * @return bool |
|
799 | - */ |
|
800 | - public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) |
|
801 | - { |
|
802 | - // don't allow config updates during WP heartbeats |
|
803 | - /** @var RequestInterface $request */ |
|
804 | - $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
805 | - if ($request->isWordPressHeartbeat()) { |
|
806 | - return false; |
|
807 | - } |
|
808 | - $config_obj = maybe_unserialize($config_obj); |
|
809 | - // get class name of the incoming object |
|
810 | - $config_class = get_class($config_obj); |
|
811 | - // run tests 1-5 and 9 to verify config |
|
812 | - if ( |
|
813 | - ! $this->_verify_config_params( |
|
814 | - $section, |
|
815 | - $name, |
|
816 | - $config_class, |
|
817 | - $config_obj, |
|
818 | - array(1, 2, 3, 4, 7, 9) |
|
819 | - ) |
|
820 | - ) { |
|
821 | - return false; |
|
822 | - } |
|
823 | - $config_option_name = $this->_generate_config_option_name($section, $name); |
|
824 | - // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
|
825 | - if (! isset($this->_addon_option_names[ $config_option_name ])) { |
|
826 | - // save new config to db |
|
827 | - if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
828 | - return true; |
|
829 | - } |
|
830 | - } else { |
|
831 | - // first check if the record already exists |
|
832 | - $existing_config = get_option($config_option_name); |
|
833 | - $config_obj = serialize($config_obj); |
|
834 | - // just return if db record is already up to date (NOT type safe comparison) |
|
835 | - if ($existing_config == $config_obj) { |
|
836 | - $this->{$section}->{$name} = $config_obj; |
|
837 | - return true; |
|
838 | - } elseif (update_option($config_option_name, $config_obj)) { |
|
839 | - EE_Config::log($config_option_name); |
|
840 | - // update wp-option for this config class |
|
841 | - $this->{$section}->{$name} = $config_obj; |
|
842 | - return true; |
|
843 | - } elseif ($throw_errors) { |
|
844 | - EE_Error::add_error( |
|
845 | - sprintf( |
|
846 | - esc_html__( |
|
847 | - 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', |
|
848 | - 'event_espresso' |
|
849 | - ), |
|
850 | - $config_class, |
|
851 | - 'EE_Config->' . $section . '->' . $name |
|
852 | - ), |
|
853 | - __FILE__, |
|
854 | - __FUNCTION__, |
|
855 | - __LINE__ |
|
856 | - ); |
|
857 | - } |
|
858 | - } |
|
859 | - return false; |
|
860 | - } |
|
861 | - |
|
862 | - |
|
863 | - /** |
|
864 | - * get_config |
|
865 | - * |
|
866 | - * @access public |
|
867 | - * @param string $section |
|
868 | - * @param string $name |
|
869 | - * @param string $config_class |
|
870 | - * @return mixed EE_Config_Base | NULL |
|
871 | - */ |
|
872 | - public function get_config($section = '', $name = '', $config_class = '') |
|
873 | - { |
|
874 | - // ensure config class is set to something |
|
875 | - $config_class = $this->_set_config_class($config_class, $name); |
|
876 | - // run tests 1-4, 6 and 7 to verify that all params have been set |
|
877 | - if (! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
878 | - return null; |
|
879 | - } |
|
880 | - // now test if the requested config object exists, but suppress errors |
|
881 | - if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
882 | - // config already exists, so pass it back |
|
883 | - return $this->{$section}->{$name}; |
|
884 | - } |
|
885 | - // load config option from db if it exists |
|
886 | - $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
887 | - // verify the newly retrieved config object, but suppress errors |
|
888 | - if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
889 | - // config is good, so set it and pass it back |
|
890 | - $this->{$section}->{$name} = $config_obj; |
|
891 | - return $this->{$section}->{$name}; |
|
892 | - } |
|
893 | - // oops! $config_obj is not already set and does not exist in the db, so create a new one |
|
894 | - $config_obj = $this->set_config($section, $name, $config_class); |
|
895 | - // verify the newly created config object |
|
896 | - if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
897 | - return $this->{$section}->{$name}; |
|
898 | - } else { |
|
899 | - EE_Error::add_error( |
|
900 | - sprintf(esc_html__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
901 | - __FILE__, |
|
902 | - __FUNCTION__, |
|
903 | - __LINE__ |
|
904 | - ); |
|
905 | - } |
|
906 | - return null; |
|
907 | - } |
|
908 | - |
|
909 | - |
|
910 | - /** |
|
911 | - * get_config_option |
|
912 | - * |
|
913 | - * @access public |
|
914 | - * @param string $config_option_name |
|
915 | - * @return mixed EE_Config_Base | FALSE |
|
916 | - */ |
|
917 | - public function get_config_option($config_option_name = '') |
|
918 | - { |
|
919 | - // retrieve the wp-option for this config class. |
|
920 | - $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
921 | - if (empty($config_option)) { |
|
922 | - EE_Config::log($config_option_name . '-NOT-FOUND'); |
|
923 | - } |
|
924 | - return $config_option; |
|
925 | - } |
|
926 | - |
|
927 | - |
|
928 | - /** |
|
929 | - * log |
|
930 | - * |
|
931 | - * @param string $config_option_name |
|
932 | - */ |
|
933 | - public static function log($config_option_name = '') |
|
934 | - { |
|
935 | - if (EE_Config::logging_enabled() && ! empty($config_option_name)) { |
|
936 | - $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
937 | - /** @var RequestParams $request */ |
|
938 | - $request = LoaderFactory::getLoader()->getShared(RequestParams::class); |
|
939 | - $config_log[ (string) microtime(true) ] = array( |
|
940 | - 'config_name' => $config_option_name, |
|
941 | - 'request' => $request->requestParams(), |
|
942 | - ); |
|
943 | - update_option(EE_Config::LOG_NAME, $config_log); |
|
944 | - } |
|
945 | - } |
|
946 | - |
|
947 | - |
|
948 | - /** |
|
949 | - * trim_log |
|
950 | - * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
|
951 | - */ |
|
952 | - public static function trim_log() |
|
953 | - { |
|
954 | - if (! EE_Config::logging_enabled()) { |
|
955 | - return; |
|
956 | - } |
|
957 | - $config_log = maybe_unserialize(get_option(EE_Config::LOG_NAME, array())); |
|
958 | - $log_length = count($config_log); |
|
959 | - if ($log_length > EE_Config::LOG_LENGTH) { |
|
960 | - ksort($config_log); |
|
961 | - $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
962 | - update_option(EE_Config::LOG_NAME, $config_log); |
|
963 | - } |
|
964 | - } |
|
965 | - |
|
966 | - |
|
967 | - /** |
|
968 | - * get_page_for_posts |
|
969 | - * if the wp-option "show_on_front" is set to "page", then this is the post_name for the post set in the |
|
970 | - * wp-option "page_for_posts", or "posts" if no page is selected |
|
971 | - * |
|
972 | - * @access public |
|
973 | - * @return string |
|
974 | - */ |
|
975 | - public static function get_page_for_posts() |
|
976 | - { |
|
977 | - $page_for_posts = get_option('page_for_posts'); |
|
978 | - if (! $page_for_posts) { |
|
979 | - return 'posts'; |
|
980 | - } |
|
981 | - global $wpdb; |
|
982 | - $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
|
983 | - return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
984 | - } |
|
985 | - |
|
986 | - |
|
987 | - /** |
|
988 | - * register_shortcodes_and_modules. |
|
989 | - * At this point, it's too early to tell if we're maintenance mode or not. |
|
990 | - * In fact, this is where we give modules a chance to let core know they exist |
|
991 | - * so they can help trigger maintenance mode if it's needed |
|
992 | - * |
|
993 | - * @access public |
|
994 | - * @return void |
|
995 | - */ |
|
996 | - public function register_shortcodes_and_modules() |
|
997 | - { |
|
998 | - // allow modules to set hooks for the rest of the system |
|
999 | - EE_Registry::instance()->modules = $this->_register_modules(); |
|
1000 | - } |
|
1001 | - |
|
1002 | - |
|
1003 | - /** |
|
1004 | - * initialize_shortcodes_and_modules |
|
1005 | - * meaning they can start adding their hooks to get stuff done |
|
1006 | - * |
|
1007 | - * @access public |
|
1008 | - * @return void |
|
1009 | - */ |
|
1010 | - public function initialize_shortcodes_and_modules() |
|
1011 | - { |
|
1012 | - // allow modules to set hooks for the rest of the system |
|
1013 | - $this->_initialize_modules(); |
|
1014 | - } |
|
1015 | - |
|
1016 | - |
|
1017 | - /** |
|
1018 | - * widgets_init |
|
1019 | - * |
|
1020 | - * @access private |
|
1021 | - * @return void |
|
1022 | - */ |
|
1023 | - public function widgets_init() |
|
1024 | - { |
|
1025 | - // only init widgets on admin pages when not in complete maintenance, and |
|
1026 | - // on frontend when not in any maintenance mode |
|
1027 | - if ( |
|
1028 | - ! EE_Maintenance_Mode::instance()->level() |
|
1029 | - || ( |
|
1030 | - is_admin() |
|
1031 | - && EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance |
|
1032 | - ) |
|
1033 | - ) { |
|
1034 | - // grab list of installed widgets |
|
1035 | - $widgets_to_register = glob(EE_WIDGETS . '*', GLOB_ONLYDIR); |
|
1036 | - // filter list of modules to register |
|
1037 | - $widgets_to_register = apply_filters( |
|
1038 | - 'FHEE__EE_Config__register_widgets__widgets_to_register', |
|
1039 | - $widgets_to_register |
|
1040 | - ); |
|
1041 | - if (! empty($widgets_to_register)) { |
|
1042 | - // cycle thru widget folders |
|
1043 | - foreach ($widgets_to_register as $widget_path) { |
|
1044 | - // add to list of installed widget modules |
|
1045 | - EE_Config::register_ee_widget($widget_path); |
|
1046 | - } |
|
1047 | - } |
|
1048 | - // filter list of installed modules |
|
1049 | - EE_Registry::instance()->widgets = apply_filters( |
|
1050 | - 'FHEE__EE_Config__register_widgets__installed_widgets', |
|
1051 | - EE_Registry::instance()->widgets |
|
1052 | - ); |
|
1053 | - } |
|
1054 | - } |
|
1055 | - |
|
1056 | - |
|
1057 | - /** |
|
1058 | - * register_ee_widget - makes core aware of this widget |
|
1059 | - * |
|
1060 | - * @access public |
|
1061 | - * @param string $widget_path - full path up to and including widget folder |
|
1062 | - * @return void |
|
1063 | - */ |
|
1064 | - public static function register_ee_widget($widget_path = null) |
|
1065 | - { |
|
1066 | - do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
1067 | - $widget_ext = '.widget.php'; |
|
1068 | - // make all separators match |
|
1069 | - $widget_path = rtrim(str_replace('\\', DS, $widget_path), DS); |
|
1070 | - // does the file path INCLUDE the actual file name as part of the path ? |
|
1071 | - if (strpos($widget_path, $widget_ext) !== false) { |
|
1072 | - // grab and shortcode file name from directory name and break apart at dots |
|
1073 | - $file_name = explode('.', basename($widget_path)); |
|
1074 | - // take first segment from file name pieces and remove class prefix if it exists |
|
1075 | - $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1076 | - // sanitize shortcode directory name |
|
1077 | - $widget = sanitize_key($widget); |
|
1078 | - // now we need to rebuild the shortcode path |
|
1079 | - $widget_path = explode('/', $widget_path); |
|
1080 | - // remove last segment |
|
1081 | - array_pop($widget_path); |
|
1082 | - // glue it back together |
|
1083 | - $widget_path = implode(DS, $widget_path); |
|
1084 | - } else { |
|
1085 | - // grab and sanitize widget directory name |
|
1086 | - $widget = sanitize_key(basename($widget_path)); |
|
1087 | - } |
|
1088 | - // create classname from widget directory name |
|
1089 | - $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1090 | - // add class prefix |
|
1091 | - $widget_class = 'EEW_' . $widget; |
|
1092 | - // does the widget exist ? |
|
1093 | - if (! is_readable($widget_path . '/' . $widget_class . $widget_ext)) { |
|
1094 | - $msg = sprintf( |
|
1095 | - esc_html__( |
|
1096 | - 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
|
1097 | - 'event_espresso' |
|
1098 | - ), |
|
1099 | - $widget_class, |
|
1100 | - $widget_path . '/' . $widget_class . $widget_ext |
|
1101 | - ); |
|
1102 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1103 | - return; |
|
1104 | - } |
|
1105 | - // load the widget class file |
|
1106 | - require_once($widget_path . '/' . $widget_class . $widget_ext); |
|
1107 | - // verify that class exists |
|
1108 | - if (! class_exists($widget_class)) { |
|
1109 | - $msg = sprintf(esc_html__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1110 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1111 | - return; |
|
1112 | - } |
|
1113 | - register_widget($widget_class); |
|
1114 | - // add to array of registered widgets |
|
1115 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . '/' . $widget_class . $widget_ext; |
|
1116 | - } |
|
1117 | - |
|
1118 | - |
|
1119 | - /** |
|
1120 | - * _register_modules |
|
1121 | - * |
|
1122 | - * @access private |
|
1123 | - * @return array |
|
1124 | - */ |
|
1125 | - private function _register_modules() |
|
1126 | - { |
|
1127 | - // grab list of installed modules |
|
1128 | - $modules_to_register = glob(EE_MODULES . '*', GLOB_ONLYDIR); |
|
1129 | - // filter list of modules to register |
|
1130 | - $modules_to_register = apply_filters( |
|
1131 | - 'FHEE__EE_Config__register_modules__modules_to_register', |
|
1132 | - $modules_to_register |
|
1133 | - ); |
|
1134 | - if (! empty($modules_to_register)) { |
|
1135 | - // loop through folders |
|
1136 | - foreach ($modules_to_register as $module_path) { |
|
1137 | - /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
|
1138 | - if ( |
|
1139 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1140 | - && $module_path !== EE_MODULES . 'gateways' |
|
1141 | - ) { |
|
1142 | - // add to list of installed modules |
|
1143 | - EE_Config::register_module($module_path); |
|
1144 | - } |
|
1145 | - } |
|
1146 | - } |
|
1147 | - // filter list of installed modules |
|
1148 | - return apply_filters( |
|
1149 | - 'FHEE__EE_Config___register_modules__installed_modules', |
|
1150 | - EE_Registry::instance()->modules |
|
1151 | - ); |
|
1152 | - } |
|
1153 | - |
|
1154 | - |
|
1155 | - /** |
|
1156 | - * register_module - makes core aware of this module |
|
1157 | - * |
|
1158 | - * @access public |
|
1159 | - * @param string $module_path - full path up to and including module folder |
|
1160 | - * @return bool |
|
1161 | - */ |
|
1162 | - public static function register_module($module_path = null) |
|
1163 | - { |
|
1164 | - do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1165 | - $module_ext = '.module.php'; |
|
1166 | - // make all separators match |
|
1167 | - $module_path = str_replace(array('\\', '/'), '/', $module_path); |
|
1168 | - // does the file path INCLUDE the actual file name as part of the path ? |
|
1169 | - if (strpos($module_path, $module_ext) !== false) { |
|
1170 | - // grab and shortcode file name from directory name and break apart at dots |
|
1171 | - $module_file = explode('.', basename($module_path)); |
|
1172 | - // now we need to rebuild the shortcode path |
|
1173 | - $module_path = explode('/', $module_path); |
|
1174 | - // remove last segment |
|
1175 | - array_pop($module_path); |
|
1176 | - // glue it back together |
|
1177 | - $module_path = implode('/', $module_path) . '/'; |
|
1178 | - // take first segment from file name pieces and sanitize it |
|
1179 | - $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1180 | - // ensure class prefix is added |
|
1181 | - $module_class = strpos($module, 'EED_') !== 0 ? 'EED_' . $module : $module; |
|
1182 | - } else { |
|
1183 | - // we need to generate the filename based off of the folder name |
|
1184 | - // grab and sanitize module name |
|
1185 | - $module = strtolower(basename($module_path)); |
|
1186 | - $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1187 | - // like trailingslashit() |
|
1188 | - $module_path = rtrim($module_path, '/') . '/'; |
|
1189 | - // create classname from module directory name |
|
1190 | - $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1191 | - // add class prefix |
|
1192 | - $module_class = 'EED_' . $module; |
|
1193 | - } |
|
1194 | - // does the module exist ? |
|
1195 | - if (! is_readable($module_path . '/' . $module_class . $module_ext)) { |
|
1196 | - $msg = sprintf( |
|
1197 | - esc_html__( |
|
1198 | - 'The requested %s module file could not be found or is not readable due to file permissions.', |
|
1199 | - 'event_espresso' |
|
1200 | - ), |
|
1201 | - $module |
|
1202 | - ); |
|
1203 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1204 | - return false; |
|
1205 | - } |
|
1206 | - // load the module class file |
|
1207 | - require_once($module_path . $module_class . $module_ext); |
|
1208 | - // verify that class exists |
|
1209 | - if (! class_exists($module_class)) { |
|
1210 | - $msg = sprintf(esc_html__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1211 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1212 | - return false; |
|
1213 | - } |
|
1214 | - // add to array of registered modules |
|
1215 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1216 | - do_action( |
|
1217 | - 'AHEE__EE_Config__register_module__complete', |
|
1218 | - $module_class, |
|
1219 | - EE_Registry::instance()->modules->{$module_class} |
|
1220 | - ); |
|
1221 | - return true; |
|
1222 | - } |
|
1223 | - |
|
1224 | - |
|
1225 | - /** |
|
1226 | - * _initialize_modules |
|
1227 | - * allow modules to set hooks for the rest of the system |
|
1228 | - * |
|
1229 | - * @access private |
|
1230 | - * @return void |
|
1231 | - */ |
|
1232 | - private function _initialize_modules() |
|
1233 | - { |
|
1234 | - // cycle thru shortcode folders |
|
1235 | - foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1236 | - // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
|
1237 | - // which set hooks ? |
|
1238 | - if (is_admin()) { |
|
1239 | - // fire immediately |
|
1240 | - call_user_func(array($module_class, 'set_hooks_admin')); |
|
1241 | - } else { |
|
1242 | - // delay until other systems are online |
|
1243 | - add_action( |
|
1244 | - 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
|
1245 | - array($module_class, 'set_hooks') |
|
1246 | - ); |
|
1247 | - } |
|
1248 | - } |
|
1249 | - } |
|
1250 | - |
|
1251 | - |
|
1252 | - /** |
|
1253 | - * register_route - adds module method routes to route_map |
|
1254 | - * |
|
1255 | - * @access public |
|
1256 | - * @param string $route - "pretty" public alias for module method |
|
1257 | - * @param string $module - module name (classname without EED_ prefix) |
|
1258 | - * @param string $method_name - the actual module method to be routed to |
|
1259 | - * @param string $key - url param key indicating a route is being called |
|
1260 | - * @return bool |
|
1261 | - */ |
|
1262 | - public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') |
|
1263 | - { |
|
1264 | - do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1265 | - $module = str_replace('EED_', '', $module); |
|
1266 | - $module_class = 'EED_' . $module; |
|
1267 | - if (! isset(EE_Registry::instance()->modules->{$module_class})) { |
|
1268 | - $msg = sprintf(esc_html__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1269 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1270 | - return false; |
|
1271 | - } |
|
1272 | - if (empty($route)) { |
|
1273 | - $msg = sprintf(esc_html__('No route has been supplied.', 'event_espresso'), $route); |
|
1274 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1275 | - return false; |
|
1276 | - } |
|
1277 | - if (! method_exists('EED_' . $module, $method_name)) { |
|
1278 | - $msg = sprintf( |
|
1279 | - esc_html__('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1280 | - $route |
|
1281 | - ); |
|
1282 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1283 | - return false; |
|
1284 | - } |
|
1285 | - EE_Config::$_module_route_map[ (string) $key ][ (string) $route ] = array('EED_' . $module, $method_name); |
|
1286 | - return true; |
|
1287 | - } |
|
1288 | - |
|
1289 | - |
|
1290 | - /** |
|
1291 | - * get_route - get module method route |
|
1292 | - * |
|
1293 | - * @access public |
|
1294 | - * @param string $route - "pretty" public alias for module method |
|
1295 | - * @param string $key - url param key indicating a route is being called |
|
1296 | - * @return string |
|
1297 | - */ |
|
1298 | - public static function get_route($route = null, $key = 'ee') |
|
1299 | - { |
|
1300 | - do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1301 | - $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1302 | - if (isset(EE_Config::$_module_route_map[ $key ][ $route ])) { |
|
1303 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1304 | - } |
|
1305 | - return null; |
|
1306 | - } |
|
1307 | - |
|
1308 | - |
|
1309 | - /** |
|
1310 | - * get_routes - get ALL module method routes |
|
1311 | - * |
|
1312 | - * @access public |
|
1313 | - * @return array |
|
1314 | - */ |
|
1315 | - public static function get_routes() |
|
1316 | - { |
|
1317 | - return EE_Config::$_module_route_map; |
|
1318 | - } |
|
1319 | - |
|
1320 | - |
|
1321 | - /** |
|
1322 | - * register_forward - allows modules to forward request to another module for further processing |
|
1323 | - * |
|
1324 | - * @access public |
|
1325 | - * @param string $route - "pretty" public alias for module method |
|
1326 | - * @param integer $status - integer value corresponding to status constant strings set in module parent |
|
1327 | - * class, allows different forwards to be served based on status |
|
1328 | - * @param array|string $forward - function name or array( class, method ) |
|
1329 | - * @param string $key - url param key indicating a route is being called |
|
1330 | - * @return bool |
|
1331 | - */ |
|
1332 | - public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') |
|
1333 | - { |
|
1334 | - do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1335 | - if (! isset(EE_Config::$_module_route_map[ $key ][ $route ]) || empty($route)) { |
|
1336 | - $msg = sprintf( |
|
1337 | - esc_html__('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1338 | - $route |
|
1339 | - ); |
|
1340 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1341 | - return false; |
|
1342 | - } |
|
1343 | - if (empty($forward)) { |
|
1344 | - $msg = sprintf(esc_html__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1345 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1346 | - return false; |
|
1347 | - } |
|
1348 | - if (is_array($forward)) { |
|
1349 | - if (! isset($forward[1])) { |
|
1350 | - $msg = sprintf( |
|
1351 | - esc_html__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1352 | - $route |
|
1353 | - ); |
|
1354 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1355 | - return false; |
|
1356 | - } |
|
1357 | - if (! method_exists($forward[0], $forward[1])) { |
|
1358 | - $msg = sprintf( |
|
1359 | - esc_html__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1360 | - $forward[1], |
|
1361 | - $route |
|
1362 | - ); |
|
1363 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1364 | - return false; |
|
1365 | - } |
|
1366 | - } elseif (! function_exists($forward)) { |
|
1367 | - $msg = sprintf( |
|
1368 | - esc_html__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1369 | - $forward, |
|
1370 | - $route |
|
1371 | - ); |
|
1372 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1373 | - return false; |
|
1374 | - } |
|
1375 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint($status) ] = $forward; |
|
1376 | - return true; |
|
1377 | - } |
|
1378 | - |
|
1379 | - |
|
1380 | - /** |
|
1381 | - * get_forward - get forwarding route |
|
1382 | - * |
|
1383 | - * @access public |
|
1384 | - * @param string $route - "pretty" public alias for module method |
|
1385 | - * @param integer $status - integer value corresponding to status constant strings set in module parent class, |
|
1386 | - * allows different forwards to be served based on status |
|
1387 | - * @param string $key - url param key indicating a route is being called |
|
1388 | - * @return string |
|
1389 | - */ |
|
1390 | - public static function get_forward($route = null, $status = 0, $key = 'ee') |
|
1391 | - { |
|
1392 | - do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1393 | - if (isset(EE_Config::$_module_forward_map[ $key ][ $route ][ $status ])) { |
|
1394 | - return apply_filters( |
|
1395 | - 'FHEE__EE_Config__get_forward', |
|
1396 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1397 | - $route, |
|
1398 | - $status |
|
1399 | - ); |
|
1400 | - } |
|
1401 | - return null; |
|
1402 | - } |
|
1403 | - |
|
1404 | - |
|
1405 | - /** |
|
1406 | - * register_forward - allows modules to specify different view templates for different method routes and status |
|
1407 | - * results |
|
1408 | - * |
|
1409 | - * @access public |
|
1410 | - * @param string $route - "pretty" public alias for module method |
|
1411 | - * @param integer $status - integer value corresponding to status constant strings set in module parent class, |
|
1412 | - * allows different views to be served based on status |
|
1413 | - * @param string $view |
|
1414 | - * @param string $key - url param key indicating a route is being called |
|
1415 | - * @return bool |
|
1416 | - */ |
|
1417 | - public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') |
|
1418 | - { |
|
1419 | - do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1420 | - if (! isset(EE_Config::$_module_route_map[ $key ][ $route ]) || empty($route)) { |
|
1421 | - $msg = sprintf( |
|
1422 | - esc_html__('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1423 | - $route |
|
1424 | - ); |
|
1425 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1426 | - return false; |
|
1427 | - } |
|
1428 | - if (! is_readable($view)) { |
|
1429 | - $msg = sprintf( |
|
1430 | - esc_html__( |
|
1431 | - 'The %s view file could not be found or is not readable due to file permissions.', |
|
1432 | - 'event_espresso' |
|
1433 | - ), |
|
1434 | - $view |
|
1435 | - ); |
|
1436 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1437 | - return false; |
|
1438 | - } |
|
1439 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint($status) ] = $view; |
|
1440 | - return true; |
|
1441 | - } |
|
1442 | - |
|
1443 | - |
|
1444 | - /** |
|
1445 | - * get_view - get view for route and status |
|
1446 | - * |
|
1447 | - * @access public |
|
1448 | - * @param string $route - "pretty" public alias for module method |
|
1449 | - * @param integer $status - integer value corresponding to status constant strings set in module parent class, |
|
1450 | - * allows different views to be served based on status |
|
1451 | - * @param string $key - url param key indicating a route is being called |
|
1452 | - * @return string |
|
1453 | - */ |
|
1454 | - public static function get_view($route = null, $status = 0, $key = 'ee') |
|
1455 | - { |
|
1456 | - do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1457 | - if (isset(EE_Config::$_module_view_map[ $key ][ $route ][ $status ])) { |
|
1458 | - return apply_filters( |
|
1459 | - 'FHEE__EE_Config__get_view', |
|
1460 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1461 | - $route, |
|
1462 | - $status |
|
1463 | - ); |
|
1464 | - } |
|
1465 | - return null; |
|
1466 | - } |
|
1467 | - |
|
1468 | - |
|
1469 | - public function update_addon_option_names() |
|
1470 | - { |
|
1471 | - update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1472 | - } |
|
1473 | - |
|
1474 | - |
|
1475 | - public function shutdown() |
|
1476 | - { |
|
1477 | - $this->update_addon_option_names(); |
|
1478 | - } |
|
1479 | - |
|
1480 | - |
|
1481 | - /** |
|
1482 | - * @return LegacyShortcodesManager |
|
1483 | - */ |
|
1484 | - public static function getLegacyShortcodesManager() |
|
1485 | - { |
|
1486 | - if (! EE_Config::instance()->legacy_shortcodes_manager instanceof LegacyShortcodesManager) { |
|
1487 | - EE_Config::instance()->legacy_shortcodes_manager = LoaderFactory::getLoader()->getShared( |
|
1488 | - LegacyShortcodesManager::class |
|
1489 | - ); |
|
1490 | - } |
|
1491 | - return EE_Config::instance()->legacy_shortcodes_manager; |
|
1492 | - } |
|
1493 | - |
|
1494 | - |
|
1495 | - /** |
|
1496 | - * register_shortcode - makes core aware of this shortcode |
|
1497 | - * |
|
1498 | - * @deprecated 4.9.26 |
|
1499 | - * @param string $shortcode_path - full path up to and including shortcode folder |
|
1500 | - * @return bool |
|
1501 | - */ |
|
1502 | - public static function register_shortcode($shortcode_path = null) |
|
1503 | - { |
|
1504 | - EE_Error::doing_it_wrong( |
|
1505 | - __METHOD__, |
|
1506 | - esc_html__( |
|
1507 | - 'Usage is deprecated. Use \EventEspresso\core\services\shortcodes\LegacyShortcodesManager::registerShortcode() as direct replacement, or better yet, please see the new \EventEspresso\core\services\shortcodes\ShortcodesManager class.', |
|
1508 | - 'event_espresso' |
|
1509 | - ), |
|
1510 | - '4.9.26' |
|
1511 | - ); |
|
1512 | - return EE_Config::instance()->getLegacyShortcodesManager()->registerShortcode($shortcode_path); |
|
1513 | - } |
|
1514 | -} |
|
1515 | - |
|
1516 | -/** |
|
1517 | - * Base class used for config classes. These classes should generally not have |
|
1518 | - * magic functions in use, except we'll allow them to magically set and get stuff... |
|
1519 | - * basically, they should just be well-defined stdClasses |
|
1520 | - */ |
|
1521 | -class EE_Config_Base |
|
1522 | -{ |
|
1523 | - /** |
|
1524 | - * Utility function for escaping the value of a property and returning. |
|
1525 | - * |
|
1526 | - * @param string $property property name (checks to see if exists). |
|
1527 | - * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
|
1528 | - * @throws EE_Error |
|
1529 | - */ |
|
1530 | - public function get_pretty($property) |
|
1531 | - { |
|
1532 | - if (! property_exists($this, $property)) { |
|
1533 | - throw new EE_Error( |
|
1534 | - sprintf( |
|
1535 | - esc_html__( |
|
1536 | - '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
|
1537 | - 'event_espresso' |
|
1538 | - ), |
|
1539 | - get_class($this), |
|
1540 | - $property |
|
1541 | - ) |
|
1542 | - ); |
|
1543 | - } |
|
1544 | - // just handling escaping of strings for now. |
|
1545 | - if (is_string($this->{$property})) { |
|
1546 | - return stripslashes($this->{$property}); |
|
1547 | - } |
|
1548 | - return $this->{$property}; |
|
1549 | - } |
|
1550 | - |
|
1551 | - |
|
1552 | - public function populate() |
|
1553 | - { |
|
1554 | - // grab defaults via a new instance of this class. |
|
1555 | - $class_name = get_class($this); |
|
1556 | - $defaults = new $class_name(); |
|
1557 | - // loop through the properties for this class and see if they are set. If they are NOT, then grab the |
|
1558 | - // default from our $defaults object. |
|
1559 | - foreach (get_object_vars($defaults) as $property => $value) { |
|
1560 | - if ($this->{$property} === null) { |
|
1561 | - $this->{$property} = $value; |
|
1562 | - } |
|
1563 | - } |
|
1564 | - // cleanup |
|
1565 | - unset($defaults); |
|
1566 | - } |
|
1567 | - |
|
1568 | - |
|
1569 | - /** |
|
1570 | - * __isset |
|
1571 | - * |
|
1572 | - * @param $a |
|
1573 | - * @return bool |
|
1574 | - */ |
|
1575 | - public function __isset($a) |
|
1576 | - { |
|
1577 | - return false; |
|
1578 | - } |
|
1579 | - |
|
1580 | - |
|
1581 | - /** |
|
1582 | - * __unset |
|
1583 | - * |
|
1584 | - * @param $a |
|
1585 | - * @return bool |
|
1586 | - */ |
|
1587 | - public function __unset($a) |
|
1588 | - { |
|
1589 | - return false; |
|
1590 | - } |
|
1591 | - |
|
1592 | - |
|
1593 | - /** |
|
1594 | - * __clone |
|
1595 | - */ |
|
1596 | - public function __clone() |
|
1597 | - { |
|
1598 | - } |
|
1599 | - |
|
1600 | - |
|
1601 | - /** |
|
1602 | - * __wakeup |
|
1603 | - */ |
|
1604 | - public function __wakeup() |
|
1605 | - { |
|
1606 | - } |
|
1607 | - |
|
1608 | - |
|
1609 | - /** |
|
1610 | - * __destruct |
|
1611 | - */ |
|
1612 | - public function __destruct() |
|
1613 | - { |
|
1614 | - } |
|
1615 | -} |
|
1616 | - |
|
1617 | -/** |
|
1618 | - * Class for defining what's in the EE_Config relating to registration settings |
|
1619 | - */ |
|
1620 | -class EE_Core_Config extends EE_Config_Base |
|
1621 | -{ |
|
1622 | - const OPTION_NAME_UXIP = 'ee_ueip_optin'; |
|
1623 | - |
|
1624 | - |
|
1625 | - public $current_blog_id; |
|
1626 | - |
|
1627 | - public $ee_ueip_optin; |
|
1628 | - |
|
1629 | - public $ee_ueip_has_notified; |
|
1630 | - |
|
1631 | - /** |
|
1632 | - * Not to be confused with the 4 critical page variables (See |
|
1633 | - * get_critical_pages_array()), this is just an array of wp posts that have EE |
|
1634 | - * shortcodes in them. Keys are slugs, values are arrays with only 1 element: where the key is the shortcode |
|
1635 | - * in the page, and the value is the page's ID. The key 'posts' is basically a duplicate of this same array. |
|
1636 | - * |
|
1637 | - * @var array |
|
1638 | - */ |
|
1639 | - public $post_shortcodes; |
|
1640 | - |
|
1641 | - public $module_route_map; |
|
1642 | - |
|
1643 | - public $module_forward_map; |
|
1644 | - |
|
1645 | - public $module_view_map; |
|
1646 | - |
|
1647 | - /** |
|
1648 | - * The next 4 vars are the IDs of critical EE pages. |
|
1649 | - * |
|
1650 | - * @var int |
|
1651 | - */ |
|
1652 | - public $reg_page_id; |
|
1653 | - |
|
1654 | - public $txn_page_id; |
|
1655 | - |
|
1656 | - public $thank_you_page_id; |
|
1657 | - |
|
1658 | - public $cancel_page_id; |
|
1659 | - |
|
1660 | - /** |
|
1661 | - * The next 4 vars are the URLs of critical EE pages. |
|
1662 | - * |
|
1663 | - * @var int |
|
1664 | - */ |
|
1665 | - public $reg_page_url; |
|
1666 | - |
|
1667 | - public $txn_page_url; |
|
1668 | - |
|
1669 | - public $thank_you_page_url; |
|
1670 | - |
|
1671 | - public $cancel_page_url; |
|
1672 | - |
|
1673 | - /** |
|
1674 | - * The next vars relate to the custom slugs for EE CPT routes |
|
1675 | - */ |
|
1676 | - public $event_cpt_slug; |
|
1677 | - |
|
1678 | - /** |
|
1679 | - * This caches the _ee_ueip_option in case this config is reset in the same |
|
1680 | - * request across blog switches in a multisite context. |
|
1681 | - * Avoids extra queries to the db for this option. |
|
1682 | - * |
|
1683 | - * @var bool |
|
1684 | - */ |
|
1685 | - public static $ee_ueip_option; |
|
1686 | - |
|
1687 | - |
|
1688 | - /** |
|
1689 | - * class constructor |
|
1690 | - * |
|
1691 | - * @access public |
|
1692 | - */ |
|
1693 | - public function __construct() |
|
1694 | - { |
|
1695 | - // set default organization settings |
|
1696 | - $this->current_blog_id = get_current_blog_id(); |
|
1697 | - $this->current_blog_id = $this->current_blog_id === null ? 1 : $this->current_blog_id; |
|
1698 | - $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
|
1699 | - $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1700 | - $this->post_shortcodes = array(); |
|
1701 | - $this->module_route_map = array(); |
|
1702 | - $this->module_forward_map = array(); |
|
1703 | - $this->module_view_map = array(); |
|
1704 | - // critical EE page IDs |
|
1705 | - $this->reg_page_id = 0; |
|
1706 | - $this->txn_page_id = 0; |
|
1707 | - $this->thank_you_page_id = 0; |
|
1708 | - $this->cancel_page_id = 0; |
|
1709 | - // critical EE page URLs |
|
1710 | - $this->reg_page_url = ''; |
|
1711 | - $this->txn_page_url = ''; |
|
1712 | - $this->thank_you_page_url = ''; |
|
1713 | - $this->cancel_page_url = ''; |
|
1714 | - // cpt slugs |
|
1715 | - $this->event_cpt_slug = esc_html__('events', 'event_espresso'); |
|
1716 | - // ueip constant check |
|
1717 | - if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1718 | - $this->ee_ueip_optin = false; |
|
1719 | - $this->ee_ueip_has_notified = true; |
|
1720 | - } |
|
1721 | - } |
|
1722 | - |
|
1723 | - |
|
1724 | - /** |
|
1725 | - * @return array |
|
1726 | - */ |
|
1727 | - public function get_critical_pages_array() |
|
1728 | - { |
|
1729 | - return array( |
|
1730 | - $this->reg_page_id, |
|
1731 | - $this->txn_page_id, |
|
1732 | - $this->thank_you_page_id, |
|
1733 | - $this->cancel_page_id, |
|
1734 | - ); |
|
1735 | - } |
|
1736 | - |
|
1737 | - |
|
1738 | - /** |
|
1739 | - * @return array |
|
1740 | - */ |
|
1741 | - public function get_critical_pages_shortcodes_array() |
|
1742 | - { |
|
1743 | - return array( |
|
1744 | - $this->reg_page_id => 'ESPRESSO_CHECKOUT', |
|
1745 | - $this->txn_page_id => 'ESPRESSO_TXN_PAGE', |
|
1746 | - $this->thank_you_page_id => 'ESPRESSO_THANK_YOU', |
|
1747 | - $this->cancel_page_id => 'ESPRESSO_CANCELLED', |
|
1748 | - ); |
|
1749 | - } |
|
1750 | - |
|
1751 | - |
|
1752 | - /** |
|
1753 | - * gets/returns URL for EE reg_page |
|
1754 | - * |
|
1755 | - * @access public |
|
1756 | - * @return string |
|
1757 | - */ |
|
1758 | - public function reg_page_url() |
|
1759 | - { |
|
1760 | - if (! $this->reg_page_url) { |
|
1761 | - $this->reg_page_url = add_query_arg( |
|
1762 | - array('uts' => time()), |
|
1763 | - get_permalink($this->reg_page_id) |
|
1764 | - ) . '#checkout'; |
|
1765 | - } |
|
1766 | - return $this->reg_page_url; |
|
1767 | - } |
|
1768 | - |
|
1769 | - |
|
1770 | - /** |
|
1771 | - * gets/returns URL for EE txn_page |
|
1772 | - * |
|
1773 | - * @param array $query_args like what gets passed to |
|
1774 | - * add_query_arg() as the first argument |
|
1775 | - * @access public |
|
1776 | - * @return string |
|
1777 | - */ |
|
1778 | - public function txn_page_url($query_args = array()) |
|
1779 | - { |
|
1780 | - if (! $this->txn_page_url) { |
|
1781 | - $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1782 | - } |
|
1783 | - if ($query_args) { |
|
1784 | - return add_query_arg($query_args, $this->txn_page_url); |
|
1785 | - } else { |
|
1786 | - return $this->txn_page_url; |
|
1787 | - } |
|
1788 | - } |
|
1789 | - |
|
1790 | - |
|
1791 | - /** |
|
1792 | - * gets/returns URL for EE thank_you_page |
|
1793 | - * |
|
1794 | - * @param array $query_args like what gets passed to |
|
1795 | - * add_query_arg() as the first argument |
|
1796 | - * @access public |
|
1797 | - * @return string |
|
1798 | - */ |
|
1799 | - public function thank_you_page_url($query_args = array()) |
|
1800 | - { |
|
1801 | - if (! $this->thank_you_page_url) { |
|
1802 | - $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1803 | - } |
|
1804 | - if ($query_args) { |
|
1805 | - return add_query_arg($query_args, $this->thank_you_page_url); |
|
1806 | - } else { |
|
1807 | - return $this->thank_you_page_url; |
|
1808 | - } |
|
1809 | - } |
|
1810 | - |
|
1811 | - |
|
1812 | - /** |
|
1813 | - * gets/returns URL for EE cancel_page |
|
1814 | - * |
|
1815 | - * @access public |
|
1816 | - * @return string |
|
1817 | - */ |
|
1818 | - public function cancel_page_url() |
|
1819 | - { |
|
1820 | - if (! $this->cancel_page_url) { |
|
1821 | - $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1822 | - } |
|
1823 | - return $this->cancel_page_url; |
|
1824 | - } |
|
1825 | - |
|
1826 | - |
|
1827 | - /** |
|
1828 | - * Resets all critical page urls to their original state. Used primarily by the __sleep() magic method currently. |
|
1829 | - * |
|
1830 | - * @since 4.7.5 |
|
1831 | - */ |
|
1832 | - protected function _reset_urls() |
|
1833 | - { |
|
1834 | - $this->reg_page_url = ''; |
|
1835 | - $this->txn_page_url = ''; |
|
1836 | - $this->cancel_page_url = ''; |
|
1837 | - $this->thank_you_page_url = ''; |
|
1838 | - } |
|
1839 | - |
|
1840 | - |
|
1841 | - /** |
|
1842 | - * Used to return what the optin value is set for the EE User Experience Program. |
|
1843 | - * This accounts for multisite and this value being requested for a subsite. In multisite, the value is set |
|
1844 | - * on the main site only. |
|
1845 | - * |
|
1846 | - * @return bool |
|
1847 | - */ |
|
1848 | - protected function _get_main_ee_ueip_optin() |
|
1849 | - { |
|
1850 | - // if this is the main site then we can just bypass our direct query. |
|
1851 | - if (is_main_site()) { |
|
1852 | - return get_option(self::OPTION_NAME_UXIP, false); |
|
1853 | - } |
|
1854 | - // is this already cached for this request? If so use it. |
|
1855 | - if (EE_Core_Config::$ee_ueip_option !== null) { |
|
1856 | - return EE_Core_Config::$ee_ueip_option; |
|
1857 | - } |
|
1858 | - global $wpdb; |
|
1859 | - $current_network_main_site = is_multisite() ? get_current_site() : null; |
|
1860 | - $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1861 | - $option = self::OPTION_NAME_UXIP; |
|
1862 | - // set correct table for query |
|
1863 | - $table_name = $wpdb->get_blog_prefix($current_main_site_id) . 'options'; |
|
1864 | - // rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
|
1865 | - // get_blog_option() does a switch_to_blog an that could cause infinite recursion because EE_Core_Config might be |
|
1866 | - // re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
|
1867 | - // this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
|
1868 | - // for the purpose of caching. |
|
1869 | - $pre = apply_filters('pre_option_' . $option, false, $option); |
|
1870 | - if (false !== $pre) { |
|
1871 | - EE_Core_Config::$ee_ueip_option = $pre; |
|
1872 | - return EE_Core_Config::$ee_ueip_option; |
|
1873 | - } |
|
1874 | - $row = $wpdb->get_row( |
|
1875 | - $wpdb->prepare( |
|
1876 | - "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", |
|
1877 | - $option |
|
1878 | - ) |
|
1879 | - ); |
|
1880 | - if (is_object($row)) { |
|
1881 | - $value = $row->option_value; |
|
1882 | - } else { // option does not exist so use default. |
|
1883 | - EE_Core_Config::$ee_ueip_option = apply_filters('default_option_' . $option, false, $option); |
|
1884 | - return EE_Core_Config::$ee_ueip_option; |
|
1885 | - } |
|
1886 | - EE_Core_Config::$ee_ueip_option = apply_filters('option_' . $option, maybe_unserialize($value), $option); |
|
1887 | - return EE_Core_Config::$ee_ueip_option; |
|
1888 | - } |
|
1889 | - |
|
1890 | - |
|
1891 | - /** |
|
1892 | - * Utility function for escaping the value of a property and returning. |
|
1893 | - * |
|
1894 | - * @param string $property property name (checks to see if exists). |
|
1895 | - * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
|
1896 | - * @throws EE_Error |
|
1897 | - */ |
|
1898 | - public function get_pretty($property) |
|
1899 | - { |
|
1900 | - if ($property === self::OPTION_NAME_UXIP) { |
|
1901 | - return $this->ee_ueip_optin ? 'yes' : 'no'; |
|
1902 | - } |
|
1903 | - return parent::get_pretty($property); |
|
1904 | - } |
|
1905 | - |
|
1906 | - |
|
1907 | - /** |
|
1908 | - * Currently used to ensure critical page urls have initial values saved to the db instead of any current set values |
|
1909 | - * on the object. |
|
1910 | - * |
|
1911 | - * @return array |
|
1912 | - */ |
|
1913 | - public function __sleep() |
|
1914 | - { |
|
1915 | - // reset all url properties |
|
1916 | - $this->_reset_urls(); |
|
1917 | - // return what to save to db |
|
1918 | - return array_keys(get_object_vars($this)); |
|
1919 | - } |
|
1920 | -} |
|
1921 | - |
|
1922 | -/** |
|
1923 | - * Config class for storing info on the Organization |
|
1924 | - */ |
|
1925 | -class EE_Organization_Config extends EE_Config_Base |
|
1926 | -{ |
|
1927 | - /** |
|
1928 | - * @var string $name |
|
1929 | - * eg EE4.1 |
|
1930 | - */ |
|
1931 | - public $name; |
|
1932 | - |
|
1933 | - /** |
|
1934 | - * @var string $address_1 |
|
1935 | - * eg 123 Onna Road |
|
1936 | - */ |
|
1937 | - public $address_1 = ''; |
|
1938 | - |
|
1939 | - /** |
|
1940 | - * @var string $address_2 |
|
1941 | - * eg PO Box 123 |
|
1942 | - */ |
|
1943 | - public $address_2 = ''; |
|
1944 | - |
|
1945 | - /** |
|
1946 | - * @var string $city |
|
1947 | - * eg Inna City |
|
1948 | - */ |
|
1949 | - public $city = ''; |
|
1950 | - |
|
1951 | - /** |
|
1952 | - * @var int $STA_ID |
|
1953 | - * eg 4 |
|
1954 | - */ |
|
1955 | - public $STA_ID = 0; |
|
1956 | - |
|
1957 | - /** |
|
1958 | - * @var string $CNT_ISO |
|
1959 | - * eg US |
|
1960 | - */ |
|
1961 | - public $CNT_ISO = ''; |
|
1962 | - |
|
1963 | - /** |
|
1964 | - * @var string $zip |
|
1965 | - * eg 12345 or V1A 2B3 |
|
1966 | - */ |
|
1967 | - public $zip = ''; |
|
1968 | - |
|
1969 | - /** |
|
1970 | - * @var string $email |
|
1971 | - * eg [email protected] |
|
1972 | - */ |
|
1973 | - public $email; |
|
1974 | - |
|
1975 | - /** |
|
1976 | - * @var string $phone |
|
1977 | - * eg. 111-111-1111 |
|
1978 | - */ |
|
1979 | - public $phone = ''; |
|
1980 | - |
|
1981 | - /** |
|
1982 | - * @var string $vat |
|
1983 | - * VAT/Tax Number |
|
1984 | - */ |
|
1985 | - public $vat = ''; |
|
1986 | - |
|
1987 | - /** |
|
1988 | - * @var string $logo_url |
|
1989 | - * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1990 | - */ |
|
1991 | - public $logo_url = ''; |
|
1992 | - |
|
1993 | - /** |
|
1994 | - * The below are all various properties for holding links to organization social network profiles |
|
1995 | - * |
|
1996 | - * @var string |
|
1997 | - */ |
|
1998 | - /** |
|
1999 | - * facebook (facebook.com/profile.name) |
|
2000 | - * |
|
2001 | - * @var string |
|
2002 | - */ |
|
2003 | - public $facebook = ''; |
|
2004 | - |
|
2005 | - /** |
|
2006 | - * twitter (twitter.com/twitter_handle) |
|
2007 | - * |
|
2008 | - * @var string |
|
2009 | - */ |
|
2010 | - public $twitter = ''; |
|
2011 | - |
|
2012 | - /** |
|
2013 | - * linkedin (linkedin.com/in/profile_name) |
|
2014 | - * |
|
2015 | - * @var string |
|
2016 | - */ |
|
2017 | - public $linkedin = ''; |
|
2018 | - |
|
2019 | - /** |
|
2020 | - * pinterest (www.pinterest.com/profile_name) |
|
2021 | - * |
|
2022 | - * @var string |
|
2023 | - */ |
|
2024 | - public $pinterest = ''; |
|
2025 | - |
|
2026 | - /** |
|
2027 | - * google+ (google.com/+profileName) |
|
2028 | - * |
|
2029 | - * @var string |
|
2030 | - */ |
|
2031 | - public $google = ''; |
|
2032 | - |
|
2033 | - /** |
|
2034 | - * instagram (instagram.com/handle) |
|
2035 | - * |
|
2036 | - * @var string |
|
2037 | - */ |
|
2038 | - public $instagram = ''; |
|
2039 | - |
|
2040 | - |
|
2041 | - /** |
|
2042 | - * class constructor |
|
2043 | - * |
|
2044 | - * @access public |
|
2045 | - */ |
|
2046 | - public function __construct() |
|
2047 | - { |
|
2048 | - // set default organization settings |
|
2049 | - // decode HTML entities from the WP blogname, because it's stored in the DB with HTML entities encoded |
|
2050 | - $this->name = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
2051 | - $this->email = get_bloginfo('admin_email'); |
|
2052 | - } |
|
2053 | -} |
|
2054 | - |
|
2055 | -/** |
|
2056 | - * Class for defining what's in the EE_Config relating to currency |
|
2057 | - */ |
|
2058 | -class EE_Currency_Config extends EE_Config_Base |
|
2059 | -{ |
|
2060 | - /** |
|
2061 | - * @var string $code |
|
2062 | - * eg 'US' |
|
2063 | - */ |
|
2064 | - public $code; |
|
2065 | - |
|
2066 | - /** |
|
2067 | - * @var string $name |
|
2068 | - * eg 'Dollar' |
|
2069 | - */ |
|
2070 | - public $name; |
|
2071 | - |
|
2072 | - /** |
|
2073 | - * plural name |
|
2074 | - * |
|
2075 | - * @var string $plural |
|
2076 | - * eg 'Dollars' |
|
2077 | - */ |
|
2078 | - public $plural; |
|
2079 | - |
|
2080 | - /** |
|
2081 | - * currency sign |
|
2082 | - * |
|
2083 | - * @var string $sign |
|
2084 | - * eg '$' |
|
2085 | - */ |
|
2086 | - public $sign; |
|
2087 | - |
|
2088 | - /** |
|
2089 | - * Whether the currency sign should come before the number or not |
|
2090 | - * |
|
2091 | - * @var boolean $sign_b4 |
|
2092 | - */ |
|
2093 | - public $sign_b4; |
|
2094 | - |
|
2095 | - /** |
|
2096 | - * How many digits should come after the decimal place |
|
2097 | - * |
|
2098 | - * @var int $dec_plc |
|
2099 | - */ |
|
2100 | - public $dec_plc; |
|
2101 | - |
|
2102 | - /** |
|
2103 | - * Symbol to use for decimal mark |
|
2104 | - * |
|
2105 | - * @var string $dec_mrk |
|
2106 | - * eg '.' |
|
2107 | - */ |
|
2108 | - public $dec_mrk; |
|
2109 | - |
|
2110 | - /** |
|
2111 | - * Symbol to use for thousands |
|
2112 | - * |
|
2113 | - * @var string $thsnds |
|
2114 | - * eg ',' |
|
2115 | - */ |
|
2116 | - public $thsnds; |
|
2117 | - |
|
2118 | - |
|
2119 | - /** |
|
2120 | - * class constructor |
|
2121 | - * |
|
2122 | - * @access public |
|
2123 | - * @param string $CNT_ISO |
|
2124 | - * @throws EE_Error |
|
2125 | - * @throws ReflectionException |
|
2126 | - */ |
|
2127 | - public function __construct($CNT_ISO = '') |
|
2128 | - { |
|
2129 | - if ($CNT_ISO && $CNT_ISO === $this->code) { |
|
2130 | - return; |
|
2131 | - } |
|
2132 | - // get country code from organization settings or use default |
|
2133 | - $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2134 | - && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2135 | - ? EE_Registry::instance()->CFG->organization->CNT_ISO |
|
2136 | - : ''; |
|
2137 | - // but override if requested |
|
2138 | - $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2139 | - // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
|
2140 | - $this->setCurrency($CNT_ISO); |
|
2141 | - // fallback to hardcoded defaults, in case the above failed |
|
2142 | - if (empty($this->code)) { |
|
2143 | - $this->setFallbackCurrency(); |
|
2144 | - } |
|
2145 | - } |
|
2146 | - |
|
2147 | - |
|
2148 | - /** |
|
2149 | - * @param string|null $CNT_ISO |
|
2150 | - * @throws EE_Error |
|
2151 | - * @throws ReflectionException |
|
2152 | - */ |
|
2153 | - public function setCurrency(?string $CNT_ISO = '') |
|
2154 | - { |
|
2155 | - if (empty($CNT_ISO) || ! EE_Maintenance_Mode::instance()->models_can_query()) { |
|
2156 | - return; |
|
2157 | - } |
|
2158 | - |
|
2159 | - /** @var TableAnalysis $table_analysis */ |
|
2160 | - $table_analysis = EE_Registry::instance()->create('TableAnalysis', [], true); |
|
2161 | - if (! $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table())) { |
|
2162 | - return; |
|
2163 | - } |
|
2164 | - // retrieve the country settings from the db, just in case they have been customized |
|
2165 | - $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2166 | - if (! $country instanceof EE_Country) { |
|
2167 | - throw new DomainException( |
|
2168 | - esc_html__('Invalid Country ISO Code.', 'event_espresso') |
|
2169 | - ); |
|
2170 | - } |
|
2171 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2172 | - $this->name = $country->currency_name_single(); // Dollar |
|
2173 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2174 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2175 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after |
|
2176 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2177 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: ',' = 0,01 or '.' = 0.01 |
|
2178 | - $this->thsnds = $country->currency_thousands_separator(); // thousands sep: ',' = 1,000 or '.' = 1.000 |
|
2179 | - } |
|
2180 | - |
|
2181 | - |
|
2182 | - private function setFallbackCurrency() |
|
2183 | - { |
|
2184 | - // set default currency settings |
|
2185 | - $this->code = 'USD'; |
|
2186 | - $this->name = esc_html__('Dollar', 'event_espresso'); |
|
2187 | - $this->plural = esc_html__('Dollars', 'event_espresso'); |
|
2188 | - $this->sign = '$'; |
|
2189 | - $this->sign_b4 = true; |
|
2190 | - $this->dec_plc = 2; |
|
2191 | - $this->dec_mrk = '.'; |
|
2192 | - $this->thsnds = ','; |
|
2193 | - } |
|
2194 | - |
|
2195 | - |
|
2196 | - /** |
|
2197 | - * @param string|null $CNT_ISO |
|
2198 | - * @return EE_Currency_Config |
|
2199 | - * @throws EE_Error |
|
2200 | - * @throws ReflectionException |
|
2201 | - */ |
|
2202 | - public static function getCurrencyConfig(?string $CNT_ISO = ''): EE_Currency_Config |
|
2203 | - { |
|
2204 | - // if CNT_ISO passed lets try to get currency settings for it. |
|
2205 | - $currency_config = ! empty($CNT_ISO) |
|
2206 | - ? new EE_Currency_Config($CNT_ISO) |
|
2207 | - : null; |
|
2208 | - // default currency settings for site if not set |
|
2209 | - if ($currency_config instanceof EE_Currency_Config) { |
|
2210 | - return $currency_config; |
|
2211 | - } |
|
2212 | - EE_Config::instance()->currency = EE_Config::instance()->currency instanceof EE_Currency_Config |
|
2213 | - ? EE_Config::instance()->currency |
|
2214 | - : new EE_Currency_Config(); |
|
2215 | - return EE_Config::instance()->currency; |
|
2216 | - } |
|
2217 | -} |
|
2218 | - |
|
2219 | -/** |
|
2220 | - * Class for defining what's in the EE_Config relating to registration settings |
|
2221 | - */ |
|
2222 | -class EE_Registration_Config extends EE_Config_Base |
|
2223 | -{ |
|
2224 | - /** |
|
2225 | - * Default registration status |
|
2226 | - * |
|
2227 | - * @var string $default_STS_ID |
|
2228 | - * eg 'RPP' |
|
2229 | - */ |
|
2230 | - public $default_STS_ID; |
|
2231 | - |
|
2232 | - /** |
|
2233 | - * For new events, this will be the default value for the maximum number of tickets (equivalent to maximum number of |
|
2234 | - * registrations) |
|
2235 | - * |
|
2236 | - * @var int |
|
2237 | - */ |
|
2238 | - public $default_maximum_number_of_tickets; |
|
2239 | - |
|
2240 | - /** |
|
2241 | - * level of validation to apply to email addresses |
|
2242 | - * |
|
2243 | - * @var string $email_validation_level |
|
2244 | - * options: 'basic', 'wp_default', 'i18n', 'i18n_dns' |
|
2245 | - */ |
|
2246 | - public $email_validation_level; |
|
2247 | - |
|
2248 | - /** |
|
2249 | - * whether or not to show alternate payment options during the reg process if payment status is pending |
|
2250 | - * |
|
2251 | - * @var boolean $show_pending_payment_options |
|
2252 | - */ |
|
2253 | - public $show_pending_payment_options; |
|
2254 | - |
|
2255 | - /** |
|
2256 | - * Whether to skip the registration confirmation page |
|
2257 | - * |
|
2258 | - * @var boolean $skip_reg_confirmation |
|
2259 | - */ |
|
2260 | - public $skip_reg_confirmation; |
|
2261 | - |
|
2262 | - /** |
|
2263 | - * an array of SPCO reg steps where: |
|
2264 | - * the keys denotes the reg step order |
|
2265 | - * each element consists of an array with the following elements: |
|
2266 | - * "file_path" => the file path to the EE_SPCO_Reg_Step class |
|
2267 | - * "class_name" => the specific EE_SPCO_Reg_Step child class name |
|
2268 | - * "slug" => the URL param used to trigger the reg step |
|
2269 | - * |
|
2270 | - * @var array $reg_steps |
|
2271 | - */ |
|
2272 | - public $reg_steps; |
|
2273 | - |
|
2274 | - /** |
|
2275 | - * Whether registration confirmation should be the last page of SPCO |
|
2276 | - * |
|
2277 | - * @var boolean $reg_confirmation_last |
|
2278 | - */ |
|
2279 | - public $reg_confirmation_last; |
|
2280 | - |
|
2281 | - /** |
|
2282 | - * Whether or not to enable the EE Bot Trap |
|
2283 | - * |
|
2284 | - * @var boolean $use_bot_trap |
|
2285 | - */ |
|
2286 | - public $use_bot_trap; |
|
2287 | - |
|
2288 | - /** |
|
2289 | - * Whether or not to encrypt some data sent by the EE Bot Trap |
|
2290 | - * |
|
2291 | - * @var boolean $use_encryption |
|
2292 | - */ |
|
2293 | - public $use_encryption; |
|
2294 | - |
|
2295 | - /** |
|
2296 | - * Whether or not to use ReCaptcha |
|
2297 | - * |
|
2298 | - * @var boolean $use_captcha |
|
2299 | - */ |
|
2300 | - public $use_captcha; |
|
2301 | - |
|
2302 | - /** |
|
2303 | - * ReCaptcha Theme |
|
2304 | - * |
|
2305 | - * @var string $recaptcha_theme |
|
2306 | - * options: 'dark', 'light', 'invisible' |
|
2307 | - */ |
|
2308 | - public $recaptcha_theme; |
|
2309 | - |
|
2310 | - /** |
|
2311 | - * ReCaptcha Badge - determines the position of the reCAPTCHA badge if using Invisible ReCaptcha. |
|
2312 | - * |
|
2313 | - * @var string $recaptcha_badge |
|
2314 | - * options: 'bottomright', 'bottomleft', 'inline' |
|
2315 | - */ |
|
2316 | - public $recaptcha_badge; |
|
2317 | - |
|
2318 | - /** |
|
2319 | - * ReCaptcha Type |
|
2320 | - * |
|
2321 | - * @var string $recaptcha_type |
|
2322 | - * options: 'audio', 'image' |
|
2323 | - */ |
|
2324 | - public $recaptcha_type; |
|
2325 | - |
|
2326 | - /** |
|
2327 | - * ReCaptcha language |
|
2328 | - * |
|
2329 | - * @var string $recaptcha_language |
|
2330 | - * eg 'en' |
|
2331 | - */ |
|
2332 | - public $recaptcha_language; |
|
2333 | - |
|
2334 | - /** |
|
2335 | - * ReCaptcha public key |
|
2336 | - * |
|
2337 | - * @var string $recaptcha_publickey |
|
2338 | - */ |
|
2339 | - public $recaptcha_publickey; |
|
2340 | - |
|
2341 | - /** |
|
2342 | - * ReCaptcha private key |
|
2343 | - * |
|
2344 | - * @var string $recaptcha_privatekey |
|
2345 | - */ |
|
2346 | - public $recaptcha_privatekey; |
|
2347 | - |
|
2348 | - /** |
|
2349 | - * array of form names protected by ReCaptcha |
|
2350 | - * |
|
2351 | - * @var array $recaptcha_protected_forms |
|
2352 | - */ |
|
2353 | - public $recaptcha_protected_forms; |
|
21 | + const OPTION_NAME = 'ee_config'; |
|
22 | + |
|
23 | + const LOG_NAME = 'ee_config_log'; |
|
24 | + |
|
25 | + const LOG_LENGTH = 100; |
|
26 | + |
|
27 | + const ADDON_OPTION_NAMES = 'ee_config_option_names'; |
|
28 | + |
|
29 | + /** |
|
30 | + * instance of the EE_Config object |
|
31 | + * |
|
32 | + * @var EE_Config $_instance |
|
33 | + * @access private |
|
34 | + */ |
|
35 | + private static $_instance; |
|
36 | + |
|
37 | + /** |
|
38 | + * @var boolean $_logging_enabled |
|
39 | + */ |
|
40 | + private static $_logging_enabled = false; |
|
41 | + |
|
42 | + /** |
|
43 | + * @var LegacyShortcodesManager $legacy_shortcodes_manager |
|
44 | + */ |
|
45 | + private $legacy_shortcodes_manager; |
|
46 | + |
|
47 | + /** |
|
48 | + * An StdClass whose property names are addon slugs, |
|
49 | + * and values are their config classes |
|
50 | + * |
|
51 | + * @var StdClass |
|
52 | + */ |
|
53 | + public $addons; |
|
54 | + |
|
55 | + /** |
|
56 | + * @var EE_Admin_Config |
|
57 | + */ |
|
58 | + public $admin; |
|
59 | + |
|
60 | + /** |
|
61 | + * @var EE_Core_Config |
|
62 | + */ |
|
63 | + public $core; |
|
64 | + |
|
65 | + /** |
|
66 | + * @var EE_Currency_Config |
|
67 | + */ |
|
68 | + public $currency; |
|
69 | + |
|
70 | + /** |
|
71 | + * @var EE_Organization_Config |
|
72 | + */ |
|
73 | + public $organization; |
|
74 | + |
|
75 | + /** |
|
76 | + * @var EE_Registration_Config |
|
77 | + */ |
|
78 | + public $registration; |
|
79 | + |
|
80 | + /** |
|
81 | + * @var EE_Template_Config |
|
82 | + */ |
|
83 | + public $template_settings; |
|
84 | + |
|
85 | + /** |
|
86 | + * Holds EE environment values. |
|
87 | + * |
|
88 | + * @var EE_Environment_Config |
|
89 | + */ |
|
90 | + public $environment; |
|
91 | + |
|
92 | + /** |
|
93 | + * settings pertaining to Google maps |
|
94 | + * |
|
95 | + * @var EE_Map_Config |
|
96 | + */ |
|
97 | + public $map_settings; |
|
98 | + |
|
99 | + /** |
|
100 | + * settings pertaining to Taxes |
|
101 | + * |
|
102 | + * @var EE_Tax_Config |
|
103 | + */ |
|
104 | + public $tax_settings; |
|
105 | + |
|
106 | + /** |
|
107 | + * Settings pertaining to global messages settings. |
|
108 | + * |
|
109 | + * @var EE_Messages_Config |
|
110 | + */ |
|
111 | + public $messages; |
|
112 | + |
|
113 | + /** |
|
114 | + * @deprecated |
|
115 | + * @var EE_Gateway_Config |
|
116 | + */ |
|
117 | + public $gateway; |
|
118 | + |
|
119 | + /** |
|
120 | + * @var array |
|
121 | + */ |
|
122 | + private $_addon_option_names = array(); |
|
123 | + |
|
124 | + /** |
|
125 | + * @var array |
|
126 | + */ |
|
127 | + private static $_module_route_map = array(); |
|
128 | + |
|
129 | + /** |
|
130 | + * @var array |
|
131 | + */ |
|
132 | + private static $_module_forward_map = array(); |
|
133 | + |
|
134 | + /** |
|
135 | + * @var array |
|
136 | + */ |
|
137 | + private static $_module_view_map = array(); |
|
138 | + |
|
139 | + /** |
|
140 | + * @var bool |
|
141 | + */ |
|
142 | + private static $initialized = false; |
|
143 | + |
|
144 | + |
|
145 | + /** |
|
146 | + * @singleton method used to instantiate class object |
|
147 | + * @access public |
|
148 | + * @return EE_Config instance |
|
149 | + */ |
|
150 | + public static function instance() |
|
151 | + { |
|
152 | + // check if class object is instantiated, and instantiated properly |
|
153 | + if (! self::$_instance instanceof EE_Config) { |
|
154 | + self::$_instance = new self(); |
|
155 | + } |
|
156 | + return self::$_instance; |
|
157 | + } |
|
158 | + |
|
159 | + |
|
160 | + /** |
|
161 | + * Resets the config |
|
162 | + * |
|
163 | + * @param bool $hard_reset if TRUE, sets EE_CONFig back to its original settings in the database. If FALSE |
|
164 | + * (default) leaves the database alone, and merely resets the EE_Config object to |
|
165 | + * reflect its state in the database |
|
166 | + * @param boolean $reinstantiate if TRUE (default) call instance() and return it. Otherwise, just leave |
|
167 | + * $_instance as NULL. Useful in case you want to forget about the old instance on |
|
168 | + * EE_Config, but might not be ready to instantiate EE_Config currently (eg if the |
|
169 | + * site was put into maintenance mode) |
|
170 | + * @return EE_Config |
|
171 | + */ |
|
172 | + public static function reset($hard_reset = false, $reinstantiate = true) |
|
173 | + { |
|
174 | + if (self::$_instance instanceof EE_Config) { |
|
175 | + if ($hard_reset) { |
|
176 | + self::$_instance->legacy_shortcodes_manager = null; |
|
177 | + self::$_instance->_addon_option_names = array(); |
|
178 | + self::$_instance->_initialize_config(); |
|
179 | + self::$_instance->update_espresso_config(); |
|
180 | + } |
|
181 | + self::$_instance->update_addon_option_names(); |
|
182 | + } |
|
183 | + self::$_instance = null; |
|
184 | + self::$initialized = false; |
|
185 | + // we don't need to reset the static properties imo because those should |
|
186 | + // only change when a module is added or removed. Currently we don't |
|
187 | + // support removing a module during a request when it previously existed |
|
188 | + if ($reinstantiate) { |
|
189 | + return self::instance(); |
|
190 | + } else { |
|
191 | + return null; |
|
192 | + } |
|
193 | + } |
|
194 | + |
|
195 | + |
|
196 | + private function __construct() |
|
197 | + { |
|
198 | + if (self::$initialized) { |
|
199 | + return; |
|
200 | + } |
|
201 | + self::$initialized = true; |
|
202 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
203 | + EE_Config::$_logging_enabled = apply_filters('FHEE__EE_Config___construct__logging_enabled', false); |
|
204 | + // setup empty config classes |
|
205 | + $this->_initialize_config(); |
|
206 | + // load existing EE site settings |
|
207 | + $this->_load_core_config(); |
|
208 | + // confirm everything loaded correctly and set filtered defaults if not |
|
209 | + $this->_verify_config(); |
|
210 | + // register shortcodes and modules |
|
211 | + add_action( |
|
212 | + 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
|
213 | + [$this, 'register_shortcodes_and_modules'], |
|
214 | + 999 |
|
215 | + ); |
|
216 | + // initialize shortcodes and modules |
|
217 | + add_action('AHEE__EE_System__core_loaded_and_ready', [$this, 'initialize_shortcodes_and_modules']); |
|
218 | + // register widgets |
|
219 | + add_action('widgets_init', [$this, 'widgets_init'], 10); |
|
220 | + // shutdown |
|
221 | + add_action('shutdown', [$this, 'shutdown'], 10); |
|
222 | + // construct__end hook |
|
223 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
224 | + // hardcoded hack |
|
225 | + $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
|
226 | + } |
|
227 | + |
|
228 | + |
|
229 | + /** |
|
230 | + * @return boolean |
|
231 | + */ |
|
232 | + public static function logging_enabled() |
|
233 | + { |
|
234 | + return self::$_logging_enabled; |
|
235 | + } |
|
236 | + |
|
237 | + |
|
238 | + /** |
|
239 | + * use to get the current theme if needed from static context |
|
240 | + * |
|
241 | + * @return string current theme set. |
|
242 | + */ |
|
243 | + public static function get_current_theme() |
|
244 | + { |
|
245 | + return self::$_instance->template_settings->current_espresso_theme ?? 'Espresso_Arabica_2014'; |
|
246 | + } |
|
247 | + |
|
248 | + |
|
249 | + /** |
|
250 | + * _initialize_config |
|
251 | + * |
|
252 | + * @access private |
|
253 | + * @return void |
|
254 | + */ |
|
255 | + private function _initialize_config() |
|
256 | + { |
|
257 | + EE_Config::trim_log(); |
|
258 | + // set defaults |
|
259 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
260 | + $this->addons = new stdClass(); |
|
261 | + // set _module_route_map |
|
262 | + EE_Config::$_module_route_map = array(); |
|
263 | + // set _module_forward_map |
|
264 | + EE_Config::$_module_forward_map = array(); |
|
265 | + // set _module_view_map |
|
266 | + EE_Config::$_module_view_map = array(); |
|
267 | + } |
|
268 | + |
|
269 | + |
|
270 | + /** |
|
271 | + * load core plugin configuration |
|
272 | + * |
|
273 | + * @access private |
|
274 | + * @return void |
|
275 | + */ |
|
276 | + private function _load_core_config() |
|
277 | + { |
|
278 | + // load_core_config__start hook |
|
279 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
280 | + $espresso_config = (array) $this->get_espresso_config(); |
|
281 | + // need to move the "addons" element to the end of the config array |
|
282 | + // in case an addon config references one of the other config classes |
|
283 | + $addons = $espresso_config['addons'] ?? new StdClass(); |
|
284 | + unset($espresso_config['addons']); |
|
285 | + $espresso_config['addons'] = $addons; |
|
286 | + foreach ($espresso_config as $config => $settings) { |
|
287 | + // load_core_config__start hook |
|
288 | + $settings = apply_filters( |
|
289 | + 'FHEE__EE_Config___load_core_config__config_settings', |
|
290 | + $settings, |
|
291 | + $config, |
|
292 | + $this |
|
293 | + ); |
|
294 | + if (is_object($settings) && property_exists($this, $config)) { |
|
295 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__' . $config, $settings); |
|
296 | + // call configs populate method to ensure any defaults are set for empty values. |
|
297 | + if (method_exists($settings, 'populate')) { |
|
298 | + $this->{$config}->populate(); |
|
299 | + } |
|
300 | + if (method_exists($settings, 'do_hooks')) { |
|
301 | + $this->{$config}->do_hooks(); |
|
302 | + } |
|
303 | + } |
|
304 | + } |
|
305 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
306 | + $this->update_espresso_config(); |
|
307 | + } |
|
308 | + // load_core_config__end hook |
|
309 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
310 | + } |
|
311 | + |
|
312 | + |
|
313 | + /** |
|
314 | + * _verify_config |
|
315 | + * |
|
316 | + * @access protected |
|
317 | + * @return void |
|
318 | + */ |
|
319 | + protected function _verify_config() |
|
320 | + { |
|
321 | + $this->core = $this->core instanceof EE_Core_Config |
|
322 | + ? $this->core |
|
323 | + : new EE_Core_Config(); |
|
324 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
325 | + $this->organization = $this->organization instanceof EE_Organization_Config |
|
326 | + ? $this->organization |
|
327 | + : new EE_Organization_Config(); |
|
328 | + $this->organization = apply_filters( |
|
329 | + 'FHEE__EE_Config___initialize_config__organization', |
|
330 | + $this->organization |
|
331 | + ); |
|
332 | + $this->currency = $this->currency instanceof EE_Currency_Config |
|
333 | + ? $this->currency |
|
334 | + : new EE_Currency_Config(); |
|
335 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
336 | + $this->registration = $this->registration instanceof EE_Registration_Config |
|
337 | + ? $this->registration |
|
338 | + : new EE_Registration_Config(); |
|
339 | + $this->registration = apply_filters( |
|
340 | + 'FHEE__EE_Config___initialize_config__registration', |
|
341 | + $this->registration |
|
342 | + ); |
|
343 | + $this->admin = $this->admin instanceof EE_Admin_Config |
|
344 | + ? $this->admin |
|
345 | + : new EE_Admin_Config(); |
|
346 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
347 | + $this->template_settings = $this->template_settings instanceof EE_Template_Config |
|
348 | + ? $this->template_settings |
|
349 | + : new EE_Template_Config(); |
|
350 | + $this->template_settings = apply_filters( |
|
351 | + 'FHEE__EE_Config___initialize_config__template_settings', |
|
352 | + $this->template_settings |
|
353 | + ); |
|
354 | + $this->map_settings = $this->map_settings instanceof EE_Map_Config |
|
355 | + ? $this->map_settings |
|
356 | + : new EE_Map_Config(); |
|
357 | + $this->map_settings = apply_filters( |
|
358 | + 'FHEE__EE_Config___initialize_config__map_settings', |
|
359 | + $this->map_settings |
|
360 | + ); |
|
361 | + $this->environment = $this->environment instanceof EE_Environment_Config |
|
362 | + ? $this->environment |
|
363 | + : new EE_Environment_Config(); |
|
364 | + $this->environment = apply_filters( |
|
365 | + 'FHEE__EE_Config___initialize_config__environment', |
|
366 | + $this->environment |
|
367 | + ); |
|
368 | + $this->tax_settings = $this->tax_settings instanceof EE_Tax_Config |
|
369 | + ? $this->tax_settings |
|
370 | + : new EE_Tax_Config(); |
|
371 | + $this->tax_settings = apply_filters( |
|
372 | + 'FHEE__EE_Config___initialize_config__tax_settings', |
|
373 | + $this->tax_settings |
|
374 | + ); |
|
375 | + $this->messages = apply_filters('FHEE__EE_Config__initialize_config__messages', $this->messages); |
|
376 | + $this->messages = $this->messages instanceof EE_Messages_Config |
|
377 | + ? $this->messages |
|
378 | + : new EE_Messages_Config(); |
|
379 | + $this->gateway = $this->gateway instanceof EE_Gateway_Config |
|
380 | + ? $this->gateway |
|
381 | + : new EE_Gateway_Config(); |
|
382 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
383 | + $this->legacy_shortcodes_manager = null; |
|
384 | + } |
|
385 | + |
|
386 | + |
|
387 | + /** |
|
388 | + * get_espresso_config |
|
389 | + * |
|
390 | + * @access public |
|
391 | + * @return array of espresso config stuff |
|
392 | + */ |
|
393 | + public function get_espresso_config() |
|
394 | + { |
|
395 | + // grab espresso configuration |
|
396 | + return apply_filters( |
|
397 | + 'FHEE__EE_Config__get_espresso_config__CFG', |
|
398 | + get_option(EE_Config::OPTION_NAME, array()) |
|
399 | + ); |
|
400 | + } |
|
401 | + |
|
402 | + |
|
403 | + /** |
|
404 | + * double_check_config_comparison |
|
405 | + * |
|
406 | + * @access public |
|
407 | + * @param string $option |
|
408 | + * @param $old_value |
|
409 | + * @param $value |
|
410 | + */ |
|
411 | + public function double_check_config_comparison($option = '', $old_value, $value) |
|
412 | + { |
|
413 | + // make sure we're checking the ee config |
|
414 | + if ($option === EE_Config::OPTION_NAME) { |
|
415 | + // run a loose comparison of the old value against the new value for type and properties, |
|
416 | + // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
|
417 | + if ($value != $old_value) { |
|
418 | + // if they are NOT the same, then remove the hook, |
|
419 | + // which means the subsequent update results will be based solely on the update query results |
|
420 | + // the reason we do this is because, as stated above, |
|
421 | + // WP update_option performs an exact instance comparison (===) on any update values passed to it |
|
422 | + // this happens PRIOR to serialization and any subsequent update. |
|
423 | + // If values are found to match their previous old value, |
|
424 | + // then WP bails before performing any update. |
|
425 | + // Since we are passing the EE_Config object, it is comparing the EXACT instance of the saved version |
|
426 | + // it just pulled from the db, with the one being passed to it (which will not match). |
|
427 | + // HOWEVER, once the object is serialized and passed off to MySQL to update, |
|
428 | + // MySQL MAY ALSO NOT perform the update because |
|
429 | + // the string it sees in the db looks the same as the new one it has been passed!!! |
|
430 | + // This results in the query returning an "affected rows" value of ZERO, |
|
431 | + // which gets returned immediately by WP update_option and looks like an error. |
|
432 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
433 | + } |
|
434 | + } |
|
435 | + } |
|
436 | + |
|
437 | + |
|
438 | + /** |
|
439 | + * update_espresso_config |
|
440 | + * |
|
441 | + * @access public |
|
442 | + */ |
|
443 | + protected function _reset_espresso_addon_config() |
|
444 | + { |
|
445 | + $this->_addon_option_names = array(); |
|
446 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
447 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
448 | + if ($addon_config_obj instanceof EE_Config_Base) { |
|
449 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
450 | + } |
|
451 | + $this->addons->{$addon_name} = null; |
|
452 | + } |
|
453 | + } |
|
454 | + |
|
455 | + |
|
456 | + /** |
|
457 | + * update_espresso_config |
|
458 | + * |
|
459 | + * @access public |
|
460 | + * @param bool $add_success |
|
461 | + * @param bool $add_error |
|
462 | + * @return bool |
|
463 | + */ |
|
464 | + public function update_espresso_config($add_success = false, $add_error = true) |
|
465 | + { |
|
466 | + // don't allow config updates during WP heartbeats |
|
467 | + /** @var RequestInterface $request */ |
|
468 | + $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
469 | + if ($request->isWordPressHeartbeat()) { |
|
470 | + return false; |
|
471 | + } |
|
472 | + // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
|
473 | + // $clone = clone( self::$_instance ); |
|
474 | + // self::$_instance = NULL; |
|
475 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
476 | + $this->_reset_espresso_addon_config(); |
|
477 | + // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
|
478 | + // but BEFORE the actual update occurs |
|
479 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
480 | + // don't want to persist legacy_shortcodes_manager, but don't want to lose it either |
|
481 | + $legacy_shortcodes_manager = $this->legacy_shortcodes_manager; |
|
482 | + $this->legacy_shortcodes_manager = null; |
|
483 | + // now update "ee_config" |
|
484 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
485 | + $this->legacy_shortcodes_manager = $legacy_shortcodes_manager; |
|
486 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
487 | + // if not saved... check if the hook we just added still exists; |
|
488 | + // if it does, it means one of two things: |
|
489 | + // that update_option bailed at the($value === $old_value) conditional, |
|
490 | + // or... |
|
491 | + // the db update query returned 0 rows affected |
|
492 | + // (probably because the data value was the same from it's perspective) |
|
493 | + // so the existence of the hook means that a negative result from update_option is NOT an error, |
|
494 | + // but just means no update occurred, so don't display an error to the user. |
|
495 | + // BUT... if update_option returns FALSE, AND the hook is missing, |
|
496 | + // then it means that something truly went wrong |
|
497 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
498 | + // remove our action since we don't want it in the system anymore |
|
499 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
500 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
501 | + // self::$_instance = $clone; |
|
502 | + // unset( $clone ); |
|
503 | + // if config remains the same or was updated successfully |
|
504 | + if ($saved) { |
|
505 | + if ($add_success) { |
|
506 | + EE_Error::add_success( |
|
507 | + esc_html__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
508 | + __FILE__, |
|
509 | + __FUNCTION__, |
|
510 | + __LINE__ |
|
511 | + ); |
|
512 | + } |
|
513 | + return true; |
|
514 | + } else { |
|
515 | + if ($add_error) { |
|
516 | + EE_Error::add_error( |
|
517 | + esc_html__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
518 | + __FILE__, |
|
519 | + __FUNCTION__, |
|
520 | + __LINE__ |
|
521 | + ); |
|
522 | + } |
|
523 | + return false; |
|
524 | + } |
|
525 | + } |
|
526 | + |
|
527 | + |
|
528 | + /** |
|
529 | + * _verify_config_params |
|
530 | + * |
|
531 | + * @access private |
|
532 | + * @param string $section |
|
533 | + * @param string $name |
|
534 | + * @param string $config_class |
|
535 | + * @param EE_Config_Base $config_obj |
|
536 | + * @param array $tests_to_run |
|
537 | + * @param bool $display_errors |
|
538 | + * @return bool TRUE on success, FALSE on fail |
|
539 | + */ |
|
540 | + private function _verify_config_params( |
|
541 | + $section = '', |
|
542 | + $name = '', |
|
543 | + $config_class = '', |
|
544 | + $config_obj = null, |
|
545 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
546 | + $display_errors = true |
|
547 | + ) { |
|
548 | + try { |
|
549 | + foreach ($tests_to_run as $test) { |
|
550 | + switch ($test) { |
|
551 | + // TEST #1 : check that section was set |
|
552 | + case 1: |
|
553 | + if (empty($section)) { |
|
554 | + if ($display_errors) { |
|
555 | + throw new EE_Error( |
|
556 | + sprintf( |
|
557 | + esc_html__( |
|
558 | + 'No configuration section has been provided while attempting to save "%s".', |
|
559 | + 'event_espresso' |
|
560 | + ), |
|
561 | + $config_class |
|
562 | + ) |
|
563 | + ); |
|
564 | + } |
|
565 | + return false; |
|
566 | + } |
|
567 | + break; |
|
568 | + // TEST #2 : check that settings section exists |
|
569 | + case 2: |
|
570 | + if (! isset($this->{$section})) { |
|
571 | + if ($display_errors) { |
|
572 | + throw new EE_Error( |
|
573 | + sprintf( |
|
574 | + esc_html__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
575 | + $section |
|
576 | + ) |
|
577 | + ); |
|
578 | + } |
|
579 | + return false; |
|
580 | + } |
|
581 | + break; |
|
582 | + // TEST #3 : check that section is the proper format |
|
583 | + case 3: |
|
584 | + if ( |
|
585 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
586 | + ) { |
|
587 | + if ($display_errors) { |
|
588 | + throw new EE_Error( |
|
589 | + sprintf( |
|
590 | + esc_html__( |
|
591 | + 'The "%s" configuration settings have not been formatted correctly.', |
|
592 | + 'event_espresso' |
|
593 | + ), |
|
594 | + $section |
|
595 | + ) |
|
596 | + ); |
|
597 | + } |
|
598 | + return false; |
|
599 | + } |
|
600 | + break; |
|
601 | + // TEST #4 : check that config section name has been set |
|
602 | + case 4: |
|
603 | + if (empty($name)) { |
|
604 | + if ($display_errors) { |
|
605 | + throw new EE_Error( |
|
606 | + esc_html__( |
|
607 | + 'No name has been provided for the specific configuration section.', |
|
608 | + 'event_espresso' |
|
609 | + ) |
|
610 | + ); |
|
611 | + } |
|
612 | + return false; |
|
613 | + } |
|
614 | + break; |
|
615 | + // TEST #5 : check that a config class name has been set |
|
616 | + case 5: |
|
617 | + if (empty($config_class)) { |
|
618 | + if ($display_errors) { |
|
619 | + throw new EE_Error( |
|
620 | + esc_html__( |
|
621 | + 'No class name has been provided for the specific configuration section.', |
|
622 | + 'event_espresso' |
|
623 | + ) |
|
624 | + ); |
|
625 | + } |
|
626 | + return false; |
|
627 | + } |
|
628 | + break; |
|
629 | + // TEST #6 : verify config class is accessible |
|
630 | + case 6: |
|
631 | + if (! class_exists($config_class)) { |
|
632 | + if ($display_errors) { |
|
633 | + throw new EE_Error( |
|
634 | + sprintf( |
|
635 | + esc_html__( |
|
636 | + 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', |
|
637 | + 'event_espresso' |
|
638 | + ), |
|
639 | + $config_class |
|
640 | + ) |
|
641 | + ); |
|
642 | + } |
|
643 | + return false; |
|
644 | + } |
|
645 | + break; |
|
646 | + // TEST #7 : check that config has even been set |
|
647 | + case 7: |
|
648 | + if (! isset($this->{$section}->{$name})) { |
|
649 | + if ($display_errors) { |
|
650 | + throw new EE_Error( |
|
651 | + sprintf( |
|
652 | + esc_html__('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
653 | + $section, |
|
654 | + $name |
|
655 | + ) |
|
656 | + ); |
|
657 | + } |
|
658 | + return false; |
|
659 | + } else { |
|
660 | + // and make sure it's not serialized |
|
661 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name}); |
|
662 | + } |
|
663 | + break; |
|
664 | + // TEST #8 : check that config is the requested type |
|
665 | + case 8: |
|
666 | + if (! $this->{$section}->{$name} instanceof $config_class) { |
|
667 | + if ($display_errors) { |
|
668 | + throw new EE_Error( |
|
669 | + sprintf( |
|
670 | + esc_html__( |
|
671 | + 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', |
|
672 | + 'event_espresso' |
|
673 | + ), |
|
674 | + $section, |
|
675 | + $name, |
|
676 | + $config_class |
|
677 | + ) |
|
678 | + ); |
|
679 | + } |
|
680 | + return false; |
|
681 | + } |
|
682 | + break; |
|
683 | + // TEST #9 : verify config object |
|
684 | + case 9: |
|
685 | + if (! $config_obj instanceof EE_Config_Base) { |
|
686 | + if ($display_errors) { |
|
687 | + throw new EE_Error( |
|
688 | + sprintf( |
|
689 | + esc_html__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
690 | + print_r($config_obj, true) |
|
691 | + ) |
|
692 | + ); |
|
693 | + } |
|
694 | + return false; |
|
695 | + } |
|
696 | + break; |
|
697 | + } |
|
698 | + } |
|
699 | + } catch (EE_Error $e) { |
|
700 | + $e->get_error(); |
|
701 | + } |
|
702 | + // you have successfully run the gauntlet |
|
703 | + return true; |
|
704 | + } |
|
705 | + |
|
706 | + |
|
707 | + /** |
|
708 | + * _generate_config_option_name |
|
709 | + * |
|
710 | + * @access protected |
|
711 | + * @param string $section |
|
712 | + * @param string $name |
|
713 | + * @return string |
|
714 | + */ |
|
715 | + private function _generate_config_option_name($section = '', $name = '') |
|
716 | + { |
|
717 | + return 'ee_config-' . strtolower($section . '-' . str_replace(array('EE_', 'EED_'), '', $name)); |
|
718 | + } |
|
719 | + |
|
720 | + |
|
721 | + /** |
|
722 | + * _set_config_class |
|
723 | + * ensures that a config class is set, either from a passed config class or one generated from the config name |
|
724 | + * |
|
725 | + * @access private |
|
726 | + * @param string $config_class |
|
727 | + * @param string $name |
|
728 | + * @return string |
|
729 | + */ |
|
730 | + private function _set_config_class($config_class = '', $name = '') |
|
731 | + { |
|
732 | + return ! empty($config_class) |
|
733 | + ? $config_class |
|
734 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))) . '_Config'; |
|
735 | + } |
|
736 | + |
|
737 | + |
|
738 | + /** |
|
739 | + * set_config |
|
740 | + * |
|
741 | + * @access protected |
|
742 | + * @param string $section |
|
743 | + * @param string $name |
|
744 | + * @param string $config_class |
|
745 | + * @param EE_Config_Base $config_obj |
|
746 | + * @return EE_Config_Base |
|
747 | + */ |
|
748 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) |
|
749 | + { |
|
750 | + // ensure config class is set to something |
|
751 | + $config_class = $this->_set_config_class($config_class, $name); |
|
752 | + // run tests 1-4, 6, and 7 to verify all config params are set and valid |
|
753 | + if (! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
754 | + return null; |
|
755 | + } |
|
756 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
757 | + // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
|
758 | + if (! isset($this->_addon_option_names[ $config_option_name ])) { |
|
759 | + $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
760 | + $this->update_addon_option_names(); |
|
761 | + } |
|
762 | + // verify the incoming config object but suppress errors |
|
763 | + if (! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
764 | + $config_obj = new $config_class(); |
|
765 | + } |
|
766 | + if (get_option($config_option_name)) { |
|
767 | + EE_Config::log($config_option_name); |
|
768 | + update_option($config_option_name, $config_obj); |
|
769 | + $this->{$section}->{$name} = $config_obj; |
|
770 | + return $this->{$section}->{$name}; |
|
771 | + } else { |
|
772 | + // create a wp-option for this config |
|
773 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
774 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
775 | + return $this->{$section}->{$name}; |
|
776 | + } else { |
|
777 | + EE_Error::add_error( |
|
778 | + sprintf(esc_html__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
779 | + __FILE__, |
|
780 | + __FUNCTION__, |
|
781 | + __LINE__ |
|
782 | + ); |
|
783 | + return null; |
|
784 | + } |
|
785 | + } |
|
786 | + } |
|
787 | + |
|
788 | + |
|
789 | + /** |
|
790 | + * update_config |
|
791 | + * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
792 | + * |
|
793 | + * @access public |
|
794 | + * @param string $section |
|
795 | + * @param string $name |
|
796 | + * @param EE_Config_Base|string $config_obj |
|
797 | + * @param bool $throw_errors |
|
798 | + * @return bool |
|
799 | + */ |
|
800 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) |
|
801 | + { |
|
802 | + // don't allow config updates during WP heartbeats |
|
803 | + /** @var RequestInterface $request */ |
|
804 | + $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
805 | + if ($request->isWordPressHeartbeat()) { |
|
806 | + return false; |
|
807 | + } |
|
808 | + $config_obj = maybe_unserialize($config_obj); |
|
809 | + // get class name of the incoming object |
|
810 | + $config_class = get_class($config_obj); |
|
811 | + // run tests 1-5 and 9 to verify config |
|
812 | + if ( |
|
813 | + ! $this->_verify_config_params( |
|
814 | + $section, |
|
815 | + $name, |
|
816 | + $config_class, |
|
817 | + $config_obj, |
|
818 | + array(1, 2, 3, 4, 7, 9) |
|
819 | + ) |
|
820 | + ) { |
|
821 | + return false; |
|
822 | + } |
|
823 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
824 | + // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
|
825 | + if (! isset($this->_addon_option_names[ $config_option_name ])) { |
|
826 | + // save new config to db |
|
827 | + if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
828 | + return true; |
|
829 | + } |
|
830 | + } else { |
|
831 | + // first check if the record already exists |
|
832 | + $existing_config = get_option($config_option_name); |
|
833 | + $config_obj = serialize($config_obj); |
|
834 | + // just return if db record is already up to date (NOT type safe comparison) |
|
835 | + if ($existing_config == $config_obj) { |
|
836 | + $this->{$section}->{$name} = $config_obj; |
|
837 | + return true; |
|
838 | + } elseif (update_option($config_option_name, $config_obj)) { |
|
839 | + EE_Config::log($config_option_name); |
|
840 | + // update wp-option for this config class |
|
841 | + $this->{$section}->{$name} = $config_obj; |
|
842 | + return true; |
|
843 | + } elseif ($throw_errors) { |
|
844 | + EE_Error::add_error( |
|
845 | + sprintf( |
|
846 | + esc_html__( |
|
847 | + 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', |
|
848 | + 'event_espresso' |
|
849 | + ), |
|
850 | + $config_class, |
|
851 | + 'EE_Config->' . $section . '->' . $name |
|
852 | + ), |
|
853 | + __FILE__, |
|
854 | + __FUNCTION__, |
|
855 | + __LINE__ |
|
856 | + ); |
|
857 | + } |
|
858 | + } |
|
859 | + return false; |
|
860 | + } |
|
861 | + |
|
862 | + |
|
863 | + /** |
|
864 | + * get_config |
|
865 | + * |
|
866 | + * @access public |
|
867 | + * @param string $section |
|
868 | + * @param string $name |
|
869 | + * @param string $config_class |
|
870 | + * @return mixed EE_Config_Base | NULL |
|
871 | + */ |
|
872 | + public function get_config($section = '', $name = '', $config_class = '') |
|
873 | + { |
|
874 | + // ensure config class is set to something |
|
875 | + $config_class = $this->_set_config_class($config_class, $name); |
|
876 | + // run tests 1-4, 6 and 7 to verify that all params have been set |
|
877 | + if (! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
878 | + return null; |
|
879 | + } |
|
880 | + // now test if the requested config object exists, but suppress errors |
|
881 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
882 | + // config already exists, so pass it back |
|
883 | + return $this->{$section}->{$name}; |
|
884 | + } |
|
885 | + // load config option from db if it exists |
|
886 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
887 | + // verify the newly retrieved config object, but suppress errors |
|
888 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
889 | + // config is good, so set it and pass it back |
|
890 | + $this->{$section}->{$name} = $config_obj; |
|
891 | + return $this->{$section}->{$name}; |
|
892 | + } |
|
893 | + // oops! $config_obj is not already set and does not exist in the db, so create a new one |
|
894 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
895 | + // verify the newly created config object |
|
896 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
897 | + return $this->{$section}->{$name}; |
|
898 | + } else { |
|
899 | + EE_Error::add_error( |
|
900 | + sprintf(esc_html__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
901 | + __FILE__, |
|
902 | + __FUNCTION__, |
|
903 | + __LINE__ |
|
904 | + ); |
|
905 | + } |
|
906 | + return null; |
|
907 | + } |
|
908 | + |
|
909 | + |
|
910 | + /** |
|
911 | + * get_config_option |
|
912 | + * |
|
913 | + * @access public |
|
914 | + * @param string $config_option_name |
|
915 | + * @return mixed EE_Config_Base | FALSE |
|
916 | + */ |
|
917 | + public function get_config_option($config_option_name = '') |
|
918 | + { |
|
919 | + // retrieve the wp-option for this config class. |
|
920 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
921 | + if (empty($config_option)) { |
|
922 | + EE_Config::log($config_option_name . '-NOT-FOUND'); |
|
923 | + } |
|
924 | + return $config_option; |
|
925 | + } |
|
926 | + |
|
927 | + |
|
928 | + /** |
|
929 | + * log |
|
930 | + * |
|
931 | + * @param string $config_option_name |
|
932 | + */ |
|
933 | + public static function log($config_option_name = '') |
|
934 | + { |
|
935 | + if (EE_Config::logging_enabled() && ! empty($config_option_name)) { |
|
936 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
937 | + /** @var RequestParams $request */ |
|
938 | + $request = LoaderFactory::getLoader()->getShared(RequestParams::class); |
|
939 | + $config_log[ (string) microtime(true) ] = array( |
|
940 | + 'config_name' => $config_option_name, |
|
941 | + 'request' => $request->requestParams(), |
|
942 | + ); |
|
943 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
944 | + } |
|
945 | + } |
|
946 | + |
|
947 | + |
|
948 | + /** |
|
949 | + * trim_log |
|
950 | + * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
|
951 | + */ |
|
952 | + public static function trim_log() |
|
953 | + { |
|
954 | + if (! EE_Config::logging_enabled()) { |
|
955 | + return; |
|
956 | + } |
|
957 | + $config_log = maybe_unserialize(get_option(EE_Config::LOG_NAME, array())); |
|
958 | + $log_length = count($config_log); |
|
959 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
960 | + ksort($config_log); |
|
961 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
962 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
963 | + } |
|
964 | + } |
|
965 | + |
|
966 | + |
|
967 | + /** |
|
968 | + * get_page_for_posts |
|
969 | + * if the wp-option "show_on_front" is set to "page", then this is the post_name for the post set in the |
|
970 | + * wp-option "page_for_posts", or "posts" if no page is selected |
|
971 | + * |
|
972 | + * @access public |
|
973 | + * @return string |
|
974 | + */ |
|
975 | + public static function get_page_for_posts() |
|
976 | + { |
|
977 | + $page_for_posts = get_option('page_for_posts'); |
|
978 | + if (! $page_for_posts) { |
|
979 | + return 'posts'; |
|
980 | + } |
|
981 | + global $wpdb; |
|
982 | + $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
|
983 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
984 | + } |
|
985 | + |
|
986 | + |
|
987 | + /** |
|
988 | + * register_shortcodes_and_modules. |
|
989 | + * At this point, it's too early to tell if we're maintenance mode or not. |
|
990 | + * In fact, this is where we give modules a chance to let core know they exist |
|
991 | + * so they can help trigger maintenance mode if it's needed |
|
992 | + * |
|
993 | + * @access public |
|
994 | + * @return void |
|
995 | + */ |
|
996 | + public function register_shortcodes_and_modules() |
|
997 | + { |
|
998 | + // allow modules to set hooks for the rest of the system |
|
999 | + EE_Registry::instance()->modules = $this->_register_modules(); |
|
1000 | + } |
|
1001 | + |
|
1002 | + |
|
1003 | + /** |
|
1004 | + * initialize_shortcodes_and_modules |
|
1005 | + * meaning they can start adding their hooks to get stuff done |
|
1006 | + * |
|
1007 | + * @access public |
|
1008 | + * @return void |
|
1009 | + */ |
|
1010 | + public function initialize_shortcodes_and_modules() |
|
1011 | + { |
|
1012 | + // allow modules to set hooks for the rest of the system |
|
1013 | + $this->_initialize_modules(); |
|
1014 | + } |
|
1015 | + |
|
1016 | + |
|
1017 | + /** |
|
1018 | + * widgets_init |
|
1019 | + * |
|
1020 | + * @access private |
|
1021 | + * @return void |
|
1022 | + */ |
|
1023 | + public function widgets_init() |
|
1024 | + { |
|
1025 | + // only init widgets on admin pages when not in complete maintenance, and |
|
1026 | + // on frontend when not in any maintenance mode |
|
1027 | + if ( |
|
1028 | + ! EE_Maintenance_Mode::instance()->level() |
|
1029 | + || ( |
|
1030 | + is_admin() |
|
1031 | + && EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance |
|
1032 | + ) |
|
1033 | + ) { |
|
1034 | + // grab list of installed widgets |
|
1035 | + $widgets_to_register = glob(EE_WIDGETS . '*', GLOB_ONLYDIR); |
|
1036 | + // filter list of modules to register |
|
1037 | + $widgets_to_register = apply_filters( |
|
1038 | + 'FHEE__EE_Config__register_widgets__widgets_to_register', |
|
1039 | + $widgets_to_register |
|
1040 | + ); |
|
1041 | + if (! empty($widgets_to_register)) { |
|
1042 | + // cycle thru widget folders |
|
1043 | + foreach ($widgets_to_register as $widget_path) { |
|
1044 | + // add to list of installed widget modules |
|
1045 | + EE_Config::register_ee_widget($widget_path); |
|
1046 | + } |
|
1047 | + } |
|
1048 | + // filter list of installed modules |
|
1049 | + EE_Registry::instance()->widgets = apply_filters( |
|
1050 | + 'FHEE__EE_Config__register_widgets__installed_widgets', |
|
1051 | + EE_Registry::instance()->widgets |
|
1052 | + ); |
|
1053 | + } |
|
1054 | + } |
|
1055 | + |
|
1056 | + |
|
1057 | + /** |
|
1058 | + * register_ee_widget - makes core aware of this widget |
|
1059 | + * |
|
1060 | + * @access public |
|
1061 | + * @param string $widget_path - full path up to and including widget folder |
|
1062 | + * @return void |
|
1063 | + */ |
|
1064 | + public static function register_ee_widget($widget_path = null) |
|
1065 | + { |
|
1066 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
1067 | + $widget_ext = '.widget.php'; |
|
1068 | + // make all separators match |
|
1069 | + $widget_path = rtrim(str_replace('\\', DS, $widget_path), DS); |
|
1070 | + // does the file path INCLUDE the actual file name as part of the path ? |
|
1071 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1072 | + // grab and shortcode file name from directory name and break apart at dots |
|
1073 | + $file_name = explode('.', basename($widget_path)); |
|
1074 | + // take first segment from file name pieces and remove class prefix if it exists |
|
1075 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1076 | + // sanitize shortcode directory name |
|
1077 | + $widget = sanitize_key($widget); |
|
1078 | + // now we need to rebuild the shortcode path |
|
1079 | + $widget_path = explode('/', $widget_path); |
|
1080 | + // remove last segment |
|
1081 | + array_pop($widget_path); |
|
1082 | + // glue it back together |
|
1083 | + $widget_path = implode(DS, $widget_path); |
|
1084 | + } else { |
|
1085 | + // grab and sanitize widget directory name |
|
1086 | + $widget = sanitize_key(basename($widget_path)); |
|
1087 | + } |
|
1088 | + // create classname from widget directory name |
|
1089 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1090 | + // add class prefix |
|
1091 | + $widget_class = 'EEW_' . $widget; |
|
1092 | + // does the widget exist ? |
|
1093 | + if (! is_readable($widget_path . '/' . $widget_class . $widget_ext)) { |
|
1094 | + $msg = sprintf( |
|
1095 | + esc_html__( |
|
1096 | + 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
|
1097 | + 'event_espresso' |
|
1098 | + ), |
|
1099 | + $widget_class, |
|
1100 | + $widget_path . '/' . $widget_class . $widget_ext |
|
1101 | + ); |
|
1102 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1103 | + return; |
|
1104 | + } |
|
1105 | + // load the widget class file |
|
1106 | + require_once($widget_path . '/' . $widget_class . $widget_ext); |
|
1107 | + // verify that class exists |
|
1108 | + if (! class_exists($widget_class)) { |
|
1109 | + $msg = sprintf(esc_html__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1110 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1111 | + return; |
|
1112 | + } |
|
1113 | + register_widget($widget_class); |
|
1114 | + // add to array of registered widgets |
|
1115 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path . '/' . $widget_class . $widget_ext; |
|
1116 | + } |
|
1117 | + |
|
1118 | + |
|
1119 | + /** |
|
1120 | + * _register_modules |
|
1121 | + * |
|
1122 | + * @access private |
|
1123 | + * @return array |
|
1124 | + */ |
|
1125 | + private function _register_modules() |
|
1126 | + { |
|
1127 | + // grab list of installed modules |
|
1128 | + $modules_to_register = glob(EE_MODULES . '*', GLOB_ONLYDIR); |
|
1129 | + // filter list of modules to register |
|
1130 | + $modules_to_register = apply_filters( |
|
1131 | + 'FHEE__EE_Config__register_modules__modules_to_register', |
|
1132 | + $modules_to_register |
|
1133 | + ); |
|
1134 | + if (! empty($modules_to_register)) { |
|
1135 | + // loop through folders |
|
1136 | + foreach ($modules_to_register as $module_path) { |
|
1137 | + /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
|
1138 | + if ( |
|
1139 | + $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1140 | + && $module_path !== EE_MODULES . 'gateways' |
|
1141 | + ) { |
|
1142 | + // add to list of installed modules |
|
1143 | + EE_Config::register_module($module_path); |
|
1144 | + } |
|
1145 | + } |
|
1146 | + } |
|
1147 | + // filter list of installed modules |
|
1148 | + return apply_filters( |
|
1149 | + 'FHEE__EE_Config___register_modules__installed_modules', |
|
1150 | + EE_Registry::instance()->modules |
|
1151 | + ); |
|
1152 | + } |
|
1153 | + |
|
1154 | + |
|
1155 | + /** |
|
1156 | + * register_module - makes core aware of this module |
|
1157 | + * |
|
1158 | + * @access public |
|
1159 | + * @param string $module_path - full path up to and including module folder |
|
1160 | + * @return bool |
|
1161 | + */ |
|
1162 | + public static function register_module($module_path = null) |
|
1163 | + { |
|
1164 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1165 | + $module_ext = '.module.php'; |
|
1166 | + // make all separators match |
|
1167 | + $module_path = str_replace(array('\\', '/'), '/', $module_path); |
|
1168 | + // does the file path INCLUDE the actual file name as part of the path ? |
|
1169 | + if (strpos($module_path, $module_ext) !== false) { |
|
1170 | + // grab and shortcode file name from directory name and break apart at dots |
|
1171 | + $module_file = explode('.', basename($module_path)); |
|
1172 | + // now we need to rebuild the shortcode path |
|
1173 | + $module_path = explode('/', $module_path); |
|
1174 | + // remove last segment |
|
1175 | + array_pop($module_path); |
|
1176 | + // glue it back together |
|
1177 | + $module_path = implode('/', $module_path) . '/'; |
|
1178 | + // take first segment from file name pieces and sanitize it |
|
1179 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1180 | + // ensure class prefix is added |
|
1181 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_' . $module : $module; |
|
1182 | + } else { |
|
1183 | + // we need to generate the filename based off of the folder name |
|
1184 | + // grab and sanitize module name |
|
1185 | + $module = strtolower(basename($module_path)); |
|
1186 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1187 | + // like trailingslashit() |
|
1188 | + $module_path = rtrim($module_path, '/') . '/'; |
|
1189 | + // create classname from module directory name |
|
1190 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1191 | + // add class prefix |
|
1192 | + $module_class = 'EED_' . $module; |
|
1193 | + } |
|
1194 | + // does the module exist ? |
|
1195 | + if (! is_readable($module_path . '/' . $module_class . $module_ext)) { |
|
1196 | + $msg = sprintf( |
|
1197 | + esc_html__( |
|
1198 | + 'The requested %s module file could not be found or is not readable due to file permissions.', |
|
1199 | + 'event_espresso' |
|
1200 | + ), |
|
1201 | + $module |
|
1202 | + ); |
|
1203 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1204 | + return false; |
|
1205 | + } |
|
1206 | + // load the module class file |
|
1207 | + require_once($module_path . $module_class . $module_ext); |
|
1208 | + // verify that class exists |
|
1209 | + if (! class_exists($module_class)) { |
|
1210 | + $msg = sprintf(esc_html__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1211 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1212 | + return false; |
|
1213 | + } |
|
1214 | + // add to array of registered modules |
|
1215 | + EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1216 | + do_action( |
|
1217 | + 'AHEE__EE_Config__register_module__complete', |
|
1218 | + $module_class, |
|
1219 | + EE_Registry::instance()->modules->{$module_class} |
|
1220 | + ); |
|
1221 | + return true; |
|
1222 | + } |
|
1223 | + |
|
1224 | + |
|
1225 | + /** |
|
1226 | + * _initialize_modules |
|
1227 | + * allow modules to set hooks for the rest of the system |
|
1228 | + * |
|
1229 | + * @access private |
|
1230 | + * @return void |
|
1231 | + */ |
|
1232 | + private function _initialize_modules() |
|
1233 | + { |
|
1234 | + // cycle thru shortcode folders |
|
1235 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1236 | + // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
|
1237 | + // which set hooks ? |
|
1238 | + if (is_admin()) { |
|
1239 | + // fire immediately |
|
1240 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1241 | + } else { |
|
1242 | + // delay until other systems are online |
|
1243 | + add_action( |
|
1244 | + 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
|
1245 | + array($module_class, 'set_hooks') |
|
1246 | + ); |
|
1247 | + } |
|
1248 | + } |
|
1249 | + } |
|
1250 | + |
|
1251 | + |
|
1252 | + /** |
|
1253 | + * register_route - adds module method routes to route_map |
|
1254 | + * |
|
1255 | + * @access public |
|
1256 | + * @param string $route - "pretty" public alias for module method |
|
1257 | + * @param string $module - module name (classname without EED_ prefix) |
|
1258 | + * @param string $method_name - the actual module method to be routed to |
|
1259 | + * @param string $key - url param key indicating a route is being called |
|
1260 | + * @return bool |
|
1261 | + */ |
|
1262 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') |
|
1263 | + { |
|
1264 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1265 | + $module = str_replace('EED_', '', $module); |
|
1266 | + $module_class = 'EED_' . $module; |
|
1267 | + if (! isset(EE_Registry::instance()->modules->{$module_class})) { |
|
1268 | + $msg = sprintf(esc_html__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1269 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1270 | + return false; |
|
1271 | + } |
|
1272 | + if (empty($route)) { |
|
1273 | + $msg = sprintf(esc_html__('No route has been supplied.', 'event_espresso'), $route); |
|
1274 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1275 | + return false; |
|
1276 | + } |
|
1277 | + if (! method_exists('EED_' . $module, $method_name)) { |
|
1278 | + $msg = sprintf( |
|
1279 | + esc_html__('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1280 | + $route |
|
1281 | + ); |
|
1282 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1283 | + return false; |
|
1284 | + } |
|
1285 | + EE_Config::$_module_route_map[ (string) $key ][ (string) $route ] = array('EED_' . $module, $method_name); |
|
1286 | + return true; |
|
1287 | + } |
|
1288 | + |
|
1289 | + |
|
1290 | + /** |
|
1291 | + * get_route - get module method route |
|
1292 | + * |
|
1293 | + * @access public |
|
1294 | + * @param string $route - "pretty" public alias for module method |
|
1295 | + * @param string $key - url param key indicating a route is being called |
|
1296 | + * @return string |
|
1297 | + */ |
|
1298 | + public static function get_route($route = null, $key = 'ee') |
|
1299 | + { |
|
1300 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1301 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1302 | + if (isset(EE_Config::$_module_route_map[ $key ][ $route ])) { |
|
1303 | + return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1304 | + } |
|
1305 | + return null; |
|
1306 | + } |
|
1307 | + |
|
1308 | + |
|
1309 | + /** |
|
1310 | + * get_routes - get ALL module method routes |
|
1311 | + * |
|
1312 | + * @access public |
|
1313 | + * @return array |
|
1314 | + */ |
|
1315 | + public static function get_routes() |
|
1316 | + { |
|
1317 | + return EE_Config::$_module_route_map; |
|
1318 | + } |
|
1319 | + |
|
1320 | + |
|
1321 | + /** |
|
1322 | + * register_forward - allows modules to forward request to another module for further processing |
|
1323 | + * |
|
1324 | + * @access public |
|
1325 | + * @param string $route - "pretty" public alias for module method |
|
1326 | + * @param integer $status - integer value corresponding to status constant strings set in module parent |
|
1327 | + * class, allows different forwards to be served based on status |
|
1328 | + * @param array|string $forward - function name or array( class, method ) |
|
1329 | + * @param string $key - url param key indicating a route is being called |
|
1330 | + * @return bool |
|
1331 | + */ |
|
1332 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') |
|
1333 | + { |
|
1334 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1335 | + if (! isset(EE_Config::$_module_route_map[ $key ][ $route ]) || empty($route)) { |
|
1336 | + $msg = sprintf( |
|
1337 | + esc_html__('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1338 | + $route |
|
1339 | + ); |
|
1340 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1341 | + return false; |
|
1342 | + } |
|
1343 | + if (empty($forward)) { |
|
1344 | + $msg = sprintf(esc_html__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1345 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1346 | + return false; |
|
1347 | + } |
|
1348 | + if (is_array($forward)) { |
|
1349 | + if (! isset($forward[1])) { |
|
1350 | + $msg = sprintf( |
|
1351 | + esc_html__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1352 | + $route |
|
1353 | + ); |
|
1354 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1355 | + return false; |
|
1356 | + } |
|
1357 | + if (! method_exists($forward[0], $forward[1])) { |
|
1358 | + $msg = sprintf( |
|
1359 | + esc_html__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1360 | + $forward[1], |
|
1361 | + $route |
|
1362 | + ); |
|
1363 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1364 | + return false; |
|
1365 | + } |
|
1366 | + } elseif (! function_exists($forward)) { |
|
1367 | + $msg = sprintf( |
|
1368 | + esc_html__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1369 | + $forward, |
|
1370 | + $route |
|
1371 | + ); |
|
1372 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1373 | + return false; |
|
1374 | + } |
|
1375 | + EE_Config::$_module_forward_map[ $key ][ $route ][ absint($status) ] = $forward; |
|
1376 | + return true; |
|
1377 | + } |
|
1378 | + |
|
1379 | + |
|
1380 | + /** |
|
1381 | + * get_forward - get forwarding route |
|
1382 | + * |
|
1383 | + * @access public |
|
1384 | + * @param string $route - "pretty" public alias for module method |
|
1385 | + * @param integer $status - integer value corresponding to status constant strings set in module parent class, |
|
1386 | + * allows different forwards to be served based on status |
|
1387 | + * @param string $key - url param key indicating a route is being called |
|
1388 | + * @return string |
|
1389 | + */ |
|
1390 | + public static function get_forward($route = null, $status = 0, $key = 'ee') |
|
1391 | + { |
|
1392 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1393 | + if (isset(EE_Config::$_module_forward_map[ $key ][ $route ][ $status ])) { |
|
1394 | + return apply_filters( |
|
1395 | + 'FHEE__EE_Config__get_forward', |
|
1396 | + EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1397 | + $route, |
|
1398 | + $status |
|
1399 | + ); |
|
1400 | + } |
|
1401 | + return null; |
|
1402 | + } |
|
1403 | + |
|
1404 | + |
|
1405 | + /** |
|
1406 | + * register_forward - allows modules to specify different view templates for different method routes and status |
|
1407 | + * results |
|
1408 | + * |
|
1409 | + * @access public |
|
1410 | + * @param string $route - "pretty" public alias for module method |
|
1411 | + * @param integer $status - integer value corresponding to status constant strings set in module parent class, |
|
1412 | + * allows different views to be served based on status |
|
1413 | + * @param string $view |
|
1414 | + * @param string $key - url param key indicating a route is being called |
|
1415 | + * @return bool |
|
1416 | + */ |
|
1417 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') |
|
1418 | + { |
|
1419 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1420 | + if (! isset(EE_Config::$_module_route_map[ $key ][ $route ]) || empty($route)) { |
|
1421 | + $msg = sprintf( |
|
1422 | + esc_html__('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1423 | + $route |
|
1424 | + ); |
|
1425 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1426 | + return false; |
|
1427 | + } |
|
1428 | + if (! is_readable($view)) { |
|
1429 | + $msg = sprintf( |
|
1430 | + esc_html__( |
|
1431 | + 'The %s view file could not be found or is not readable due to file permissions.', |
|
1432 | + 'event_espresso' |
|
1433 | + ), |
|
1434 | + $view |
|
1435 | + ); |
|
1436 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
1437 | + return false; |
|
1438 | + } |
|
1439 | + EE_Config::$_module_view_map[ $key ][ $route ][ absint($status) ] = $view; |
|
1440 | + return true; |
|
1441 | + } |
|
1442 | + |
|
1443 | + |
|
1444 | + /** |
|
1445 | + * get_view - get view for route and status |
|
1446 | + * |
|
1447 | + * @access public |
|
1448 | + * @param string $route - "pretty" public alias for module method |
|
1449 | + * @param integer $status - integer value corresponding to status constant strings set in module parent class, |
|
1450 | + * allows different views to be served based on status |
|
1451 | + * @param string $key - url param key indicating a route is being called |
|
1452 | + * @return string |
|
1453 | + */ |
|
1454 | + public static function get_view($route = null, $status = 0, $key = 'ee') |
|
1455 | + { |
|
1456 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1457 | + if (isset(EE_Config::$_module_view_map[ $key ][ $route ][ $status ])) { |
|
1458 | + return apply_filters( |
|
1459 | + 'FHEE__EE_Config__get_view', |
|
1460 | + EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1461 | + $route, |
|
1462 | + $status |
|
1463 | + ); |
|
1464 | + } |
|
1465 | + return null; |
|
1466 | + } |
|
1467 | + |
|
1468 | + |
|
1469 | + public function update_addon_option_names() |
|
1470 | + { |
|
1471 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1472 | + } |
|
1473 | + |
|
1474 | + |
|
1475 | + public function shutdown() |
|
1476 | + { |
|
1477 | + $this->update_addon_option_names(); |
|
1478 | + } |
|
1479 | + |
|
1480 | + |
|
1481 | + /** |
|
1482 | + * @return LegacyShortcodesManager |
|
1483 | + */ |
|
1484 | + public static function getLegacyShortcodesManager() |
|
1485 | + { |
|
1486 | + if (! EE_Config::instance()->legacy_shortcodes_manager instanceof LegacyShortcodesManager) { |
|
1487 | + EE_Config::instance()->legacy_shortcodes_manager = LoaderFactory::getLoader()->getShared( |
|
1488 | + LegacyShortcodesManager::class |
|
1489 | + ); |
|
1490 | + } |
|
1491 | + return EE_Config::instance()->legacy_shortcodes_manager; |
|
1492 | + } |
|
1493 | + |
|
1494 | + |
|
1495 | + /** |
|
1496 | + * register_shortcode - makes core aware of this shortcode |
|
1497 | + * |
|
1498 | + * @deprecated 4.9.26 |
|
1499 | + * @param string $shortcode_path - full path up to and including shortcode folder |
|
1500 | + * @return bool |
|
1501 | + */ |
|
1502 | + public static function register_shortcode($shortcode_path = null) |
|
1503 | + { |
|
1504 | + EE_Error::doing_it_wrong( |
|
1505 | + __METHOD__, |
|
1506 | + esc_html__( |
|
1507 | + 'Usage is deprecated. Use \EventEspresso\core\services\shortcodes\LegacyShortcodesManager::registerShortcode() as direct replacement, or better yet, please see the new \EventEspresso\core\services\shortcodes\ShortcodesManager class.', |
|
1508 | + 'event_espresso' |
|
1509 | + ), |
|
1510 | + '4.9.26' |
|
1511 | + ); |
|
1512 | + return EE_Config::instance()->getLegacyShortcodesManager()->registerShortcode($shortcode_path); |
|
1513 | + } |
|
1514 | +} |
|
2354 | 1515 | |
2355 | - /** |
|
2356 | - * ReCaptcha width |
|
2357 | - * |
|
2358 | - * @var int $recaptcha_width |
|
2359 | - * @deprecated |
|
2360 | - */ |
|
2361 | - public $recaptcha_width; |
|
1516 | +/** |
|
1517 | + * Base class used for config classes. These classes should generally not have |
|
1518 | + * magic functions in use, except we'll allow them to magically set and get stuff... |
|
1519 | + * basically, they should just be well-defined stdClasses |
|
1520 | + */ |
|
1521 | +class EE_Config_Base |
|
1522 | +{ |
|
1523 | + /** |
|
1524 | + * Utility function for escaping the value of a property and returning. |
|
1525 | + * |
|
1526 | + * @param string $property property name (checks to see if exists). |
|
1527 | + * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
|
1528 | + * @throws EE_Error |
|
1529 | + */ |
|
1530 | + public function get_pretty($property) |
|
1531 | + { |
|
1532 | + if (! property_exists($this, $property)) { |
|
1533 | + throw new EE_Error( |
|
1534 | + sprintf( |
|
1535 | + esc_html__( |
|
1536 | + '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
|
1537 | + 'event_espresso' |
|
1538 | + ), |
|
1539 | + get_class($this), |
|
1540 | + $property |
|
1541 | + ) |
|
1542 | + ); |
|
1543 | + } |
|
1544 | + // just handling escaping of strings for now. |
|
1545 | + if (is_string($this->{$property})) { |
|
1546 | + return stripslashes($this->{$property}); |
|
1547 | + } |
|
1548 | + return $this->{$property}; |
|
1549 | + } |
|
1550 | + |
|
1551 | + |
|
1552 | + public function populate() |
|
1553 | + { |
|
1554 | + // grab defaults via a new instance of this class. |
|
1555 | + $class_name = get_class($this); |
|
1556 | + $defaults = new $class_name(); |
|
1557 | + // loop through the properties for this class and see if they are set. If they are NOT, then grab the |
|
1558 | + // default from our $defaults object. |
|
1559 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1560 | + if ($this->{$property} === null) { |
|
1561 | + $this->{$property} = $value; |
|
1562 | + } |
|
1563 | + } |
|
1564 | + // cleanup |
|
1565 | + unset($defaults); |
|
1566 | + } |
|
1567 | + |
|
1568 | + |
|
1569 | + /** |
|
1570 | + * __isset |
|
1571 | + * |
|
1572 | + * @param $a |
|
1573 | + * @return bool |
|
1574 | + */ |
|
1575 | + public function __isset($a) |
|
1576 | + { |
|
1577 | + return false; |
|
1578 | + } |
|
1579 | + |
|
1580 | + |
|
1581 | + /** |
|
1582 | + * __unset |
|
1583 | + * |
|
1584 | + * @param $a |
|
1585 | + * @return bool |
|
1586 | + */ |
|
1587 | + public function __unset($a) |
|
1588 | + { |
|
1589 | + return false; |
|
1590 | + } |
|
1591 | + |
|
1592 | + |
|
1593 | + /** |
|
1594 | + * __clone |
|
1595 | + */ |
|
1596 | + public function __clone() |
|
1597 | + { |
|
1598 | + } |
|
1599 | + |
|
1600 | + |
|
1601 | + /** |
|
1602 | + * __wakeup |
|
1603 | + */ |
|
1604 | + public function __wakeup() |
|
1605 | + { |
|
1606 | + } |
|
1607 | + |
|
1608 | + |
|
1609 | + /** |
|
1610 | + * __destruct |
|
1611 | + */ |
|
1612 | + public function __destruct() |
|
1613 | + { |
|
1614 | + } |
|
1615 | +} |
|
2362 | 1616 | |
2363 | - /** |
|
2364 | - * Whether or not invalid attempts to directly access the registration checkout page should be tracked. |
|
2365 | - * |
|
2366 | - * @var boolean $track_invalid_checkout_access |
|
2367 | - */ |
|
2368 | - protected $track_invalid_checkout_access = true; |
|
1617 | +/** |
|
1618 | + * Class for defining what's in the EE_Config relating to registration settings |
|
1619 | + */ |
|
1620 | +class EE_Core_Config extends EE_Config_Base |
|
1621 | +{ |
|
1622 | + const OPTION_NAME_UXIP = 'ee_ueip_optin'; |
|
1623 | + |
|
1624 | + |
|
1625 | + public $current_blog_id; |
|
1626 | + |
|
1627 | + public $ee_ueip_optin; |
|
1628 | + |
|
1629 | + public $ee_ueip_has_notified; |
|
1630 | + |
|
1631 | + /** |
|
1632 | + * Not to be confused with the 4 critical page variables (See |
|
1633 | + * get_critical_pages_array()), this is just an array of wp posts that have EE |
|
1634 | + * shortcodes in them. Keys are slugs, values are arrays with only 1 element: where the key is the shortcode |
|
1635 | + * in the page, and the value is the page's ID. The key 'posts' is basically a duplicate of this same array. |
|
1636 | + * |
|
1637 | + * @var array |
|
1638 | + */ |
|
1639 | + public $post_shortcodes; |
|
1640 | + |
|
1641 | + public $module_route_map; |
|
1642 | + |
|
1643 | + public $module_forward_map; |
|
1644 | + |
|
1645 | + public $module_view_map; |
|
1646 | + |
|
1647 | + /** |
|
1648 | + * The next 4 vars are the IDs of critical EE pages. |
|
1649 | + * |
|
1650 | + * @var int |
|
1651 | + */ |
|
1652 | + public $reg_page_id; |
|
1653 | + |
|
1654 | + public $txn_page_id; |
|
1655 | + |
|
1656 | + public $thank_you_page_id; |
|
1657 | + |
|
1658 | + public $cancel_page_id; |
|
1659 | + |
|
1660 | + /** |
|
1661 | + * The next 4 vars are the URLs of critical EE pages. |
|
1662 | + * |
|
1663 | + * @var int |
|
1664 | + */ |
|
1665 | + public $reg_page_url; |
|
1666 | + |
|
1667 | + public $txn_page_url; |
|
1668 | + |
|
1669 | + public $thank_you_page_url; |
|
1670 | + |
|
1671 | + public $cancel_page_url; |
|
1672 | + |
|
1673 | + /** |
|
1674 | + * The next vars relate to the custom slugs for EE CPT routes |
|
1675 | + */ |
|
1676 | + public $event_cpt_slug; |
|
1677 | + |
|
1678 | + /** |
|
1679 | + * This caches the _ee_ueip_option in case this config is reset in the same |
|
1680 | + * request across blog switches in a multisite context. |
|
1681 | + * Avoids extra queries to the db for this option. |
|
1682 | + * |
|
1683 | + * @var bool |
|
1684 | + */ |
|
1685 | + public static $ee_ueip_option; |
|
1686 | + |
|
1687 | + |
|
1688 | + /** |
|
1689 | + * class constructor |
|
1690 | + * |
|
1691 | + * @access public |
|
1692 | + */ |
|
1693 | + public function __construct() |
|
1694 | + { |
|
1695 | + // set default organization settings |
|
1696 | + $this->current_blog_id = get_current_blog_id(); |
|
1697 | + $this->current_blog_id = $this->current_blog_id === null ? 1 : $this->current_blog_id; |
|
1698 | + $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
|
1699 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1700 | + $this->post_shortcodes = array(); |
|
1701 | + $this->module_route_map = array(); |
|
1702 | + $this->module_forward_map = array(); |
|
1703 | + $this->module_view_map = array(); |
|
1704 | + // critical EE page IDs |
|
1705 | + $this->reg_page_id = 0; |
|
1706 | + $this->txn_page_id = 0; |
|
1707 | + $this->thank_you_page_id = 0; |
|
1708 | + $this->cancel_page_id = 0; |
|
1709 | + // critical EE page URLs |
|
1710 | + $this->reg_page_url = ''; |
|
1711 | + $this->txn_page_url = ''; |
|
1712 | + $this->thank_you_page_url = ''; |
|
1713 | + $this->cancel_page_url = ''; |
|
1714 | + // cpt slugs |
|
1715 | + $this->event_cpt_slug = esc_html__('events', 'event_espresso'); |
|
1716 | + // ueip constant check |
|
1717 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1718 | + $this->ee_ueip_optin = false; |
|
1719 | + $this->ee_ueip_has_notified = true; |
|
1720 | + } |
|
1721 | + } |
|
1722 | + |
|
1723 | + |
|
1724 | + /** |
|
1725 | + * @return array |
|
1726 | + */ |
|
1727 | + public function get_critical_pages_array() |
|
1728 | + { |
|
1729 | + return array( |
|
1730 | + $this->reg_page_id, |
|
1731 | + $this->txn_page_id, |
|
1732 | + $this->thank_you_page_id, |
|
1733 | + $this->cancel_page_id, |
|
1734 | + ); |
|
1735 | + } |
|
1736 | + |
|
1737 | + |
|
1738 | + /** |
|
1739 | + * @return array |
|
1740 | + */ |
|
1741 | + public function get_critical_pages_shortcodes_array() |
|
1742 | + { |
|
1743 | + return array( |
|
1744 | + $this->reg_page_id => 'ESPRESSO_CHECKOUT', |
|
1745 | + $this->txn_page_id => 'ESPRESSO_TXN_PAGE', |
|
1746 | + $this->thank_you_page_id => 'ESPRESSO_THANK_YOU', |
|
1747 | + $this->cancel_page_id => 'ESPRESSO_CANCELLED', |
|
1748 | + ); |
|
1749 | + } |
|
1750 | + |
|
1751 | + |
|
1752 | + /** |
|
1753 | + * gets/returns URL for EE reg_page |
|
1754 | + * |
|
1755 | + * @access public |
|
1756 | + * @return string |
|
1757 | + */ |
|
1758 | + public function reg_page_url() |
|
1759 | + { |
|
1760 | + if (! $this->reg_page_url) { |
|
1761 | + $this->reg_page_url = add_query_arg( |
|
1762 | + array('uts' => time()), |
|
1763 | + get_permalink($this->reg_page_id) |
|
1764 | + ) . '#checkout'; |
|
1765 | + } |
|
1766 | + return $this->reg_page_url; |
|
1767 | + } |
|
1768 | + |
|
1769 | + |
|
1770 | + /** |
|
1771 | + * gets/returns URL for EE txn_page |
|
1772 | + * |
|
1773 | + * @param array $query_args like what gets passed to |
|
1774 | + * add_query_arg() as the first argument |
|
1775 | + * @access public |
|
1776 | + * @return string |
|
1777 | + */ |
|
1778 | + public function txn_page_url($query_args = array()) |
|
1779 | + { |
|
1780 | + if (! $this->txn_page_url) { |
|
1781 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1782 | + } |
|
1783 | + if ($query_args) { |
|
1784 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1785 | + } else { |
|
1786 | + return $this->txn_page_url; |
|
1787 | + } |
|
1788 | + } |
|
1789 | + |
|
1790 | + |
|
1791 | + /** |
|
1792 | + * gets/returns URL for EE thank_you_page |
|
1793 | + * |
|
1794 | + * @param array $query_args like what gets passed to |
|
1795 | + * add_query_arg() as the first argument |
|
1796 | + * @access public |
|
1797 | + * @return string |
|
1798 | + */ |
|
1799 | + public function thank_you_page_url($query_args = array()) |
|
1800 | + { |
|
1801 | + if (! $this->thank_you_page_url) { |
|
1802 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1803 | + } |
|
1804 | + if ($query_args) { |
|
1805 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1806 | + } else { |
|
1807 | + return $this->thank_you_page_url; |
|
1808 | + } |
|
1809 | + } |
|
1810 | + |
|
1811 | + |
|
1812 | + /** |
|
1813 | + * gets/returns URL for EE cancel_page |
|
1814 | + * |
|
1815 | + * @access public |
|
1816 | + * @return string |
|
1817 | + */ |
|
1818 | + public function cancel_page_url() |
|
1819 | + { |
|
1820 | + if (! $this->cancel_page_url) { |
|
1821 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1822 | + } |
|
1823 | + return $this->cancel_page_url; |
|
1824 | + } |
|
1825 | + |
|
1826 | + |
|
1827 | + /** |
|
1828 | + * Resets all critical page urls to their original state. Used primarily by the __sleep() magic method currently. |
|
1829 | + * |
|
1830 | + * @since 4.7.5 |
|
1831 | + */ |
|
1832 | + protected function _reset_urls() |
|
1833 | + { |
|
1834 | + $this->reg_page_url = ''; |
|
1835 | + $this->txn_page_url = ''; |
|
1836 | + $this->cancel_page_url = ''; |
|
1837 | + $this->thank_you_page_url = ''; |
|
1838 | + } |
|
1839 | + |
|
1840 | + |
|
1841 | + /** |
|
1842 | + * Used to return what the optin value is set for the EE User Experience Program. |
|
1843 | + * This accounts for multisite and this value being requested for a subsite. In multisite, the value is set |
|
1844 | + * on the main site only. |
|
1845 | + * |
|
1846 | + * @return bool |
|
1847 | + */ |
|
1848 | + protected function _get_main_ee_ueip_optin() |
|
1849 | + { |
|
1850 | + // if this is the main site then we can just bypass our direct query. |
|
1851 | + if (is_main_site()) { |
|
1852 | + return get_option(self::OPTION_NAME_UXIP, false); |
|
1853 | + } |
|
1854 | + // is this already cached for this request? If so use it. |
|
1855 | + if (EE_Core_Config::$ee_ueip_option !== null) { |
|
1856 | + return EE_Core_Config::$ee_ueip_option; |
|
1857 | + } |
|
1858 | + global $wpdb; |
|
1859 | + $current_network_main_site = is_multisite() ? get_current_site() : null; |
|
1860 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1861 | + $option = self::OPTION_NAME_UXIP; |
|
1862 | + // set correct table for query |
|
1863 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id) . 'options'; |
|
1864 | + // rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
|
1865 | + // get_blog_option() does a switch_to_blog an that could cause infinite recursion because EE_Core_Config might be |
|
1866 | + // re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
|
1867 | + // this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
|
1868 | + // for the purpose of caching. |
|
1869 | + $pre = apply_filters('pre_option_' . $option, false, $option); |
|
1870 | + if (false !== $pre) { |
|
1871 | + EE_Core_Config::$ee_ueip_option = $pre; |
|
1872 | + return EE_Core_Config::$ee_ueip_option; |
|
1873 | + } |
|
1874 | + $row = $wpdb->get_row( |
|
1875 | + $wpdb->prepare( |
|
1876 | + "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", |
|
1877 | + $option |
|
1878 | + ) |
|
1879 | + ); |
|
1880 | + if (is_object($row)) { |
|
1881 | + $value = $row->option_value; |
|
1882 | + } else { // option does not exist so use default. |
|
1883 | + EE_Core_Config::$ee_ueip_option = apply_filters('default_option_' . $option, false, $option); |
|
1884 | + return EE_Core_Config::$ee_ueip_option; |
|
1885 | + } |
|
1886 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_' . $option, maybe_unserialize($value), $option); |
|
1887 | + return EE_Core_Config::$ee_ueip_option; |
|
1888 | + } |
|
1889 | + |
|
1890 | + |
|
1891 | + /** |
|
1892 | + * Utility function for escaping the value of a property and returning. |
|
1893 | + * |
|
1894 | + * @param string $property property name (checks to see if exists). |
|
1895 | + * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
|
1896 | + * @throws EE_Error |
|
1897 | + */ |
|
1898 | + public function get_pretty($property) |
|
1899 | + { |
|
1900 | + if ($property === self::OPTION_NAME_UXIP) { |
|
1901 | + return $this->ee_ueip_optin ? 'yes' : 'no'; |
|
1902 | + } |
|
1903 | + return parent::get_pretty($property); |
|
1904 | + } |
|
1905 | + |
|
1906 | + |
|
1907 | + /** |
|
1908 | + * Currently used to ensure critical page urls have initial values saved to the db instead of any current set values |
|
1909 | + * on the object. |
|
1910 | + * |
|
1911 | + * @return array |
|
1912 | + */ |
|
1913 | + public function __sleep() |
|
1914 | + { |
|
1915 | + // reset all url properties |
|
1916 | + $this->_reset_urls(); |
|
1917 | + // return what to save to db |
|
1918 | + return array_keys(get_object_vars($this)); |
|
1919 | + } |
|
1920 | +} |
|
2369 | 1921 | |
2370 | - /** |
|
2371 | - * Whether or not to show the privacy policy consent checkbox |
|
2372 | - * |
|
2373 | - * @var bool |
|
2374 | - */ |
|
2375 | - public $consent_checkbox_enabled; |
|
1922 | +/** |
|
1923 | + * Config class for storing info on the Organization |
|
1924 | + */ |
|
1925 | +class EE_Organization_Config extends EE_Config_Base |
|
1926 | +{ |
|
1927 | + /** |
|
1928 | + * @var string $name |
|
1929 | + * eg EE4.1 |
|
1930 | + */ |
|
1931 | + public $name; |
|
1932 | + |
|
1933 | + /** |
|
1934 | + * @var string $address_1 |
|
1935 | + * eg 123 Onna Road |
|
1936 | + */ |
|
1937 | + public $address_1 = ''; |
|
1938 | + |
|
1939 | + /** |
|
1940 | + * @var string $address_2 |
|
1941 | + * eg PO Box 123 |
|
1942 | + */ |
|
1943 | + public $address_2 = ''; |
|
1944 | + |
|
1945 | + /** |
|
1946 | + * @var string $city |
|
1947 | + * eg Inna City |
|
1948 | + */ |
|
1949 | + public $city = ''; |
|
1950 | + |
|
1951 | + /** |
|
1952 | + * @var int $STA_ID |
|
1953 | + * eg 4 |
|
1954 | + */ |
|
1955 | + public $STA_ID = 0; |
|
1956 | + |
|
1957 | + /** |
|
1958 | + * @var string $CNT_ISO |
|
1959 | + * eg US |
|
1960 | + */ |
|
1961 | + public $CNT_ISO = ''; |
|
1962 | + |
|
1963 | + /** |
|
1964 | + * @var string $zip |
|
1965 | + * eg 12345 or V1A 2B3 |
|
1966 | + */ |
|
1967 | + public $zip = ''; |
|
1968 | + |
|
1969 | + /** |
|
1970 | + * @var string $email |
|
1971 | + * eg [email protected] |
|
1972 | + */ |
|
1973 | + public $email; |
|
1974 | + |
|
1975 | + /** |
|
1976 | + * @var string $phone |
|
1977 | + * eg. 111-111-1111 |
|
1978 | + */ |
|
1979 | + public $phone = ''; |
|
1980 | + |
|
1981 | + /** |
|
1982 | + * @var string $vat |
|
1983 | + * VAT/Tax Number |
|
1984 | + */ |
|
1985 | + public $vat = ''; |
|
1986 | + |
|
1987 | + /** |
|
1988 | + * @var string $logo_url |
|
1989 | + * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1990 | + */ |
|
1991 | + public $logo_url = ''; |
|
1992 | + |
|
1993 | + /** |
|
1994 | + * The below are all various properties for holding links to organization social network profiles |
|
1995 | + * |
|
1996 | + * @var string |
|
1997 | + */ |
|
1998 | + /** |
|
1999 | + * facebook (facebook.com/profile.name) |
|
2000 | + * |
|
2001 | + * @var string |
|
2002 | + */ |
|
2003 | + public $facebook = ''; |
|
2004 | + |
|
2005 | + /** |
|
2006 | + * twitter (twitter.com/twitter_handle) |
|
2007 | + * |
|
2008 | + * @var string |
|
2009 | + */ |
|
2010 | + public $twitter = ''; |
|
2011 | + |
|
2012 | + /** |
|
2013 | + * linkedin (linkedin.com/in/profile_name) |
|
2014 | + * |
|
2015 | + * @var string |
|
2016 | + */ |
|
2017 | + public $linkedin = ''; |
|
2018 | + |
|
2019 | + /** |
|
2020 | + * pinterest (www.pinterest.com/profile_name) |
|
2021 | + * |
|
2022 | + * @var string |
|
2023 | + */ |
|
2024 | + public $pinterest = ''; |
|
2025 | + |
|
2026 | + /** |
|
2027 | + * google+ (google.com/+profileName) |
|
2028 | + * |
|
2029 | + * @var string |
|
2030 | + */ |
|
2031 | + public $google = ''; |
|
2032 | + |
|
2033 | + /** |
|
2034 | + * instagram (instagram.com/handle) |
|
2035 | + * |
|
2036 | + * @var string |
|
2037 | + */ |
|
2038 | + public $instagram = ''; |
|
2039 | + |
|
2040 | + |
|
2041 | + /** |
|
2042 | + * class constructor |
|
2043 | + * |
|
2044 | + * @access public |
|
2045 | + */ |
|
2046 | + public function __construct() |
|
2047 | + { |
|
2048 | + // set default organization settings |
|
2049 | + // decode HTML entities from the WP blogname, because it's stored in the DB with HTML entities encoded |
|
2050 | + $this->name = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
2051 | + $this->email = get_bloginfo('admin_email'); |
|
2052 | + } |
|
2053 | +} |
|
2376 | 2054 | |
2377 | - /** |
|
2378 | - * Label text to show on the checkbox |
|
2379 | - * |
|
2380 | - * @var string |
|
2381 | - */ |
|
2382 | - public $consent_checkbox_label_text; |
|
2055 | +/** |
|
2056 | + * Class for defining what's in the EE_Config relating to currency |
|
2057 | + */ |
|
2058 | +class EE_Currency_Config extends EE_Config_Base |
|
2059 | +{ |
|
2060 | + /** |
|
2061 | + * @var string $code |
|
2062 | + * eg 'US' |
|
2063 | + */ |
|
2064 | + public $code; |
|
2065 | + |
|
2066 | + /** |
|
2067 | + * @var string $name |
|
2068 | + * eg 'Dollar' |
|
2069 | + */ |
|
2070 | + public $name; |
|
2071 | + |
|
2072 | + /** |
|
2073 | + * plural name |
|
2074 | + * |
|
2075 | + * @var string $plural |
|
2076 | + * eg 'Dollars' |
|
2077 | + */ |
|
2078 | + public $plural; |
|
2079 | + |
|
2080 | + /** |
|
2081 | + * currency sign |
|
2082 | + * |
|
2083 | + * @var string $sign |
|
2084 | + * eg '$' |
|
2085 | + */ |
|
2086 | + public $sign; |
|
2087 | + |
|
2088 | + /** |
|
2089 | + * Whether the currency sign should come before the number or not |
|
2090 | + * |
|
2091 | + * @var boolean $sign_b4 |
|
2092 | + */ |
|
2093 | + public $sign_b4; |
|
2094 | + |
|
2095 | + /** |
|
2096 | + * How many digits should come after the decimal place |
|
2097 | + * |
|
2098 | + * @var int $dec_plc |
|
2099 | + */ |
|
2100 | + public $dec_plc; |
|
2101 | + |
|
2102 | + /** |
|
2103 | + * Symbol to use for decimal mark |
|
2104 | + * |
|
2105 | + * @var string $dec_mrk |
|
2106 | + * eg '.' |
|
2107 | + */ |
|
2108 | + public $dec_mrk; |
|
2109 | + |
|
2110 | + /** |
|
2111 | + * Symbol to use for thousands |
|
2112 | + * |
|
2113 | + * @var string $thsnds |
|
2114 | + * eg ',' |
|
2115 | + */ |
|
2116 | + public $thsnds; |
|
2117 | + |
|
2118 | + |
|
2119 | + /** |
|
2120 | + * class constructor |
|
2121 | + * |
|
2122 | + * @access public |
|
2123 | + * @param string $CNT_ISO |
|
2124 | + * @throws EE_Error |
|
2125 | + * @throws ReflectionException |
|
2126 | + */ |
|
2127 | + public function __construct($CNT_ISO = '') |
|
2128 | + { |
|
2129 | + if ($CNT_ISO && $CNT_ISO === $this->code) { |
|
2130 | + return; |
|
2131 | + } |
|
2132 | + // get country code from organization settings or use default |
|
2133 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2134 | + && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2135 | + ? EE_Registry::instance()->CFG->organization->CNT_ISO |
|
2136 | + : ''; |
|
2137 | + // but override if requested |
|
2138 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2139 | + // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
|
2140 | + $this->setCurrency($CNT_ISO); |
|
2141 | + // fallback to hardcoded defaults, in case the above failed |
|
2142 | + if (empty($this->code)) { |
|
2143 | + $this->setFallbackCurrency(); |
|
2144 | + } |
|
2145 | + } |
|
2146 | + |
|
2147 | + |
|
2148 | + /** |
|
2149 | + * @param string|null $CNT_ISO |
|
2150 | + * @throws EE_Error |
|
2151 | + * @throws ReflectionException |
|
2152 | + */ |
|
2153 | + public function setCurrency(?string $CNT_ISO = '') |
|
2154 | + { |
|
2155 | + if (empty($CNT_ISO) || ! EE_Maintenance_Mode::instance()->models_can_query()) { |
|
2156 | + return; |
|
2157 | + } |
|
2158 | + |
|
2159 | + /** @var TableAnalysis $table_analysis */ |
|
2160 | + $table_analysis = EE_Registry::instance()->create('TableAnalysis', [], true); |
|
2161 | + if (! $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table())) { |
|
2162 | + return; |
|
2163 | + } |
|
2164 | + // retrieve the country settings from the db, just in case they have been customized |
|
2165 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2166 | + if (! $country instanceof EE_Country) { |
|
2167 | + throw new DomainException( |
|
2168 | + esc_html__('Invalid Country ISO Code.', 'event_espresso') |
|
2169 | + ); |
|
2170 | + } |
|
2171 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2172 | + $this->name = $country->currency_name_single(); // Dollar |
|
2173 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2174 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2175 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after |
|
2176 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2177 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: ',' = 0,01 or '.' = 0.01 |
|
2178 | + $this->thsnds = $country->currency_thousands_separator(); // thousands sep: ',' = 1,000 or '.' = 1.000 |
|
2179 | + } |
|
2180 | + |
|
2181 | + |
|
2182 | + private function setFallbackCurrency() |
|
2183 | + { |
|
2184 | + // set default currency settings |
|
2185 | + $this->code = 'USD'; |
|
2186 | + $this->name = esc_html__('Dollar', 'event_espresso'); |
|
2187 | + $this->plural = esc_html__('Dollars', 'event_espresso'); |
|
2188 | + $this->sign = '$'; |
|
2189 | + $this->sign_b4 = true; |
|
2190 | + $this->dec_plc = 2; |
|
2191 | + $this->dec_mrk = '.'; |
|
2192 | + $this->thsnds = ','; |
|
2193 | + } |
|
2194 | + |
|
2195 | + |
|
2196 | + /** |
|
2197 | + * @param string|null $CNT_ISO |
|
2198 | + * @return EE_Currency_Config |
|
2199 | + * @throws EE_Error |
|
2200 | + * @throws ReflectionException |
|
2201 | + */ |
|
2202 | + public static function getCurrencyConfig(?string $CNT_ISO = ''): EE_Currency_Config |
|
2203 | + { |
|
2204 | + // if CNT_ISO passed lets try to get currency settings for it. |
|
2205 | + $currency_config = ! empty($CNT_ISO) |
|
2206 | + ? new EE_Currency_Config($CNT_ISO) |
|
2207 | + : null; |
|
2208 | + // default currency settings for site if not set |
|
2209 | + if ($currency_config instanceof EE_Currency_Config) { |
|
2210 | + return $currency_config; |
|
2211 | + } |
|
2212 | + EE_Config::instance()->currency = EE_Config::instance()->currency instanceof EE_Currency_Config |
|
2213 | + ? EE_Config::instance()->currency |
|
2214 | + : new EE_Currency_Config(); |
|
2215 | + return EE_Config::instance()->currency; |
|
2216 | + } |
|
2217 | +} |
|
2383 | 2218 | |
2384 | - /* |
|
2219 | +/** |
|
2220 | + * Class for defining what's in the EE_Config relating to registration settings |
|
2221 | + */ |
|
2222 | +class EE_Registration_Config extends EE_Config_Base |
|
2223 | +{ |
|
2224 | + /** |
|
2225 | + * Default registration status |
|
2226 | + * |
|
2227 | + * @var string $default_STS_ID |
|
2228 | + * eg 'RPP' |
|
2229 | + */ |
|
2230 | + public $default_STS_ID; |
|
2231 | + |
|
2232 | + /** |
|
2233 | + * For new events, this will be the default value for the maximum number of tickets (equivalent to maximum number of |
|
2234 | + * registrations) |
|
2235 | + * |
|
2236 | + * @var int |
|
2237 | + */ |
|
2238 | + public $default_maximum_number_of_tickets; |
|
2239 | + |
|
2240 | + /** |
|
2241 | + * level of validation to apply to email addresses |
|
2242 | + * |
|
2243 | + * @var string $email_validation_level |
|
2244 | + * options: 'basic', 'wp_default', 'i18n', 'i18n_dns' |
|
2245 | + */ |
|
2246 | + public $email_validation_level; |
|
2247 | + |
|
2248 | + /** |
|
2249 | + * whether or not to show alternate payment options during the reg process if payment status is pending |
|
2250 | + * |
|
2251 | + * @var boolean $show_pending_payment_options |
|
2252 | + */ |
|
2253 | + public $show_pending_payment_options; |
|
2254 | + |
|
2255 | + /** |
|
2256 | + * Whether to skip the registration confirmation page |
|
2257 | + * |
|
2258 | + * @var boolean $skip_reg_confirmation |
|
2259 | + */ |
|
2260 | + public $skip_reg_confirmation; |
|
2261 | + |
|
2262 | + /** |
|
2263 | + * an array of SPCO reg steps where: |
|
2264 | + * the keys denotes the reg step order |
|
2265 | + * each element consists of an array with the following elements: |
|
2266 | + * "file_path" => the file path to the EE_SPCO_Reg_Step class |
|
2267 | + * "class_name" => the specific EE_SPCO_Reg_Step child class name |
|
2268 | + * "slug" => the URL param used to trigger the reg step |
|
2269 | + * |
|
2270 | + * @var array $reg_steps |
|
2271 | + */ |
|
2272 | + public $reg_steps; |
|
2273 | + |
|
2274 | + /** |
|
2275 | + * Whether registration confirmation should be the last page of SPCO |
|
2276 | + * |
|
2277 | + * @var boolean $reg_confirmation_last |
|
2278 | + */ |
|
2279 | + public $reg_confirmation_last; |
|
2280 | + |
|
2281 | + /** |
|
2282 | + * Whether or not to enable the EE Bot Trap |
|
2283 | + * |
|
2284 | + * @var boolean $use_bot_trap |
|
2285 | + */ |
|
2286 | + public $use_bot_trap; |
|
2287 | + |
|
2288 | + /** |
|
2289 | + * Whether or not to encrypt some data sent by the EE Bot Trap |
|
2290 | + * |
|
2291 | + * @var boolean $use_encryption |
|
2292 | + */ |
|
2293 | + public $use_encryption; |
|
2294 | + |
|
2295 | + /** |
|
2296 | + * Whether or not to use ReCaptcha |
|
2297 | + * |
|
2298 | + * @var boolean $use_captcha |
|
2299 | + */ |
|
2300 | + public $use_captcha; |
|
2301 | + |
|
2302 | + /** |
|
2303 | + * ReCaptcha Theme |
|
2304 | + * |
|
2305 | + * @var string $recaptcha_theme |
|
2306 | + * options: 'dark', 'light', 'invisible' |
|
2307 | + */ |
|
2308 | + public $recaptcha_theme; |
|
2309 | + |
|
2310 | + /** |
|
2311 | + * ReCaptcha Badge - determines the position of the reCAPTCHA badge if using Invisible ReCaptcha. |
|
2312 | + * |
|
2313 | + * @var string $recaptcha_badge |
|
2314 | + * options: 'bottomright', 'bottomleft', 'inline' |
|
2315 | + */ |
|
2316 | + public $recaptcha_badge; |
|
2317 | + |
|
2318 | + /** |
|
2319 | + * ReCaptcha Type |
|
2320 | + * |
|
2321 | + * @var string $recaptcha_type |
|
2322 | + * options: 'audio', 'image' |
|
2323 | + */ |
|
2324 | + public $recaptcha_type; |
|
2325 | + |
|
2326 | + /** |
|
2327 | + * ReCaptcha language |
|
2328 | + * |
|
2329 | + * @var string $recaptcha_language |
|
2330 | + * eg 'en' |
|
2331 | + */ |
|
2332 | + public $recaptcha_language; |
|
2333 | + |
|
2334 | + /** |
|
2335 | + * ReCaptcha public key |
|
2336 | + * |
|
2337 | + * @var string $recaptcha_publickey |
|
2338 | + */ |
|
2339 | + public $recaptcha_publickey; |
|
2340 | + |
|
2341 | + /** |
|
2342 | + * ReCaptcha private key |
|
2343 | + * |
|
2344 | + * @var string $recaptcha_privatekey |
|
2345 | + */ |
|
2346 | + public $recaptcha_privatekey; |
|
2347 | + |
|
2348 | + /** |
|
2349 | + * array of form names protected by ReCaptcha |
|
2350 | + * |
|
2351 | + * @var array $recaptcha_protected_forms |
|
2352 | + */ |
|
2353 | + public $recaptcha_protected_forms; |
|
2354 | + |
|
2355 | + /** |
|
2356 | + * ReCaptcha width |
|
2357 | + * |
|
2358 | + * @var int $recaptcha_width |
|
2359 | + * @deprecated |
|
2360 | + */ |
|
2361 | + public $recaptcha_width; |
|
2362 | + |
|
2363 | + /** |
|
2364 | + * Whether or not invalid attempts to directly access the registration checkout page should be tracked. |
|
2365 | + * |
|
2366 | + * @var boolean $track_invalid_checkout_access |
|
2367 | + */ |
|
2368 | + protected $track_invalid_checkout_access = true; |
|
2369 | + |
|
2370 | + /** |
|
2371 | + * Whether or not to show the privacy policy consent checkbox |
|
2372 | + * |
|
2373 | + * @var bool |
|
2374 | + */ |
|
2375 | + public $consent_checkbox_enabled; |
|
2376 | + |
|
2377 | + /** |
|
2378 | + * Label text to show on the checkbox |
|
2379 | + * |
|
2380 | + * @var string |
|
2381 | + */ |
|
2382 | + public $consent_checkbox_label_text; |
|
2383 | + |
|
2384 | + /* |
|
2385 | 2385 | * String describing how long to keep payment logs. Passed into DateTime constructor |
2386 | 2386 | * @var string |
2387 | 2387 | */ |
2388 | - public $gateway_log_lifespan = '1 week'; |
|
2389 | - |
|
2390 | - /** |
|
2391 | - * Enable copy attendee info at form |
|
2392 | - * |
|
2393 | - * @var boolean $enable_copy_attendee |
|
2394 | - */ |
|
2395 | - protected $copy_attendee_info = true; |
|
2396 | - |
|
2397 | - |
|
2398 | - /** |
|
2399 | - * class constructor |
|
2400 | - * |
|
2401 | - * @access public |
|
2402 | - */ |
|
2403 | - public function __construct() |
|
2404 | - { |
|
2405 | - // set default registration settings |
|
2406 | - $this->default_STS_ID = EEM_Registration::status_id_pending_payment; |
|
2407 | - $this->email_validation_level = 'wp_default'; |
|
2408 | - $this->show_pending_payment_options = true; |
|
2409 | - $this->skip_reg_confirmation = true; |
|
2410 | - $this->reg_steps = array(); |
|
2411 | - $this->reg_confirmation_last = false; |
|
2412 | - $this->use_bot_trap = true; |
|
2413 | - $this->use_encryption = true; |
|
2414 | - $this->use_captcha = false; |
|
2415 | - $this->recaptcha_theme = 'light'; |
|
2416 | - $this->recaptcha_badge = 'bottomleft'; |
|
2417 | - $this->recaptcha_type = 'image'; |
|
2418 | - $this->recaptcha_language = 'en'; |
|
2419 | - $this->recaptcha_publickey = null; |
|
2420 | - $this->recaptcha_privatekey = null; |
|
2421 | - $this->recaptcha_protected_forms = array(); |
|
2422 | - $this->recaptcha_width = 500; |
|
2423 | - $this->default_maximum_number_of_tickets = 10; |
|
2424 | - $this->consent_checkbox_enabled = false; |
|
2425 | - $this->consent_checkbox_label_text = ''; |
|
2426 | - $this->gateway_log_lifespan = '7 days'; |
|
2427 | - $this->copy_attendee_info = true; |
|
2428 | - } |
|
2429 | - |
|
2430 | - |
|
2431 | - /** |
|
2432 | - * This is called by the config loader and hooks are initialized AFTER the config has been populated. |
|
2433 | - * |
|
2434 | - * @since 4.8.8.rc.019 |
|
2435 | - */ |
|
2436 | - public function do_hooks() |
|
2437 | - { |
|
2438 | - add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2439 | - add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_max_ticket_on_EEM_Event')); |
|
2440 | - add_action('setup_theme', array($this, 'setDefaultCheckboxLabelText')); |
|
2441 | - } |
|
2442 | - |
|
2443 | - |
|
2444 | - /** |
|
2445 | - * Hooked into `AHEE__EE_Config___load_core_config__end` to ensure the default for the |
|
2446 | - * EVT_default_registration_status field matches the config setting for default_STS_ID. |
|
2447 | - */ |
|
2448 | - public function set_default_reg_status_on_EEM_Event() |
|
2449 | - { |
|
2450 | - EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2451 | - } |
|
2452 | - |
|
2453 | - |
|
2454 | - /** |
|
2455 | - * Hooked into `AHEE__EE_Config___load_core_config__end` to ensure the default for the EVT_additional_limit field |
|
2456 | - * for Events matches the config setting for default_maximum_number_of_tickets |
|
2457 | - */ |
|
2458 | - public function set_default_max_ticket_on_EEM_Event() |
|
2459 | - { |
|
2460 | - EEM_Event::set_default_additional_limit($this->default_maximum_number_of_tickets); |
|
2461 | - } |
|
2462 | - |
|
2463 | - |
|
2464 | - /** |
|
2465 | - * Sets the default consent checkbox text. This needs to be done a bit later than when EE_Registration_Config is |
|
2466 | - * constructed because that happens before we can get the privacy policy page's permalink. |
|
2467 | - * |
|
2468 | - * @throws InvalidArgumentException |
|
2469 | - * @throws InvalidDataTypeException |
|
2470 | - * @throws InvalidInterfaceException |
|
2471 | - */ |
|
2472 | - public function setDefaultCheckboxLabelText() |
|
2473 | - { |
|
2474 | - if ( |
|
2475 | - $this->getConsentCheckboxLabelText() === null |
|
2476 | - || $this->getConsentCheckboxLabelText() === '' |
|
2477 | - ) { |
|
2478 | - $opening_a_tag = ''; |
|
2479 | - $closing_a_tag = ''; |
|
2480 | - if (function_exists('get_privacy_policy_url')) { |
|
2481 | - $privacy_page_url = get_privacy_policy_url(); |
|
2482 | - if (! empty($privacy_page_url)) { |
|
2483 | - $opening_a_tag = '<a href="' . $privacy_page_url . '" target="_blank">'; |
|
2484 | - $closing_a_tag = '</a>'; |
|
2485 | - } |
|
2486 | - } |
|
2487 | - $loader = LoaderFactory::getLoader(); |
|
2488 | - $org_config = $loader->getShared('EE_Organization_Config'); |
|
2489 | - /** |
|
2490 | - * @var $org_config EE_Organization_Config |
|
2491 | - */ |
|
2492 | - |
|
2493 | - $this->setConsentCheckboxLabelText( |
|
2494 | - sprintf( |
|
2495 | - esc_html__( |
|
2496 | - 'I consent to %1$s storing and using my personal information, according to their %2$sprivacy policy%3$s.', |
|
2497 | - 'event_espresso' |
|
2498 | - ), |
|
2499 | - $org_config->name, |
|
2500 | - $opening_a_tag, |
|
2501 | - $closing_a_tag |
|
2502 | - ) |
|
2503 | - ); |
|
2504 | - } |
|
2505 | - } |
|
2506 | - |
|
2507 | - |
|
2508 | - /** |
|
2509 | - * @return boolean |
|
2510 | - */ |
|
2511 | - public function track_invalid_checkout_access() |
|
2512 | - { |
|
2513 | - return $this->track_invalid_checkout_access; |
|
2514 | - } |
|
2515 | - |
|
2516 | - |
|
2517 | - /** |
|
2518 | - * @param boolean $track_invalid_checkout_access |
|
2519 | - */ |
|
2520 | - public function set_track_invalid_checkout_access($track_invalid_checkout_access) |
|
2521 | - { |
|
2522 | - $this->track_invalid_checkout_access = filter_var( |
|
2523 | - $track_invalid_checkout_access, |
|
2524 | - FILTER_VALIDATE_BOOLEAN |
|
2525 | - ); |
|
2526 | - } |
|
2527 | - |
|
2528 | - /** |
|
2529 | - * @return boolean |
|
2530 | - */ |
|
2531 | - public function copyAttendeeInfo() |
|
2532 | - { |
|
2533 | - return $this->copy_attendee_info; |
|
2534 | - } |
|
2535 | - |
|
2536 | - |
|
2537 | - /** |
|
2538 | - * @param boolean $copy_attendee_info |
|
2539 | - */ |
|
2540 | - public function setCopyAttendeeInfo($copy_attendee_info) |
|
2541 | - { |
|
2542 | - $this->copy_attendee_info = filter_var( |
|
2543 | - $copy_attendee_info, |
|
2544 | - FILTER_VALIDATE_BOOLEAN |
|
2545 | - ); |
|
2546 | - } |
|
2547 | - |
|
2548 | - |
|
2549 | - /** |
|
2550 | - * Gets the options to make availalbe for the gateway log lifespan |
|
2551 | - * @return array |
|
2552 | - */ |
|
2553 | - public function gatewayLogLifespanOptions() |
|
2554 | - { |
|
2555 | - return (array) apply_filters( |
|
2556 | - 'FHEE_EE_Admin_Config__gatewayLogLifespanOptions', |
|
2557 | - array( |
|
2558 | - '1 second' => esc_html__('Don\'t Log At All', 'event_espresso'), |
|
2559 | - '1 day' => esc_html__('1 Day', 'event_espresso'), |
|
2560 | - '7 days' => esc_html__('7 Days', 'event_espresso'), |
|
2561 | - '14 days' => esc_html__('14 Days', 'event_espresso'), |
|
2562 | - '30 days' => esc_html__('30 Days', 'event_espresso') |
|
2563 | - ) |
|
2564 | - ); |
|
2565 | - } |
|
2566 | - |
|
2567 | - |
|
2568 | - /** |
|
2569 | - * @return bool |
|
2570 | - */ |
|
2571 | - public function isConsentCheckboxEnabled() |
|
2572 | - { |
|
2573 | - return $this->consent_checkbox_enabled; |
|
2574 | - } |
|
2575 | - |
|
2576 | - |
|
2577 | - /** |
|
2578 | - * @param bool $consent_checkbox_enabled |
|
2579 | - */ |
|
2580 | - public function setConsentCheckboxEnabled($consent_checkbox_enabled) |
|
2581 | - { |
|
2582 | - $this->consent_checkbox_enabled = filter_var( |
|
2583 | - $consent_checkbox_enabled, |
|
2584 | - FILTER_VALIDATE_BOOLEAN |
|
2585 | - ); |
|
2586 | - } |
|
2587 | - |
|
2588 | - |
|
2589 | - /** |
|
2590 | - * @return string |
|
2591 | - */ |
|
2592 | - public function getConsentCheckboxLabelText() |
|
2593 | - { |
|
2594 | - return $this->consent_checkbox_label_text; |
|
2595 | - } |
|
2596 | - |
|
2597 | - |
|
2598 | - /** |
|
2599 | - * @param string $consent_checkbox_label_text |
|
2600 | - */ |
|
2601 | - public function setConsentCheckboxLabelText($consent_checkbox_label_text) |
|
2602 | - { |
|
2603 | - $this->consent_checkbox_label_text = (string) $consent_checkbox_label_text; |
|
2604 | - } |
|
2388 | + public $gateway_log_lifespan = '1 week'; |
|
2389 | + |
|
2390 | + /** |
|
2391 | + * Enable copy attendee info at form |
|
2392 | + * |
|
2393 | + * @var boolean $enable_copy_attendee |
|
2394 | + */ |
|
2395 | + protected $copy_attendee_info = true; |
|
2396 | + |
|
2397 | + |
|
2398 | + /** |
|
2399 | + * class constructor |
|
2400 | + * |
|
2401 | + * @access public |
|
2402 | + */ |
|
2403 | + public function __construct() |
|
2404 | + { |
|
2405 | + // set default registration settings |
|
2406 | + $this->default_STS_ID = EEM_Registration::status_id_pending_payment; |
|
2407 | + $this->email_validation_level = 'wp_default'; |
|
2408 | + $this->show_pending_payment_options = true; |
|
2409 | + $this->skip_reg_confirmation = true; |
|
2410 | + $this->reg_steps = array(); |
|
2411 | + $this->reg_confirmation_last = false; |
|
2412 | + $this->use_bot_trap = true; |
|
2413 | + $this->use_encryption = true; |
|
2414 | + $this->use_captcha = false; |
|
2415 | + $this->recaptcha_theme = 'light'; |
|
2416 | + $this->recaptcha_badge = 'bottomleft'; |
|
2417 | + $this->recaptcha_type = 'image'; |
|
2418 | + $this->recaptcha_language = 'en'; |
|
2419 | + $this->recaptcha_publickey = null; |
|
2420 | + $this->recaptcha_privatekey = null; |
|
2421 | + $this->recaptcha_protected_forms = array(); |
|
2422 | + $this->recaptcha_width = 500; |
|
2423 | + $this->default_maximum_number_of_tickets = 10; |
|
2424 | + $this->consent_checkbox_enabled = false; |
|
2425 | + $this->consent_checkbox_label_text = ''; |
|
2426 | + $this->gateway_log_lifespan = '7 days'; |
|
2427 | + $this->copy_attendee_info = true; |
|
2428 | + } |
|
2429 | + |
|
2430 | + |
|
2431 | + /** |
|
2432 | + * This is called by the config loader and hooks are initialized AFTER the config has been populated. |
|
2433 | + * |
|
2434 | + * @since 4.8.8.rc.019 |
|
2435 | + */ |
|
2436 | + public function do_hooks() |
|
2437 | + { |
|
2438 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2439 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_max_ticket_on_EEM_Event')); |
|
2440 | + add_action('setup_theme', array($this, 'setDefaultCheckboxLabelText')); |
|
2441 | + } |
|
2442 | + |
|
2443 | + |
|
2444 | + /** |
|
2445 | + * Hooked into `AHEE__EE_Config___load_core_config__end` to ensure the default for the |
|
2446 | + * EVT_default_registration_status field matches the config setting for default_STS_ID. |
|
2447 | + */ |
|
2448 | + public function set_default_reg_status_on_EEM_Event() |
|
2449 | + { |
|
2450 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2451 | + } |
|
2452 | + |
|
2453 | + |
|
2454 | + /** |
|
2455 | + * Hooked into `AHEE__EE_Config___load_core_config__end` to ensure the default for the EVT_additional_limit field |
|
2456 | + * for Events matches the config setting for default_maximum_number_of_tickets |
|
2457 | + */ |
|
2458 | + public function set_default_max_ticket_on_EEM_Event() |
|
2459 | + { |
|
2460 | + EEM_Event::set_default_additional_limit($this->default_maximum_number_of_tickets); |
|
2461 | + } |
|
2462 | + |
|
2463 | + |
|
2464 | + /** |
|
2465 | + * Sets the default consent checkbox text. This needs to be done a bit later than when EE_Registration_Config is |
|
2466 | + * constructed because that happens before we can get the privacy policy page's permalink. |
|
2467 | + * |
|
2468 | + * @throws InvalidArgumentException |
|
2469 | + * @throws InvalidDataTypeException |
|
2470 | + * @throws InvalidInterfaceException |
|
2471 | + */ |
|
2472 | + public function setDefaultCheckboxLabelText() |
|
2473 | + { |
|
2474 | + if ( |
|
2475 | + $this->getConsentCheckboxLabelText() === null |
|
2476 | + || $this->getConsentCheckboxLabelText() === '' |
|
2477 | + ) { |
|
2478 | + $opening_a_tag = ''; |
|
2479 | + $closing_a_tag = ''; |
|
2480 | + if (function_exists('get_privacy_policy_url')) { |
|
2481 | + $privacy_page_url = get_privacy_policy_url(); |
|
2482 | + if (! empty($privacy_page_url)) { |
|
2483 | + $opening_a_tag = '<a href="' . $privacy_page_url . '" target="_blank">'; |
|
2484 | + $closing_a_tag = '</a>'; |
|
2485 | + } |
|
2486 | + } |
|
2487 | + $loader = LoaderFactory::getLoader(); |
|
2488 | + $org_config = $loader->getShared('EE_Organization_Config'); |
|
2489 | + /** |
|
2490 | + * @var $org_config EE_Organization_Config |
|
2491 | + */ |
|
2492 | + |
|
2493 | + $this->setConsentCheckboxLabelText( |
|
2494 | + sprintf( |
|
2495 | + esc_html__( |
|
2496 | + 'I consent to %1$s storing and using my personal information, according to their %2$sprivacy policy%3$s.', |
|
2497 | + 'event_espresso' |
|
2498 | + ), |
|
2499 | + $org_config->name, |
|
2500 | + $opening_a_tag, |
|
2501 | + $closing_a_tag |
|
2502 | + ) |
|
2503 | + ); |
|
2504 | + } |
|
2505 | + } |
|
2506 | + |
|
2507 | + |
|
2508 | + /** |
|
2509 | + * @return boolean |
|
2510 | + */ |
|
2511 | + public function track_invalid_checkout_access() |
|
2512 | + { |
|
2513 | + return $this->track_invalid_checkout_access; |
|
2514 | + } |
|
2515 | + |
|
2516 | + |
|
2517 | + /** |
|
2518 | + * @param boolean $track_invalid_checkout_access |
|
2519 | + */ |
|
2520 | + public function set_track_invalid_checkout_access($track_invalid_checkout_access) |
|
2521 | + { |
|
2522 | + $this->track_invalid_checkout_access = filter_var( |
|
2523 | + $track_invalid_checkout_access, |
|
2524 | + FILTER_VALIDATE_BOOLEAN |
|
2525 | + ); |
|
2526 | + } |
|
2527 | + |
|
2528 | + /** |
|
2529 | + * @return boolean |
|
2530 | + */ |
|
2531 | + public function copyAttendeeInfo() |
|
2532 | + { |
|
2533 | + return $this->copy_attendee_info; |
|
2534 | + } |
|
2535 | + |
|
2536 | + |
|
2537 | + /** |
|
2538 | + * @param boolean $copy_attendee_info |
|
2539 | + */ |
|
2540 | + public function setCopyAttendeeInfo($copy_attendee_info) |
|
2541 | + { |
|
2542 | + $this->copy_attendee_info = filter_var( |
|
2543 | + $copy_attendee_info, |
|
2544 | + FILTER_VALIDATE_BOOLEAN |
|
2545 | + ); |
|
2546 | + } |
|
2547 | + |
|
2548 | + |
|
2549 | + /** |
|
2550 | + * Gets the options to make availalbe for the gateway log lifespan |
|
2551 | + * @return array |
|
2552 | + */ |
|
2553 | + public function gatewayLogLifespanOptions() |
|
2554 | + { |
|
2555 | + return (array) apply_filters( |
|
2556 | + 'FHEE_EE_Admin_Config__gatewayLogLifespanOptions', |
|
2557 | + array( |
|
2558 | + '1 second' => esc_html__('Don\'t Log At All', 'event_espresso'), |
|
2559 | + '1 day' => esc_html__('1 Day', 'event_espresso'), |
|
2560 | + '7 days' => esc_html__('7 Days', 'event_espresso'), |
|
2561 | + '14 days' => esc_html__('14 Days', 'event_espresso'), |
|
2562 | + '30 days' => esc_html__('30 Days', 'event_espresso') |
|
2563 | + ) |
|
2564 | + ); |
|
2565 | + } |
|
2566 | + |
|
2567 | + |
|
2568 | + /** |
|
2569 | + * @return bool |
|
2570 | + */ |
|
2571 | + public function isConsentCheckboxEnabled() |
|
2572 | + { |
|
2573 | + return $this->consent_checkbox_enabled; |
|
2574 | + } |
|
2575 | + |
|
2576 | + |
|
2577 | + /** |
|
2578 | + * @param bool $consent_checkbox_enabled |
|
2579 | + */ |
|
2580 | + public function setConsentCheckboxEnabled($consent_checkbox_enabled) |
|
2581 | + { |
|
2582 | + $this->consent_checkbox_enabled = filter_var( |
|
2583 | + $consent_checkbox_enabled, |
|
2584 | + FILTER_VALIDATE_BOOLEAN |
|
2585 | + ); |
|
2586 | + } |
|
2587 | + |
|
2588 | + |
|
2589 | + /** |
|
2590 | + * @return string |
|
2591 | + */ |
|
2592 | + public function getConsentCheckboxLabelText() |
|
2593 | + { |
|
2594 | + return $this->consent_checkbox_label_text; |
|
2595 | + } |
|
2596 | + |
|
2597 | + |
|
2598 | + /** |
|
2599 | + * @param string $consent_checkbox_label_text |
|
2600 | + */ |
|
2601 | + public function setConsentCheckboxLabelText($consent_checkbox_label_text) |
|
2602 | + { |
|
2603 | + $this->consent_checkbox_label_text = (string) $consent_checkbox_label_text; |
|
2604 | + } |
|
2605 | 2605 | } |
2606 | 2606 | |
2607 | 2607 | /** |
@@ -2609,180 +2609,180 @@ discard block |
||
2609 | 2609 | */ |
2610 | 2610 | class EE_Admin_Config extends EE_Config_Base |
2611 | 2611 | { |
2612 | - /** |
|
2613 | - * @var boolean $useAdvancedEditor |
|
2614 | - */ |
|
2615 | - private $useAdvancedEditor; |
|
2616 | - |
|
2617 | - /** |
|
2618 | - * @var boolean $use_personnel_manager |
|
2619 | - */ |
|
2620 | - public $use_personnel_manager; |
|
2621 | - |
|
2622 | - /** |
|
2623 | - * @var boolean $use_dashboard_widget |
|
2624 | - */ |
|
2625 | - public $use_dashboard_widget; |
|
2626 | - |
|
2627 | - /** |
|
2628 | - * @var int $events_in_dashboard |
|
2629 | - */ |
|
2630 | - public $events_in_dashboard; |
|
2631 | - |
|
2632 | - /** |
|
2633 | - * @var boolean $use_event_timezones |
|
2634 | - */ |
|
2635 | - public $use_event_timezones; |
|
2636 | - |
|
2637 | - /** |
|
2638 | - * @var string $log_file_name |
|
2639 | - */ |
|
2640 | - public $log_file_name; |
|
2641 | - |
|
2642 | - /** |
|
2643 | - * @var string $debug_file_name |
|
2644 | - */ |
|
2645 | - public $debug_file_name; |
|
2646 | - |
|
2647 | - /** |
|
2648 | - * @var boolean $use_remote_logging |
|
2649 | - */ |
|
2650 | - public $use_remote_logging; |
|
2651 | - |
|
2652 | - /** |
|
2653 | - * @var string $remote_logging_url |
|
2654 | - */ |
|
2655 | - public $remote_logging_url; |
|
2656 | - |
|
2657 | - /** |
|
2658 | - * @var boolean $show_reg_footer |
|
2659 | - */ |
|
2660 | - public $show_reg_footer; |
|
2661 | - |
|
2662 | - /** |
|
2663 | - * @var string $affiliate_id |
|
2664 | - */ |
|
2665 | - public $affiliate_id; |
|
2666 | - |
|
2667 | - /** |
|
2668 | - * adds extra layer of encoding to session data to prevent serialization errors |
|
2669 | - * but is incompatible with some server configuration errors |
|
2670 | - * if you get "500 internal server errors" during registration, try turning this on |
|
2671 | - * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off |
|
2672 | - * |
|
2673 | - * @var boolean $encode_session_data |
|
2674 | - */ |
|
2675 | - private $encode_session_data = false; |
|
2676 | - |
|
2677 | - /** |
|
2678 | - * @var boolean |
|
2679 | - */ |
|
2680 | - private $is_caffeinated; |
|
2681 | - |
|
2682 | - |
|
2683 | - /** |
|
2684 | - * class constructor |
|
2685 | - * |
|
2686 | - * @access public |
|
2687 | - */ |
|
2688 | - public function __construct() |
|
2689 | - { |
|
2690 | - // set default general admin settings |
|
2691 | - $this->useAdvancedEditor = true; |
|
2692 | - $this->use_personnel_manager = true; |
|
2693 | - $this->use_dashboard_widget = true; |
|
2694 | - $this->events_in_dashboard = 30; |
|
2695 | - $this->use_event_timezones = false; |
|
2696 | - $this->use_remote_logging = false; |
|
2697 | - $this->remote_logging_url = null; |
|
2698 | - $this->show_reg_footer = apply_filters( |
|
2699 | - 'FHEE__EE_Admin_Config__show_reg_footer__default', |
|
2700 | - false |
|
2701 | - ); |
|
2702 | - $this->affiliate_id = 'default'; |
|
2703 | - $this->encode_session_data = false; |
|
2704 | - } |
|
2705 | - |
|
2706 | - |
|
2707 | - /** |
|
2708 | - * @param bool $reset |
|
2709 | - * @return string |
|
2710 | - */ |
|
2711 | - public function log_file_name($reset = false) |
|
2712 | - { |
|
2713 | - if (empty($this->log_file_name) || $reset) { |
|
2714 | - $this->log_file_name = sanitize_key('espresso_log_' . md5(uniqid('', true))) . '.txt'; |
|
2715 | - EE_Config::instance()->update_espresso_config(false, false); |
|
2716 | - } |
|
2717 | - return $this->log_file_name; |
|
2718 | - } |
|
2719 | - |
|
2720 | - |
|
2721 | - /** |
|
2722 | - * @param bool $reset |
|
2723 | - * @return string |
|
2724 | - */ |
|
2725 | - public function debug_file_name($reset = false) |
|
2726 | - { |
|
2727 | - if (empty($this->debug_file_name) || $reset) { |
|
2728 | - $this->debug_file_name = sanitize_key('espresso_debug_' . md5(uniqid('', true))) . '.txt'; |
|
2729 | - EE_Config::instance()->update_espresso_config(false, false); |
|
2730 | - } |
|
2731 | - return $this->debug_file_name; |
|
2732 | - } |
|
2733 | - |
|
2734 | - |
|
2735 | - /** |
|
2736 | - * @return string |
|
2737 | - */ |
|
2738 | - public function affiliate_id() |
|
2739 | - { |
|
2740 | - return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default'; |
|
2741 | - } |
|
2742 | - |
|
2743 | - |
|
2744 | - /** |
|
2745 | - * @return boolean |
|
2746 | - */ |
|
2747 | - public function encode_session_data() |
|
2748 | - { |
|
2749 | - return filter_var($this->encode_session_data, FILTER_VALIDATE_BOOLEAN); |
|
2750 | - } |
|
2751 | - |
|
2752 | - |
|
2753 | - /** |
|
2754 | - * @param boolean $encode_session_data |
|
2755 | - */ |
|
2756 | - public function set_encode_session_data($encode_session_data) |
|
2757 | - { |
|
2758 | - $this->encode_session_data = filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN); |
|
2759 | - } |
|
2760 | - |
|
2761 | - /** |
|
2762 | - * @return boolean |
|
2763 | - */ |
|
2764 | - public function useAdvancedEditor() |
|
2765 | - { |
|
2766 | - if ($this->is_caffeinated === null) { |
|
2767 | - $domain = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\Domain'); |
|
2768 | - $this->is_caffeinated = $domain->isCaffeinated(); |
|
2769 | - } |
|
2770 | - return $this->useAdvancedEditor && $this->is_caffeinated; |
|
2771 | - } |
|
2772 | - |
|
2773 | - /** |
|
2774 | - * @param boolean $use_advanced_editor |
|
2775 | - */ |
|
2776 | - public function setUseAdvancedEditor($use_advanced_editor = true) |
|
2777 | - { |
|
2778 | - $this->useAdvancedEditor = filter_var( |
|
2779 | - apply_filters( |
|
2780 | - 'FHEE__EE_Admin_Config__setUseAdvancedEditor__use_advanced_editor', |
|
2781 | - $use_advanced_editor |
|
2782 | - ), |
|
2783 | - FILTER_VALIDATE_BOOLEAN |
|
2784 | - ); |
|
2785 | - } |
|
2612 | + /** |
|
2613 | + * @var boolean $useAdvancedEditor |
|
2614 | + */ |
|
2615 | + private $useAdvancedEditor; |
|
2616 | + |
|
2617 | + /** |
|
2618 | + * @var boolean $use_personnel_manager |
|
2619 | + */ |
|
2620 | + public $use_personnel_manager; |
|
2621 | + |
|
2622 | + /** |
|
2623 | + * @var boolean $use_dashboard_widget |
|
2624 | + */ |
|
2625 | + public $use_dashboard_widget; |
|
2626 | + |
|
2627 | + /** |
|
2628 | + * @var int $events_in_dashboard |
|
2629 | + */ |
|
2630 | + public $events_in_dashboard; |
|
2631 | + |
|
2632 | + /** |
|
2633 | + * @var boolean $use_event_timezones |
|
2634 | + */ |
|
2635 | + public $use_event_timezones; |
|
2636 | + |
|
2637 | + /** |
|
2638 | + * @var string $log_file_name |
|
2639 | + */ |
|
2640 | + public $log_file_name; |
|
2641 | + |
|
2642 | + /** |
|
2643 | + * @var string $debug_file_name |
|
2644 | + */ |
|
2645 | + public $debug_file_name; |
|
2646 | + |
|
2647 | + /** |
|
2648 | + * @var boolean $use_remote_logging |
|
2649 | + */ |
|
2650 | + public $use_remote_logging; |
|
2651 | + |
|
2652 | + /** |
|
2653 | + * @var string $remote_logging_url |
|
2654 | + */ |
|
2655 | + public $remote_logging_url; |
|
2656 | + |
|
2657 | + /** |
|
2658 | + * @var boolean $show_reg_footer |
|
2659 | + */ |
|
2660 | + public $show_reg_footer; |
|
2661 | + |
|
2662 | + /** |
|
2663 | + * @var string $affiliate_id |
|
2664 | + */ |
|
2665 | + public $affiliate_id; |
|
2666 | + |
|
2667 | + /** |
|
2668 | + * adds extra layer of encoding to session data to prevent serialization errors |
|
2669 | + * but is incompatible with some server configuration errors |
|
2670 | + * if you get "500 internal server errors" during registration, try turning this on |
|
2671 | + * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off |
|
2672 | + * |
|
2673 | + * @var boolean $encode_session_data |
|
2674 | + */ |
|
2675 | + private $encode_session_data = false; |
|
2676 | + |
|
2677 | + /** |
|
2678 | + * @var boolean |
|
2679 | + */ |
|
2680 | + private $is_caffeinated; |
|
2681 | + |
|
2682 | + |
|
2683 | + /** |
|
2684 | + * class constructor |
|
2685 | + * |
|
2686 | + * @access public |
|
2687 | + */ |
|
2688 | + public function __construct() |
|
2689 | + { |
|
2690 | + // set default general admin settings |
|
2691 | + $this->useAdvancedEditor = true; |
|
2692 | + $this->use_personnel_manager = true; |
|
2693 | + $this->use_dashboard_widget = true; |
|
2694 | + $this->events_in_dashboard = 30; |
|
2695 | + $this->use_event_timezones = false; |
|
2696 | + $this->use_remote_logging = false; |
|
2697 | + $this->remote_logging_url = null; |
|
2698 | + $this->show_reg_footer = apply_filters( |
|
2699 | + 'FHEE__EE_Admin_Config__show_reg_footer__default', |
|
2700 | + false |
|
2701 | + ); |
|
2702 | + $this->affiliate_id = 'default'; |
|
2703 | + $this->encode_session_data = false; |
|
2704 | + } |
|
2705 | + |
|
2706 | + |
|
2707 | + /** |
|
2708 | + * @param bool $reset |
|
2709 | + * @return string |
|
2710 | + */ |
|
2711 | + public function log_file_name($reset = false) |
|
2712 | + { |
|
2713 | + if (empty($this->log_file_name) || $reset) { |
|
2714 | + $this->log_file_name = sanitize_key('espresso_log_' . md5(uniqid('', true))) . '.txt'; |
|
2715 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2716 | + } |
|
2717 | + return $this->log_file_name; |
|
2718 | + } |
|
2719 | + |
|
2720 | + |
|
2721 | + /** |
|
2722 | + * @param bool $reset |
|
2723 | + * @return string |
|
2724 | + */ |
|
2725 | + public function debug_file_name($reset = false) |
|
2726 | + { |
|
2727 | + if (empty($this->debug_file_name) || $reset) { |
|
2728 | + $this->debug_file_name = sanitize_key('espresso_debug_' . md5(uniqid('', true))) . '.txt'; |
|
2729 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2730 | + } |
|
2731 | + return $this->debug_file_name; |
|
2732 | + } |
|
2733 | + |
|
2734 | + |
|
2735 | + /** |
|
2736 | + * @return string |
|
2737 | + */ |
|
2738 | + public function affiliate_id() |
|
2739 | + { |
|
2740 | + return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default'; |
|
2741 | + } |
|
2742 | + |
|
2743 | + |
|
2744 | + /** |
|
2745 | + * @return boolean |
|
2746 | + */ |
|
2747 | + public function encode_session_data() |
|
2748 | + { |
|
2749 | + return filter_var($this->encode_session_data, FILTER_VALIDATE_BOOLEAN); |
|
2750 | + } |
|
2751 | + |
|
2752 | + |
|
2753 | + /** |
|
2754 | + * @param boolean $encode_session_data |
|
2755 | + */ |
|
2756 | + public function set_encode_session_data($encode_session_data) |
|
2757 | + { |
|
2758 | + $this->encode_session_data = filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN); |
|
2759 | + } |
|
2760 | + |
|
2761 | + /** |
|
2762 | + * @return boolean |
|
2763 | + */ |
|
2764 | + public function useAdvancedEditor() |
|
2765 | + { |
|
2766 | + if ($this->is_caffeinated === null) { |
|
2767 | + $domain = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\Domain'); |
|
2768 | + $this->is_caffeinated = $domain->isCaffeinated(); |
|
2769 | + } |
|
2770 | + return $this->useAdvancedEditor && $this->is_caffeinated; |
|
2771 | + } |
|
2772 | + |
|
2773 | + /** |
|
2774 | + * @param boolean $use_advanced_editor |
|
2775 | + */ |
|
2776 | + public function setUseAdvancedEditor($use_advanced_editor = true) |
|
2777 | + { |
|
2778 | + $this->useAdvancedEditor = filter_var( |
|
2779 | + apply_filters( |
|
2780 | + 'FHEE__EE_Admin_Config__setUseAdvancedEditor__use_advanced_editor', |
|
2781 | + $use_advanced_editor |
|
2782 | + ), |
|
2783 | + FILTER_VALIDATE_BOOLEAN |
|
2784 | + ); |
|
2785 | + } |
|
2786 | 2786 | } |
2787 | 2787 | |
2788 | 2788 | /** |
@@ -2790,70 +2790,70 @@ discard block |
||
2790 | 2790 | */ |
2791 | 2791 | class EE_Template_Config extends EE_Config_Base |
2792 | 2792 | { |
2793 | - /** |
|
2794 | - * @var boolean $enable_default_style |
|
2795 | - */ |
|
2796 | - public $enable_default_style; |
|
2797 | - |
|
2798 | - /** |
|
2799 | - * @var string $custom_style_sheet |
|
2800 | - */ |
|
2801 | - public $custom_style_sheet; |
|
2802 | - |
|
2803 | - /** |
|
2804 | - * @var boolean $display_address_in_regform |
|
2805 | - */ |
|
2806 | - public $display_address_in_regform; |
|
2807 | - |
|
2808 | - /** |
|
2809 | - * @var int $display_description_on_multi_reg_page |
|
2810 | - */ |
|
2811 | - public $display_description_on_multi_reg_page; |
|
2812 | - |
|
2813 | - /** |
|
2814 | - * @var boolean $use_custom_templates |
|
2815 | - */ |
|
2816 | - public $use_custom_templates; |
|
2817 | - |
|
2818 | - /** |
|
2819 | - * @var string $current_espresso_theme |
|
2820 | - */ |
|
2821 | - public $current_espresso_theme; |
|
2822 | - |
|
2823 | - /** |
|
2824 | - * @var EE_Ticket_Selector_Config $EED_Ticket_Selector |
|
2825 | - */ |
|
2826 | - public $EED_Ticket_Selector; |
|
2827 | - |
|
2828 | - /** |
|
2829 | - * @var EE_Event_Single_Config $EED_Event_Single |
|
2830 | - */ |
|
2831 | - public $EED_Event_Single; |
|
2832 | - |
|
2833 | - /** |
|
2834 | - * @var EE_Events_Archive_Config $EED_Events_Archive |
|
2835 | - */ |
|
2836 | - public $EED_Events_Archive; |
|
2837 | - |
|
2838 | - |
|
2839 | - /** |
|
2840 | - * class constructor |
|
2841 | - * |
|
2842 | - * @access public |
|
2843 | - */ |
|
2844 | - public function __construct() |
|
2845 | - { |
|
2846 | - // set default template settings |
|
2847 | - $this->enable_default_style = true; |
|
2848 | - $this->custom_style_sheet = null; |
|
2849 | - $this->display_address_in_regform = true; |
|
2850 | - $this->display_description_on_multi_reg_page = false; |
|
2851 | - $this->use_custom_templates = false; |
|
2852 | - $this->current_espresso_theme = 'Espresso_Arabica_2014'; |
|
2853 | - $this->EED_Event_Single = null; |
|
2854 | - $this->EED_Events_Archive = null; |
|
2855 | - $this->EED_Ticket_Selector = null; |
|
2856 | - } |
|
2793 | + /** |
|
2794 | + * @var boolean $enable_default_style |
|
2795 | + */ |
|
2796 | + public $enable_default_style; |
|
2797 | + |
|
2798 | + /** |
|
2799 | + * @var string $custom_style_sheet |
|
2800 | + */ |
|
2801 | + public $custom_style_sheet; |
|
2802 | + |
|
2803 | + /** |
|
2804 | + * @var boolean $display_address_in_regform |
|
2805 | + */ |
|
2806 | + public $display_address_in_regform; |
|
2807 | + |
|
2808 | + /** |
|
2809 | + * @var int $display_description_on_multi_reg_page |
|
2810 | + */ |
|
2811 | + public $display_description_on_multi_reg_page; |
|
2812 | + |
|
2813 | + /** |
|
2814 | + * @var boolean $use_custom_templates |
|
2815 | + */ |
|
2816 | + public $use_custom_templates; |
|
2817 | + |
|
2818 | + /** |
|
2819 | + * @var string $current_espresso_theme |
|
2820 | + */ |
|
2821 | + public $current_espresso_theme; |
|
2822 | + |
|
2823 | + /** |
|
2824 | + * @var EE_Ticket_Selector_Config $EED_Ticket_Selector |
|
2825 | + */ |
|
2826 | + public $EED_Ticket_Selector; |
|
2827 | + |
|
2828 | + /** |
|
2829 | + * @var EE_Event_Single_Config $EED_Event_Single |
|
2830 | + */ |
|
2831 | + public $EED_Event_Single; |
|
2832 | + |
|
2833 | + /** |
|
2834 | + * @var EE_Events_Archive_Config $EED_Events_Archive |
|
2835 | + */ |
|
2836 | + public $EED_Events_Archive; |
|
2837 | + |
|
2838 | + |
|
2839 | + /** |
|
2840 | + * class constructor |
|
2841 | + * |
|
2842 | + * @access public |
|
2843 | + */ |
|
2844 | + public function __construct() |
|
2845 | + { |
|
2846 | + // set default template settings |
|
2847 | + $this->enable_default_style = true; |
|
2848 | + $this->custom_style_sheet = null; |
|
2849 | + $this->display_address_in_regform = true; |
|
2850 | + $this->display_description_on_multi_reg_page = false; |
|
2851 | + $this->use_custom_templates = false; |
|
2852 | + $this->current_espresso_theme = 'Espresso_Arabica_2014'; |
|
2853 | + $this->EED_Event_Single = null; |
|
2854 | + $this->EED_Events_Archive = null; |
|
2855 | + $this->EED_Ticket_Selector = null; |
|
2856 | + } |
|
2857 | 2857 | } |
2858 | 2858 | |
2859 | 2859 | /** |
@@ -2861,114 +2861,114 @@ discard block |
||
2861 | 2861 | */ |
2862 | 2862 | class EE_Map_Config extends EE_Config_Base |
2863 | 2863 | { |
2864 | - /** |
|
2865 | - * @var boolean $use_google_maps |
|
2866 | - */ |
|
2867 | - public $use_google_maps; |
|
2868 | - |
|
2869 | - /** |
|
2870 | - * @var string $api_key |
|
2871 | - */ |
|
2872 | - public $google_map_api_key; |
|
2873 | - |
|
2874 | - /** |
|
2875 | - * @var int $event_details_map_width |
|
2876 | - */ |
|
2877 | - public $event_details_map_width; |
|
2878 | - |
|
2879 | - /** |
|
2880 | - * @var int $event_details_map_height |
|
2881 | - */ |
|
2882 | - public $event_details_map_height; |
|
2883 | - |
|
2884 | - /** |
|
2885 | - * @var int $event_details_map_zoom |
|
2886 | - */ |
|
2887 | - public $event_details_map_zoom; |
|
2888 | - |
|
2889 | - /** |
|
2890 | - * @var boolean $event_details_display_nav |
|
2891 | - */ |
|
2892 | - public $event_details_display_nav; |
|
2893 | - |
|
2894 | - /** |
|
2895 | - * @var boolean $event_details_nav_size |
|
2896 | - */ |
|
2897 | - public $event_details_nav_size; |
|
2898 | - |
|
2899 | - /** |
|
2900 | - * @var string $event_details_control_type |
|
2901 | - */ |
|
2902 | - public $event_details_control_type; |
|
2903 | - |
|
2904 | - /** |
|
2905 | - * @var string $event_details_map_align |
|
2906 | - */ |
|
2907 | - public $event_details_map_align; |
|
2908 | - |
|
2909 | - /** |
|
2910 | - * @var int $event_list_map_width |
|
2911 | - */ |
|
2912 | - public $event_list_map_width; |
|
2913 | - |
|
2914 | - /** |
|
2915 | - * @var int $event_list_map_height |
|
2916 | - */ |
|
2917 | - public $event_list_map_height; |
|
2918 | - |
|
2919 | - /** |
|
2920 | - * @var int $event_list_map_zoom |
|
2921 | - */ |
|
2922 | - public $event_list_map_zoom; |
|
2923 | - |
|
2924 | - /** |
|
2925 | - * @var boolean $event_list_display_nav |
|
2926 | - */ |
|
2927 | - public $event_list_display_nav; |
|
2928 | - |
|
2929 | - /** |
|
2930 | - * @var boolean $event_list_nav_size |
|
2931 | - */ |
|
2932 | - public $event_list_nav_size; |
|
2933 | - |
|
2934 | - /** |
|
2935 | - * @var string $event_list_control_type |
|
2936 | - */ |
|
2937 | - public $event_list_control_type; |
|
2938 | - |
|
2939 | - /** |
|
2940 | - * @var string $event_list_map_align |
|
2941 | - */ |
|
2942 | - public $event_list_map_align; |
|
2943 | - |
|
2944 | - |
|
2945 | - /** |
|
2946 | - * class constructor |
|
2947 | - * |
|
2948 | - * @access public |
|
2949 | - */ |
|
2950 | - public function __construct() |
|
2951 | - { |
|
2952 | - // set default map settings |
|
2953 | - $this->use_google_maps = true; |
|
2954 | - $this->google_map_api_key = ''; |
|
2955 | - // for event details pages (reg page) |
|
2956 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2957 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2958 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2959 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2960 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2961 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2962 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2963 | - // for event list pages |
|
2964 | - $this->event_list_map_width = 300; // ee_map_width |
|
2965 | - $this->event_list_map_height = 185; // ee_map_height |
|
2966 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2967 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2968 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2969 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2970 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2971 | - } |
|
2864 | + /** |
|
2865 | + * @var boolean $use_google_maps |
|
2866 | + */ |
|
2867 | + public $use_google_maps; |
|
2868 | + |
|
2869 | + /** |
|
2870 | + * @var string $api_key |
|
2871 | + */ |
|
2872 | + public $google_map_api_key; |
|
2873 | + |
|
2874 | + /** |
|
2875 | + * @var int $event_details_map_width |
|
2876 | + */ |
|
2877 | + public $event_details_map_width; |
|
2878 | + |
|
2879 | + /** |
|
2880 | + * @var int $event_details_map_height |
|
2881 | + */ |
|
2882 | + public $event_details_map_height; |
|
2883 | + |
|
2884 | + /** |
|
2885 | + * @var int $event_details_map_zoom |
|
2886 | + */ |
|
2887 | + public $event_details_map_zoom; |
|
2888 | + |
|
2889 | + /** |
|
2890 | + * @var boolean $event_details_display_nav |
|
2891 | + */ |
|
2892 | + public $event_details_display_nav; |
|
2893 | + |
|
2894 | + /** |
|
2895 | + * @var boolean $event_details_nav_size |
|
2896 | + */ |
|
2897 | + public $event_details_nav_size; |
|
2898 | + |
|
2899 | + /** |
|
2900 | + * @var string $event_details_control_type |
|
2901 | + */ |
|
2902 | + public $event_details_control_type; |
|
2903 | + |
|
2904 | + /** |
|
2905 | + * @var string $event_details_map_align |
|
2906 | + */ |
|
2907 | + public $event_details_map_align; |
|
2908 | + |
|
2909 | + /** |
|
2910 | + * @var int $event_list_map_width |
|
2911 | + */ |
|
2912 | + public $event_list_map_width; |
|
2913 | + |
|
2914 | + /** |
|
2915 | + * @var int $event_list_map_height |
|
2916 | + */ |
|
2917 | + public $event_list_map_height; |
|
2918 | + |
|
2919 | + /** |
|
2920 | + * @var int $event_list_map_zoom |
|
2921 | + */ |
|
2922 | + public $event_list_map_zoom; |
|
2923 | + |
|
2924 | + /** |
|
2925 | + * @var boolean $event_list_display_nav |
|
2926 | + */ |
|
2927 | + public $event_list_display_nav; |
|
2928 | + |
|
2929 | + /** |
|
2930 | + * @var boolean $event_list_nav_size |
|
2931 | + */ |
|
2932 | + public $event_list_nav_size; |
|
2933 | + |
|
2934 | + /** |
|
2935 | + * @var string $event_list_control_type |
|
2936 | + */ |
|
2937 | + public $event_list_control_type; |
|
2938 | + |
|
2939 | + /** |
|
2940 | + * @var string $event_list_map_align |
|
2941 | + */ |
|
2942 | + public $event_list_map_align; |
|
2943 | + |
|
2944 | + |
|
2945 | + /** |
|
2946 | + * class constructor |
|
2947 | + * |
|
2948 | + * @access public |
|
2949 | + */ |
|
2950 | + public function __construct() |
|
2951 | + { |
|
2952 | + // set default map settings |
|
2953 | + $this->use_google_maps = true; |
|
2954 | + $this->google_map_api_key = ''; |
|
2955 | + // for event details pages (reg page) |
|
2956 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2957 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2958 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2959 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2960 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2961 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2962 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2963 | + // for event list pages |
|
2964 | + $this->event_list_map_width = 300; // ee_map_width |
|
2965 | + $this->event_list_map_height = 185; // ee_map_height |
|
2966 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2967 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2968 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2969 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2970 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2971 | + } |
|
2972 | 2972 | } |
2973 | 2973 | |
2974 | 2974 | /** |
@@ -2976,46 +2976,46 @@ discard block |
||
2976 | 2976 | */ |
2977 | 2977 | class EE_Events_Archive_Config extends EE_Config_Base |
2978 | 2978 | { |
2979 | - public $display_status_banner; |
|
2979 | + public $display_status_banner; |
|
2980 | 2980 | |
2981 | - public $display_description; |
|
2981 | + public $display_description; |
|
2982 | 2982 | |
2983 | - public $display_ticket_selector; |
|
2983 | + public $display_ticket_selector; |
|
2984 | 2984 | |
2985 | - public $display_datetimes; |
|
2985 | + public $display_datetimes; |
|
2986 | 2986 | |
2987 | - public $display_venue; |
|
2987 | + public $display_venue; |
|
2988 | 2988 | |
2989 | - public $display_expired_events; |
|
2989 | + public $display_expired_events; |
|
2990 | 2990 | |
2991 | - public $use_sortable_display_order; |
|
2991 | + public $use_sortable_display_order; |
|
2992 | 2992 | |
2993 | - public $display_order_tickets; |
|
2993 | + public $display_order_tickets; |
|
2994 | 2994 | |
2995 | - public $display_order_datetimes; |
|
2995 | + public $display_order_datetimes; |
|
2996 | 2996 | |
2997 | - public $display_order_event; |
|
2997 | + public $display_order_event; |
|
2998 | 2998 | |
2999 | - public $display_order_venue; |
|
2999 | + public $display_order_venue; |
|
3000 | 3000 | |
3001 | 3001 | |
3002 | - /** |
|
3003 | - * class constructor |
|
3004 | - */ |
|
3005 | - public function __construct() |
|
3006 | - { |
|
3007 | - $this->display_status_banner = 0; |
|
3008 | - $this->display_description = 1; |
|
3009 | - $this->display_ticket_selector = 0; |
|
3010 | - $this->display_datetimes = 1; |
|
3011 | - $this->display_venue = 0; |
|
3012 | - $this->display_expired_events = 0; |
|
3013 | - $this->use_sortable_display_order = false; |
|
3014 | - $this->display_order_tickets = 100; |
|
3015 | - $this->display_order_datetimes = 110; |
|
3016 | - $this->display_order_event = 120; |
|
3017 | - $this->display_order_venue = 130; |
|
3018 | - } |
|
3002 | + /** |
|
3003 | + * class constructor |
|
3004 | + */ |
|
3005 | + public function __construct() |
|
3006 | + { |
|
3007 | + $this->display_status_banner = 0; |
|
3008 | + $this->display_description = 1; |
|
3009 | + $this->display_ticket_selector = 0; |
|
3010 | + $this->display_datetimes = 1; |
|
3011 | + $this->display_venue = 0; |
|
3012 | + $this->display_expired_events = 0; |
|
3013 | + $this->use_sortable_display_order = false; |
|
3014 | + $this->display_order_tickets = 100; |
|
3015 | + $this->display_order_datetimes = 110; |
|
3016 | + $this->display_order_event = 120; |
|
3017 | + $this->display_order_venue = 130; |
|
3018 | + } |
|
3019 | 3019 | } |
3020 | 3020 | |
3021 | 3021 | /** |
@@ -3023,34 +3023,34 @@ discard block |
||
3023 | 3023 | */ |
3024 | 3024 | class EE_Event_Single_Config extends EE_Config_Base |
3025 | 3025 | { |
3026 | - public $display_status_banner_single; |
|
3026 | + public $display_status_banner_single; |
|
3027 | 3027 | |
3028 | - public $display_venue; |
|
3028 | + public $display_venue; |
|
3029 | 3029 | |
3030 | - public $use_sortable_display_order; |
|
3030 | + public $use_sortable_display_order; |
|
3031 | 3031 | |
3032 | - public $display_order_tickets; |
|
3032 | + public $display_order_tickets; |
|
3033 | 3033 | |
3034 | - public $display_order_datetimes; |
|
3034 | + public $display_order_datetimes; |
|
3035 | 3035 | |
3036 | - public $display_order_event; |
|
3036 | + public $display_order_event; |
|
3037 | 3037 | |
3038 | - public $display_order_venue; |
|
3038 | + public $display_order_venue; |
|
3039 | 3039 | |
3040 | 3040 | |
3041 | - /** |
|
3042 | - * class constructor |
|
3043 | - */ |
|
3044 | - public function __construct() |
|
3045 | - { |
|
3046 | - $this->display_status_banner_single = 0; |
|
3047 | - $this->display_venue = 1; |
|
3048 | - $this->use_sortable_display_order = false; |
|
3049 | - $this->display_order_tickets = 100; |
|
3050 | - $this->display_order_datetimes = 110; |
|
3051 | - $this->display_order_event = 120; |
|
3052 | - $this->display_order_venue = 130; |
|
3053 | - } |
|
3041 | + /** |
|
3042 | + * class constructor |
|
3043 | + */ |
|
3044 | + public function __construct() |
|
3045 | + { |
|
3046 | + $this->display_status_banner_single = 0; |
|
3047 | + $this->display_venue = 1; |
|
3048 | + $this->use_sortable_display_order = false; |
|
3049 | + $this->display_order_tickets = 100; |
|
3050 | + $this->display_order_datetimes = 110; |
|
3051 | + $this->display_order_event = 120; |
|
3052 | + $this->display_order_venue = 130; |
|
3053 | + } |
|
3054 | 3054 | } |
3055 | 3055 | |
3056 | 3056 | /** |
@@ -3058,172 +3058,172 @@ discard block |
||
3058 | 3058 | */ |
3059 | 3059 | class EE_Ticket_Selector_Config extends EE_Config_Base |
3060 | 3060 | { |
3061 | - /** |
|
3062 | - * constant to indicate that a datetime selector should NEVER be shown for ticket selectors |
|
3063 | - */ |
|
3064 | - const DO_NOT_SHOW_DATETIME_SELECTOR = 'no_datetime_selector'; |
|
3065 | - |
|
3066 | - /** |
|
3067 | - * constant to indicate that a datetime selector should only be shown for ticket selectors |
|
3068 | - * when the number of datetimes for the event matches the value set for $datetime_selector_threshold |
|
3069 | - */ |
|
3070 | - const MAYBE_SHOW_DATETIME_SELECTOR = 'maybe_datetime_selector'; |
|
3071 | - |
|
3072 | - /** |
|
3073 | - * @var boolean $show_ticket_sale_columns |
|
3074 | - */ |
|
3075 | - public $show_ticket_sale_columns; |
|
3076 | - |
|
3077 | - /** |
|
3078 | - * @var boolean $show_ticket_details |
|
3079 | - */ |
|
3080 | - public $show_ticket_details; |
|
3081 | - |
|
3082 | - /** |
|
3083 | - * @var boolean $show_expired_tickets |
|
3084 | - */ |
|
3085 | - public $show_expired_tickets; |
|
3086 | - |
|
3087 | - /** |
|
3088 | - * whether or not to display a dropdown box populated with event datetimes |
|
3089 | - * that toggles which tickets are displayed for a ticket selector. |
|
3090 | - * uses one of the *_DATETIME_SELECTOR constants defined above |
|
3091 | - * |
|
3092 | - * @var string $show_datetime_selector |
|
3093 | - */ |
|
3094 | - private $show_datetime_selector = 'no_datetime_selector'; |
|
3095 | - |
|
3096 | - /** |
|
3097 | - * the number of datetimes an event has to have before conditionally displaying a datetime selector |
|
3098 | - * |
|
3099 | - * @var int $datetime_selector_threshold |
|
3100 | - */ |
|
3101 | - private $datetime_selector_threshold = 3; |
|
3102 | - |
|
3103 | - /** |
|
3104 | - * determines the maximum number of "checked" dates in the date and time filter |
|
3105 | - * |
|
3106 | - * @var int $datetime_selector_checked |
|
3107 | - */ |
|
3108 | - private $datetime_selector_max_checked = 10; |
|
3109 | - |
|
3110 | - |
|
3111 | - /** |
|
3112 | - * class constructor |
|
3113 | - */ |
|
3114 | - public function __construct() |
|
3115 | - { |
|
3116 | - $this->show_ticket_sale_columns = true; |
|
3117 | - $this->show_ticket_details = true; |
|
3118 | - $this->show_expired_tickets = true; |
|
3119 | - $this->show_datetime_selector = EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR; |
|
3120 | - $this->datetime_selector_threshold = 3; |
|
3121 | - $this->datetime_selector_max_checked = 10; |
|
3122 | - } |
|
3123 | - |
|
3124 | - |
|
3125 | - /** |
|
3126 | - * returns true if a datetime selector should be displayed |
|
3127 | - * |
|
3128 | - * @param array $datetimes |
|
3129 | - * @return bool |
|
3130 | - */ |
|
3131 | - public function showDatetimeSelector(array $datetimes) |
|
3132 | - { |
|
3133 | - // if the settings are NOT: don't show OR below threshold, THEN active = true |
|
3134 | - return ! ( |
|
3135 | - $this->getShowDatetimeSelector() === EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR |
|
3136 | - || ( |
|
3137 | - $this->getShowDatetimeSelector() === EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR |
|
3138 | - && count($datetimes) < $this->getDatetimeSelectorThreshold() |
|
3139 | - ) |
|
3140 | - ); |
|
3141 | - } |
|
3142 | - |
|
3143 | - |
|
3144 | - /** |
|
3145 | - * @return string |
|
3146 | - */ |
|
3147 | - public function getShowDatetimeSelector() |
|
3148 | - { |
|
3149 | - return $this->show_datetime_selector; |
|
3150 | - } |
|
3151 | - |
|
3152 | - |
|
3153 | - /** |
|
3154 | - * @param bool $keys_only |
|
3155 | - * @return array |
|
3156 | - */ |
|
3157 | - public function getShowDatetimeSelectorOptions($keys_only = true) |
|
3158 | - { |
|
3159 | - return $keys_only |
|
3160 | - ? array( |
|
3161 | - EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR, |
|
3162 | - EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR, |
|
3163 | - ) |
|
3164 | - : array( |
|
3165 | - EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR => esc_html__( |
|
3166 | - 'Do not show date & time filter', |
|
3167 | - 'event_espresso' |
|
3168 | - ), |
|
3169 | - EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR => esc_html__( |
|
3170 | - 'Maybe show date & time filter', |
|
3171 | - 'event_espresso' |
|
3172 | - ), |
|
3173 | - ); |
|
3174 | - } |
|
3175 | - |
|
3176 | - |
|
3177 | - /** |
|
3178 | - * @param string $show_datetime_selector |
|
3179 | - */ |
|
3180 | - public function setShowDatetimeSelector($show_datetime_selector) |
|
3181 | - { |
|
3182 | - $this->show_datetime_selector = in_array( |
|
3183 | - $show_datetime_selector, |
|
3184 | - $this->getShowDatetimeSelectorOptions(), |
|
3185 | - true |
|
3186 | - ) |
|
3187 | - ? $show_datetime_selector |
|
3188 | - : EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR; |
|
3189 | - } |
|
3190 | - |
|
3191 | - |
|
3192 | - /** |
|
3193 | - * @return int |
|
3194 | - */ |
|
3195 | - public function getDatetimeSelectorThreshold() |
|
3196 | - { |
|
3197 | - return $this->datetime_selector_threshold; |
|
3198 | - } |
|
3199 | - |
|
3200 | - |
|
3201 | - /** |
|
3202 | - * @param int $datetime_selector_threshold |
|
3203 | - */ |
|
3204 | - public function setDatetimeSelectorThreshold($datetime_selector_threshold) |
|
3205 | - { |
|
3206 | - $datetime_selector_threshold = absint($datetime_selector_threshold); |
|
3207 | - $this->datetime_selector_threshold = $datetime_selector_threshold ? $datetime_selector_threshold : 3; |
|
3208 | - } |
|
3209 | - |
|
3210 | - |
|
3211 | - /** |
|
3212 | - * @return int |
|
3213 | - */ |
|
3214 | - public function getDatetimeSelectorMaxChecked() |
|
3215 | - { |
|
3216 | - return $this->datetime_selector_max_checked; |
|
3217 | - } |
|
3218 | - |
|
3219 | - |
|
3220 | - /** |
|
3221 | - * @param int $datetime_selector_max_checked |
|
3222 | - */ |
|
3223 | - public function setDatetimeSelectorMaxChecked($datetime_selector_max_checked) |
|
3224 | - { |
|
3225 | - $this->datetime_selector_max_checked = absint($datetime_selector_max_checked); |
|
3226 | - } |
|
3061 | + /** |
|
3062 | + * constant to indicate that a datetime selector should NEVER be shown for ticket selectors |
|
3063 | + */ |
|
3064 | + const DO_NOT_SHOW_DATETIME_SELECTOR = 'no_datetime_selector'; |
|
3065 | + |
|
3066 | + /** |
|
3067 | + * constant to indicate that a datetime selector should only be shown for ticket selectors |
|
3068 | + * when the number of datetimes for the event matches the value set for $datetime_selector_threshold |
|
3069 | + */ |
|
3070 | + const MAYBE_SHOW_DATETIME_SELECTOR = 'maybe_datetime_selector'; |
|
3071 | + |
|
3072 | + /** |
|
3073 | + * @var boolean $show_ticket_sale_columns |
|
3074 | + */ |
|
3075 | + public $show_ticket_sale_columns; |
|
3076 | + |
|
3077 | + /** |
|
3078 | + * @var boolean $show_ticket_details |
|
3079 | + */ |
|
3080 | + public $show_ticket_details; |
|
3081 | + |
|
3082 | + /** |
|
3083 | + * @var boolean $show_expired_tickets |
|
3084 | + */ |
|
3085 | + public $show_expired_tickets; |
|
3086 | + |
|
3087 | + /** |
|
3088 | + * whether or not to display a dropdown box populated with event datetimes |
|
3089 | + * that toggles which tickets are displayed for a ticket selector. |
|
3090 | + * uses one of the *_DATETIME_SELECTOR constants defined above |
|
3091 | + * |
|
3092 | + * @var string $show_datetime_selector |
|
3093 | + */ |
|
3094 | + private $show_datetime_selector = 'no_datetime_selector'; |
|
3095 | + |
|
3096 | + /** |
|
3097 | + * the number of datetimes an event has to have before conditionally displaying a datetime selector |
|
3098 | + * |
|
3099 | + * @var int $datetime_selector_threshold |
|
3100 | + */ |
|
3101 | + private $datetime_selector_threshold = 3; |
|
3102 | + |
|
3103 | + /** |
|
3104 | + * determines the maximum number of "checked" dates in the date and time filter |
|
3105 | + * |
|
3106 | + * @var int $datetime_selector_checked |
|
3107 | + */ |
|
3108 | + private $datetime_selector_max_checked = 10; |
|
3109 | + |
|
3110 | + |
|
3111 | + /** |
|
3112 | + * class constructor |
|
3113 | + */ |
|
3114 | + public function __construct() |
|
3115 | + { |
|
3116 | + $this->show_ticket_sale_columns = true; |
|
3117 | + $this->show_ticket_details = true; |
|
3118 | + $this->show_expired_tickets = true; |
|
3119 | + $this->show_datetime_selector = EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR; |
|
3120 | + $this->datetime_selector_threshold = 3; |
|
3121 | + $this->datetime_selector_max_checked = 10; |
|
3122 | + } |
|
3123 | + |
|
3124 | + |
|
3125 | + /** |
|
3126 | + * returns true if a datetime selector should be displayed |
|
3127 | + * |
|
3128 | + * @param array $datetimes |
|
3129 | + * @return bool |
|
3130 | + */ |
|
3131 | + public function showDatetimeSelector(array $datetimes) |
|
3132 | + { |
|
3133 | + // if the settings are NOT: don't show OR below threshold, THEN active = true |
|
3134 | + return ! ( |
|
3135 | + $this->getShowDatetimeSelector() === EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR |
|
3136 | + || ( |
|
3137 | + $this->getShowDatetimeSelector() === EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR |
|
3138 | + && count($datetimes) < $this->getDatetimeSelectorThreshold() |
|
3139 | + ) |
|
3140 | + ); |
|
3141 | + } |
|
3142 | + |
|
3143 | + |
|
3144 | + /** |
|
3145 | + * @return string |
|
3146 | + */ |
|
3147 | + public function getShowDatetimeSelector() |
|
3148 | + { |
|
3149 | + return $this->show_datetime_selector; |
|
3150 | + } |
|
3151 | + |
|
3152 | + |
|
3153 | + /** |
|
3154 | + * @param bool $keys_only |
|
3155 | + * @return array |
|
3156 | + */ |
|
3157 | + public function getShowDatetimeSelectorOptions($keys_only = true) |
|
3158 | + { |
|
3159 | + return $keys_only |
|
3160 | + ? array( |
|
3161 | + EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR, |
|
3162 | + EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR, |
|
3163 | + ) |
|
3164 | + : array( |
|
3165 | + EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR => esc_html__( |
|
3166 | + 'Do not show date & time filter', |
|
3167 | + 'event_espresso' |
|
3168 | + ), |
|
3169 | + EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR => esc_html__( |
|
3170 | + 'Maybe show date & time filter', |
|
3171 | + 'event_espresso' |
|
3172 | + ), |
|
3173 | + ); |
|
3174 | + } |
|
3175 | + |
|
3176 | + |
|
3177 | + /** |
|
3178 | + * @param string $show_datetime_selector |
|
3179 | + */ |
|
3180 | + public function setShowDatetimeSelector($show_datetime_selector) |
|
3181 | + { |
|
3182 | + $this->show_datetime_selector = in_array( |
|
3183 | + $show_datetime_selector, |
|
3184 | + $this->getShowDatetimeSelectorOptions(), |
|
3185 | + true |
|
3186 | + ) |
|
3187 | + ? $show_datetime_selector |
|
3188 | + : EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR; |
|
3189 | + } |
|
3190 | + |
|
3191 | + |
|
3192 | + /** |
|
3193 | + * @return int |
|
3194 | + */ |
|
3195 | + public function getDatetimeSelectorThreshold() |
|
3196 | + { |
|
3197 | + return $this->datetime_selector_threshold; |
|
3198 | + } |
|
3199 | + |
|
3200 | + |
|
3201 | + /** |
|
3202 | + * @param int $datetime_selector_threshold |
|
3203 | + */ |
|
3204 | + public function setDatetimeSelectorThreshold($datetime_selector_threshold) |
|
3205 | + { |
|
3206 | + $datetime_selector_threshold = absint($datetime_selector_threshold); |
|
3207 | + $this->datetime_selector_threshold = $datetime_selector_threshold ? $datetime_selector_threshold : 3; |
|
3208 | + } |
|
3209 | + |
|
3210 | + |
|
3211 | + /** |
|
3212 | + * @return int |
|
3213 | + */ |
|
3214 | + public function getDatetimeSelectorMaxChecked() |
|
3215 | + { |
|
3216 | + return $this->datetime_selector_max_checked; |
|
3217 | + } |
|
3218 | + |
|
3219 | + |
|
3220 | + /** |
|
3221 | + * @param int $datetime_selector_max_checked |
|
3222 | + */ |
|
3223 | + public function setDatetimeSelectorMaxChecked($datetime_selector_max_checked) |
|
3224 | + { |
|
3225 | + $this->datetime_selector_max_checked = absint($datetime_selector_max_checked); |
|
3226 | + } |
|
3227 | 3227 | } |
3228 | 3228 | |
3229 | 3229 | /** |
@@ -3235,87 +3235,87 @@ discard block |
||
3235 | 3235 | */ |
3236 | 3236 | class EE_Environment_Config extends EE_Config_Base |
3237 | 3237 | { |
3238 | - /** |
|
3239 | - * Hold any php environment variables that we want to track. |
|
3240 | - * |
|
3241 | - * @var stdClass; |
|
3242 | - */ |
|
3243 | - public $php; |
|
3244 | - |
|
3245 | - |
|
3246 | - /** |
|
3247 | - * constructor |
|
3248 | - */ |
|
3249 | - public function __construct() |
|
3250 | - { |
|
3251 | - $this->php = new stdClass(); |
|
3252 | - $this->_set_php_values(); |
|
3253 | - } |
|
3254 | - |
|
3255 | - |
|
3256 | - /** |
|
3257 | - * This sets the php environment variables. |
|
3258 | - * |
|
3259 | - * @since 4.4.0 |
|
3260 | - * @return void |
|
3261 | - */ |
|
3262 | - protected function _set_php_values() |
|
3263 | - { |
|
3264 | - $this->php->max_input_vars = ini_get('max_input_vars'); |
|
3265 | - $this->php->version = phpversion(); |
|
3266 | - } |
|
3267 | - |
|
3268 | - |
|
3269 | - /** |
|
3270 | - * helper method for determining whether input_count is |
|
3271 | - * reaching the potential maximum the server can handle |
|
3272 | - * according to max_input_vars |
|
3273 | - * |
|
3274 | - * @param int $input_count the count of input vars. |
|
3275 | - * @return array { |
|
3276 | - * An array that represents whether available space and if no available space the error |
|
3277 | - * message. |
|
3278 | - * @type bool $has_space whether more inputs can be added. |
|
3279 | - * @type string $msg Any message to be displayed. |
|
3280 | - * } |
|
3281 | - */ |
|
3282 | - public function max_input_vars_limit_check($input_count = 0) |
|
3283 | - { |
|
3284 | - if ( |
|
3285 | - ! empty($this->php->max_input_vars) |
|
3286 | - && ($input_count >= $this->php->max_input_vars) |
|
3287 | - ) { |
|
3288 | - // check the server setting because the config value could be stale |
|
3289 | - $max_input_vars = ini_get('max_input_vars'); |
|
3290 | - if ($input_count >= $max_input_vars) { |
|
3291 | - return sprintf( |
|
3292 | - esc_html__( |
|
3293 | - 'The maximum number of inputs on this page has been exceeded. You cannot make edits to this page because of your server\'s PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.%1$sPlease contact your web host and ask them to raise the "max_input_vars" limit.', |
|
3294 | - 'event_espresso' |
|
3295 | - ), |
|
3296 | - '<br>', |
|
3297 | - $input_count, |
|
3298 | - $max_input_vars |
|
3299 | - ); |
|
3300 | - } else { |
|
3301 | - return ''; |
|
3302 | - } |
|
3303 | - } else { |
|
3304 | - return ''; |
|
3305 | - } |
|
3306 | - } |
|
3307 | - |
|
3308 | - |
|
3309 | - /** |
|
3310 | - * The purpose of this method is just to force rechecking php values so if they've changed, they get updated. |
|
3311 | - * |
|
3312 | - * @since 4.4.1 |
|
3313 | - * @return void |
|
3314 | - */ |
|
3315 | - public function recheck_values() |
|
3316 | - { |
|
3317 | - $this->_set_php_values(); |
|
3318 | - } |
|
3238 | + /** |
|
3239 | + * Hold any php environment variables that we want to track. |
|
3240 | + * |
|
3241 | + * @var stdClass; |
|
3242 | + */ |
|
3243 | + public $php; |
|
3244 | + |
|
3245 | + |
|
3246 | + /** |
|
3247 | + * constructor |
|
3248 | + */ |
|
3249 | + public function __construct() |
|
3250 | + { |
|
3251 | + $this->php = new stdClass(); |
|
3252 | + $this->_set_php_values(); |
|
3253 | + } |
|
3254 | + |
|
3255 | + |
|
3256 | + /** |
|
3257 | + * This sets the php environment variables. |
|
3258 | + * |
|
3259 | + * @since 4.4.0 |
|
3260 | + * @return void |
|
3261 | + */ |
|
3262 | + protected function _set_php_values() |
|
3263 | + { |
|
3264 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
3265 | + $this->php->version = phpversion(); |
|
3266 | + } |
|
3267 | + |
|
3268 | + |
|
3269 | + /** |
|
3270 | + * helper method for determining whether input_count is |
|
3271 | + * reaching the potential maximum the server can handle |
|
3272 | + * according to max_input_vars |
|
3273 | + * |
|
3274 | + * @param int $input_count the count of input vars. |
|
3275 | + * @return array { |
|
3276 | + * An array that represents whether available space and if no available space the error |
|
3277 | + * message. |
|
3278 | + * @type bool $has_space whether more inputs can be added. |
|
3279 | + * @type string $msg Any message to be displayed. |
|
3280 | + * } |
|
3281 | + */ |
|
3282 | + public function max_input_vars_limit_check($input_count = 0) |
|
3283 | + { |
|
3284 | + if ( |
|
3285 | + ! empty($this->php->max_input_vars) |
|
3286 | + && ($input_count >= $this->php->max_input_vars) |
|
3287 | + ) { |
|
3288 | + // check the server setting because the config value could be stale |
|
3289 | + $max_input_vars = ini_get('max_input_vars'); |
|
3290 | + if ($input_count >= $max_input_vars) { |
|
3291 | + return sprintf( |
|
3292 | + esc_html__( |
|
3293 | + 'The maximum number of inputs on this page has been exceeded. You cannot make edits to this page because of your server\'s PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.%1$sPlease contact your web host and ask them to raise the "max_input_vars" limit.', |
|
3294 | + 'event_espresso' |
|
3295 | + ), |
|
3296 | + '<br>', |
|
3297 | + $input_count, |
|
3298 | + $max_input_vars |
|
3299 | + ); |
|
3300 | + } else { |
|
3301 | + return ''; |
|
3302 | + } |
|
3303 | + } else { |
|
3304 | + return ''; |
|
3305 | + } |
|
3306 | + } |
|
3307 | + |
|
3308 | + |
|
3309 | + /** |
|
3310 | + * The purpose of this method is just to force rechecking php values so if they've changed, they get updated. |
|
3311 | + * |
|
3312 | + * @since 4.4.1 |
|
3313 | + * @return void |
|
3314 | + */ |
|
3315 | + public function recheck_values() |
|
3316 | + { |
|
3317 | + $this->_set_php_values(); |
|
3318 | + } |
|
3319 | 3319 | } |
3320 | 3320 | |
3321 | 3321 | /** |
@@ -3327,21 +3327,21 @@ discard block |
||
3327 | 3327 | */ |
3328 | 3328 | class EE_Tax_Config extends EE_Config_Base |
3329 | 3329 | { |
3330 | - /* |
|
3330 | + /* |
|
3331 | 3331 | * flag to indicate whether or not to display ticket prices with the taxes included |
3332 | 3332 | * |
3333 | 3333 | * @var boolean $prices_displayed_including_taxes |
3334 | 3334 | */ |
3335 | - public $prices_displayed_including_taxes; |
|
3335 | + public $prices_displayed_including_taxes; |
|
3336 | 3336 | |
3337 | 3337 | |
3338 | - /** |
|
3339 | - * class constructor |
|
3340 | - */ |
|
3341 | - public function __construct() |
|
3342 | - { |
|
3343 | - $this->prices_displayed_including_taxes = true; |
|
3344 | - } |
|
3338 | + /** |
|
3339 | + * class constructor |
|
3340 | + */ |
|
3341 | + public function __construct() |
|
3342 | + { |
|
3343 | + $this->prices_displayed_including_taxes = true; |
|
3344 | + } |
|
3345 | 3345 | } |
3346 | 3346 | |
3347 | 3347 | /** |
@@ -3354,19 +3354,19 @@ discard block |
||
3354 | 3354 | */ |
3355 | 3355 | class EE_Messages_Config extends EE_Config_Base |
3356 | 3356 | { |
3357 | - /** |
|
3358 | - * This is an integer representing the deletion threshold in months for when old messages will get deleted. |
|
3359 | - * A value of 0 represents never deleting. Default is 0. |
|
3360 | - * |
|
3361 | - * @var integer |
|
3362 | - */ |
|
3363 | - public $delete_threshold; |
|
3364 | - |
|
3365 | - |
|
3366 | - public function __construct() |
|
3367 | - { |
|
3368 | - $this->delete_threshold = 0; |
|
3369 | - } |
|
3357 | + /** |
|
3358 | + * This is an integer representing the deletion threshold in months for when old messages will get deleted. |
|
3359 | + * A value of 0 represents never deleting. Default is 0. |
|
3360 | + * |
|
3361 | + * @var integer |
|
3362 | + */ |
|
3363 | + public $delete_threshold; |
|
3364 | + |
|
3365 | + |
|
3366 | + public function __construct() |
|
3367 | + { |
|
3368 | + $this->delete_threshold = 0; |
|
3369 | + } |
|
3370 | 3370 | } |
3371 | 3371 | |
3372 | 3372 | /** |
@@ -3376,31 +3376,31 @@ discard block |
||
3376 | 3376 | */ |
3377 | 3377 | class EE_Gateway_Config extends EE_Config_Base |
3378 | 3378 | { |
3379 | - /** |
|
3380 | - * Array with keys that are payment gateways slugs, and values are arrays |
|
3381 | - * with any config info the gateway wants to store |
|
3382 | - * |
|
3383 | - * @var array |
|
3384 | - */ |
|
3385 | - public $payment_settings; |
|
3386 | - |
|
3387 | - /** |
|
3388 | - * Where keys are gateway slugs, and values are booleans indicating whether or not |
|
3389 | - * the gateway is stored in the uploads directory |
|
3390 | - * |
|
3391 | - * @var array |
|
3392 | - */ |
|
3393 | - public $active_gateways; |
|
3394 | - |
|
3395 | - |
|
3396 | - /** |
|
3397 | - * class constructor |
|
3398 | - * |
|
3399 | - * @deprecated |
|
3400 | - */ |
|
3401 | - public function __construct() |
|
3402 | - { |
|
3403 | - $this->payment_settings = array(); |
|
3404 | - $this->active_gateways = array('Invoice' => false); |
|
3405 | - } |
|
3379 | + /** |
|
3380 | + * Array with keys that are payment gateways slugs, and values are arrays |
|
3381 | + * with any config info the gateway wants to store |
|
3382 | + * |
|
3383 | + * @var array |
|
3384 | + */ |
|
3385 | + public $payment_settings; |
|
3386 | + |
|
3387 | + /** |
|
3388 | + * Where keys are gateway slugs, and values are booleans indicating whether or not |
|
3389 | + * the gateway is stored in the uploads directory |
|
3390 | + * |
|
3391 | + * @var array |
|
3392 | + */ |
|
3393 | + public $active_gateways; |
|
3394 | + |
|
3395 | + |
|
3396 | + /** |
|
3397 | + * class constructor |
|
3398 | + * |
|
3399 | + * @deprecated |
|
3400 | + */ |
|
3401 | + public function __construct() |
|
3402 | + { |
|
3403 | + $this->payment_settings = array(); |
|
3404 | + $this->active_gateways = array('Invoice' => false); |
|
3405 | + } |
|
3406 | 3406 | } |
@@ -20,1130 +20,1130 @@ |
||
20 | 20 | */ |
21 | 21 | class EE_Dependency_Map |
22 | 22 | { |
23 | - /** |
|
24 | - * This means that the requested class dependency is not present in the dependency map |
|
25 | - */ |
|
26 | - const not_registered = 0; |
|
27 | - |
|
28 | - /** |
|
29 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
30 | - */ |
|
31 | - const load_new_object = 1; |
|
32 | - |
|
33 | - /** |
|
34 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
35 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
36 | - */ |
|
37 | - const load_from_cache = 2; |
|
38 | - |
|
39 | - /** |
|
40 | - * When registering a dependency, |
|
41 | - * this indicates to keep any existing dependencies that already exist, |
|
42 | - * and simply discard any new dependencies declared in the incoming data |
|
43 | - */ |
|
44 | - const KEEP_EXISTING_DEPENDENCIES = 0; |
|
45 | - |
|
46 | - /** |
|
47 | - * When registering a dependency, |
|
48 | - * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
49 | - */ |
|
50 | - const OVERWRITE_DEPENDENCIES = 1; |
|
51 | - |
|
52 | - /** |
|
53 | - * @type EE_Dependency_Map $_instance |
|
54 | - */ |
|
55 | - protected static $_instance; |
|
56 | - |
|
57 | - /** |
|
58 | - * @var ClassInterfaceCache $class_cache |
|
59 | - */ |
|
60 | - private $class_cache; |
|
61 | - |
|
62 | - /** |
|
63 | - * @type RequestInterface $request |
|
64 | - */ |
|
65 | - protected $request; |
|
66 | - |
|
67 | - /** |
|
68 | - * @type LegacyRequestInterface $legacy_request |
|
69 | - */ |
|
70 | - protected $legacy_request; |
|
71 | - |
|
72 | - /** |
|
73 | - * @type ResponseInterface $response |
|
74 | - */ |
|
75 | - protected $response; |
|
76 | - |
|
77 | - /** |
|
78 | - * @type LoaderInterface $loader |
|
79 | - */ |
|
80 | - protected $loader; |
|
81 | - |
|
82 | - /** |
|
83 | - * @type array $_dependency_map |
|
84 | - */ |
|
85 | - protected $_dependency_map = []; |
|
86 | - |
|
87 | - /** |
|
88 | - * @type array $_class_loaders |
|
89 | - */ |
|
90 | - protected $_class_loaders = []; |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * EE_Dependency_Map constructor. |
|
95 | - * |
|
96 | - * @param ClassInterfaceCache $class_cache |
|
97 | - */ |
|
98 | - protected function __construct(ClassInterfaceCache $class_cache) |
|
99 | - { |
|
100 | - $this->class_cache = $class_cache; |
|
101 | - do_action('EE_Dependency_Map____construct', $this); |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * @return void |
|
107 | - * @throws InvalidAliasException |
|
108 | - */ |
|
109 | - public function initialize() |
|
110 | - { |
|
111 | - $this->_register_core_dependencies(); |
|
112 | - $this->_register_core_class_loaders(); |
|
113 | - $this->_register_core_aliases(); |
|
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * @singleton method used to instantiate class object |
|
119 | - * @param ClassInterfaceCache|null $class_cache |
|
120 | - * @return EE_Dependency_Map |
|
121 | - */ |
|
122 | - public static function instance(ClassInterfaceCache $class_cache = null): EE_Dependency_Map |
|
123 | - { |
|
124 | - // check if class object is instantiated, and instantiated properly |
|
125 | - if ( |
|
126 | - ! 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 | - string $class, |
|
179 | - array $dependencies, |
|
180 | - int $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
181 | - ): bool { |
|
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 | - string $class, |
|
202 | - array $dependencies, |
|
203 | - int $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
204 | - ): bool { |
|
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 ( |
|
215 | - $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
216 | - || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ]) |
|
217 | - ) { |
|
218 | - unset($dependencies[ $dependency ]); |
|
219 | - $dependencies[ $alias ] = $load_source; |
|
220 | - $registered = true; |
|
221 | - } |
|
222 | - } |
|
223 | - // now add our two lists of dependencies together. |
|
224 | - // using Union (+=) favours the arrays in precedence from left to right, |
|
225 | - // so $dependencies is NOT overwritten because it is listed first |
|
226 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
227 | - // Union is way faster than array_merge() but should be used with caution... |
|
228 | - // especially with numerically indexed arrays |
|
229 | - $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ]; |
|
230 | - // now we need to ensure that the resulting dependencies |
|
231 | - // array only has the entries that are required for the class |
|
232 | - // so first count how many dependencies were originally registered for the class |
|
233 | - $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]); |
|
234 | - // if that count is non-zero (meaning dependencies were already registered) |
|
235 | - EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count |
|
236 | - // then truncate the final array to match that count |
|
237 | - ? array_slice($dependencies, 0, $dependency_count) |
|
238 | - // otherwise just take the incoming array because nothing previously existed |
|
239 | - : $dependencies; |
|
240 | - return $registered; |
|
241 | - } |
|
242 | - |
|
243 | - |
|
244 | - /** |
|
245 | - * @param string $class_name |
|
246 | - * @param callable|string $loader |
|
247 | - * @param bool $overwrite |
|
248 | - * @return bool |
|
249 | - * @throws DomainException |
|
250 | - */ |
|
251 | - public static function register_class_loader( |
|
252 | - string $class_name, |
|
253 | - $loader = 'load_core', |
|
254 | - bool $overwrite = false |
|
255 | - ): bool { |
|
256 | - return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader, $overwrite); |
|
257 | - } |
|
258 | - |
|
259 | - |
|
260 | - /** |
|
261 | - * @param string $class_name |
|
262 | - * @param Closure|string $loader |
|
263 | - * @param bool $overwrite |
|
264 | - * @return bool |
|
265 | - * @throws DomainException |
|
266 | - */ |
|
267 | - public function registerClassLoader(string $class_name, $loader = 'load_core', bool $overwrite = false): bool |
|
268 | - { |
|
269 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
270 | - throw new DomainException( |
|
271 | - esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
272 | - ); |
|
273 | - } |
|
274 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
275 | - if ( |
|
276 | - ! is_callable($loader) |
|
277 | - && ( |
|
278 | - strpos($loader, 'load_') !== 0 |
|
279 | - || ! method_exists('EE_Registry', $loader) |
|
280 | - ) |
|
281 | - ) { |
|
282 | - throw new DomainException( |
|
283 | - sprintf( |
|
284 | - esc_html__( |
|
285 | - '"%1$s" is not a valid loader method on EE_Registry.', |
|
286 | - 'event_espresso' |
|
287 | - ), |
|
288 | - $loader |
|
289 | - ) |
|
290 | - ); |
|
291 | - } |
|
292 | - $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name); |
|
293 | - if ($overwrite || ! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) { |
|
294 | - EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader; |
|
295 | - return true; |
|
296 | - } |
|
297 | - return false; |
|
298 | - } |
|
299 | - |
|
300 | - |
|
301 | - /** |
|
302 | - * @return array |
|
303 | - */ |
|
304 | - public function dependency_map(): array |
|
305 | - { |
|
306 | - return $this->_dependency_map; |
|
307 | - } |
|
308 | - |
|
309 | - |
|
310 | - /** |
|
311 | - * returns TRUE if dependency map contains a listing for the provided class name |
|
312 | - * |
|
313 | - * @param string $class_name |
|
314 | - * @return boolean |
|
315 | - */ |
|
316 | - public function has(string $class_name = ''): bool |
|
317 | - { |
|
318 | - // all legacy models have the same dependencies |
|
319 | - if (strpos($class_name, 'EEM_') === 0) { |
|
320 | - $class_name = 'LEGACY_MODELS'; |
|
321 | - } |
|
322 | - return isset($this->_dependency_map[ $class_name ]); |
|
323 | - } |
|
324 | - |
|
325 | - |
|
326 | - /** |
|
327 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
328 | - * |
|
329 | - * @param string $class_name |
|
330 | - * @param string $dependency |
|
331 | - * @return bool |
|
332 | - */ |
|
333 | - public function has_dependency_for_class(string $class_name = '', string $dependency = ''): bool |
|
334 | - { |
|
335 | - // all legacy models have the same dependencies |
|
336 | - if (strpos($class_name, 'EEM_') === 0) { |
|
337 | - $class_name = 'LEGACY_MODELS'; |
|
338 | - } |
|
339 | - $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
340 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
341 | - } |
|
342 | - |
|
343 | - |
|
344 | - /** |
|
345 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
346 | - * |
|
347 | - * @param string $class_name |
|
348 | - * @param string $dependency |
|
349 | - * @return int |
|
350 | - */ |
|
351 | - public function loading_strategy_for_class_dependency(string $class_name = '', string $dependency = ''): int |
|
352 | - { |
|
353 | - // all legacy models have the same dependencies |
|
354 | - if (strpos($class_name, 'EEM_') === 0) { |
|
355 | - $class_name = 'LEGACY_MODELS'; |
|
356 | - } |
|
357 | - $dependency = $this->getFqnForAlias($dependency); |
|
358 | - return $this->has_dependency_for_class($class_name, $dependency) |
|
359 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
360 | - : EE_Dependency_Map::not_registered; |
|
361 | - } |
|
362 | - |
|
363 | - |
|
364 | - /** |
|
365 | - * @param string $class_name |
|
366 | - * @return string | Closure |
|
367 | - */ |
|
368 | - public function class_loader(string $class_name) |
|
369 | - { |
|
370 | - // all legacy models use load_model() |
|
371 | - if (strpos($class_name, 'EEM_') === 0) { |
|
372 | - return 'load_model'; |
|
373 | - } |
|
374 | - // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
375 | - // perform strpos() first to avoid loading regex every time we load a class |
|
376 | - if ( |
|
377 | - strpos($class_name, 'EE_CPT_') === 0 |
|
378 | - && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
379 | - ) { |
|
380 | - return 'load_core'; |
|
381 | - } |
|
382 | - $class_name = $this->getFqnForAlias($class_name); |
|
383 | - return $this->_class_loaders[ $class_name ] ?? ''; |
|
384 | - } |
|
385 | - |
|
386 | - |
|
387 | - /** |
|
388 | - * @return array |
|
389 | - */ |
|
390 | - public function class_loaders(): array |
|
391 | - { |
|
392 | - return $this->_class_loaders; |
|
393 | - } |
|
394 | - |
|
395 | - |
|
396 | - /** |
|
397 | - * adds an alias for a classname |
|
398 | - * |
|
399 | - * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
400 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
401 | - * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
402 | - * @throws InvalidAliasException |
|
403 | - */ |
|
404 | - public function add_alias(string $fqcn, string $alias, string $for_class = '') |
|
405 | - { |
|
406 | - $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
407 | - } |
|
408 | - |
|
409 | - |
|
410 | - /** |
|
411 | - * Returns TRUE if the provided fully qualified name IS an alias |
|
412 | - * WHY? |
|
413 | - * Because if a class is type hinting for a concretion, |
|
414 | - * then why would we need to find another class to supply it? |
|
415 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
416 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
417 | - * Don't go looking for some substitute. |
|
418 | - * Whereas if a class is type hinting for an interface... |
|
419 | - * then we need to find an actual class to use. |
|
420 | - * So the interface IS the alias for some other FQN, |
|
421 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
422 | - * represents some other class. |
|
423 | - * |
|
424 | - * @param string $fqn |
|
425 | - * @param string $for_class |
|
426 | - * @return bool |
|
427 | - */ |
|
428 | - public function isAlias(string $fqn = '', string $for_class = ''): bool |
|
429 | - { |
|
430 | - return $this->class_cache->isAlias($fqn, $for_class); |
|
431 | - } |
|
432 | - |
|
433 | - |
|
434 | - /** |
|
435 | - * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
436 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
437 | - * for example: |
|
438 | - * if the following two entries were added to the _aliases array: |
|
439 | - * array( |
|
440 | - * 'interface_alias' => 'some\namespace\interface' |
|
441 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
442 | - * ) |
|
443 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
444 | - * to load an instance of 'some\namespace\classname' |
|
445 | - * |
|
446 | - * @param string $alias |
|
447 | - * @param string $for_class |
|
448 | - * @return string |
|
449 | - */ |
|
450 | - public function getFqnForAlias(string $alias = '', string $for_class = ''): string |
|
451 | - { |
|
452 | - return $this->class_cache->getFqnForAlias($alias, $for_class); |
|
453 | - } |
|
454 | - |
|
455 | - |
|
456 | - /** |
|
457 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
458 | - * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
459 | - * This is done by using the following class constants: |
|
460 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
461 | - * EE_Dependency_Map::load_new_object - generates a new object every time |
|
462 | - */ |
|
463 | - protected function _register_core_dependencies() |
|
464 | - { |
|
465 | - $this->_dependency_map = [ |
|
466 | - 'EE_Admin' => [ |
|
467 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
468 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
469 | - ], |
|
470 | - 'EE_Request_Handler' => [ |
|
471 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
472 | - 'EventEspresso\core\services\request\Response' => EE_Dependency_Map::load_from_cache, |
|
473 | - ], |
|
474 | - 'EE_System' => [ |
|
475 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
476 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
477 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
478 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
479 | - 'EventEspresso\core\services\routing\Router' => EE_Dependency_Map::load_from_cache, |
|
480 | - ], |
|
481 | - 'EE_Session' => [ |
|
482 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
483 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
484 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
485 | - 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
486 | - 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
487 | - ], |
|
488 | - 'EE_Cart' => [ |
|
489 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
490 | - ], |
|
491 | - 'EE_Messenger_Collection_Loader' => [ |
|
492 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
493 | - ], |
|
494 | - 'EE_Message_Type_Collection_Loader' => [ |
|
495 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
496 | - ], |
|
497 | - 'EE_Message_Resource_Manager' => [ |
|
498 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
499 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
500 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
501 | - ], |
|
502 | - 'EE_Message_Factory' => [ |
|
503 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
504 | - ], |
|
505 | - 'EE_messages' => [ |
|
506 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
507 | - ], |
|
508 | - 'EE_Messages_Generator' => [ |
|
509 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
510 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
511 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
512 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
513 | - ], |
|
514 | - 'EE_Messages_Processor' => [ |
|
515 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
516 | - ], |
|
517 | - 'EE_Messages_Queue' => [ |
|
518 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
519 | - ], |
|
520 | - 'EE_Messages_Template_Defaults' => [ |
|
521 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
522 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
523 | - ], |
|
524 | - 'EE_Message_To_Generate_From_Request' => [ |
|
525 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
526 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
527 | - ], |
|
528 | - 'EventEspresso\core\services\commands\CommandBus' => [ |
|
529 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
530 | - ], |
|
531 | - 'EventEspresso\services\commands\CommandHandler' => [ |
|
532 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
533 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
534 | - ], |
|
535 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => [ |
|
536 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
537 | - ], |
|
538 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => [ |
|
539 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
540 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
541 | - ], |
|
542 | - 'EventEspresso\core\services\commands\CommandFactory' => [ |
|
543 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
544 | - ], |
|
545 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => [ |
|
546 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
547 | - ], |
|
548 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [ |
|
549 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
550 | - ], |
|
551 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [ |
|
552 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
553 | - ], |
|
554 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => [ |
|
555 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
556 | - ], |
|
557 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [ |
|
558 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
559 | - ], |
|
560 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [ |
|
561 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
562 | - ], |
|
563 | - 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [ |
|
564 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
565 | - ], |
|
566 | - 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [ |
|
567 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
568 | - ], |
|
569 | - 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => [ |
|
570 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
571 | - ], |
|
572 | - 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => [ |
|
573 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
574 | - ], |
|
575 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [ |
|
576 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
577 | - ], |
|
578 | - 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => [ |
|
579 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
580 | - ], |
|
581 | - 'EventEspresso\core\services\database\TableManager' => [ |
|
582 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
583 | - ], |
|
584 | - 'EE_Data_Migration_Class_Base' => [ |
|
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_1_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_2_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_3_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_4_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_5_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_6_0' => [ |
|
609 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
610 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
611 | - ], |
|
612 | - 'EE_DMS_Core_4_7_0' => [ |
|
613 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
614 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
615 | - ], |
|
616 | - 'EE_DMS_Core_4_8_0' => [ |
|
617 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
618 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
619 | - ], |
|
620 | - 'EE_DMS_Core_4_9_0' => [ |
|
621 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
622 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
623 | - ], |
|
624 | - 'EE_DMS_Core_4_10_0' => [ |
|
625 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
626 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
627 | - 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
628 | - ], |
|
629 | - 'EE_DMS_Core_4_11_0' => [ |
|
630 | - 'EE_DMS_Core_4_10_0' => EE_Dependency_Map::load_from_cache, |
|
631 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
632 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
633 | - ], |
|
634 | - 'EE_DMS_Core_4_12_0' => [ |
|
635 | - 'EE_DMS_Core_4_11_0' => EE_Dependency_Map::load_from_cache, |
|
636 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
637 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
638 | - ], |
|
639 | - 'EventEspresso\core\services\assets\I18nRegistry' => [ |
|
640 | - [], |
|
641 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
642 | - ], |
|
643 | - 'EventEspresso\core\services\assets\Registry' => [ |
|
644 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
645 | - 'EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache, |
|
646 | - ], |
|
647 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => [ |
|
648 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
649 | - ], |
|
650 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => [ |
|
651 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
652 | - ], |
|
653 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => [ |
|
654 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
655 | - ], |
|
656 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => [ |
|
657 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
658 | - ], |
|
659 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => [ |
|
660 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
661 | - ], |
|
662 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => [ |
|
663 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
664 | - ], |
|
665 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => [ |
|
666 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
667 | - ], |
|
668 | - 'EventEspresso\core\services\cache\BasicCacheManager' => [ |
|
669 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
670 | - ], |
|
671 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [ |
|
672 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
673 | - ], |
|
674 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [ |
|
675 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
676 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
677 | - ], |
|
678 | - 'EventEspresso\core\domain\values\EmailAddress' => [ |
|
679 | - null, |
|
680 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
681 | - ], |
|
682 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => [ |
|
683 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
684 | - ], |
|
685 | - 'LEGACY_MODELS' => [ |
|
686 | - null, |
|
687 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
688 | - ], |
|
689 | - 'EE_Module_Request_Router' => [ |
|
690 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
691 | - ], |
|
692 | - 'EE_Registration_Processor' => [ |
|
693 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
694 | - ], |
|
695 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [ |
|
696 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
697 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
698 | - ], |
|
699 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
700 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
701 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
702 | - ], |
|
703 | - 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [ |
|
704 | - 'EventEspresso\core\domain\entities\users\CurrentUser' => EE_Dependency_Map::load_from_cache, |
|
705 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
706 | - 'EE_Ticket_Selector_Config' => EE_Dependency_Map::load_from_cache, |
|
707 | - ], |
|
708 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
709 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
710 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
711 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
712 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
713 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
714 | - ], |
|
715 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
716 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
717 | - ], |
|
718 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
719 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
720 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
721 | - ], |
|
722 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
723 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
724 | - ], |
|
725 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
726 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
727 | - ], |
|
728 | - 'EE_CPT_Strategy' => [ |
|
729 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
730 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
731 | - ], |
|
732 | - 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
733 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
734 | - ], |
|
735 | - 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
736 | - null, |
|
737 | - null, |
|
738 | - null, |
|
739 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
740 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
741 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
742 | - ], |
|
743 | - 'EventEspresso\core\services\dependencies\DependencyResolver' => [ |
|
744 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
745 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
746 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
747 | - ], |
|
748 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => [ |
|
749 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
750 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
751 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
752 | - ], |
|
753 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => [ |
|
754 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
755 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
756 | - ], |
|
757 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => [ |
|
758 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
759 | - 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
760 | - ], |
|
761 | - 'EE_URL_Validation_Strategy' => [ |
|
762 | - null, |
|
763 | - null, |
|
764 | - 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
765 | - ], |
|
766 | - 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
767 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
768 | - ], |
|
769 | - 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
770 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
771 | - ], |
|
772 | - 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [ |
|
773 | - 'WP_REST_Server' => EE_Dependency_Map::load_from_cache, |
|
774 | - 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache, |
|
775 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache, |
|
776 | - null, |
|
777 | - ], |
|
778 | - 'EventEspresso\core\services\routing\RouteHandler' => [ |
|
779 | - 'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache, |
|
780 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
781 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
782 | - 'EventEspresso\core\services\routing\RouteCollection' => EE_Dependency_Map::load_from_cache, |
|
783 | - ], |
|
784 | - 'EventEspresso\core\services\json\JsonDataNodeHandler' => [ |
|
785 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
786 | - ], |
|
787 | - 'EventEspresso\core\services\routing\Router' => [ |
|
788 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
789 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
790 | - 'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache, |
|
791 | - ], |
|
792 | - 'EventEspresso\core\services\assets\AssetManifest' => [ |
|
793 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
794 | - ], |
|
795 | - 'EventEspresso\core\services\assets\AssetManifestFactory' => [ |
|
796 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
797 | - ], |
|
798 | - 'EventEspresso\core\services\assets\BaristaFactory' => [ |
|
799 | - 'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache, |
|
800 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
801 | - ], |
|
802 | - 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => [ |
|
803 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
804 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
805 | - ], |
|
806 | - 'EventEspresso\core\services\addon\AddonManager' => [ |
|
807 | - 'EventEspresso\core\services\addon\AddonCollection' => EE_Dependency_Map::load_from_cache, |
|
808 | - 'EventEspresso\core\Psr4Autoloader' => EE_Dependency_Map::load_from_cache, |
|
809 | - 'EventEspresso\core\services\addon\api\v1\RegisterAddon' => EE_Dependency_Map::load_from_cache, |
|
810 | - 'EventEspresso\core\services\addon\api\IncompatibleAddonHandler' => EE_Dependency_Map::load_from_cache, |
|
811 | - 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => EE_Dependency_Map::load_from_cache, |
|
812 | - ], |
|
813 | - 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => [ |
|
814 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
815 | - ], |
|
816 | - 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [ |
|
817 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
818 | - ], |
|
819 | - 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [ |
|
820 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
821 | - ], |
|
822 | - 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [ |
|
823 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
824 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
825 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
826 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
827 | - ], |
|
828 | - 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [ |
|
829 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
830 | - ], |
|
831 | - 'EventEspresso\core\services\request\CurrentPage' => [ |
|
832 | - 'EE_CPT_Strategy' => EE_Dependency_Map::load_from_cache, |
|
833 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
834 | - ], |
|
835 | - 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => [ |
|
836 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
837 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
838 | - ], |
|
839 | - 'EventEspresso\core\services\shortcodes\ShortcodesManager' => [ |
|
840 | - 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache, |
|
841 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
842 | - ], |
|
843 | - 'EventEspresso\core\domain\entities\users\CurrentUser' => [ |
|
844 | - 'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache, |
|
845 | - ], |
|
846 | - 'EventEspresso\core\services\form\meta\InputTypes' => [ |
|
847 | - 'EventEspresso\core\services\form\meta\inputs\Block' => EE_Dependency_Map::load_from_cache, |
|
848 | - 'EventEspresso\core\services\form\meta\inputs\Button' => EE_Dependency_Map::load_from_cache, |
|
849 | - 'EventEspresso\core\services\form\meta\inputs\DateTime' => EE_Dependency_Map::load_from_cache, |
|
850 | - 'EventEspresso\core\services\form\meta\inputs\Input' => EE_Dependency_Map::load_from_cache, |
|
851 | - 'EventEspresso\core\services\form\meta\inputs\Number' => EE_Dependency_Map::load_from_cache, |
|
852 | - 'EventEspresso\core\services\form\meta\inputs\Phone' => EE_Dependency_Map::load_from_cache, |
|
853 | - 'EventEspresso\core\services\form\meta\inputs\Select' => EE_Dependency_Map::load_from_cache, |
|
854 | - 'EventEspresso\core\services\form\meta\inputs\Text' => EE_Dependency_Map::load_from_cache, |
|
855 | - ], |
|
856 | - 'EventEspresso\core\domain\services\registration\form\v1\RegFormDependencyHandler' => [ |
|
857 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
858 | - ], |
|
859 | - 'EventEspresso\core\services\calculators\LineItemCalculator' => [ |
|
860 | - 'EventEspresso\core\services\helpers\DecimalValues' => EE_Dependency_Map::load_from_cache, |
|
861 | - ], |
|
862 | - 'EventEspresso\core\services\helpers\DecimalValues' => [ |
|
863 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
864 | - ], |
|
865 | - ]; |
|
866 | - } |
|
867 | - |
|
868 | - |
|
869 | - /** |
|
870 | - * Registers how core classes are loaded. |
|
871 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
872 | - * 'EE_Request_Handler' => 'load_core' |
|
873 | - * 'EE_Messages_Queue' => 'load_lib' |
|
874 | - * 'EEH_Debug_Tools' => 'load_helper' |
|
875 | - * or, if greater control is required, by providing a custom closure. For example: |
|
876 | - * 'Some_Class' => function () { |
|
877 | - * return new Some_Class(); |
|
878 | - * }, |
|
879 | - * This is required for instantiating dependencies |
|
880 | - * where an interface has been type hinted in a class constructor. For example: |
|
881 | - * 'Required_Interface' => function () { |
|
882 | - * return new A_Class_That_Implements_Required_Interface(); |
|
883 | - * }, |
|
884 | - */ |
|
885 | - protected function _register_core_class_loaders() |
|
886 | - { |
|
887 | - $this->_class_loaders = [ |
|
888 | - // load_core |
|
889 | - 'EE_Dependency_Map' => function () { |
|
890 | - return $this; |
|
891 | - }, |
|
892 | - 'EE_Capabilities' => 'load_core', |
|
893 | - 'EE_Encryption' => 'load_core', |
|
894 | - 'EE_Front_Controller' => 'load_core', |
|
895 | - 'EE_Module_Request_Router' => 'load_core', |
|
896 | - 'EE_Registry' => 'load_core', |
|
897 | - 'EE_Request' => function () { |
|
898 | - return $this->legacy_request; |
|
899 | - }, |
|
900 | - 'EventEspresso\core\services\request\Request' => function () { |
|
901 | - return $this->request; |
|
902 | - }, |
|
903 | - 'EventEspresso\core\services\request\Response' => function () { |
|
904 | - return $this->response; |
|
905 | - }, |
|
906 | - 'EE_Base' => 'load_core', |
|
907 | - 'EE_Request_Handler' => 'load_core', |
|
908 | - 'EE_Session' => 'load_core', |
|
909 | - 'EE_Cron_Tasks' => 'load_core', |
|
910 | - 'EE_System' => 'load_core', |
|
911 | - 'EE_Maintenance_Mode' => 'load_core', |
|
912 | - 'EE_Register_CPTs' => 'load_core', |
|
913 | - 'EE_Admin' => 'load_core', |
|
914 | - 'EE_CPT_Strategy' => 'load_core', |
|
915 | - // load_class |
|
916 | - 'EE_Registration_Processor' => 'load_class', |
|
917 | - // load_lib |
|
918 | - 'EE_Message_Resource_Manager' => 'load_lib', |
|
919 | - 'EE_Message_Type_Collection' => 'load_lib', |
|
920 | - 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
921 | - 'EE_Messenger_Collection' => 'load_lib', |
|
922 | - 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
923 | - 'EE_Messages_Processor' => 'load_lib', |
|
924 | - 'EE_Message_Repository' => 'load_lib', |
|
925 | - 'EE_Messages_Queue' => 'load_lib', |
|
926 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
927 | - 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
928 | - 'EE_Payment_Method_Manager' => 'load_lib', |
|
929 | - 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
930 | - 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
931 | - 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
932 | - 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
933 | - 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
934 | - 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
935 | - 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
936 | - 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
937 | - 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
938 | - 'EE_DMS_Core_4_11_0' => 'load_dms', |
|
939 | - 'EE_DMS_Core_4_12_0' => 'load_dms', |
|
940 | - 'EE_Messages_Generator' => static function () { |
|
941 | - return EE_Registry::instance()->load_lib( |
|
942 | - 'Messages_Generator', |
|
943 | - [], |
|
944 | - false, |
|
945 | - false |
|
946 | - ); |
|
947 | - }, |
|
948 | - 'EE_Messages_Template_Defaults' => static function ($arguments = []) { |
|
949 | - return EE_Registry::instance()->load_lib( |
|
950 | - 'Messages_Template_Defaults', |
|
951 | - $arguments, |
|
952 | - false, |
|
953 | - false |
|
954 | - ); |
|
955 | - }, |
|
956 | - // load_helper |
|
957 | - 'EEH_Parse_Shortcodes' => static function () { |
|
958 | - if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
959 | - return new EEH_Parse_Shortcodes(); |
|
960 | - } |
|
961 | - return null; |
|
962 | - }, |
|
963 | - 'EE_Template_Config' => static function () { |
|
964 | - return EE_Config::instance()->template_settings; |
|
965 | - }, |
|
966 | - 'EE_Currency_Config' => static function () { |
|
967 | - return EE_Currency_Config::getCurrencyConfig(); |
|
968 | - }, |
|
969 | - 'EE_Registration_Config' => static function () { |
|
970 | - return EE_Config::instance()->registration; |
|
971 | - }, |
|
972 | - 'EE_Core_Config' => static function () { |
|
973 | - return EE_Config::instance()->core; |
|
974 | - }, |
|
975 | - 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
976 | - return LoaderFactory::getLoader(); |
|
977 | - }, |
|
978 | - 'EE_Network_Config' => static function () { |
|
979 | - return EE_Network_Config::instance(); |
|
980 | - }, |
|
981 | - 'EE_Config' => static function () { |
|
982 | - return EE_Config::instance(); |
|
983 | - }, |
|
984 | - 'EventEspresso\core\domain\Domain' => static function () { |
|
985 | - return DomainFactory::getEventEspressoCoreDomain(); |
|
986 | - }, |
|
987 | - 'EE_Admin_Config' => static function () { |
|
988 | - return EE_Config::instance()->admin; |
|
989 | - }, |
|
990 | - 'EE_Organization_Config' => static function () { |
|
991 | - return EE_Config::instance()->organization; |
|
992 | - }, |
|
993 | - 'EE_Network_Core_Config' => static function () { |
|
994 | - return EE_Network_Config::instance()->core; |
|
995 | - }, |
|
996 | - 'EE_Environment_Config' => static function () { |
|
997 | - return EE_Config::instance()->environment; |
|
998 | - }, |
|
999 | - 'EED_Core_Rest_Api' => static function () { |
|
1000 | - return EED_Core_Rest_Api::instance(); |
|
1001 | - }, |
|
1002 | - 'WP_REST_Server' => static function () { |
|
1003 | - return rest_get_server(); |
|
1004 | - }, |
|
1005 | - 'EventEspresso\core\Psr4Autoloader' => static function () { |
|
1006 | - return EE_Psr4AutoloaderInit::psr4_loader(); |
|
1007 | - }, |
|
1008 | - 'EE_Ticket_Selector_Config' => function () { |
|
1009 | - return EE_Config::instance()->template_settings->EED_Ticket_Selector; |
|
1010 | - }, |
|
1011 | - ]; |
|
1012 | - } |
|
1013 | - |
|
1014 | - |
|
1015 | - /** |
|
1016 | - * can be used for supplying alternate names for classes, |
|
1017 | - * or for connecting interface names to instantiable classes |
|
1018 | - * |
|
1019 | - * @throws InvalidAliasException |
|
1020 | - */ |
|
1021 | - protected function _register_core_aliases() |
|
1022 | - { |
|
1023 | - $aliases = [ |
|
1024 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
1025 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
1026 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
1027 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
1028 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
1029 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
1030 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1031 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
1032 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1033 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
1034 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
1035 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
1036 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
1037 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
1038 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
1039 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
1040 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
1041 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
1042 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
1043 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
1044 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1045 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
1046 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1047 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
1048 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
1049 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
1050 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
1051 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
1052 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
1053 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
1054 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
1055 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
1056 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
1057 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
1058 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
1059 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
1060 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
1061 | - 'Registration_Processor' => 'EE_Registration_Processor', |
|
1062 | - 'EventEspresso\core\services\assets\AssetManifestInterface' => 'EventEspresso\core\services\assets\AssetManifest', |
|
1063 | - ]; |
|
1064 | - foreach ($aliases as $alias => $fqn) { |
|
1065 | - if (is_array($fqn)) { |
|
1066 | - foreach ($fqn as $class => $for_class) { |
|
1067 | - $this->class_cache->addAlias($class, $alias, $for_class); |
|
1068 | - } |
|
1069 | - continue; |
|
1070 | - } |
|
1071 | - $this->class_cache->addAlias($fqn, $alias); |
|
1072 | - } |
|
1073 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1074 | - $this->class_cache->addAlias( |
|
1075 | - 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
1076 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
1077 | - ); |
|
1078 | - } |
|
1079 | - } |
|
1080 | - |
|
1081 | - |
|
1082 | - public function debug($for_class = '') |
|
1083 | - { |
|
1084 | - if (method_exists($this->class_cache, 'debug')) { |
|
1085 | - $this->class_cache->debug($for_class); |
|
1086 | - } |
|
1087 | - } |
|
1088 | - |
|
1089 | - |
|
1090 | - /** |
|
1091 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
1092 | - * request Primarily used by unit tests. |
|
1093 | - */ |
|
1094 | - public function reset() |
|
1095 | - { |
|
1096 | - $this->_register_core_class_loaders(); |
|
1097 | - $this->_register_core_dependencies(); |
|
1098 | - } |
|
1099 | - |
|
1100 | - |
|
1101 | - /** |
|
1102 | - * PLZ NOTE: a better name for this method would be is_alias() |
|
1103 | - * because it returns TRUE if the provided fully qualified name IS an alias |
|
1104 | - * WHY? |
|
1105 | - * Because if a class is type hinting for a concretion, |
|
1106 | - * then why would we need to find another class to supply it? |
|
1107 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
1108 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
1109 | - * Don't go looking for some substitute. |
|
1110 | - * Whereas if a class is type hinting for an interface... |
|
1111 | - * then we need to find an actual class to use. |
|
1112 | - * So the interface IS the alias for some other FQN, |
|
1113 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
1114 | - * represents some other class. |
|
1115 | - * |
|
1116 | - * @param string $fqn |
|
1117 | - * @param string $for_class |
|
1118 | - * @return bool |
|
1119 | - * @deprecated 4.9.62.p |
|
1120 | - */ |
|
1121 | - public function has_alias(string $fqn = '', string $for_class = ''): bool |
|
1122 | - { |
|
1123 | - return $this->isAlias($fqn, $for_class); |
|
1124 | - } |
|
1125 | - |
|
1126 | - |
|
1127 | - /** |
|
1128 | - * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1129 | - * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1130 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1131 | - * for example: |
|
1132 | - * if the following two entries were added to the _aliases array: |
|
1133 | - * array( |
|
1134 | - * 'interface_alias' => 'some\namespace\interface' |
|
1135 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
1136 | - * ) |
|
1137 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1138 | - * to load an instance of 'some\namespace\classname' |
|
1139 | - * |
|
1140 | - * @param string $alias |
|
1141 | - * @param string $for_class |
|
1142 | - * @return string |
|
1143 | - * @deprecated 4.9.62.p |
|
1144 | - */ |
|
1145 | - public function get_alias(string $alias = '', string $for_class = ''): string |
|
1146 | - { |
|
1147 | - return $this->getFqnForAlias($alias, $for_class); |
|
1148 | - } |
|
23 | + /** |
|
24 | + * This means that the requested class dependency is not present in the dependency map |
|
25 | + */ |
|
26 | + const not_registered = 0; |
|
27 | + |
|
28 | + /** |
|
29 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
30 | + */ |
|
31 | + const load_new_object = 1; |
|
32 | + |
|
33 | + /** |
|
34 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
35 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
36 | + */ |
|
37 | + const load_from_cache = 2; |
|
38 | + |
|
39 | + /** |
|
40 | + * When registering a dependency, |
|
41 | + * this indicates to keep any existing dependencies that already exist, |
|
42 | + * and simply discard any new dependencies declared in the incoming data |
|
43 | + */ |
|
44 | + const KEEP_EXISTING_DEPENDENCIES = 0; |
|
45 | + |
|
46 | + /** |
|
47 | + * When registering a dependency, |
|
48 | + * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
49 | + */ |
|
50 | + const OVERWRITE_DEPENDENCIES = 1; |
|
51 | + |
|
52 | + /** |
|
53 | + * @type EE_Dependency_Map $_instance |
|
54 | + */ |
|
55 | + protected static $_instance; |
|
56 | + |
|
57 | + /** |
|
58 | + * @var ClassInterfaceCache $class_cache |
|
59 | + */ |
|
60 | + private $class_cache; |
|
61 | + |
|
62 | + /** |
|
63 | + * @type RequestInterface $request |
|
64 | + */ |
|
65 | + protected $request; |
|
66 | + |
|
67 | + /** |
|
68 | + * @type LegacyRequestInterface $legacy_request |
|
69 | + */ |
|
70 | + protected $legacy_request; |
|
71 | + |
|
72 | + /** |
|
73 | + * @type ResponseInterface $response |
|
74 | + */ |
|
75 | + protected $response; |
|
76 | + |
|
77 | + /** |
|
78 | + * @type LoaderInterface $loader |
|
79 | + */ |
|
80 | + protected $loader; |
|
81 | + |
|
82 | + /** |
|
83 | + * @type array $_dependency_map |
|
84 | + */ |
|
85 | + protected $_dependency_map = []; |
|
86 | + |
|
87 | + /** |
|
88 | + * @type array $_class_loaders |
|
89 | + */ |
|
90 | + protected $_class_loaders = []; |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * EE_Dependency_Map constructor. |
|
95 | + * |
|
96 | + * @param ClassInterfaceCache $class_cache |
|
97 | + */ |
|
98 | + protected function __construct(ClassInterfaceCache $class_cache) |
|
99 | + { |
|
100 | + $this->class_cache = $class_cache; |
|
101 | + do_action('EE_Dependency_Map____construct', $this); |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * @return void |
|
107 | + * @throws InvalidAliasException |
|
108 | + */ |
|
109 | + public function initialize() |
|
110 | + { |
|
111 | + $this->_register_core_dependencies(); |
|
112 | + $this->_register_core_class_loaders(); |
|
113 | + $this->_register_core_aliases(); |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * @singleton method used to instantiate class object |
|
119 | + * @param ClassInterfaceCache|null $class_cache |
|
120 | + * @return EE_Dependency_Map |
|
121 | + */ |
|
122 | + public static function instance(ClassInterfaceCache $class_cache = null): EE_Dependency_Map |
|
123 | + { |
|
124 | + // check if class object is instantiated, and instantiated properly |
|
125 | + if ( |
|
126 | + ! 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 | + string $class, |
|
179 | + array $dependencies, |
|
180 | + int $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
181 | + ): bool { |
|
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 | + string $class, |
|
202 | + array $dependencies, |
|
203 | + int $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
204 | + ): bool { |
|
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 ( |
|
215 | + $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
216 | + || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ]) |
|
217 | + ) { |
|
218 | + unset($dependencies[ $dependency ]); |
|
219 | + $dependencies[ $alias ] = $load_source; |
|
220 | + $registered = true; |
|
221 | + } |
|
222 | + } |
|
223 | + // now add our two lists of dependencies together. |
|
224 | + // using Union (+=) favours the arrays in precedence from left to right, |
|
225 | + // so $dependencies is NOT overwritten because it is listed first |
|
226 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
227 | + // Union is way faster than array_merge() but should be used with caution... |
|
228 | + // especially with numerically indexed arrays |
|
229 | + $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ]; |
|
230 | + // now we need to ensure that the resulting dependencies |
|
231 | + // array only has the entries that are required for the class |
|
232 | + // so first count how many dependencies were originally registered for the class |
|
233 | + $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]); |
|
234 | + // if that count is non-zero (meaning dependencies were already registered) |
|
235 | + EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count |
|
236 | + // then truncate the final array to match that count |
|
237 | + ? array_slice($dependencies, 0, $dependency_count) |
|
238 | + // otherwise just take the incoming array because nothing previously existed |
|
239 | + : $dependencies; |
|
240 | + return $registered; |
|
241 | + } |
|
242 | + |
|
243 | + |
|
244 | + /** |
|
245 | + * @param string $class_name |
|
246 | + * @param callable|string $loader |
|
247 | + * @param bool $overwrite |
|
248 | + * @return bool |
|
249 | + * @throws DomainException |
|
250 | + */ |
|
251 | + public static function register_class_loader( |
|
252 | + string $class_name, |
|
253 | + $loader = 'load_core', |
|
254 | + bool $overwrite = false |
|
255 | + ): bool { |
|
256 | + return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader, $overwrite); |
|
257 | + } |
|
258 | + |
|
259 | + |
|
260 | + /** |
|
261 | + * @param string $class_name |
|
262 | + * @param Closure|string $loader |
|
263 | + * @param bool $overwrite |
|
264 | + * @return bool |
|
265 | + * @throws DomainException |
|
266 | + */ |
|
267 | + public function registerClassLoader(string $class_name, $loader = 'load_core', bool $overwrite = false): bool |
|
268 | + { |
|
269 | + if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
270 | + throw new DomainException( |
|
271 | + esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
272 | + ); |
|
273 | + } |
|
274 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
275 | + if ( |
|
276 | + ! is_callable($loader) |
|
277 | + && ( |
|
278 | + strpos($loader, 'load_') !== 0 |
|
279 | + || ! method_exists('EE_Registry', $loader) |
|
280 | + ) |
|
281 | + ) { |
|
282 | + throw new DomainException( |
|
283 | + sprintf( |
|
284 | + esc_html__( |
|
285 | + '"%1$s" is not a valid loader method on EE_Registry.', |
|
286 | + 'event_espresso' |
|
287 | + ), |
|
288 | + $loader |
|
289 | + ) |
|
290 | + ); |
|
291 | + } |
|
292 | + $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name); |
|
293 | + if ($overwrite || ! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) { |
|
294 | + EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader; |
|
295 | + return true; |
|
296 | + } |
|
297 | + return false; |
|
298 | + } |
|
299 | + |
|
300 | + |
|
301 | + /** |
|
302 | + * @return array |
|
303 | + */ |
|
304 | + public function dependency_map(): array |
|
305 | + { |
|
306 | + return $this->_dependency_map; |
|
307 | + } |
|
308 | + |
|
309 | + |
|
310 | + /** |
|
311 | + * returns TRUE if dependency map contains a listing for the provided class name |
|
312 | + * |
|
313 | + * @param string $class_name |
|
314 | + * @return boolean |
|
315 | + */ |
|
316 | + public function has(string $class_name = ''): bool |
|
317 | + { |
|
318 | + // all legacy models have the same dependencies |
|
319 | + if (strpos($class_name, 'EEM_') === 0) { |
|
320 | + $class_name = 'LEGACY_MODELS'; |
|
321 | + } |
|
322 | + return isset($this->_dependency_map[ $class_name ]); |
|
323 | + } |
|
324 | + |
|
325 | + |
|
326 | + /** |
|
327 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
328 | + * |
|
329 | + * @param string $class_name |
|
330 | + * @param string $dependency |
|
331 | + * @return bool |
|
332 | + */ |
|
333 | + public function has_dependency_for_class(string $class_name = '', string $dependency = ''): bool |
|
334 | + { |
|
335 | + // all legacy models have the same dependencies |
|
336 | + if (strpos($class_name, 'EEM_') === 0) { |
|
337 | + $class_name = 'LEGACY_MODELS'; |
|
338 | + } |
|
339 | + $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
340 | + return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
341 | + } |
|
342 | + |
|
343 | + |
|
344 | + /** |
|
345 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
346 | + * |
|
347 | + * @param string $class_name |
|
348 | + * @param string $dependency |
|
349 | + * @return int |
|
350 | + */ |
|
351 | + public function loading_strategy_for_class_dependency(string $class_name = '', string $dependency = ''): int |
|
352 | + { |
|
353 | + // all legacy models have the same dependencies |
|
354 | + if (strpos($class_name, 'EEM_') === 0) { |
|
355 | + $class_name = 'LEGACY_MODELS'; |
|
356 | + } |
|
357 | + $dependency = $this->getFqnForAlias($dependency); |
|
358 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
359 | + ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
360 | + : EE_Dependency_Map::not_registered; |
|
361 | + } |
|
362 | + |
|
363 | + |
|
364 | + /** |
|
365 | + * @param string $class_name |
|
366 | + * @return string | Closure |
|
367 | + */ |
|
368 | + public function class_loader(string $class_name) |
|
369 | + { |
|
370 | + // all legacy models use load_model() |
|
371 | + if (strpos($class_name, 'EEM_') === 0) { |
|
372 | + return 'load_model'; |
|
373 | + } |
|
374 | + // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
375 | + // perform strpos() first to avoid loading regex every time we load a class |
|
376 | + if ( |
|
377 | + strpos($class_name, 'EE_CPT_') === 0 |
|
378 | + && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
379 | + ) { |
|
380 | + return 'load_core'; |
|
381 | + } |
|
382 | + $class_name = $this->getFqnForAlias($class_name); |
|
383 | + return $this->_class_loaders[ $class_name ] ?? ''; |
|
384 | + } |
|
385 | + |
|
386 | + |
|
387 | + /** |
|
388 | + * @return array |
|
389 | + */ |
|
390 | + public function class_loaders(): array |
|
391 | + { |
|
392 | + return $this->_class_loaders; |
|
393 | + } |
|
394 | + |
|
395 | + |
|
396 | + /** |
|
397 | + * adds an alias for a classname |
|
398 | + * |
|
399 | + * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
400 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
401 | + * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
402 | + * @throws InvalidAliasException |
|
403 | + */ |
|
404 | + public function add_alias(string $fqcn, string $alias, string $for_class = '') |
|
405 | + { |
|
406 | + $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
407 | + } |
|
408 | + |
|
409 | + |
|
410 | + /** |
|
411 | + * Returns TRUE if the provided fully qualified name IS an alias |
|
412 | + * WHY? |
|
413 | + * Because if a class is type hinting for a concretion, |
|
414 | + * then why would we need to find another class to supply it? |
|
415 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
416 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
417 | + * Don't go looking for some substitute. |
|
418 | + * Whereas if a class is type hinting for an interface... |
|
419 | + * then we need to find an actual class to use. |
|
420 | + * So the interface IS the alias for some other FQN, |
|
421 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
422 | + * represents some other class. |
|
423 | + * |
|
424 | + * @param string $fqn |
|
425 | + * @param string $for_class |
|
426 | + * @return bool |
|
427 | + */ |
|
428 | + public function isAlias(string $fqn = '', string $for_class = ''): bool |
|
429 | + { |
|
430 | + return $this->class_cache->isAlias($fqn, $for_class); |
|
431 | + } |
|
432 | + |
|
433 | + |
|
434 | + /** |
|
435 | + * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
436 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
437 | + * for example: |
|
438 | + * if the following two entries were added to the _aliases array: |
|
439 | + * array( |
|
440 | + * 'interface_alias' => 'some\namespace\interface' |
|
441 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
442 | + * ) |
|
443 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
444 | + * to load an instance of 'some\namespace\classname' |
|
445 | + * |
|
446 | + * @param string $alias |
|
447 | + * @param string $for_class |
|
448 | + * @return string |
|
449 | + */ |
|
450 | + public function getFqnForAlias(string $alias = '', string $for_class = ''): string |
|
451 | + { |
|
452 | + return $this->class_cache->getFqnForAlias($alias, $for_class); |
|
453 | + } |
|
454 | + |
|
455 | + |
|
456 | + /** |
|
457 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
458 | + * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
459 | + * This is done by using the following class constants: |
|
460 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
461 | + * EE_Dependency_Map::load_new_object - generates a new object every time |
|
462 | + */ |
|
463 | + protected function _register_core_dependencies() |
|
464 | + { |
|
465 | + $this->_dependency_map = [ |
|
466 | + 'EE_Admin' => [ |
|
467 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
468 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
469 | + ], |
|
470 | + 'EE_Request_Handler' => [ |
|
471 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
472 | + 'EventEspresso\core\services\request\Response' => EE_Dependency_Map::load_from_cache, |
|
473 | + ], |
|
474 | + 'EE_System' => [ |
|
475 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
476 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
477 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
478 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
479 | + 'EventEspresso\core\services\routing\Router' => EE_Dependency_Map::load_from_cache, |
|
480 | + ], |
|
481 | + 'EE_Session' => [ |
|
482 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
483 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
484 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
485 | + 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
486 | + 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
487 | + ], |
|
488 | + 'EE_Cart' => [ |
|
489 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
490 | + ], |
|
491 | + 'EE_Messenger_Collection_Loader' => [ |
|
492 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
493 | + ], |
|
494 | + 'EE_Message_Type_Collection_Loader' => [ |
|
495 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
496 | + ], |
|
497 | + 'EE_Message_Resource_Manager' => [ |
|
498 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
499 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
500 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
501 | + ], |
|
502 | + 'EE_Message_Factory' => [ |
|
503 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
504 | + ], |
|
505 | + 'EE_messages' => [ |
|
506 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
507 | + ], |
|
508 | + 'EE_Messages_Generator' => [ |
|
509 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
510 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
511 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
512 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
513 | + ], |
|
514 | + 'EE_Messages_Processor' => [ |
|
515 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
516 | + ], |
|
517 | + 'EE_Messages_Queue' => [ |
|
518 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
519 | + ], |
|
520 | + 'EE_Messages_Template_Defaults' => [ |
|
521 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
522 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
523 | + ], |
|
524 | + 'EE_Message_To_Generate_From_Request' => [ |
|
525 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
526 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
527 | + ], |
|
528 | + 'EventEspresso\core\services\commands\CommandBus' => [ |
|
529 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
530 | + ], |
|
531 | + 'EventEspresso\services\commands\CommandHandler' => [ |
|
532 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
533 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
534 | + ], |
|
535 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => [ |
|
536 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
537 | + ], |
|
538 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => [ |
|
539 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
540 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
541 | + ], |
|
542 | + 'EventEspresso\core\services\commands\CommandFactory' => [ |
|
543 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
544 | + ], |
|
545 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => [ |
|
546 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
547 | + ], |
|
548 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [ |
|
549 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
550 | + ], |
|
551 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [ |
|
552 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
553 | + ], |
|
554 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => [ |
|
555 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
556 | + ], |
|
557 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [ |
|
558 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
559 | + ], |
|
560 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [ |
|
561 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
562 | + ], |
|
563 | + 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [ |
|
564 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
565 | + ], |
|
566 | + 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [ |
|
567 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
568 | + ], |
|
569 | + 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => [ |
|
570 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
571 | + ], |
|
572 | + 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => [ |
|
573 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
574 | + ], |
|
575 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [ |
|
576 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
577 | + ], |
|
578 | + 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => [ |
|
579 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
580 | + ], |
|
581 | + 'EventEspresso\core\services\database\TableManager' => [ |
|
582 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
583 | + ], |
|
584 | + 'EE_Data_Migration_Class_Base' => [ |
|
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_1_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_2_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_3_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_4_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_5_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_6_0' => [ |
|
609 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
610 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
611 | + ], |
|
612 | + 'EE_DMS_Core_4_7_0' => [ |
|
613 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
614 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
615 | + ], |
|
616 | + 'EE_DMS_Core_4_8_0' => [ |
|
617 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
618 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
619 | + ], |
|
620 | + 'EE_DMS_Core_4_9_0' => [ |
|
621 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
622 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
623 | + ], |
|
624 | + 'EE_DMS_Core_4_10_0' => [ |
|
625 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
626 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
627 | + 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
628 | + ], |
|
629 | + 'EE_DMS_Core_4_11_0' => [ |
|
630 | + 'EE_DMS_Core_4_10_0' => EE_Dependency_Map::load_from_cache, |
|
631 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
632 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
633 | + ], |
|
634 | + 'EE_DMS_Core_4_12_0' => [ |
|
635 | + 'EE_DMS_Core_4_11_0' => EE_Dependency_Map::load_from_cache, |
|
636 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
637 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
638 | + ], |
|
639 | + 'EventEspresso\core\services\assets\I18nRegistry' => [ |
|
640 | + [], |
|
641 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
642 | + ], |
|
643 | + 'EventEspresso\core\services\assets\Registry' => [ |
|
644 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
645 | + 'EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache, |
|
646 | + ], |
|
647 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => [ |
|
648 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
649 | + ], |
|
650 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => [ |
|
651 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
652 | + ], |
|
653 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => [ |
|
654 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
655 | + ], |
|
656 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => [ |
|
657 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
658 | + ], |
|
659 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => [ |
|
660 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
661 | + ], |
|
662 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => [ |
|
663 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
664 | + ], |
|
665 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => [ |
|
666 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
667 | + ], |
|
668 | + 'EventEspresso\core\services\cache\BasicCacheManager' => [ |
|
669 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
670 | + ], |
|
671 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [ |
|
672 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
673 | + ], |
|
674 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [ |
|
675 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
676 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
677 | + ], |
|
678 | + 'EventEspresso\core\domain\values\EmailAddress' => [ |
|
679 | + null, |
|
680 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
681 | + ], |
|
682 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => [ |
|
683 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
684 | + ], |
|
685 | + 'LEGACY_MODELS' => [ |
|
686 | + null, |
|
687 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
688 | + ], |
|
689 | + 'EE_Module_Request_Router' => [ |
|
690 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
691 | + ], |
|
692 | + 'EE_Registration_Processor' => [ |
|
693 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
694 | + ], |
|
695 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [ |
|
696 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
697 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
698 | + ], |
|
699 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
700 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
701 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
702 | + ], |
|
703 | + 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [ |
|
704 | + 'EventEspresso\core\domain\entities\users\CurrentUser' => EE_Dependency_Map::load_from_cache, |
|
705 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
706 | + 'EE_Ticket_Selector_Config' => EE_Dependency_Map::load_from_cache, |
|
707 | + ], |
|
708 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
709 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
710 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
711 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
712 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
713 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
714 | + ], |
|
715 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
716 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
717 | + ], |
|
718 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
719 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
720 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
721 | + ], |
|
722 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
723 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
724 | + ], |
|
725 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
726 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
727 | + ], |
|
728 | + 'EE_CPT_Strategy' => [ |
|
729 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
730 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
731 | + ], |
|
732 | + 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
733 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
734 | + ], |
|
735 | + 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
736 | + null, |
|
737 | + null, |
|
738 | + null, |
|
739 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
740 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
741 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
742 | + ], |
|
743 | + 'EventEspresso\core\services\dependencies\DependencyResolver' => [ |
|
744 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
745 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
746 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
747 | + ], |
|
748 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => [ |
|
749 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
750 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
751 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
752 | + ], |
|
753 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => [ |
|
754 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
755 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
756 | + ], |
|
757 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => [ |
|
758 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
759 | + 'EventEspresso\core\services\routing\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
760 | + ], |
|
761 | + 'EE_URL_Validation_Strategy' => [ |
|
762 | + null, |
|
763 | + null, |
|
764 | + 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
765 | + ], |
|
766 | + 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
767 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
768 | + ], |
|
769 | + 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
770 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
771 | + ], |
|
772 | + 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [ |
|
773 | + 'WP_REST_Server' => EE_Dependency_Map::load_from_cache, |
|
774 | + 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache, |
|
775 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache, |
|
776 | + null, |
|
777 | + ], |
|
778 | + 'EventEspresso\core\services\routing\RouteHandler' => [ |
|
779 | + 'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache, |
|
780 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
781 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
782 | + 'EventEspresso\core\services\routing\RouteCollection' => EE_Dependency_Map::load_from_cache, |
|
783 | + ], |
|
784 | + 'EventEspresso\core\services\json\JsonDataNodeHandler' => [ |
|
785 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
786 | + ], |
|
787 | + 'EventEspresso\core\services\routing\Router' => [ |
|
788 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
789 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
790 | + 'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache, |
|
791 | + ], |
|
792 | + 'EventEspresso\core\services\assets\AssetManifest' => [ |
|
793 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
794 | + ], |
|
795 | + 'EventEspresso\core\services\assets\AssetManifestFactory' => [ |
|
796 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
797 | + ], |
|
798 | + 'EventEspresso\core\services\assets\BaristaFactory' => [ |
|
799 | + 'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache, |
|
800 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
801 | + ], |
|
802 | + 'EventEspresso\core\domain\services\capabilities\FeatureFlags' => [ |
|
803 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
804 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
805 | + ], |
|
806 | + 'EventEspresso\core\services\addon\AddonManager' => [ |
|
807 | + 'EventEspresso\core\services\addon\AddonCollection' => EE_Dependency_Map::load_from_cache, |
|
808 | + 'EventEspresso\core\Psr4Autoloader' => EE_Dependency_Map::load_from_cache, |
|
809 | + 'EventEspresso\core\services\addon\api\v1\RegisterAddon' => EE_Dependency_Map::load_from_cache, |
|
810 | + 'EventEspresso\core\services\addon\api\IncompatibleAddonHandler' => EE_Dependency_Map::load_from_cache, |
|
811 | + 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => EE_Dependency_Map::load_from_cache, |
|
812 | + ], |
|
813 | + 'EventEspresso\core\services\addon\api\ThirdPartyPluginHandler' => [ |
|
814 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
815 | + ], |
|
816 | + 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [ |
|
817 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
818 | + ], |
|
819 | + 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [ |
|
820 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
821 | + ], |
|
822 | + 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [ |
|
823 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
824 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
825 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
826 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
827 | + ], |
|
828 | + 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [ |
|
829 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
830 | + ], |
|
831 | + 'EventEspresso\core\services\request\CurrentPage' => [ |
|
832 | + 'EE_CPT_Strategy' => EE_Dependency_Map::load_from_cache, |
|
833 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
834 | + ], |
|
835 | + 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => [ |
|
836 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
837 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
838 | + ], |
|
839 | + 'EventEspresso\core\services\shortcodes\ShortcodesManager' => [ |
|
840 | + 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache, |
|
841 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
842 | + ], |
|
843 | + 'EventEspresso\core\domain\entities\users\CurrentUser' => [ |
|
844 | + 'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache, |
|
845 | + ], |
|
846 | + 'EventEspresso\core\services\form\meta\InputTypes' => [ |
|
847 | + 'EventEspresso\core\services\form\meta\inputs\Block' => EE_Dependency_Map::load_from_cache, |
|
848 | + 'EventEspresso\core\services\form\meta\inputs\Button' => EE_Dependency_Map::load_from_cache, |
|
849 | + 'EventEspresso\core\services\form\meta\inputs\DateTime' => EE_Dependency_Map::load_from_cache, |
|
850 | + 'EventEspresso\core\services\form\meta\inputs\Input' => EE_Dependency_Map::load_from_cache, |
|
851 | + 'EventEspresso\core\services\form\meta\inputs\Number' => EE_Dependency_Map::load_from_cache, |
|
852 | + 'EventEspresso\core\services\form\meta\inputs\Phone' => EE_Dependency_Map::load_from_cache, |
|
853 | + 'EventEspresso\core\services\form\meta\inputs\Select' => EE_Dependency_Map::load_from_cache, |
|
854 | + 'EventEspresso\core\services\form\meta\inputs\Text' => EE_Dependency_Map::load_from_cache, |
|
855 | + ], |
|
856 | + 'EventEspresso\core\domain\services\registration\form\v1\RegFormDependencyHandler' => [ |
|
857 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
858 | + ], |
|
859 | + 'EventEspresso\core\services\calculators\LineItemCalculator' => [ |
|
860 | + 'EventEspresso\core\services\helpers\DecimalValues' => EE_Dependency_Map::load_from_cache, |
|
861 | + ], |
|
862 | + 'EventEspresso\core\services\helpers\DecimalValues' => [ |
|
863 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
864 | + ], |
|
865 | + ]; |
|
866 | + } |
|
867 | + |
|
868 | + |
|
869 | + /** |
|
870 | + * Registers how core classes are loaded. |
|
871 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
872 | + * 'EE_Request_Handler' => 'load_core' |
|
873 | + * 'EE_Messages_Queue' => 'load_lib' |
|
874 | + * 'EEH_Debug_Tools' => 'load_helper' |
|
875 | + * or, if greater control is required, by providing a custom closure. For example: |
|
876 | + * 'Some_Class' => function () { |
|
877 | + * return new Some_Class(); |
|
878 | + * }, |
|
879 | + * This is required for instantiating dependencies |
|
880 | + * where an interface has been type hinted in a class constructor. For example: |
|
881 | + * 'Required_Interface' => function () { |
|
882 | + * return new A_Class_That_Implements_Required_Interface(); |
|
883 | + * }, |
|
884 | + */ |
|
885 | + protected function _register_core_class_loaders() |
|
886 | + { |
|
887 | + $this->_class_loaders = [ |
|
888 | + // load_core |
|
889 | + 'EE_Dependency_Map' => function () { |
|
890 | + return $this; |
|
891 | + }, |
|
892 | + 'EE_Capabilities' => 'load_core', |
|
893 | + 'EE_Encryption' => 'load_core', |
|
894 | + 'EE_Front_Controller' => 'load_core', |
|
895 | + 'EE_Module_Request_Router' => 'load_core', |
|
896 | + 'EE_Registry' => 'load_core', |
|
897 | + 'EE_Request' => function () { |
|
898 | + return $this->legacy_request; |
|
899 | + }, |
|
900 | + 'EventEspresso\core\services\request\Request' => function () { |
|
901 | + return $this->request; |
|
902 | + }, |
|
903 | + 'EventEspresso\core\services\request\Response' => function () { |
|
904 | + return $this->response; |
|
905 | + }, |
|
906 | + 'EE_Base' => 'load_core', |
|
907 | + 'EE_Request_Handler' => 'load_core', |
|
908 | + 'EE_Session' => 'load_core', |
|
909 | + 'EE_Cron_Tasks' => 'load_core', |
|
910 | + 'EE_System' => 'load_core', |
|
911 | + 'EE_Maintenance_Mode' => 'load_core', |
|
912 | + 'EE_Register_CPTs' => 'load_core', |
|
913 | + 'EE_Admin' => 'load_core', |
|
914 | + 'EE_CPT_Strategy' => 'load_core', |
|
915 | + // load_class |
|
916 | + 'EE_Registration_Processor' => 'load_class', |
|
917 | + // load_lib |
|
918 | + 'EE_Message_Resource_Manager' => 'load_lib', |
|
919 | + 'EE_Message_Type_Collection' => 'load_lib', |
|
920 | + 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
921 | + 'EE_Messenger_Collection' => 'load_lib', |
|
922 | + 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
923 | + 'EE_Messages_Processor' => 'load_lib', |
|
924 | + 'EE_Message_Repository' => 'load_lib', |
|
925 | + 'EE_Messages_Queue' => 'load_lib', |
|
926 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
927 | + 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
928 | + 'EE_Payment_Method_Manager' => 'load_lib', |
|
929 | + 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
930 | + 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
931 | + 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
932 | + 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
933 | + 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
934 | + 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
935 | + 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
936 | + 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
937 | + 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
938 | + 'EE_DMS_Core_4_11_0' => 'load_dms', |
|
939 | + 'EE_DMS_Core_4_12_0' => 'load_dms', |
|
940 | + 'EE_Messages_Generator' => static function () { |
|
941 | + return EE_Registry::instance()->load_lib( |
|
942 | + 'Messages_Generator', |
|
943 | + [], |
|
944 | + false, |
|
945 | + false |
|
946 | + ); |
|
947 | + }, |
|
948 | + 'EE_Messages_Template_Defaults' => static function ($arguments = []) { |
|
949 | + return EE_Registry::instance()->load_lib( |
|
950 | + 'Messages_Template_Defaults', |
|
951 | + $arguments, |
|
952 | + false, |
|
953 | + false |
|
954 | + ); |
|
955 | + }, |
|
956 | + // load_helper |
|
957 | + 'EEH_Parse_Shortcodes' => static function () { |
|
958 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
959 | + return new EEH_Parse_Shortcodes(); |
|
960 | + } |
|
961 | + return null; |
|
962 | + }, |
|
963 | + 'EE_Template_Config' => static function () { |
|
964 | + return EE_Config::instance()->template_settings; |
|
965 | + }, |
|
966 | + 'EE_Currency_Config' => static function () { |
|
967 | + return EE_Currency_Config::getCurrencyConfig(); |
|
968 | + }, |
|
969 | + 'EE_Registration_Config' => static function () { |
|
970 | + return EE_Config::instance()->registration; |
|
971 | + }, |
|
972 | + 'EE_Core_Config' => static function () { |
|
973 | + return EE_Config::instance()->core; |
|
974 | + }, |
|
975 | + 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
976 | + return LoaderFactory::getLoader(); |
|
977 | + }, |
|
978 | + 'EE_Network_Config' => static function () { |
|
979 | + return EE_Network_Config::instance(); |
|
980 | + }, |
|
981 | + 'EE_Config' => static function () { |
|
982 | + return EE_Config::instance(); |
|
983 | + }, |
|
984 | + 'EventEspresso\core\domain\Domain' => static function () { |
|
985 | + return DomainFactory::getEventEspressoCoreDomain(); |
|
986 | + }, |
|
987 | + 'EE_Admin_Config' => static function () { |
|
988 | + return EE_Config::instance()->admin; |
|
989 | + }, |
|
990 | + 'EE_Organization_Config' => static function () { |
|
991 | + return EE_Config::instance()->organization; |
|
992 | + }, |
|
993 | + 'EE_Network_Core_Config' => static function () { |
|
994 | + return EE_Network_Config::instance()->core; |
|
995 | + }, |
|
996 | + 'EE_Environment_Config' => static function () { |
|
997 | + return EE_Config::instance()->environment; |
|
998 | + }, |
|
999 | + 'EED_Core_Rest_Api' => static function () { |
|
1000 | + return EED_Core_Rest_Api::instance(); |
|
1001 | + }, |
|
1002 | + 'WP_REST_Server' => static function () { |
|
1003 | + return rest_get_server(); |
|
1004 | + }, |
|
1005 | + 'EventEspresso\core\Psr4Autoloader' => static function () { |
|
1006 | + return EE_Psr4AutoloaderInit::psr4_loader(); |
|
1007 | + }, |
|
1008 | + 'EE_Ticket_Selector_Config' => function () { |
|
1009 | + return EE_Config::instance()->template_settings->EED_Ticket_Selector; |
|
1010 | + }, |
|
1011 | + ]; |
|
1012 | + } |
|
1013 | + |
|
1014 | + |
|
1015 | + /** |
|
1016 | + * can be used for supplying alternate names for classes, |
|
1017 | + * or for connecting interface names to instantiable classes |
|
1018 | + * |
|
1019 | + * @throws InvalidAliasException |
|
1020 | + */ |
|
1021 | + protected function _register_core_aliases() |
|
1022 | + { |
|
1023 | + $aliases = [ |
|
1024 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
1025 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
1026 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
1027 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
1028 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
1029 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
1030 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1031 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
1032 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1033 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
1034 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
1035 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
1036 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
1037 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
1038 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
1039 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
1040 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
1041 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
1042 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
1043 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
1044 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1045 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
1046 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1047 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
1048 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
1049 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
1050 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
1051 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
1052 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
1053 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
1054 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
1055 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
1056 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
1057 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
1058 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
1059 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
1060 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
1061 | + 'Registration_Processor' => 'EE_Registration_Processor', |
|
1062 | + 'EventEspresso\core\services\assets\AssetManifestInterface' => 'EventEspresso\core\services\assets\AssetManifest', |
|
1063 | + ]; |
|
1064 | + foreach ($aliases as $alias => $fqn) { |
|
1065 | + if (is_array($fqn)) { |
|
1066 | + foreach ($fqn as $class => $for_class) { |
|
1067 | + $this->class_cache->addAlias($class, $alias, $for_class); |
|
1068 | + } |
|
1069 | + continue; |
|
1070 | + } |
|
1071 | + $this->class_cache->addAlias($fqn, $alias); |
|
1072 | + } |
|
1073 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1074 | + $this->class_cache->addAlias( |
|
1075 | + 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
1076 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
1077 | + ); |
|
1078 | + } |
|
1079 | + } |
|
1080 | + |
|
1081 | + |
|
1082 | + public function debug($for_class = '') |
|
1083 | + { |
|
1084 | + if (method_exists($this->class_cache, 'debug')) { |
|
1085 | + $this->class_cache->debug($for_class); |
|
1086 | + } |
|
1087 | + } |
|
1088 | + |
|
1089 | + |
|
1090 | + /** |
|
1091 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
1092 | + * request Primarily used by unit tests. |
|
1093 | + */ |
|
1094 | + public function reset() |
|
1095 | + { |
|
1096 | + $this->_register_core_class_loaders(); |
|
1097 | + $this->_register_core_dependencies(); |
|
1098 | + } |
|
1099 | + |
|
1100 | + |
|
1101 | + /** |
|
1102 | + * PLZ NOTE: a better name for this method would be is_alias() |
|
1103 | + * because it returns TRUE if the provided fully qualified name IS an alias |
|
1104 | + * WHY? |
|
1105 | + * Because if a class is type hinting for a concretion, |
|
1106 | + * then why would we need to find another class to supply it? |
|
1107 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
1108 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
1109 | + * Don't go looking for some substitute. |
|
1110 | + * Whereas if a class is type hinting for an interface... |
|
1111 | + * then we need to find an actual class to use. |
|
1112 | + * So the interface IS the alias for some other FQN, |
|
1113 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
1114 | + * represents some other class. |
|
1115 | + * |
|
1116 | + * @param string $fqn |
|
1117 | + * @param string $for_class |
|
1118 | + * @return bool |
|
1119 | + * @deprecated 4.9.62.p |
|
1120 | + */ |
|
1121 | + public function has_alias(string $fqn = '', string $for_class = ''): bool |
|
1122 | + { |
|
1123 | + return $this->isAlias($fqn, $for_class); |
|
1124 | + } |
|
1125 | + |
|
1126 | + |
|
1127 | + /** |
|
1128 | + * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1129 | + * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1130 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1131 | + * for example: |
|
1132 | + * if the following two entries were added to the _aliases array: |
|
1133 | + * array( |
|
1134 | + * 'interface_alias' => 'some\namespace\interface' |
|
1135 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
1136 | + * ) |
|
1137 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1138 | + * to load an instance of 'some\namespace\classname' |
|
1139 | + * |
|
1140 | + * @param string $alias |
|
1141 | + * @param string $for_class |
|
1142 | + * @return string |
|
1143 | + * @deprecated 4.9.62.p |
|
1144 | + */ |
|
1145 | + public function get_alias(string $alias = '', string $for_class = ''): string |
|
1146 | + { |
|
1147 | + return $this->getFqnForAlias($alias, $for_class); |
|
1148 | + } |
|
1149 | 1149 | } |
@@ -14,49 +14,49 @@ |
||
14 | 14 | */ |
15 | 15 | class Tickets_Admin_Page_Init extends EE_Admin_Page_Init |
16 | 16 | { |
17 | - /** |
|
18 | - * constructor |
|
19 | - * |
|
20 | - * @Constructor |
|
21 | - * @access public |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function __construct() |
|
25 | - { |
|
26 | - if (! defined('TICKETS_PG_SLUG')) { |
|
27 | - define('TICKETS_PG_SLUG', 'tickets'); |
|
28 | - define('TICKETS_LABEL', esc_html__('Default Tickets', 'event_espresso')); |
|
29 | - define('TICKETS_ADMIN', EE_CORE_CAF_ADMIN . 'new/' . TICKETS_PG_SLUG . '/'); |
|
30 | - define('TICKETS_ADMIN_URL', admin_url('admin.php?page=' . TICKETS_PG_SLUG)); |
|
31 | - define('TICKETS_ASSETS_PATH', TICKETS_ADMIN . 'assets/'); |
|
32 | - define('TICKETS_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . TICKETS_PG_SLUG . '/assets/'); |
|
33 | - define('TICKETS_TEMPLATE_PATH', TICKETS_ADMIN . 'templates/'); |
|
34 | - define('TICKETS_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . TICKETS_PG_SLUG . '/templates/'); |
|
35 | - } |
|
36 | - parent::__construct(); |
|
37 | - $this->_folder_path = EE_CORE_CAF_ADMIN . 'new/' . $this->_folder_name . DS; |
|
38 | - } |
|
17 | + /** |
|
18 | + * constructor |
|
19 | + * |
|
20 | + * @Constructor |
|
21 | + * @access public |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function __construct() |
|
25 | + { |
|
26 | + if (! defined('TICKETS_PG_SLUG')) { |
|
27 | + define('TICKETS_PG_SLUG', 'tickets'); |
|
28 | + define('TICKETS_LABEL', esc_html__('Default Tickets', 'event_espresso')); |
|
29 | + define('TICKETS_ADMIN', EE_CORE_CAF_ADMIN . 'new/' . TICKETS_PG_SLUG . '/'); |
|
30 | + define('TICKETS_ADMIN_URL', admin_url('admin.php?page=' . TICKETS_PG_SLUG)); |
|
31 | + define('TICKETS_ASSETS_PATH', TICKETS_ADMIN . 'assets/'); |
|
32 | + define('TICKETS_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . TICKETS_PG_SLUG . '/assets/'); |
|
33 | + define('TICKETS_TEMPLATE_PATH', TICKETS_ADMIN . 'templates/'); |
|
34 | + define('TICKETS_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . TICKETS_PG_SLUG . '/templates/'); |
|
35 | + } |
|
36 | + parent::__construct(); |
|
37 | + $this->_folder_path = EE_CORE_CAF_ADMIN . 'new/' . $this->_folder_name . DS; |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - protected function _set_init_properties() |
|
42 | - { |
|
43 | - $this->label = TICKETS_LABEL; |
|
44 | - } |
|
41 | + protected function _set_init_properties() |
|
42 | + { |
|
43 | + $this->label = TICKETS_LABEL; |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - protected function _set_menu_map() |
|
48 | - { |
|
49 | - $this->_menu_map = new AdminMenuSubItem( |
|
50 | - array( |
|
51 | - 'menu_group' => 'management', |
|
52 | - 'menu_order' => 15, |
|
53 | - 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_ONLY, |
|
54 | - 'parent_slug' => 'espresso_events', |
|
55 | - 'menu_slug' => TICKETS_PG_SLUG, |
|
56 | - 'menu_label' => TICKETS_LABEL, |
|
57 | - 'capability' => 'ee_read_default_tickets', |
|
58 | - 'admin_init_page' => $this, |
|
59 | - ) |
|
60 | - ); |
|
61 | - } |
|
47 | + protected function _set_menu_map() |
|
48 | + { |
|
49 | + $this->_menu_map = new AdminMenuSubItem( |
|
50 | + array( |
|
51 | + 'menu_group' => 'management', |
|
52 | + 'menu_order' => 15, |
|
53 | + 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_ONLY, |
|
54 | + 'parent_slug' => 'espresso_events', |
|
55 | + 'menu_slug' => TICKETS_PG_SLUG, |
|
56 | + 'menu_label' => TICKETS_LABEL, |
|
57 | + 'capability' => 'ee_read_default_tickets', |
|
58 | + 'admin_init_page' => $this, |
|
59 | + ) |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | } |
@@ -23,18 +23,18 @@ |
||
23 | 23 | */ |
24 | 24 | public function __construct() |
25 | 25 | { |
26 | - if (! defined('TICKETS_PG_SLUG')) { |
|
26 | + if ( ! defined('TICKETS_PG_SLUG')) { |
|
27 | 27 | define('TICKETS_PG_SLUG', 'tickets'); |
28 | 28 | define('TICKETS_LABEL', esc_html__('Default Tickets', 'event_espresso')); |
29 | - define('TICKETS_ADMIN', EE_CORE_CAF_ADMIN . 'new/' . TICKETS_PG_SLUG . '/'); |
|
30 | - define('TICKETS_ADMIN_URL', admin_url('admin.php?page=' . TICKETS_PG_SLUG)); |
|
31 | - define('TICKETS_ASSETS_PATH', TICKETS_ADMIN . 'assets/'); |
|
32 | - define('TICKETS_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . TICKETS_PG_SLUG . '/assets/'); |
|
33 | - define('TICKETS_TEMPLATE_PATH', TICKETS_ADMIN . 'templates/'); |
|
34 | - define('TICKETS_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . TICKETS_PG_SLUG . '/templates/'); |
|
29 | + define('TICKETS_ADMIN', EE_CORE_CAF_ADMIN.'new/'.TICKETS_PG_SLUG.'/'); |
|
30 | + define('TICKETS_ADMIN_URL', admin_url('admin.php?page='.TICKETS_PG_SLUG)); |
|
31 | + define('TICKETS_ASSETS_PATH', TICKETS_ADMIN.'assets/'); |
|
32 | + define('TICKETS_ASSETS_URL', EE_CORE_CAF_ADMIN_URL.'new/'.TICKETS_PG_SLUG.'/assets/'); |
|
33 | + define('TICKETS_TEMPLATE_PATH', TICKETS_ADMIN.'templates/'); |
|
34 | + define('TICKETS_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL.'new/'.TICKETS_PG_SLUG.'/templates/'); |
|
35 | 35 | } |
36 | 36 | parent::__construct(); |
37 | - $this->_folder_path = EE_CORE_CAF_ADMIN . 'new/' . $this->_folder_name . DS; |
|
37 | + $this->_folder_path = EE_CORE_CAF_ADMIN.'new/'.$this->_folder_name.DS; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 |
@@ -16,51 +16,51 @@ |
||
16 | 16 | */ |
17 | 17 | class Pricing_Admin_Page_Init extends EE_Admin_Page_Init |
18 | 18 | { |
19 | - /** |
|
20 | - * @Constructor |
|
21 | - */ |
|
22 | - public function __construct() |
|
23 | - { |
|
24 | - if (! defined('PRICING_PG_SLUG')) { |
|
25 | - define('PRICING_PG_SLUG', 'pricing'); |
|
26 | - define('PRICING_LABEL', esc_html__('Pricing', 'event_espresso')); |
|
27 | - define('PRICING_PG_NAME', ucwords(str_replace('_', '', PRICING_PG_SLUG))); |
|
28 | - define('PRICING_ADMIN', EE_CORE_CAF_ADMIN . 'new/' . PRICING_PG_SLUG . '/'); |
|
29 | - define('PRICING_ADMIN_URL', admin_url('admin.php?page=' . PRICING_PG_SLUG)); |
|
30 | - define('PRICING_ASSETS_PATH', PRICING_ADMIN . 'assets/'); |
|
31 | - define('PRICING_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . PRICING_PG_SLUG . '/assets/'); |
|
32 | - define('PRICING_TEMPLATE_PATH', PRICING_ADMIN . 'templates/'); |
|
33 | - define('PRICING_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . PRICING_PG_SLUG . '/templates/'); |
|
34 | - } |
|
35 | - parent::__construct(); |
|
36 | - $this->_folder_path = EE_CORE_CAF_ADMIN . 'new/' . $this->_folder_name . '/'; |
|
37 | - } |
|
19 | + /** |
|
20 | + * @Constructor |
|
21 | + */ |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + if (! defined('PRICING_PG_SLUG')) { |
|
25 | + define('PRICING_PG_SLUG', 'pricing'); |
|
26 | + define('PRICING_LABEL', esc_html__('Pricing', 'event_espresso')); |
|
27 | + define('PRICING_PG_NAME', ucwords(str_replace('_', '', PRICING_PG_SLUG))); |
|
28 | + define('PRICING_ADMIN', EE_CORE_CAF_ADMIN . 'new/' . PRICING_PG_SLUG . '/'); |
|
29 | + define('PRICING_ADMIN_URL', admin_url('admin.php?page=' . PRICING_PG_SLUG)); |
|
30 | + define('PRICING_ASSETS_PATH', PRICING_ADMIN . 'assets/'); |
|
31 | + define('PRICING_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . PRICING_PG_SLUG . '/assets/'); |
|
32 | + define('PRICING_TEMPLATE_PATH', PRICING_ADMIN . 'templates/'); |
|
33 | + define('PRICING_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . PRICING_PG_SLUG . '/templates/'); |
|
34 | + } |
|
35 | + parent::__construct(); |
|
36 | + $this->_folder_path = EE_CORE_CAF_ADMIN . 'new/' . $this->_folder_name . '/'; |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | - protected function _set_init_properties() |
|
41 | - { |
|
42 | - $this->label = PRICING_LABEL; |
|
43 | - } |
|
40 | + protected function _set_init_properties() |
|
41 | + { |
|
42 | + $this->label = PRICING_LABEL; |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * @return array|void |
|
48 | - * @throws EE_Error |
|
49 | - * @since $VID:$ |
|
50 | - */ |
|
51 | - protected function _set_menu_map() |
|
52 | - { |
|
53 | - $this->_menu_map = new AdminMenuSubItem( |
|
54 | - array( |
|
55 | - 'menu_group' => 'management', |
|
56 | - 'menu_order' => 20, |
|
57 | - 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_ONLY, |
|
58 | - 'parent_slug' => 'espresso_events', |
|
59 | - 'menu_slug' => PRICING_PG_SLUG, |
|
60 | - 'menu_label' => PRICING_LABEL, |
|
61 | - 'capability' => 'ee_read_default_prices', |
|
62 | - 'admin_init_page' => $this, |
|
63 | - ) |
|
64 | - ); |
|
65 | - } |
|
46 | + /** |
|
47 | + * @return array|void |
|
48 | + * @throws EE_Error |
|
49 | + * @since $VID:$ |
|
50 | + */ |
|
51 | + protected function _set_menu_map() |
|
52 | + { |
|
53 | + $this->_menu_map = new AdminMenuSubItem( |
|
54 | + array( |
|
55 | + 'menu_group' => 'management', |
|
56 | + 'menu_order' => 20, |
|
57 | + 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_ONLY, |
|
58 | + 'parent_slug' => 'espresso_events', |
|
59 | + 'menu_slug' => PRICING_PG_SLUG, |
|
60 | + 'menu_label' => PRICING_LABEL, |
|
61 | + 'capability' => 'ee_read_default_prices', |
|
62 | + 'admin_init_page' => $this, |
|
63 | + ) |
|
64 | + ); |
|
65 | + } |
|
66 | 66 | } |
@@ -21,19 +21,19 @@ |
||
21 | 21 | */ |
22 | 22 | public function __construct() |
23 | 23 | { |
24 | - if (! defined('PRICING_PG_SLUG')) { |
|
24 | + if ( ! defined('PRICING_PG_SLUG')) { |
|
25 | 25 | define('PRICING_PG_SLUG', 'pricing'); |
26 | 26 | define('PRICING_LABEL', esc_html__('Pricing', 'event_espresso')); |
27 | 27 | define('PRICING_PG_NAME', ucwords(str_replace('_', '', PRICING_PG_SLUG))); |
28 | - define('PRICING_ADMIN', EE_CORE_CAF_ADMIN . 'new/' . PRICING_PG_SLUG . '/'); |
|
29 | - define('PRICING_ADMIN_URL', admin_url('admin.php?page=' . PRICING_PG_SLUG)); |
|
30 | - define('PRICING_ASSETS_PATH', PRICING_ADMIN . 'assets/'); |
|
31 | - define('PRICING_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . PRICING_PG_SLUG . '/assets/'); |
|
32 | - define('PRICING_TEMPLATE_PATH', PRICING_ADMIN . 'templates/'); |
|
33 | - define('PRICING_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL . 'new/' . PRICING_PG_SLUG . '/templates/'); |
|
28 | + define('PRICING_ADMIN', EE_CORE_CAF_ADMIN.'new/'.PRICING_PG_SLUG.'/'); |
|
29 | + define('PRICING_ADMIN_URL', admin_url('admin.php?page='.PRICING_PG_SLUG)); |
|
30 | + define('PRICING_ASSETS_PATH', PRICING_ADMIN.'assets/'); |
|
31 | + define('PRICING_ASSETS_URL', EE_CORE_CAF_ADMIN_URL.'new/'.PRICING_PG_SLUG.'/assets/'); |
|
32 | + define('PRICING_TEMPLATE_PATH', PRICING_ADMIN.'templates/'); |
|
33 | + define('PRICING_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL.'new/'.PRICING_PG_SLUG.'/templates/'); |
|
34 | 34 | } |
35 | 35 | parent::__construct(); |
36 | - $this->_folder_path = EE_CORE_CAF_ADMIN . 'new/' . $this->_folder_name . '/'; |
|
36 | + $this->_folder_path = EE_CORE_CAF_ADMIN.'new/'.$this->_folder_name.'/'; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 |
@@ -11,40 +11,40 @@ |
||
11 | 11 | */ |
12 | 12 | class Transactions_Admin_Page_Init extends EE_Admin_Page_Init |
13 | 13 | { |
14 | - public function __construct() |
|
15 | - { |
|
16 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
17 | - if (! defined('TXN_PG_SLUG')) { |
|
18 | - define('TXN_PG_SLUG', 'espresso_transactions'); |
|
19 | - define('TXN_PG_NAME', ucwords(str_replace('_', '', TXN_PG_SLUG))); |
|
20 | - define('TXN_ADMIN', EE_ADMIN_PAGES . 'transactions/'); |
|
21 | - define('TXN_ADMIN_URL', admin_url('admin.php?page=' . TXN_PG_SLUG)); |
|
22 | - define('TXN_ASSETS_PATH', TXN_ADMIN . 'assets/'); |
|
23 | - define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/assets/')); |
|
24 | - define('TXN_TEMPLATE_PATH', TXN_ADMIN . 'templates/'); |
|
25 | - define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/templates/')); |
|
26 | - } |
|
27 | - parent::__construct(); |
|
28 | - } |
|
14 | + public function __construct() |
|
15 | + { |
|
16 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
17 | + if (! defined('TXN_PG_SLUG')) { |
|
18 | + define('TXN_PG_SLUG', 'espresso_transactions'); |
|
19 | + define('TXN_PG_NAME', ucwords(str_replace('_', '', TXN_PG_SLUG))); |
|
20 | + define('TXN_ADMIN', EE_ADMIN_PAGES . 'transactions/'); |
|
21 | + define('TXN_ADMIN_URL', admin_url('admin.php?page=' . TXN_PG_SLUG)); |
|
22 | + define('TXN_ASSETS_PATH', TXN_ADMIN . 'assets/'); |
|
23 | + define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/assets/')); |
|
24 | + define('TXN_TEMPLATE_PATH', TXN_ADMIN . 'templates/'); |
|
25 | + define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/templates/')); |
|
26 | + } |
|
27 | + parent::__construct(); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | - protected function _set_init_properties() |
|
32 | - { |
|
33 | - $this->label = esc_html__('Transactions Overview', 'event_espresso'); |
|
34 | - } |
|
31 | + protected function _set_init_properties() |
|
32 | + { |
|
33 | + $this->label = esc_html__('Transactions Overview', 'event_espresso'); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - public function getMenuProperties(): array |
|
38 | - { |
|
39 | - return [ |
|
40 | - 'menu_type' => AdminMenuItem::TYPE_MENU_SUB_ITEM, |
|
41 | - 'menu_group' => 'main', |
|
42 | - 'menu_order' => 50, |
|
43 | - 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_ONLY, |
|
44 | - 'parent_slug' => 'espresso_events', |
|
45 | - 'menu_slug' => TXN_PG_SLUG, |
|
46 | - 'menu_label' => esc_html__('Transactions', 'event_espresso'), |
|
47 | - 'capability' => 'ee_read_transactions', |
|
48 | - ]; |
|
49 | - } |
|
37 | + public function getMenuProperties(): array |
|
38 | + { |
|
39 | + return [ |
|
40 | + 'menu_type' => AdminMenuItem::TYPE_MENU_SUB_ITEM, |
|
41 | + 'menu_group' => 'main', |
|
42 | + 'menu_order' => 50, |
|
43 | + 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_ONLY, |
|
44 | + 'parent_slug' => 'espresso_events', |
|
45 | + 'menu_slug' => TXN_PG_SLUG, |
|
46 | + 'menu_label' => esc_html__('Transactions', 'event_espresso'), |
|
47 | + 'capability' => 'ee_read_transactions', |
|
48 | + ]; |
|
49 | + } |
|
50 | 50 | } |
@@ -14,15 +14,15 @@ |
||
14 | 14 | public function __construct() |
15 | 15 | { |
16 | 16 | do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
17 | - if (! defined('TXN_PG_SLUG')) { |
|
17 | + if ( ! defined('TXN_PG_SLUG')) { |
|
18 | 18 | define('TXN_PG_SLUG', 'espresso_transactions'); |
19 | 19 | define('TXN_PG_NAME', ucwords(str_replace('_', '', TXN_PG_SLUG))); |
20 | - define('TXN_ADMIN', EE_ADMIN_PAGES . 'transactions/'); |
|
21 | - define('TXN_ADMIN_URL', admin_url('admin.php?page=' . TXN_PG_SLUG)); |
|
22 | - define('TXN_ASSETS_PATH', TXN_ADMIN . 'assets/'); |
|
23 | - define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/assets/')); |
|
24 | - define('TXN_TEMPLATE_PATH', TXN_ADMIN . 'templates/'); |
|
25 | - define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/templates/')); |
|
20 | + define('TXN_ADMIN', EE_ADMIN_PAGES.'transactions/'); |
|
21 | + define('TXN_ADMIN_URL', admin_url('admin.php?page='.TXN_PG_SLUG)); |
|
22 | + define('TXN_ASSETS_PATH', TXN_ADMIN.'assets/'); |
|
23 | + define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL.'transactions/assets/')); |
|
24 | + define('TXN_TEMPLATE_PATH', TXN_ADMIN.'templates/'); |
|
25 | + define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL.'transactions/templates/')); |
|
26 | 26 | } |
27 | 27 | parent::__construct(); |
28 | 28 | } |
@@ -14,38 +14,38 @@ |
||
14 | 14 | */ |
15 | 15 | class Support_Admin_Page_Init extends EE_Admin_Page_Init |
16 | 16 | { |
17 | - public function __construct() |
|
18 | - { |
|
19 | - // define some help/support page related constants |
|
20 | - if (! defined('EE_SUPPORT_PG_SLUG')) { |
|
21 | - define('EE_SUPPORT_PG_SLUG', 'espresso_support'); |
|
22 | - define('EE_SUPPORT_ADMIN_URL', admin_url('admin.php?page=' . EE_SUPPORT_PG_SLUG)); |
|
23 | - define('EE_SUPPORT_ADMIN_TEMPLATE_PATH', EE_ADMIN_PAGES . 'support/templates/'); |
|
24 | - define('EE_SUPPORT_ADMIN', EE_ADMIN_PAGES . 'support/'); |
|
25 | - define('EE_SUPPORT_ASSETS_URL', EE_ADMIN_PAGES_URL . 'support/assets/'); |
|
26 | - } |
|
27 | - parent::__construct(); |
|
28 | - } |
|
17 | + public function __construct() |
|
18 | + { |
|
19 | + // define some help/support page related constants |
|
20 | + if (! defined('EE_SUPPORT_PG_SLUG')) { |
|
21 | + define('EE_SUPPORT_PG_SLUG', 'espresso_support'); |
|
22 | + define('EE_SUPPORT_ADMIN_URL', admin_url('admin.php?page=' . EE_SUPPORT_PG_SLUG)); |
|
23 | + define('EE_SUPPORT_ADMIN_TEMPLATE_PATH', EE_ADMIN_PAGES . 'support/templates/'); |
|
24 | + define('EE_SUPPORT_ADMIN', EE_ADMIN_PAGES . 'support/'); |
|
25 | + define('EE_SUPPORT_ASSETS_URL', EE_ADMIN_PAGES_URL . 'support/assets/'); |
|
26 | + } |
|
27 | + parent::__construct(); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | - protected function _set_init_properties() |
|
32 | - { |
|
33 | - $this->label = esc_html__('Help & Support', 'event_espresso'); |
|
34 | - } |
|
31 | + protected function _set_init_properties() |
|
32 | + { |
|
33 | + $this->label = esc_html__('Help & Support', 'event_espresso'); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - public function getMenuProperties(): array |
|
38 | - { |
|
39 | - return [ |
|
40 | - 'menu_type' => AdminMenuItem::TYPE_MENU_SUB_ITEM, |
|
41 | - 'menu_group' => 'extras', |
|
42 | - 'menu_order' => 30, |
|
43 | - 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_AND_NETWORK, |
|
44 | - 'parent_slug' => 'espresso_events', |
|
45 | - 'menu_slug' => EE_SUPPORT_PG_SLUG, |
|
46 | - 'menu_label' => esc_html__('Help & Support', 'event_espresso'), |
|
47 | - 'capability' => 'ee_read_ee', |
|
48 | - 'maintenance_mode_parent' => 'espresso_maintenance_settings', |
|
49 | - ]; |
|
50 | - } |
|
37 | + public function getMenuProperties(): array |
|
38 | + { |
|
39 | + return [ |
|
40 | + 'menu_type' => AdminMenuItem::TYPE_MENU_SUB_ITEM, |
|
41 | + 'menu_group' => 'extras', |
|
42 | + 'menu_order' => 30, |
|
43 | + 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_AND_NETWORK, |
|
44 | + 'parent_slug' => 'espresso_events', |
|
45 | + 'menu_slug' => EE_SUPPORT_PG_SLUG, |
|
46 | + 'menu_label' => esc_html__('Help & Support', 'event_espresso'), |
|
47 | + 'capability' => 'ee_read_ee', |
|
48 | + 'maintenance_mode_parent' => 'espresso_maintenance_settings', |
|
49 | + ]; |
|
50 | + } |
|
51 | 51 | } |
@@ -17,12 +17,12 @@ |
||
17 | 17 | public function __construct() |
18 | 18 | { |
19 | 19 | // define some help/support page related constants |
20 | - if (! defined('EE_SUPPORT_PG_SLUG')) { |
|
20 | + if ( ! defined('EE_SUPPORT_PG_SLUG')) { |
|
21 | 21 | define('EE_SUPPORT_PG_SLUG', 'espresso_support'); |
22 | - define('EE_SUPPORT_ADMIN_URL', admin_url('admin.php?page=' . EE_SUPPORT_PG_SLUG)); |
|
23 | - define('EE_SUPPORT_ADMIN_TEMPLATE_PATH', EE_ADMIN_PAGES . 'support/templates/'); |
|
24 | - define('EE_SUPPORT_ADMIN', EE_ADMIN_PAGES . 'support/'); |
|
25 | - define('EE_SUPPORT_ASSETS_URL', EE_ADMIN_PAGES_URL . 'support/assets/'); |
|
22 | + define('EE_SUPPORT_ADMIN_URL', admin_url('admin.php?page='.EE_SUPPORT_PG_SLUG)); |
|
23 | + define('EE_SUPPORT_ADMIN_TEMPLATE_PATH', EE_ADMIN_PAGES.'support/templates/'); |
|
24 | + define('EE_SUPPORT_ADMIN', EE_ADMIN_PAGES.'support/'); |
|
25 | + define('EE_SUPPORT_ASSETS_URL', EE_ADMIN_PAGES_URL.'support/assets/'); |
|
26 | 26 | } |
27 | 27 | parent::__construct(); |
28 | 28 | } |