@@ -15,7 +15,7 @@ |
||
15 | 15 | ), |
16 | 16 | '<a href="https://eventespresso.com/wp-login.php">', |
17 | 17 | '</a>' |
18 | - );?> |
|
18 | + ); ?> |
|
19 | 19 | </p> |
20 | 20 | <p class="ee-attention"> |
21 | 21 | <?php printf( |
@@ -9,77 +9,77 @@ |
||
9 | 9 | </p> |
10 | 10 | <p> |
11 | 11 | <?php printf( |
12 | - esc_html__( |
|
13 | - 'Enter your support license key in this field to benefit from one-click updates. To manage your support license key, please %1$slogin to your Event Espresso account%2$s. Then click on Edit Account Details which appears in the left sidebar menu.', |
|
14 | - 'event_espresso' |
|
15 | - ), |
|
16 | - '<a href="https://eventespresso.com/wp-login.php">', |
|
17 | - '</a>' |
|
18 | - );?> |
|
12 | + esc_html__( |
|
13 | + 'Enter your support license key in this field to benefit from one-click updates. To manage your support license key, please %1$slogin to your Event Espresso account%2$s. Then click on Edit Account Details which appears in the left sidebar menu.', |
|
14 | + 'event_espresso' |
|
15 | + ), |
|
16 | + '<a href="https://eventespresso.com/wp-login.php">', |
|
17 | + '</a>' |
|
18 | + );?> |
|
19 | 19 | </p> |
20 | 20 | <p class="ee-attention"> |
21 | 21 | <?php printf( |
22 | - esc_html__( |
|
23 | - 'Site license keys are now called support license keys. Your support license key should only be entered on live/production sites. If this is a development or test site, %sdo not%s enter your support license key.', |
|
24 | - 'event_espresso' |
|
25 | - ), |
|
26 | - '<strong>', |
|
27 | - '</strong>' |
|
28 | - ); ?> |
|
22 | + esc_html__( |
|
23 | + 'Site license keys are now called support license keys. Your support license key should only be entered on live/production sites. If this is a development or test site, %sdo not%s enter your support license key.', |
|
24 | + 'event_espresso' |
|
25 | + ), |
|
26 | + '<strong>', |
|
27 | + '</strong>' |
|
28 | + ); ?> |
|
29 | 29 | </p> |
30 | 30 | <p> |
31 | 31 | <strong><?php esc_html_e('Contact Information', 'event_espresso'); ?></strong> |
32 | 32 | </p> |
33 | 33 | <p> |
34 | 34 | <?php esc_html_e( |
35 | - 'Enter information about your organization here. Be sure to keep your information up-to-date.', |
|
36 | - 'event_espresso' |
|
37 | - ); ?><br /> |
|
35 | + 'Enter information about your organization here. Be sure to keep your information up-to-date.', |
|
36 | + 'event_espresso' |
|
37 | + ); ?><br /> |
|
38 | 38 | <?php esc_html_e( |
39 | - 'Changing your country on this page will also change your country on the Countries page. This will affect your currency options which are used through Event Espresso. For example, if your country is currently set to United States, then your currency is USD. If you were to switch your country to United Kingdom, then your currency would change to GBP.', |
|
40 | - 'event_espresso' |
|
41 | - ); ?> |
|
39 | + 'Changing your country on this page will also change your country on the Countries page. This will affect your currency options which are used through Event Espresso. For example, if your country is currently set to United States, then your currency is USD. If you were to switch your country to United Kingdom, then your currency would change to GBP.', |
|
40 | + 'event_espresso' |
|
41 | + ); ?> |
|
42 | 42 | </p> |
43 | 43 | <p> |
44 | 44 | <strong><?php esc_html_e('Company Logo', 'event_espresso'); ?></strong> |
45 | 45 | </p> |
46 | 46 | <p> |
47 | 47 | <?php esc_html_e( |
48 | - 'You can upload a new logo here. We recommend an image that is 400 pixels wide or smaller. Your logo will be used on custom invoices, tickets, certificates, and payment templates.', |
|
49 | - 'event_espresso' |
|
50 | - ); ?> |
|
48 | + 'You can upload a new logo here. We recommend an image that is 400 pixels wide or smaller. Your logo will be used on custom invoices, tickets, certificates, and payment templates.', |
|
49 | + 'event_espresso' |
|
50 | + ); ?> |
|
51 | 51 | </p> |
52 | 52 | <p> |
53 | 53 | <strong><?php esc_html_e('Social Links', 'event_espresso'); ?></strong> |
54 | 54 | </p> |
55 | 55 | <p> |
56 | 56 | <?php esc_html_e( |
57 | - 'These URLs can be displayed automatically within your emails (using shortcodes) and front-end templates (using template tags).', |
|
58 | - 'event_espresso' |
|
59 | - ); ?> |
|
57 | + 'These URLs can be displayed automatically within your emails (using shortcodes) and front-end templates (using template tags).', |
|
58 | + 'event_espresso' |
|
59 | + ); ?> |
|
60 | 60 | </p> |
61 | 61 | <p> |
62 | 62 | <strong><?php esc_html_e('User eXperience Improvement Program (UXIP)', 'event_espresso'); ?></strong> |
63 | 63 | </p> |
64 | 64 | <p> |
65 | 65 | <?php esc_html_e( |
66 | - 'You can take part in making Event Espresso better! Your information will never be sold, traded, or misused in any way. This programs is voluntary and you can opt out at any time.', |
|
67 | - 'event_espresso' |
|
68 | - ); ?> |
|
66 | + 'You can take part in making Event Espresso better! Your information will never be sold, traded, or misused in any way. This programs is voluntary and you can opt out at any time.', |
|
67 | + 'event_espresso' |
|
68 | + ); ?> |
|
69 | 69 | </p> |
70 | 70 | <p> |
71 | 71 | <strong><?php esc_html_e('Recommendations', 'event_espresso'); ?></strong> |
72 | 72 | <br /> |
73 | 73 | <?php esc_html_e( |
74 | - 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
75 | - 'event_espresso' |
|
76 | - ); ?> |
|
74 | + 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
75 | + 'event_espresso' |
|
76 | + ); ?> |
|
77 | 77 | </p> |
78 | 78 | <p> |
79 | 79 | <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong> |
80 | 80 | <br /> |
81 | 81 | <?php esc_html_e( |
82 | - 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
83 | - 'event_espresso' |
|
84 | - ); ?> |
|
82 | + 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
83 | + 'event_espresso' |
|
84 | + ); ?> |
|
85 | 85 | </p> |
86 | 86 | \ No newline at end of file |
@@ -69,7 +69,7 @@ |
||
69 | 69 | $keys_only = empty( |
70 | 70 | array_filter( |
71 | 71 | array_values($data_value), |
72 | - function ($v) { |
|
72 | + function($v) { |
|
73 | 73 | return $v !== null && (is_array($v) || trim($v) !== ''); |
74 | 74 | } |
75 | 75 | ) |
@@ -19,38 +19,38 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function ee_recurse_into_array_for_display($data, $depth = 0, $td = true) |
21 | 21 | { |
22 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
23 | - // is_object($incomplete_class) actually returns false, hence why we check for it |
|
24 | - $data = json_decode(json_encode($data), true); |
|
25 | - } |
|
26 | - if (empty($data)) { |
|
27 | - return; |
|
28 | - } |
|
29 | - if (is_array($data)) { |
|
30 | - $depth++; |
|
31 | - ksort($data, SORT_NATURAL | SORT_FLAG_CASE); |
|
32 | - if (EEH_Array::is_associative_array($data)) { ?> |
|
22 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
23 | + // is_object($incomplete_class) actually returns false, hence why we check for it |
|
24 | + $data = json_decode(json_encode($data), true); |
|
25 | + } |
|
26 | + if (empty($data)) { |
|
27 | + return; |
|
28 | + } |
|
29 | + if (is_array($data)) { |
|
30 | + $depth++; |
|
31 | + ksort($data, SORT_NATURAL | SORT_FLAG_CASE); |
|
32 | + if (EEH_Array::is_associative_array($data)) { ?> |
|
33 | 33 | <table class='ee-system-stati ee-system-stati-<?php echo absint($depth); ?>'> |
34 | 34 | <tbody> |
35 | 35 | <?php foreach ($data as $data_key => $data_value) { |
36 | - // if the value is a single element array with no key, |
|
37 | - // and the value is a primitive (not an array, object, etc.) |
|
38 | - if ( |
|
39 | - is_array($data_value) |
|
40 | - && count($data_value) === 1 |
|
41 | - && empty(key($data_value)) |
|
42 | - && is_scalar(reset($data_value)) |
|
43 | - ) { |
|
44 | - ?> |
|
36 | + // if the value is a single element array with no key, |
|
37 | + // and the value is a primitive (not an array, object, etc.) |
|
38 | + if ( |
|
39 | + is_array($data_value) |
|
40 | + && count($data_value) === 1 |
|
41 | + && empty(key($data_value)) |
|
42 | + && is_scalar(reset($data_value)) |
|
43 | + ) { |
|
44 | + ?> |
|
45 | 45 | <tr> |
46 | 46 | <td class="ee-system-stati-value" colspan="2"> |
47 | 47 | <?php echo esc_html(reset($data_value)); ?> |
48 | 48 | </td> |
49 | 49 | </tr> |
50 | 50 | <?php |
51 | - continue; |
|
52 | - } |
|
53 | - ?> |
|
51 | + continue; |
|
52 | + } |
|
53 | + ?> |
|
54 | 54 | <tr> |
55 | 55 | <td class='ee-system-stati-key'> |
56 | 56 | <span class="ee-system-stati-label"> |
@@ -65,31 +65,31 @@ discard block |
||
65 | 65 | <?php if (is_scalar($data_value)) { ?> |
66 | 66 | <?php ee_recurse_into_array_for_display($data_value, $depth); ?> |
67 | 67 | <?php } else { |
68 | - if (is_array($data_value) && count($data_value) === 1) { |
|
69 | - // verify that values have been set |
|
70 | - $keys_only = empty( |
|
71 | - array_filter( |
|
72 | - array_values($data_value), |
|
73 | - function ($v) { |
|
74 | - return $v !== null && (is_array($v) || trim($v) !== ''); |
|
75 | - } |
|
76 | - ) |
|
77 | - ); |
|
78 | - // if the array only consists of keys (no values) |
|
79 | - if ($keys_only) { |
|
80 | - // then use keys for values |
|
81 | - $data_value = array_keys($data_value); |
|
82 | - // but if there is only one value now |
|
83 | - if (count($data_value) === 1) { |
|
84 | - // then pass that single value back into this function |
|
85 | - // this prevents extra empty layers of nothing being added to the output |
|
86 | - ee_recurse_into_array_for_display(reset($data_value), $depth); |
|
87 | - // need to finish the row off though |
|
88 | - echo '</tr>'; |
|
89 | - continue; |
|
90 | - } |
|
91 | - } |
|
92 | - } ?> |
|
68 | + if (is_array($data_value) && count($data_value) === 1) { |
|
69 | + // verify that values have been set |
|
70 | + $keys_only = empty( |
|
71 | + array_filter( |
|
72 | + array_values($data_value), |
|
73 | + function ($v) { |
|
74 | + return $v !== null && (is_array($v) || trim($v) !== ''); |
|
75 | + } |
|
76 | + ) |
|
77 | + ); |
|
78 | + // if the array only consists of keys (no values) |
|
79 | + if ($keys_only) { |
|
80 | + // then use keys for values |
|
81 | + $data_value = array_keys($data_value); |
|
82 | + // but if there is only one value now |
|
83 | + if (count($data_value) === 1) { |
|
84 | + // then pass that single value back into this function |
|
85 | + // this prevents extra empty layers of nothing being added to the output |
|
86 | + ee_recurse_into_array_for_display(reset($data_value), $depth); |
|
87 | + // need to finish the row off though |
|
88 | + echo '</tr>'; |
|
89 | + continue; |
|
90 | + } |
|
91 | + } |
|
92 | + } ?> |
|
93 | 93 | <td class="ee-system-stati-sub-values"> |
94 | 94 | <?php ee_recurse_into_array_for_display($data_value, $depth); ?> |
95 | 95 | </td> |
@@ -107,19 +107,19 @@ discard block |
||
107 | 107 | <?php } ?> |
108 | 108 | </ul> |
109 | 109 | <?php } else { |
110 | - // there's no key (label) and there's only one value, |
|
111 | - // so let's just pass that value back into this function, |
|
112 | - // but reset the depth back to where it was. |
|
113 | - // this prevents extra empty layers of nothing being added to the output |
|
114 | - $depth--; |
|
115 | - ee_recurse_into_array_for_display(reset($data), $depth, false); |
|
116 | - } |
|
117 | - } else { |
|
118 | - echo ($td ? '<td class="ee-system-stati-value">' : ''); |
|
119 | - // simple value |
|
120 | - echo wp_kses($data, AllowedTags::getAllowedTags()); |
|
121 | - echo ($td ? '</td>' : ''); |
|
122 | - } |
|
110 | + // there's no key (label) and there's only one value, |
|
111 | + // so let's just pass that value back into this function, |
|
112 | + // but reset the depth back to where it was. |
|
113 | + // this prevents extra empty layers of nothing being added to the output |
|
114 | + $depth--; |
|
115 | + ee_recurse_into_array_for_display(reset($data), $depth, false); |
|
116 | + } |
|
117 | + } else { |
|
118 | + echo ($td ? '<td class="ee-system-stati-value">' : ''); |
|
119 | + // simple value |
|
120 | + echo wp_kses($data, AllowedTags::getAllowedTags()); |
|
121 | + echo ($td ? '</td>' : ''); |
|
122 | + } |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | ?> |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | // load initial stuff. |
101 | 101 | $this->_set_file_and_folder_name(); |
102 | 102 | $this->_set_menu_map(); |
103 | - if (! $this->verifyMenuMapSet()) { |
|
103 | + if ( ! $this->verifyMenuMapSet()) { |
|
104 | 104 | return; |
105 | 105 | } |
106 | 106 | // set default capability |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | if (empty($this->_menu_map) || is_array($this->_menu_map)) { |
142 | 142 | EE_Error::doing_it_wrong( |
143 | - get_class($this) . '::$_menu_map', |
|
143 | + get_class($this).'::$_menu_map', |
|
144 | 144 | sprintf( |
145 | 145 | esc_html__( |
146 | 146 | 'The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core. Please see Admin_Page_Init class examples in core for the new way of setting this property up.', |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | { |
179 | 179 | wp_register_style( |
180 | 180 | 'espresso_menu', |
181 | - EE_ADMIN_URL . 'assets/admin-menu-styles.css', |
|
181 | + EE_ADMIN_URL.'assets/admin-menu-styles.css', |
|
182 | 182 | ['dashicons'], |
183 | 183 | EVENT_ESPRESSO_VERSION |
184 | 184 | ); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | protected function _set_capability() |
206 | 206 | { |
207 | 207 | $capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability; |
208 | - $this->capability = apply_filters('FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability); |
|
208 | + $this->capability = apply_filters('FHEE_'.$this->_menu_map->menu_slug.'_capability', $capability); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | { |
222 | 222 | // let's check user access first |
223 | 223 | $this->_check_user_access(); |
224 | - if (! is_object($this->_loaded_page_object)) { |
|
224 | + if ( ! is_object($this->_loaded_page_object)) { |
|
225 | 225 | return; |
226 | 226 | } |
227 | 227 | $this->_loaded_page_object->route_admin_request(); |
@@ -234,15 +234,15 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function set_page_dependencies($wp_page_slug) |
236 | 236 | { |
237 | - if (! $this->_load_page) { |
|
237 | + if ( ! $this->_load_page) { |
|
238 | 238 | return; |
239 | 239 | } |
240 | - if (! is_object($this->_loaded_page_object)) { |
|
240 | + if ( ! is_object($this->_loaded_page_object)) { |
|
241 | 241 | $msg[] = esc_html__( |
242 | 242 | 'We can\'t load the page because we\'re missing a valid page object that tells us what to load', |
243 | 243 | 'event_espresso' |
244 | 244 | ); |
245 | - $msg[] = $msg[0] . "\r\n" |
|
245 | + $msg[] = $msg[0]."\r\n" |
|
246 | 246 | . sprintf( |
247 | 247 | esc_html__( |
248 | 248 | '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', |
@@ -250,15 +250,15 @@ discard block |
||
250 | 250 | ), |
251 | 251 | $this->_file_name, |
252 | 252 | $this->_file_name, |
253 | - $this->_folder_path . $this->_file_name, |
|
253 | + $this->_folder_path.$this->_file_name, |
|
254 | 254 | $this->_menu_map->menu_slug |
255 | 255 | ); |
256 | 256 | throw new EE_Error(implode('||', $msg)); |
257 | 257 | } |
258 | 258 | $this->_loaded_page_object->set_wp_page_slug($wp_page_slug); |
259 | - $page_hook = 'load-' . $wp_page_slug; |
|
259 | + $page_hook = 'load-'.$wp_page_slug; |
|
260 | 260 | // hook into page load hook so all page specific stuff gets loaded. |
261 | - if (! empty($wp_page_slug)) { |
|
261 | + if ( ! empty($wp_page_slug)) { |
|
262 | 262 | add_action($page_hook, [$this->_loaded_page_object, 'load_page_dependencies']); |
263 | 263 | } |
264 | 264 | } |
@@ -294,13 +294,13 @@ discard block |
||
294 | 294 | foreach ($bt as $index => $values) { |
295 | 295 | if (isset($values['class']) && $values['class'] == $class) { |
296 | 296 | $file_index = $index - 1; |
297 | - $this->_folder_name = basename(dirname($bt[ $file_index ]['file'])); |
|
298 | - if (! empty($this->_folder_name)) { |
|
297 | + $this->_folder_name = basename(dirname($bt[$file_index]['file'])); |
|
298 | + if ( ! empty($this->_folder_name)) { |
|
299 | 299 | break; |
300 | 300 | } |
301 | 301 | } |
302 | 302 | } |
303 | - $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/'; |
|
303 | + $this->_folder_path = EE_ADMIN_PAGES.$this->_folder_name.'/'; |
|
304 | 304 | $this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name); |
305 | 305 | $this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name)); |
306 | 306 | $this->_file_name = str_replace(' ', '_', $this->_file_name); |
@@ -331,17 +331,17 @@ discard block |
||
331 | 331 | . $this->_file_name |
332 | 332 | . '_Hooks_Extend.class.php' |
333 | 333 | ); |
334 | - $this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend); |
|
334 | + $this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend); |
|
335 | 335 | } |
336 | 336 | // loop through decaf folders |
337 | 337 | $hook_files_glob_path = apply_filters( |
338 | 338 | 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', |
339 | - $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php' |
|
339 | + $this->_folder_path.'*'.$this->_file_name.'_Hooks.class.php' |
|
340 | 340 | ); |
341 | - $this->_hook_paths = array_merge( |
|
341 | + $this->_hook_paths = array_merge( |
|
342 | 342 | $this->_register_hook_files($hook_files_glob_path), |
343 | 343 | $this->_hook_paths |
344 | - ); // making sure any extended hook paths are later in the array than the core hook paths! |
|
344 | + ); // making sure any extended hook paths are later in the array than the core hook paths! |
|
345 | 345 | return $this->_hook_paths; |
346 | 346 | } |
347 | 347 | |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | foreach ($hook_paths as $file) { |
356 | 356 | // lets get the linked admin. |
357 | 357 | $hook_file = $extend |
358 | - ? str_replace(EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . '/', '', $file) |
|
358 | + ? str_replace(EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.'/', '', $file) |
|
359 | 359 | : str_replace($this->_folder_path, '', $file); |
360 | 360 | $replace = $extend |
361 | - ? '_' . $this->_file_name . '_Hooks_Extend.class.php' |
|
362 | - : '_' . $this->_file_name . '_Hooks.class.php'; |
|
361 | + ? '_'.$this->_file_name.'_Hooks_Extend.class.php' |
|
362 | + : '_'.$this->_file_name.'_Hooks.class.php'; |
|
363 | 363 | $rel_admin = str_replace($replace, '', $hook_file); |
364 | 364 | $rel_admin = strtolower($rel_admin); |
365 | 365 | // make sure we haven't already got a hook setup for this page path |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | continue; |
368 | 368 | } |
369 | 369 | $this->hook_file = $hook_file; |
370 | - $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin; |
|
370 | + $rel_admin_hook = 'FHEE_do_other_page_hooks_'.$rel_admin; |
|
371 | 371 | add_filter($rel_admin_hook, [$this, 'load_admin_hook']); |
372 | 372 | $this->_files_hooked[] = $rel_admin; |
373 | 373 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $this->_load_page = true; |
402 | 402 | |
403 | 403 | // we don't need to do a page_request check here because it's only called via WP menu system. |
404 | - $admin_page = $this->_file_name . '_Admin_Page'; |
|
404 | + $admin_page = $this->_file_name.'_Admin_Page'; |
|
405 | 405 | $hook_suffix = "{$menu_slug}_{$admin_page}"; |
406 | 406 | $admin_page = apply_filters( |
407 | 407 | "FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}", |
@@ -411,14 +411,14 @@ discard block |
||
411 | 411 | return; |
412 | 412 | } |
413 | 413 | // define requested admin page class name then load the file and instantiate |
414 | - $path_to_file = str_replace(['\\', '/'], '/', $this->_folder_path . $admin_page . '.core.php'); |
|
414 | + $path_to_file = str_replace(['\\', '/'], '/', $this->_folder_path.$admin_page.'.core.php'); |
|
415 | 415 | // so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be: |
416 | 416 | // FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page |
417 | 417 | $path_to_file = apply_filters( |
418 | 418 | "FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}", |
419 | 419 | $path_to_file |
420 | 420 | ); |
421 | - if (! is_readable($path_to_file)) { |
|
421 | + if ( ! is_readable($path_to_file)) { |
|
422 | 422 | return; |
423 | 423 | } |
424 | 424 | // This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | |
435 | 435 | public function get_admin_page_name() |
436 | 436 | { |
437 | - return $this->_file_name . '_Admin_Page'; |
|
437 | + return $this->_file_name.'_Admin_Page'; |
|
438 | 438 | } |
439 | 439 | |
440 | 440 |
@@ -16,451 +16,451 @@ |
||
16 | 16 | */ |
17 | 17 | abstract class EE_Admin_Page_Init extends EE_Base |
18 | 18 | { |
19 | - // identity properties (set in _set_defaults and _set_init_properties) |
|
20 | - public $label; |
|
19 | + // identity properties (set in _set_defaults and _set_init_properties) |
|
20 | + public $label; |
|
21 | 21 | |
22 | - /** |
|
23 | - * Menu map has a capability. However, this allows admin pages to have separate capability requirements for menus |
|
24 | - * and accessing pages. If capability is NOT set, then it defaults to the menu_map capability. |
|
25 | - * |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - public $capability; |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * This holds the menu map object for this admin page. |
|
33 | - * |
|
34 | - * @var EE_Admin_Page_Menu_Map |
|
35 | - */ |
|
36 | - protected $_menu_map; |
|
37 | - |
|
38 | - /** |
|
39 | - * deprecated |
|
40 | - */ |
|
41 | - public $menu_label; |
|
42 | - |
|
43 | - public $menu_slug; |
|
44 | - |
|
45 | - |
|
46 | - // set in _set_defaults |
|
47 | - protected $_folder_name; |
|
48 | - |
|
49 | - protected $_folder_path; |
|
50 | - |
|
51 | - protected $_file_name; |
|
52 | - |
|
53 | - public $hook_file; |
|
54 | - |
|
55 | - protected $_wp_page_slug; |
|
56 | - |
|
57 | - protected $_routing; |
|
58 | - |
|
59 | - |
|
60 | - // will hold page object. |
|
61 | - protected $_loaded_page_object; |
|
62 | - |
|
63 | - |
|
64 | - // for caf |
|
65 | - protected $_files_hooked; |
|
66 | - |
|
67 | - protected $_hook_paths; |
|
68 | - |
|
69 | - // load_page? |
|
70 | - private $_load_page; |
|
71 | - |
|
72 | - /** |
|
73 | - * @var LoaderInterface |
|
74 | - */ |
|
75 | - protected $loader; |
|
76 | - |
|
77 | - /** |
|
78 | - * @var RequestInterface |
|
79 | - */ |
|
80 | - protected $request; |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * @Constructor |
|
85 | - * @return void |
|
86 | - */ |
|
87 | - public function __construct(RequestInterface $request = null) |
|
88 | - { |
|
89 | - $this->loader = LoaderFactory::getLoader(); |
|
90 | - $this->request = $request instanceof RequestInterface |
|
91 | - ? $request |
|
92 | - : $this->loader->getShared(RequestInterface::class); |
|
93 | - // set global defaults |
|
94 | - $this->_set_defaults(); |
|
95 | - // set properties that are always available with objects. |
|
96 | - $this->_set_init_properties(); |
|
97 | - // global styles/scripts across all wp admin pages |
|
98 | - add_action('admin_enqueue_scripts', [$this, 'load_wp_global_scripts_styles'], 5); |
|
99 | - // load initial stuff. |
|
100 | - $this->_set_file_and_folder_name(); |
|
101 | - $this->_set_menu_map(); |
|
102 | - if (! $this->verifyMenuMapSet()) { |
|
103 | - return; |
|
104 | - } |
|
105 | - // set default capability |
|
106 | - $this->_set_capability(); |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * _set_init_properties |
|
112 | - * Child classes use to set the following properties: |
|
113 | - * $label |
|
114 | - * |
|
115 | - * @abstract |
|
116 | - * @return void |
|
117 | - */ |
|
118 | - abstract protected function _set_init_properties(); |
|
119 | - |
|
120 | - |
|
121 | - /** |
|
122 | - * _set_menu_map is a function that child classes use to set the menu_map property (which should be an instance of |
|
123 | - * EE_Admin_Page_Menu_Map. Their menu can either be EE_Admin_Page_Main_Menu or EE_Admin_Page_Sub_Menu. |
|
124 | - * |
|
125 | - * @since 4.4.0 |
|
126 | - * @ return void. |
|
127 | - */ |
|
128 | - protected function _set_menu_map() |
|
129 | - { |
|
130 | - return []; |
|
131 | - } |
|
132 | - |
|
133 | - |
|
134 | - /** |
|
135 | - * @return bool |
|
136 | - * @since 4.10.14.p |
|
137 | - */ |
|
138 | - private function verifyMenuMapSet() |
|
139 | - { |
|
140 | - if (empty($this->_menu_map) || is_array($this->_menu_map)) { |
|
141 | - EE_Error::doing_it_wrong( |
|
142 | - get_class($this) . '::$_menu_map', |
|
143 | - sprintf( |
|
144 | - esc_html__( |
|
145 | - 'The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core. Please see Admin_Page_Init class examples in core for the new way of setting this property up.', |
|
146 | - 'event_espresso' |
|
147 | - ), |
|
148 | - get_class($this) |
|
149 | - ), |
|
150 | - '4.4.0' |
|
151 | - ); |
|
152 | - return true; |
|
153 | - } |
|
154 | - return false; |
|
155 | - } |
|
156 | - |
|
157 | - |
|
158 | - /** |
|
159 | - * returns the menu map for this admin page |
|
160 | - * |
|
161 | - * @return EE_Admin_Page_Menu_Map |
|
162 | - * @since 4.4.0 |
|
163 | - */ |
|
164 | - public function get_menu_map() |
|
165 | - { |
|
166 | - return $this->_menu_map; |
|
167 | - } |
|
168 | - |
|
169 | - |
|
170 | - /** |
|
171 | - * This loads scripts and styles for the EE_Admin system |
|
172 | - * that must be available on ALL WP admin pages (i.e. EE_menu items) |
|
173 | - * |
|
174 | - * @return void |
|
175 | - */ |
|
176 | - public function load_wp_global_scripts_styles() |
|
177 | - { |
|
178 | - wp_register_style( |
|
179 | - 'espresso_menu', |
|
180 | - EE_ADMIN_URL . 'assets/admin-menu-styles.css', |
|
181 | - ['dashicons'], |
|
182 | - EVENT_ESPRESSO_VERSION |
|
183 | - ); |
|
184 | - wp_enqueue_style('espresso_menu'); |
|
185 | - } |
|
186 | - |
|
187 | - |
|
188 | - /** |
|
189 | - * this sets default properties (might be overridden in _set_init_properties); |
|
190 | - * |
|
191 | - * @return void |
|
192 | - */ |
|
193 | - private function _set_defaults() |
|
194 | - { |
|
195 | - $this->_file_name = $this->_folder_name = $this->_wp_page_slug = $this->capability = null; |
|
196 | - $this->_routing = true; |
|
197 | - $this->_load_page = false; |
|
198 | - $this->_files_hooked = $this->_hook_paths = []; |
|
199 | - // menu_map |
|
200 | - $this->_menu_map = $this->get_menu_map(); |
|
201 | - } |
|
202 | - |
|
203 | - |
|
204 | - protected function _set_capability() |
|
205 | - { |
|
206 | - $capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability; |
|
207 | - $this->capability = apply_filters('FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability); |
|
208 | - } |
|
209 | - |
|
210 | - |
|
211 | - /** |
|
212 | - * initialize_admin_page |
|
213 | - * This method is what executes the loading of the specific page class for the given dir_name as called by the |
|
214 | - * EE_Admin_Init class. |
|
215 | - * |
|
216 | - * @return void |
|
217 | - * @uses _initialize_admin_page() |
|
218 | - */ |
|
219 | - public function initialize_admin_page() |
|
220 | - { |
|
221 | - // let's check user access first |
|
222 | - $this->_check_user_access(); |
|
223 | - if (! is_object($this->_loaded_page_object)) { |
|
224 | - return; |
|
225 | - } |
|
226 | - $this->_loaded_page_object->route_admin_request(); |
|
227 | - } |
|
228 | - |
|
229 | - |
|
230 | - /** |
|
231 | - * @param string $wp_page_slug |
|
232 | - * @throws EE_Error |
|
233 | - */ |
|
234 | - public function set_page_dependencies($wp_page_slug) |
|
235 | - { |
|
236 | - if (! $this->_load_page) { |
|
237 | - return; |
|
238 | - } |
|
239 | - if (! is_object($this->_loaded_page_object)) { |
|
240 | - $msg[] = esc_html__( |
|
241 | - 'We can\'t load the page because we\'re missing a valid page object that tells us what to load', |
|
242 | - 'event_espresso' |
|
243 | - ); |
|
244 | - $msg[] = $msg[0] . "\r\n" |
|
245 | - . sprintf( |
|
246 | - esc_html__( |
|
247 | - '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', |
|
248 | - 'event_espresso' |
|
249 | - ), |
|
250 | - $this->_file_name, |
|
251 | - $this->_file_name, |
|
252 | - $this->_folder_path . $this->_file_name, |
|
253 | - $this->_menu_map->menu_slug |
|
254 | - ); |
|
255 | - throw new EE_Error(implode('||', $msg)); |
|
256 | - } |
|
257 | - $this->_loaded_page_object->set_wp_page_slug($wp_page_slug); |
|
258 | - $page_hook = 'load-' . $wp_page_slug; |
|
259 | - // hook into page load hook so all page specific stuff gets loaded. |
|
260 | - if (! empty($wp_page_slug)) { |
|
261 | - add_action($page_hook, [$this->_loaded_page_object, 'load_page_dependencies']); |
|
262 | - } |
|
263 | - } |
|
264 | - |
|
265 | - |
|
266 | - /** |
|
267 | - * This executes the initial page loads for EE_Admin pages to take care of any ajax or other code needing to run |
|
268 | - * before the load-page... hook. Note, the page loads are happening around the wp_init hook. |
|
269 | - * |
|
270 | - * @return void |
|
271 | - */ |
|
272 | - public function do_initial_loads() |
|
273 | - { |
|
274 | - // no loading or initializing if menu map is setup incorrectly. |
|
275 | - if (empty($this->_menu_map) || is_array($this->_menu_map)) { |
|
276 | - return; |
|
277 | - } |
|
278 | - $this->_initialize_admin_page(); |
|
279 | - } |
|
280 | - |
|
281 | - |
|
282 | - /** |
|
283 | - * all we're doing here is setting the $_file_name property for later use. |
|
284 | - * |
|
285 | - * @return void |
|
286 | - */ |
|
287 | - private function _set_file_and_folder_name() |
|
288 | - { |
|
289 | - $bt = debug_backtrace(); |
|
290 | - // for more reliable determination of folder name |
|
291 | - // 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) |
|
292 | - $class = get_class($this); |
|
293 | - foreach ($bt as $index => $values) { |
|
294 | - if (isset($values['class']) && $values['class'] == $class) { |
|
295 | - $file_index = $index - 1; |
|
296 | - $this->_folder_name = basename(dirname($bt[ $file_index ]['file'])); |
|
297 | - if (! empty($this->_folder_name)) { |
|
298 | - break; |
|
299 | - } |
|
300 | - } |
|
301 | - } |
|
302 | - $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/'; |
|
303 | - $this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name); |
|
304 | - $this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name)); |
|
305 | - $this->_file_name = str_replace(' ', '_', $this->_file_name); |
|
306 | - } |
|
307 | - |
|
308 | - |
|
309 | - /** |
|
310 | - * This automatically checks if we have a hook class in the loaded child directory. If we DO then we will register |
|
311 | - * it with the appropriate pages. That way all we have to do is make sure the file is named correctly and |
|
312 | - * "dropped" in. Example: if we wanted to set this up for Messages hooking into Events then we would do: |
|
313 | - * events_Messages_Hooks.class.php |
|
314 | - * |
|
315 | - * @param bool $extend This indicates whether we're checking the extend directory for any register_hooks |
|
316 | - * files/classes |
|
317 | - * @return array |
|
318 | - */ |
|
319 | - public function register_hooks($extend = false) |
|
320 | - { |
|
321 | - |
|
322 | - // get a list of files in the directory that have the "Hook" in their name an |
|
323 | - // 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. |
|
324 | - if ($extend) { |
|
325 | - $hook_files_glob_path = apply_filters( |
|
326 | - 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', |
|
327 | - EE_CORE_CAF_ADMIN_EXTEND |
|
328 | - . $this->_folder_name |
|
329 | - . '/*' |
|
330 | - . $this->_file_name |
|
331 | - . '_Hooks_Extend.class.php' |
|
332 | - ); |
|
333 | - $this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend); |
|
334 | - } |
|
335 | - // loop through decaf folders |
|
336 | - $hook_files_glob_path = apply_filters( |
|
337 | - 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', |
|
338 | - $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php' |
|
339 | - ); |
|
340 | - $this->_hook_paths = array_merge( |
|
341 | - $this->_register_hook_files($hook_files_glob_path), |
|
342 | - $this->_hook_paths |
|
343 | - ); // making sure any extended hook paths are later in the array than the core hook paths! |
|
344 | - return $this->_hook_paths; |
|
345 | - } |
|
346 | - |
|
347 | - |
|
348 | - protected function _register_hook_files($hook_files_glob_path, $extend = false) |
|
349 | - { |
|
350 | - $hook_paths = glob($hook_files_glob_path); |
|
351 | - if (empty($hook_paths)) { |
|
352 | - return []; |
|
353 | - } |
|
354 | - foreach ($hook_paths as $file) { |
|
355 | - // lets get the linked admin. |
|
356 | - $hook_file = $extend |
|
357 | - ? str_replace(EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . '/', '', $file) |
|
358 | - : str_replace($this->_folder_path, '', $file); |
|
359 | - $replace = $extend |
|
360 | - ? '_' . $this->_file_name . '_Hooks_Extend.class.php' |
|
361 | - : '_' . $this->_file_name . '_Hooks.class.php'; |
|
362 | - $rel_admin = str_replace($replace, '', $hook_file); |
|
363 | - $rel_admin = strtolower($rel_admin); |
|
364 | - // make sure we haven't already got a hook setup for this page path |
|
365 | - if (in_array($rel_admin, $this->_files_hooked)) { |
|
366 | - continue; |
|
367 | - } |
|
368 | - $this->hook_file = $hook_file; |
|
369 | - $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin; |
|
370 | - add_filter($rel_admin_hook, [$this, 'load_admin_hook']); |
|
371 | - $this->_files_hooked[] = $rel_admin; |
|
372 | - } |
|
373 | - return $hook_paths; |
|
374 | - } |
|
375 | - |
|
376 | - |
|
377 | - public function load_admin_hook($registered_pages) |
|
378 | - { |
|
379 | - return array_merge((array) $this->hook_file, $registered_pages); |
|
380 | - } |
|
381 | - |
|
382 | - |
|
383 | - /** |
|
384 | - * _initialize_admin_page |
|
385 | - * |
|
386 | - * @see initialize_admin_page() for info |
|
387 | - */ |
|
388 | - protected function _initialize_admin_page() |
|
389 | - { |
|
390 | - // JUST CHECK WE'RE ON RIGHT PAGE. |
|
391 | - $page = $this->request->getRequestParam('page'); |
|
392 | - $page = $this->request->getRequestParam('current_page', $page); |
|
393 | - $menu_slug = $this->_menu_map->menu_slug; |
|
394 | - |
|
395 | - |
|
396 | - if ($this->_routing && ($page === '' || $page !== $menu_slug)) { |
|
397 | - // not on the right page so let's get out. |
|
398 | - return; |
|
399 | - } |
|
400 | - $this->_load_page = true; |
|
401 | - |
|
402 | - // we don't need to do a page_request check here because it's only called via WP menu system. |
|
403 | - $admin_page = $this->_file_name . '_Admin_Page'; |
|
404 | - $hook_suffix = "{$menu_slug}_{$admin_page}"; |
|
405 | - $admin_page = apply_filters( |
|
406 | - "FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}", |
|
407 | - $admin_page |
|
408 | - ); |
|
409 | - if (empty($admin_page)) { |
|
410 | - return; |
|
411 | - } |
|
412 | - // define requested admin page class name then load the file and instantiate |
|
413 | - $path_to_file = str_replace(['\\', '/'], '/', $this->_folder_path . $admin_page . '.core.php'); |
|
414 | - // so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be: |
|
415 | - // FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page |
|
416 | - $path_to_file = apply_filters( |
|
417 | - "FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}", |
|
418 | - $path_to_file |
|
419 | - ); |
|
420 | - if (! is_readable($path_to_file)) { |
|
421 | - return; |
|
422 | - } |
|
423 | - // This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place |
|
424 | - do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization'); |
|
425 | - do_action("AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_{$menu_slug}"); |
|
426 | - require_once($path_to_file); |
|
427 | - $this->_loaded_page_object = $this->loader->getShared($admin_page, [$this->_routing]); |
|
428 | - |
|
429 | - do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization'); |
|
430 | - do_action("AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_{$menu_slug}"); |
|
431 | - } |
|
432 | - |
|
433 | - |
|
434 | - public function get_admin_page_name() |
|
435 | - { |
|
436 | - return $this->_file_name . '_Admin_Page'; |
|
437 | - } |
|
438 | - |
|
439 | - |
|
440 | - /** |
|
441 | - * @return mixed |
|
442 | - */ |
|
443 | - public function loaded_page_object() |
|
444 | - { |
|
445 | - return $this->_loaded_page_object; |
|
446 | - } |
|
447 | - |
|
448 | - /** |
|
449 | - * _check_user_access |
|
450 | - * verifies user access for this admin page. If no user access is available then let's gracefully exit with a |
|
451 | - * WordPress die message. |
|
452 | - * |
|
453 | - * @return void wp_die if fail |
|
454 | - */ |
|
455 | - private function _check_user_access() |
|
456 | - { |
|
457 | - if ( |
|
458 | - ! EE_Registry::instance()->CAP->current_user_can( |
|
459 | - $this->_menu_map->capability, |
|
460 | - $this->_menu_map->menu_slug |
|
461 | - ) |
|
462 | - ) { |
|
463 | - wp_die(esc_html__('You don\'t have access to this page.', 'event_espresso'), '', ['back_link' => true]); |
|
464 | - } |
|
465 | - } |
|
22 | + /** |
|
23 | + * Menu map has a capability. However, this allows admin pages to have separate capability requirements for menus |
|
24 | + * and accessing pages. If capability is NOT set, then it defaults to the menu_map capability. |
|
25 | + * |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + public $capability; |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * This holds the menu map object for this admin page. |
|
33 | + * |
|
34 | + * @var EE_Admin_Page_Menu_Map |
|
35 | + */ |
|
36 | + protected $_menu_map; |
|
37 | + |
|
38 | + /** |
|
39 | + * deprecated |
|
40 | + */ |
|
41 | + public $menu_label; |
|
42 | + |
|
43 | + public $menu_slug; |
|
44 | + |
|
45 | + |
|
46 | + // set in _set_defaults |
|
47 | + protected $_folder_name; |
|
48 | + |
|
49 | + protected $_folder_path; |
|
50 | + |
|
51 | + protected $_file_name; |
|
52 | + |
|
53 | + public $hook_file; |
|
54 | + |
|
55 | + protected $_wp_page_slug; |
|
56 | + |
|
57 | + protected $_routing; |
|
58 | + |
|
59 | + |
|
60 | + // will hold page object. |
|
61 | + protected $_loaded_page_object; |
|
62 | + |
|
63 | + |
|
64 | + // for caf |
|
65 | + protected $_files_hooked; |
|
66 | + |
|
67 | + protected $_hook_paths; |
|
68 | + |
|
69 | + // load_page? |
|
70 | + private $_load_page; |
|
71 | + |
|
72 | + /** |
|
73 | + * @var LoaderInterface |
|
74 | + */ |
|
75 | + protected $loader; |
|
76 | + |
|
77 | + /** |
|
78 | + * @var RequestInterface |
|
79 | + */ |
|
80 | + protected $request; |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * @Constructor |
|
85 | + * @return void |
|
86 | + */ |
|
87 | + public function __construct(RequestInterface $request = null) |
|
88 | + { |
|
89 | + $this->loader = LoaderFactory::getLoader(); |
|
90 | + $this->request = $request instanceof RequestInterface |
|
91 | + ? $request |
|
92 | + : $this->loader->getShared(RequestInterface::class); |
|
93 | + // set global defaults |
|
94 | + $this->_set_defaults(); |
|
95 | + // set properties that are always available with objects. |
|
96 | + $this->_set_init_properties(); |
|
97 | + // global styles/scripts across all wp admin pages |
|
98 | + add_action('admin_enqueue_scripts', [$this, 'load_wp_global_scripts_styles'], 5); |
|
99 | + // load initial stuff. |
|
100 | + $this->_set_file_and_folder_name(); |
|
101 | + $this->_set_menu_map(); |
|
102 | + if (! $this->verifyMenuMapSet()) { |
|
103 | + return; |
|
104 | + } |
|
105 | + // set default capability |
|
106 | + $this->_set_capability(); |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * _set_init_properties |
|
112 | + * Child classes use to set the following properties: |
|
113 | + * $label |
|
114 | + * |
|
115 | + * @abstract |
|
116 | + * @return void |
|
117 | + */ |
|
118 | + abstract protected function _set_init_properties(); |
|
119 | + |
|
120 | + |
|
121 | + /** |
|
122 | + * _set_menu_map is a function that child classes use to set the menu_map property (which should be an instance of |
|
123 | + * EE_Admin_Page_Menu_Map. Their menu can either be EE_Admin_Page_Main_Menu or EE_Admin_Page_Sub_Menu. |
|
124 | + * |
|
125 | + * @since 4.4.0 |
|
126 | + * @ return void. |
|
127 | + */ |
|
128 | + protected function _set_menu_map() |
|
129 | + { |
|
130 | + return []; |
|
131 | + } |
|
132 | + |
|
133 | + |
|
134 | + /** |
|
135 | + * @return bool |
|
136 | + * @since 4.10.14.p |
|
137 | + */ |
|
138 | + private function verifyMenuMapSet() |
|
139 | + { |
|
140 | + if (empty($this->_menu_map) || is_array($this->_menu_map)) { |
|
141 | + EE_Error::doing_it_wrong( |
|
142 | + get_class($this) . '::$_menu_map', |
|
143 | + sprintf( |
|
144 | + esc_html__( |
|
145 | + 'The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core. Please see Admin_Page_Init class examples in core for the new way of setting this property up.', |
|
146 | + 'event_espresso' |
|
147 | + ), |
|
148 | + get_class($this) |
|
149 | + ), |
|
150 | + '4.4.0' |
|
151 | + ); |
|
152 | + return true; |
|
153 | + } |
|
154 | + return false; |
|
155 | + } |
|
156 | + |
|
157 | + |
|
158 | + /** |
|
159 | + * returns the menu map for this admin page |
|
160 | + * |
|
161 | + * @return EE_Admin_Page_Menu_Map |
|
162 | + * @since 4.4.0 |
|
163 | + */ |
|
164 | + public function get_menu_map() |
|
165 | + { |
|
166 | + return $this->_menu_map; |
|
167 | + } |
|
168 | + |
|
169 | + |
|
170 | + /** |
|
171 | + * This loads scripts and styles for the EE_Admin system |
|
172 | + * that must be available on ALL WP admin pages (i.e. EE_menu items) |
|
173 | + * |
|
174 | + * @return void |
|
175 | + */ |
|
176 | + public function load_wp_global_scripts_styles() |
|
177 | + { |
|
178 | + wp_register_style( |
|
179 | + 'espresso_menu', |
|
180 | + EE_ADMIN_URL . 'assets/admin-menu-styles.css', |
|
181 | + ['dashicons'], |
|
182 | + EVENT_ESPRESSO_VERSION |
|
183 | + ); |
|
184 | + wp_enqueue_style('espresso_menu'); |
|
185 | + } |
|
186 | + |
|
187 | + |
|
188 | + /** |
|
189 | + * this sets default properties (might be overridden in _set_init_properties); |
|
190 | + * |
|
191 | + * @return void |
|
192 | + */ |
|
193 | + private function _set_defaults() |
|
194 | + { |
|
195 | + $this->_file_name = $this->_folder_name = $this->_wp_page_slug = $this->capability = null; |
|
196 | + $this->_routing = true; |
|
197 | + $this->_load_page = false; |
|
198 | + $this->_files_hooked = $this->_hook_paths = []; |
|
199 | + // menu_map |
|
200 | + $this->_menu_map = $this->get_menu_map(); |
|
201 | + } |
|
202 | + |
|
203 | + |
|
204 | + protected function _set_capability() |
|
205 | + { |
|
206 | + $capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability; |
|
207 | + $this->capability = apply_filters('FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability); |
|
208 | + } |
|
209 | + |
|
210 | + |
|
211 | + /** |
|
212 | + * initialize_admin_page |
|
213 | + * This method is what executes the loading of the specific page class for the given dir_name as called by the |
|
214 | + * EE_Admin_Init class. |
|
215 | + * |
|
216 | + * @return void |
|
217 | + * @uses _initialize_admin_page() |
|
218 | + */ |
|
219 | + public function initialize_admin_page() |
|
220 | + { |
|
221 | + // let's check user access first |
|
222 | + $this->_check_user_access(); |
|
223 | + if (! is_object($this->_loaded_page_object)) { |
|
224 | + return; |
|
225 | + } |
|
226 | + $this->_loaded_page_object->route_admin_request(); |
|
227 | + } |
|
228 | + |
|
229 | + |
|
230 | + /** |
|
231 | + * @param string $wp_page_slug |
|
232 | + * @throws EE_Error |
|
233 | + */ |
|
234 | + public function set_page_dependencies($wp_page_slug) |
|
235 | + { |
|
236 | + if (! $this->_load_page) { |
|
237 | + return; |
|
238 | + } |
|
239 | + if (! is_object($this->_loaded_page_object)) { |
|
240 | + $msg[] = esc_html__( |
|
241 | + 'We can\'t load the page because we\'re missing a valid page object that tells us what to load', |
|
242 | + 'event_espresso' |
|
243 | + ); |
|
244 | + $msg[] = $msg[0] . "\r\n" |
|
245 | + . sprintf( |
|
246 | + esc_html__( |
|
247 | + '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', |
|
248 | + 'event_espresso' |
|
249 | + ), |
|
250 | + $this->_file_name, |
|
251 | + $this->_file_name, |
|
252 | + $this->_folder_path . $this->_file_name, |
|
253 | + $this->_menu_map->menu_slug |
|
254 | + ); |
|
255 | + throw new EE_Error(implode('||', $msg)); |
|
256 | + } |
|
257 | + $this->_loaded_page_object->set_wp_page_slug($wp_page_slug); |
|
258 | + $page_hook = 'load-' . $wp_page_slug; |
|
259 | + // hook into page load hook so all page specific stuff gets loaded. |
|
260 | + if (! empty($wp_page_slug)) { |
|
261 | + add_action($page_hook, [$this->_loaded_page_object, 'load_page_dependencies']); |
|
262 | + } |
|
263 | + } |
|
264 | + |
|
265 | + |
|
266 | + /** |
|
267 | + * This executes the initial page loads for EE_Admin pages to take care of any ajax or other code needing to run |
|
268 | + * before the load-page... hook. Note, the page loads are happening around the wp_init hook. |
|
269 | + * |
|
270 | + * @return void |
|
271 | + */ |
|
272 | + public function do_initial_loads() |
|
273 | + { |
|
274 | + // no loading or initializing if menu map is setup incorrectly. |
|
275 | + if (empty($this->_menu_map) || is_array($this->_menu_map)) { |
|
276 | + return; |
|
277 | + } |
|
278 | + $this->_initialize_admin_page(); |
|
279 | + } |
|
280 | + |
|
281 | + |
|
282 | + /** |
|
283 | + * all we're doing here is setting the $_file_name property for later use. |
|
284 | + * |
|
285 | + * @return void |
|
286 | + */ |
|
287 | + private function _set_file_and_folder_name() |
|
288 | + { |
|
289 | + $bt = debug_backtrace(); |
|
290 | + // for more reliable determination of folder name |
|
291 | + // 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) |
|
292 | + $class = get_class($this); |
|
293 | + foreach ($bt as $index => $values) { |
|
294 | + if (isset($values['class']) && $values['class'] == $class) { |
|
295 | + $file_index = $index - 1; |
|
296 | + $this->_folder_name = basename(dirname($bt[ $file_index ]['file'])); |
|
297 | + if (! empty($this->_folder_name)) { |
|
298 | + break; |
|
299 | + } |
|
300 | + } |
|
301 | + } |
|
302 | + $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/'; |
|
303 | + $this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name); |
|
304 | + $this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name)); |
|
305 | + $this->_file_name = str_replace(' ', '_', $this->_file_name); |
|
306 | + } |
|
307 | + |
|
308 | + |
|
309 | + /** |
|
310 | + * This automatically checks if we have a hook class in the loaded child directory. If we DO then we will register |
|
311 | + * it with the appropriate pages. That way all we have to do is make sure the file is named correctly and |
|
312 | + * "dropped" in. Example: if we wanted to set this up for Messages hooking into Events then we would do: |
|
313 | + * events_Messages_Hooks.class.php |
|
314 | + * |
|
315 | + * @param bool $extend This indicates whether we're checking the extend directory for any register_hooks |
|
316 | + * files/classes |
|
317 | + * @return array |
|
318 | + */ |
|
319 | + public function register_hooks($extend = false) |
|
320 | + { |
|
321 | + |
|
322 | + // get a list of files in the directory that have the "Hook" in their name an |
|
323 | + // 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. |
|
324 | + if ($extend) { |
|
325 | + $hook_files_glob_path = apply_filters( |
|
326 | + 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', |
|
327 | + EE_CORE_CAF_ADMIN_EXTEND |
|
328 | + . $this->_folder_name |
|
329 | + . '/*' |
|
330 | + . $this->_file_name |
|
331 | + . '_Hooks_Extend.class.php' |
|
332 | + ); |
|
333 | + $this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend); |
|
334 | + } |
|
335 | + // loop through decaf folders |
|
336 | + $hook_files_glob_path = apply_filters( |
|
337 | + 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', |
|
338 | + $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php' |
|
339 | + ); |
|
340 | + $this->_hook_paths = array_merge( |
|
341 | + $this->_register_hook_files($hook_files_glob_path), |
|
342 | + $this->_hook_paths |
|
343 | + ); // making sure any extended hook paths are later in the array than the core hook paths! |
|
344 | + return $this->_hook_paths; |
|
345 | + } |
|
346 | + |
|
347 | + |
|
348 | + protected function _register_hook_files($hook_files_glob_path, $extend = false) |
|
349 | + { |
|
350 | + $hook_paths = glob($hook_files_glob_path); |
|
351 | + if (empty($hook_paths)) { |
|
352 | + return []; |
|
353 | + } |
|
354 | + foreach ($hook_paths as $file) { |
|
355 | + // lets get the linked admin. |
|
356 | + $hook_file = $extend |
|
357 | + ? str_replace(EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . '/', '', $file) |
|
358 | + : str_replace($this->_folder_path, '', $file); |
|
359 | + $replace = $extend |
|
360 | + ? '_' . $this->_file_name . '_Hooks_Extend.class.php' |
|
361 | + : '_' . $this->_file_name . '_Hooks.class.php'; |
|
362 | + $rel_admin = str_replace($replace, '', $hook_file); |
|
363 | + $rel_admin = strtolower($rel_admin); |
|
364 | + // make sure we haven't already got a hook setup for this page path |
|
365 | + if (in_array($rel_admin, $this->_files_hooked)) { |
|
366 | + continue; |
|
367 | + } |
|
368 | + $this->hook_file = $hook_file; |
|
369 | + $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin; |
|
370 | + add_filter($rel_admin_hook, [$this, 'load_admin_hook']); |
|
371 | + $this->_files_hooked[] = $rel_admin; |
|
372 | + } |
|
373 | + return $hook_paths; |
|
374 | + } |
|
375 | + |
|
376 | + |
|
377 | + public function load_admin_hook($registered_pages) |
|
378 | + { |
|
379 | + return array_merge((array) $this->hook_file, $registered_pages); |
|
380 | + } |
|
381 | + |
|
382 | + |
|
383 | + /** |
|
384 | + * _initialize_admin_page |
|
385 | + * |
|
386 | + * @see initialize_admin_page() for info |
|
387 | + */ |
|
388 | + protected function _initialize_admin_page() |
|
389 | + { |
|
390 | + // JUST CHECK WE'RE ON RIGHT PAGE. |
|
391 | + $page = $this->request->getRequestParam('page'); |
|
392 | + $page = $this->request->getRequestParam('current_page', $page); |
|
393 | + $menu_slug = $this->_menu_map->menu_slug; |
|
394 | + |
|
395 | + |
|
396 | + if ($this->_routing && ($page === '' || $page !== $menu_slug)) { |
|
397 | + // not on the right page so let's get out. |
|
398 | + return; |
|
399 | + } |
|
400 | + $this->_load_page = true; |
|
401 | + |
|
402 | + // we don't need to do a page_request check here because it's only called via WP menu system. |
|
403 | + $admin_page = $this->_file_name . '_Admin_Page'; |
|
404 | + $hook_suffix = "{$menu_slug}_{$admin_page}"; |
|
405 | + $admin_page = apply_filters( |
|
406 | + "FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}", |
|
407 | + $admin_page |
|
408 | + ); |
|
409 | + if (empty($admin_page)) { |
|
410 | + return; |
|
411 | + } |
|
412 | + // define requested admin page class name then load the file and instantiate |
|
413 | + $path_to_file = str_replace(['\\', '/'], '/', $this->_folder_path . $admin_page . '.core.php'); |
|
414 | + // so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be: |
|
415 | + // FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page |
|
416 | + $path_to_file = apply_filters( |
|
417 | + "FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}", |
|
418 | + $path_to_file |
|
419 | + ); |
|
420 | + if (! is_readable($path_to_file)) { |
|
421 | + return; |
|
422 | + } |
|
423 | + // This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place |
|
424 | + do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization'); |
|
425 | + do_action("AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_{$menu_slug}"); |
|
426 | + require_once($path_to_file); |
|
427 | + $this->_loaded_page_object = $this->loader->getShared($admin_page, [$this->_routing]); |
|
428 | + |
|
429 | + do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization'); |
|
430 | + do_action("AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_{$menu_slug}"); |
|
431 | + } |
|
432 | + |
|
433 | + |
|
434 | + public function get_admin_page_name() |
|
435 | + { |
|
436 | + return $this->_file_name . '_Admin_Page'; |
|
437 | + } |
|
438 | + |
|
439 | + |
|
440 | + /** |
|
441 | + * @return mixed |
|
442 | + */ |
|
443 | + public function loaded_page_object() |
|
444 | + { |
|
445 | + return $this->_loaded_page_object; |
|
446 | + } |
|
447 | + |
|
448 | + /** |
|
449 | + * _check_user_access |
|
450 | + * verifies user access for this admin page. If no user access is available then let's gracefully exit with a |
|
451 | + * WordPress die message. |
|
452 | + * |
|
453 | + * @return void wp_die if fail |
|
454 | + */ |
|
455 | + private function _check_user_access() |
|
456 | + { |
|
457 | + if ( |
|
458 | + ! EE_Registry::instance()->CAP->current_user_can( |
|
459 | + $this->_menu_map->capability, |
|
460 | + $this->_menu_map->menu_slug |
|
461 | + ) |
|
462 | + ) { |
|
463 | + wp_die(esc_html__('You don\'t have access to this page.', 'event_espresso'), '', ['back_link' => true]); |
|
464 | + } |
|
465 | + } |
|
466 | 466 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | "endDate": "<?php echo esc_html($event_end); ?>", |
26 | 26 | "description": <?php echo wp_json_encode($event_description); ?>, |
27 | 27 | "url": "<?php echo esc_url_raw($event_permalink); ?>", |
28 | - "eventAttendanceMode": "<?php echo esc_url_raw('https://schema.org/' . $event_attendance_mode); ?>", |
|
28 | + "eventAttendanceMode": "<?php echo esc_url_raw('https://schema.org/'.$event_attendance_mode); ?>", |
|
29 | 29 | "eventStatus": [ "<?php echo esc_url_raw($event_status); ?>" ], |
30 | 30 | "offers": [ |
31 | 31 | <?php |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | "price": "<?php echo esc_html($ticket['price']); ?>", |
40 | 40 | "priceCurrency": "<?php echo esc_html($currency); ?>" |
41 | 41 | <?php if (isset($ticket['availability'])) { |
42 | - ?>,"availability": "<?php echo esc_url_raw('https://schema.org/' . $ticket['availability']); ?>" |
|
42 | + ?>,"availability": "<?php echo esc_url_raw('https://schema.org/'.$ticket['availability']); ?>" |
|
43 | 43 | <?php } ?> |
44 | 44 | }<?php |
45 | 45 | $i++; |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | "eventStatus": [ "<?php echo esc_url_raw($event_status); ?>" ], |
30 | 30 | "offers": [ |
31 | 31 | <?php |
32 | - $i = 0; |
|
33 | - foreach ($event_tickets as $ticket) {?> |
|
32 | + $i = 0; |
|
33 | + foreach ($event_tickets as $ticket) {?> |
|
34 | 34 | { |
35 | 35 | "@type": "Offer", |
36 | 36 | "url": "<?php echo esc_url_raw($event_permalink); ?>", |
@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | "price": "<?php echo esc_html($ticket['price']); ?>", |
40 | 40 | "priceCurrency": "<?php echo esc_html($currency); ?>" |
41 | 41 | <?php if (isset($ticket['availability'])) { |
42 | - ?>,"availability": "<?php echo esc_url_raw('https://schema.org/' . $ticket['availability']); ?>" |
|
42 | + ?>,"availability": "<?php echo esc_url_raw('https://schema.org/' . $ticket['availability']); ?>" |
|
43 | 43 | <?php } ?> |
44 | 44 | }<?php |
45 | - $i++; |
|
46 | - if ($i < count($event_tickets)) { |
|
47 | - echo ','; |
|
48 | - } |
|
49 | - } |
|
50 | - ?> |
|
45 | + $i++; |
|
46 | + if ($i < count($event_tickets)) { |
|
47 | + echo ','; |
|
48 | + } |
|
49 | + } |
|
50 | + ?> |
|
51 | 51 | ]<?php |
52 | - if ($venue_name) { |
|
53 | - ?>, |
|
52 | + if ($venue_name) { |
|
53 | + ?>, |
|
54 | 54 | "location": { |
55 | 55 | "@type": "Place", |
56 | 56 | "name": <?php echo wp_json_encode($venue_name); ?>, |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | } |
64 | 64 | } |
65 | 65 | <?php |
66 | - } ?> |
|
66 | + } ?> |
|
67 | 67 | <?php |
68 | - if ($event_image) { |
|
69 | - ?>, |
|
68 | + if ($event_image) { |
|
69 | + ?>, |
|
70 | 70 | "image": "<?php echo esc_url_raw($event_image); ?>" |
71 | 71 | <?php |
72 | - } ?> |
|
72 | + } ?> |
|
73 | 73 | <?php do_action('AHEE__json_linked_data_for_event__template'); ?> |
74 | 74 | } |
75 | 75 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | if ($is_array) { |
26 | 26 | $values = []; |
27 | 27 | foreach ((array) $param as $key => $value) { |
28 | - $values[ $key ] = $this->clean($value, $type, is_array($value), $delimiter); |
|
28 | + $values[$key] = $this->clean($value, $type, is_array($value), $delimiter); |
|
29 | 29 | } |
30 | 30 | return $values; |
31 | 31 | } |
@@ -6,67 +6,67 @@ |
||
6 | 6 | |
7 | 7 | class RequestSanitizer |
8 | 8 | { |
9 | - /** |
|
10 | - * Will sanitize the supplied request parameter based on the specified data type |
|
11 | - * |
|
12 | - * @param mixed $param the supplied request parameter |
|
13 | - * @param string $type the specified data type (default: "string") |
|
14 | - * valid values: "bool", "float", "int", "key", "url", or "string" |
|
15 | - * @param bool $is_array if true, then $param will be treated as an array of $type |
|
16 | - * @param string $delimiter if $param is a CSV like value (ex: 1,2,3,4,5...) then this is the value separator |
|
17 | - * @return array|bool|float|int|string |
|
18 | - * @since 4.10.14.p |
|
19 | - */ |
|
20 | - public function clean($param, $type = DataType::STRING, $is_array = false, $delimiter = '') |
|
21 | - { |
|
22 | - if ($delimiter !== '' && is_string($param)) { |
|
23 | - $param = explode($delimiter, $param); |
|
24 | - $is_array = is_array($param); |
|
25 | - // unset the delimiter else this function will recurse forever when we loop over the array of results |
|
26 | - $delimiter = ''; |
|
27 | - } |
|
28 | - // check if we are getting an improperly typed array and correct |
|
29 | - $is_array = $is_array && is_array($param); |
|
30 | - if ($is_array) { |
|
31 | - $values = []; |
|
32 | - foreach ((array) $param as $key => $value) { |
|
33 | - $values[ $key ] = $this->clean($value, $type, is_array($value), $delimiter); |
|
34 | - } |
|
35 | - return $values; |
|
36 | - } |
|
37 | - return $this->sanitizeParam($param, $type); |
|
38 | - } |
|
9 | + /** |
|
10 | + * Will sanitize the supplied request parameter based on the specified data type |
|
11 | + * |
|
12 | + * @param mixed $param the supplied request parameter |
|
13 | + * @param string $type the specified data type (default: "string") |
|
14 | + * valid values: "bool", "float", "int", "key", "url", or "string" |
|
15 | + * @param bool $is_array if true, then $param will be treated as an array of $type |
|
16 | + * @param string $delimiter if $param is a CSV like value (ex: 1,2,3,4,5...) then this is the value separator |
|
17 | + * @return array|bool|float|int|string |
|
18 | + * @since 4.10.14.p |
|
19 | + */ |
|
20 | + public function clean($param, $type = DataType::STRING, $is_array = false, $delimiter = '') |
|
21 | + { |
|
22 | + if ($delimiter !== '' && is_string($param)) { |
|
23 | + $param = explode($delimiter, $param); |
|
24 | + $is_array = is_array($param); |
|
25 | + // unset the delimiter else this function will recurse forever when we loop over the array of results |
|
26 | + $delimiter = ''; |
|
27 | + } |
|
28 | + // check if we are getting an improperly typed array and correct |
|
29 | + $is_array = $is_array && is_array($param); |
|
30 | + if ($is_array) { |
|
31 | + $values = []; |
|
32 | + foreach ((array) $param as $key => $value) { |
|
33 | + $values[ $key ] = $this->clean($value, $type, is_array($value), $delimiter); |
|
34 | + } |
|
35 | + return $values; |
|
36 | + } |
|
37 | + return $this->sanitizeParam($param, $type); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - /** |
|
42 | - * @param mixed $param |
|
43 | - * @param string $type |
|
44 | - * @return array|float|int|mixed|string|string[]|null |
|
45 | - * @since 4.10.20.p |
|
46 | - */ |
|
47 | - public function sanitizeParam($param, $type = DataType::STRING) |
|
48 | - { |
|
49 | - switch ($type) { |
|
50 | - case DataType::BOOL: |
|
51 | - return filter_var($param, FILTER_VALIDATE_BOOLEAN); |
|
52 | - case DataType::FLOAT: |
|
53 | - return (float) $param; |
|
54 | - case DataType::FQCN: |
|
55 | - return preg_replace('[^\\\w\d]', '', $param); |
|
56 | - case DataType::HTML: |
|
57 | - $allowed_tags = AllowedTags::getAllowedTags(); |
|
58 | - return wp_kses($param, $allowed_tags); |
|
59 | - case DataType::INT: |
|
60 | - return (int) $param; |
|
61 | - case DataType::KEY: |
|
62 | - return sanitize_key($param); |
|
63 | - case DataType::TITLE: |
|
64 | - return sanitize_title($param); |
|
65 | - case DataType::URL: |
|
66 | - return esc_url_raw($param); |
|
67 | - case DataType::STRING: |
|
68 | - default: |
|
69 | - return sanitize_text_field($param); |
|
70 | - } |
|
71 | - } |
|
41 | + /** |
|
42 | + * @param mixed $param |
|
43 | + * @param string $type |
|
44 | + * @return array|float|int|mixed|string|string[]|null |
|
45 | + * @since 4.10.20.p |
|
46 | + */ |
|
47 | + public function sanitizeParam($param, $type = DataType::STRING) |
|
48 | + { |
|
49 | + switch ($type) { |
|
50 | + case DataType::BOOL: |
|
51 | + return filter_var($param, FILTER_VALIDATE_BOOLEAN); |
|
52 | + case DataType::FLOAT: |
|
53 | + return (float) $param; |
|
54 | + case DataType::FQCN: |
|
55 | + return preg_replace('[^\\\w\d]', '', $param); |
|
56 | + case DataType::HTML: |
|
57 | + $allowed_tags = AllowedTags::getAllowedTags(); |
|
58 | + return wp_kses($param, $allowed_tags); |
|
59 | + case DataType::INT: |
|
60 | + return (int) $param; |
|
61 | + case DataType::KEY: |
|
62 | + return sanitize_key($param); |
|
63 | + case DataType::TITLE: |
|
64 | + return sanitize_title($param); |
|
65 | + case DataType::URL: |
|
66 | + return esc_url_raw($param); |
|
67 | + case DataType::STRING: |
|
68 | + default: |
|
69 | + return sanitize_text_field($param); |
|
70 | + } |
|
71 | + } |
|
72 | 72 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | */ |
61 | 61 | private function getGlobalRouteCondition($globalRouteCondition, $default) |
62 | 62 | { |
63 | - return isset($this->globalRouteConditions[ $globalRouteCondition ]) |
|
64 | - ? $this->globalRouteConditions[ $globalRouteCondition ] |
|
63 | + return isset($this->globalRouteConditions[$globalRouteCondition]) |
|
64 | + ? $this->globalRouteConditions[$globalRouteCondition] |
|
65 | 65 | : $default; |
66 | 66 | } |
67 | 67 | |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | return $this->isAjaxRequest(); |
93 | 93 | } |
94 | 94 | // make sure these constants are defined |
95 | - if (! defined('EE_ADMIN_AJAX')) { |
|
95 | + if ( ! defined('EE_ADMIN_AJAX')) { |
|
96 | 96 | define('EE_ADMIN_AJAX', false); |
97 | 97 | } |
98 | - if (! defined('EE_FRONT_AJAX')) { |
|
98 | + if ( ! defined('EE_FRONT_AJAX')) { |
|
99 | 99 | define('EE_FRONT_AJAX', false); |
100 | 100 | } |
101 | 101 | // Detect WP_Cron |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | $this->request->getRequestParam('ee_front_ajax', false, 'bool') |
133 | 133 | || $this->request->getRequestParam('data[ee_front_ajax]', false, 'bool') |
134 | 134 | ) { |
135 | - if (! defined('EE_FRONT_AJAX')) { |
|
135 | + if ( ! defined('EE_FRONT_AJAX')) { |
|
136 | 136 | define('EE_FRONT_AJAX', true); |
137 | 137 | } |
138 | - if (! defined('EE_ADMIN_AJAX')) { |
|
138 | + if ( ! defined('EE_ADMIN_AJAX')) { |
|
139 | 139 | define('EE_ADMIN_AJAX', false); |
140 | 140 | } |
141 | 141 | return $this->factory->create(RequestTypeContext::AJAX_FRONT); |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | $this->request->getRequestParam('ee_admin_ajax', false, 'bool') |
145 | 145 | || $this->request->getRequestParam('data[ee_admin_ajax]', false, 'bool') |
146 | 146 | ) { |
147 | - if (! defined('EE_ADMIN_AJAX')) { |
|
147 | + if ( ! defined('EE_ADMIN_AJAX')) { |
|
148 | 148 | define('EE_ADMIN_AJAX', true); |
149 | 149 | } |
150 | - if (! defined('EE_FRONT_AJAX')) { |
|
150 | + if ( ! defined('EE_FRONT_AJAX')) { |
|
151 | 151 | define('EE_FRONT_AJAX', false); |
152 | 152 | } |
153 | 153 | return $this->factory->create(RequestTypeContext::AJAX_ADMIN); |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | // Check for URLs like http://mysite.com/?rest_route=/ee... and http://mysite.com/wp-json/ee/... |
168 | 168 | return strpos( |
169 | 169 | $this->request->getRequestParam('rest_route'), |
170 | - '/' . Domain::API_NAMESPACE |
|
170 | + '/'.Domain::API_NAMESPACE |
|
171 | 171 | ) === 0 |
172 | - || $this->uriPathMatches(trim(rest_get_url_prefix(), '/') . '/' . Domain::API_NAMESPACE); |
|
172 | + || $this->uriPathMatches(trim(rest_get_url_prefix(), '/').'/'.Domain::API_NAMESPACE); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 |
@@ -17,216 +17,216 @@ |
||
17 | 17 | */ |
18 | 18 | class RequestTypeContextDetector |
19 | 19 | { |
20 | - /** |
|
21 | - * @var RequestTypeContextFactoryInterface $factory |
|
22 | - */ |
|
23 | - private $factory; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var RequestInterface $request |
|
27 | - */ |
|
28 | - private $request; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var array $globalRouteConditions |
|
32 | - */ |
|
33 | - private $globalRouteConditions; |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * RequestTypeContextDetector constructor. |
|
38 | - * |
|
39 | - * @param RequestInterface $request |
|
40 | - * @param RequestTypeContextFactoryInterface $factory |
|
41 | - * @param array $globalRouteConditions an array for injecting values that would |
|
42 | - * otherwise be defined as global constants |
|
43 | - * or other global variables for the current |
|
44 | - * request route such as DOING_AJAX |
|
45 | - */ |
|
46 | - public function __construct( |
|
47 | - RequestInterface $request, |
|
48 | - RequestTypeContextFactoryInterface $factory, |
|
49 | - array $globalRouteConditions = array() |
|
50 | - ) { |
|
51 | - $this->request = $request; |
|
52 | - $this->factory = $factory; |
|
53 | - $this->globalRouteConditions = $globalRouteConditions; |
|
54 | - } |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * @return mixed |
|
59 | - */ |
|
60 | - private function getGlobalRouteCondition($globalRouteCondition, $default) |
|
61 | - { |
|
62 | - return isset($this->globalRouteConditions[ $globalRouteCondition ]) |
|
63 | - ? $this->globalRouteConditions[ $globalRouteCondition ] |
|
64 | - : $default; |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * @return RequestTypeContext |
|
70 | - * @throws InvalidArgumentException |
|
71 | - */ |
|
72 | - public function detectRequestTypeContext() |
|
73 | - { |
|
74 | - // Detect error scrapes |
|
75 | - if ( |
|
76 | - $this->request->getRequestParam('wp_scrape_key') |
|
77 | - && $this->request->getRequestParam('wp_scrape_nonce') |
|
78 | - ) { |
|
79 | - return $this->factory->create(RequestTypeContext::WP_SCRAPE); |
|
80 | - } |
|
81 | - // Detect EE REST API |
|
82 | - if ($this->isEspressoRestApiRequest()) { |
|
83 | - return $this->factory->create(RequestTypeContext::API); |
|
84 | - } |
|
85 | - // Detect WP REST API |
|
86 | - if ($this->isWordPressRestApiRequest()) { |
|
87 | - return $this->factory->create(RequestTypeContext::WP_API); |
|
88 | - } |
|
89 | - // Detect AJAX |
|
90 | - if ($this->getGlobalRouteCondition('DOING_AJAX', false)) { |
|
91 | - return $this->isAjaxRequest(); |
|
92 | - } |
|
93 | - // make sure these constants are defined |
|
94 | - if (! defined('EE_ADMIN_AJAX')) { |
|
95 | - define('EE_ADMIN_AJAX', false); |
|
96 | - } |
|
97 | - if (! defined('EE_FRONT_AJAX')) { |
|
98 | - define('EE_FRONT_AJAX', false); |
|
99 | - } |
|
100 | - // Detect WP_Cron |
|
101 | - if ($this->isCronRequest()) { |
|
102 | - return $this->factory->create(RequestTypeContext::CRON); |
|
103 | - } |
|
104 | - // Detect command line requests |
|
105 | - if ($this->getGlobalRouteCondition('WP_CLI', false)) { |
|
106 | - return $this->factory->create(RequestTypeContext::CLI); |
|
107 | - } |
|
108 | - // detect WordPress admin (ie: "Dashboard") |
|
109 | - if ($this->getGlobalRouteCondition('is_admin', false)) { |
|
110 | - return $this->factory->create(RequestTypeContext::ADMIN); |
|
111 | - } |
|
112 | - // Detect iFrames |
|
113 | - if ($this->isIframeRoute()) { |
|
114 | - return $this->factory->create(RequestTypeContext::IFRAME); |
|
115 | - } |
|
116 | - // Detect Feeds |
|
117 | - if ($this->isFeedRequest()) { |
|
118 | - return $this->factory->create(RequestTypeContext::FEED); |
|
119 | - } |
|
120 | - // and by process of elimination... |
|
121 | - return $this->factory->create(RequestTypeContext::FRONTEND); |
|
122 | - } |
|
123 | - |
|
124 | - |
|
125 | - /** |
|
126 | - * @return RequestTypeContext |
|
127 | - */ |
|
128 | - private function isAjaxRequest() |
|
129 | - { |
|
130 | - if ( |
|
131 | - $this->request->getRequestParam('ee_front_ajax', false, 'bool') |
|
132 | - || $this->request->getRequestParam('data[ee_front_ajax]', false, 'bool') |
|
133 | - ) { |
|
134 | - if (! defined('EE_FRONT_AJAX')) { |
|
135 | - define('EE_FRONT_AJAX', true); |
|
136 | - } |
|
137 | - if (! defined('EE_ADMIN_AJAX')) { |
|
138 | - define('EE_ADMIN_AJAX', false); |
|
139 | - } |
|
140 | - return $this->factory->create(RequestTypeContext::AJAX_FRONT); |
|
141 | - } |
|
142 | - if ( |
|
143 | - $this->request->getRequestParam('ee_admin_ajax', false, 'bool') |
|
144 | - || $this->request->getRequestParam('data[ee_admin_ajax]', false, 'bool') |
|
145 | - ) { |
|
146 | - if (! defined('EE_ADMIN_AJAX')) { |
|
147 | - define('EE_ADMIN_AJAX', true); |
|
148 | - } |
|
149 | - if (! defined('EE_FRONT_AJAX')) { |
|
150 | - define('EE_FRONT_AJAX', false); |
|
151 | - } |
|
152 | - return $this->factory->create(RequestTypeContext::AJAX_ADMIN); |
|
153 | - } |
|
154 | - if ($this->request->getRequestParam('action') === 'heartbeat') { |
|
155 | - return $this->factory->create(RequestTypeContext::AJAX_HEARTBEAT); |
|
156 | - } |
|
157 | - return $this->factory->create(RequestTypeContext::AJAX_OTHER); |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - /** |
|
162 | - * @return bool |
|
163 | - */ |
|
164 | - private function isEspressoRestApiRequest() |
|
165 | - { |
|
166 | - // Check for URLs like http://mysite.com/?rest_route=/ee... and http://mysite.com/wp-json/ee/... |
|
167 | - return strpos( |
|
168 | - $this->request->getRequestParam('rest_route'), |
|
169 | - '/' . Domain::API_NAMESPACE |
|
170 | - ) === 0 |
|
171 | - || $this->uriPathMatches(trim(rest_get_url_prefix(), '/') . '/' . Domain::API_NAMESPACE); |
|
172 | - } |
|
173 | - |
|
174 | - |
|
175 | - |
|
176 | - /** |
|
177 | - * @return bool |
|
178 | - */ |
|
179 | - private function isWordPressRestApiRequest() |
|
180 | - { |
|
181 | - // Check for URLs like http://mysite.com/?rest_route=/.. and http://mysite.com/wp-json/... |
|
182 | - return $this->request->getRequestParam('rest_route') !== '' |
|
183 | - || $this->uriPathMatches(trim(rest_get_url_prefix(), '/')); |
|
184 | - } |
|
185 | - |
|
186 | - |
|
187 | - /** |
|
188 | - * @return bool |
|
189 | - */ |
|
190 | - private function isCronRequest() |
|
191 | - { |
|
192 | - return $this->uriPathMatches('wp-cron.php'); |
|
193 | - } |
|
194 | - |
|
195 | - |
|
196 | - /** |
|
197 | - * @return bool |
|
198 | - */ |
|
199 | - private function isFeedRequest() |
|
200 | - { |
|
201 | - return $this->uriPathMatches('feed'); |
|
202 | - } |
|
203 | - |
|
204 | - |
|
205 | - /** |
|
206 | - * @param string $component |
|
207 | - * @return bool |
|
208 | - */ |
|
209 | - private function uriPathMatches($component) |
|
210 | - { |
|
211 | - $request_uri = $this->request->requestUri(true); |
|
212 | - $parts = explode('?', $request_uri); |
|
213 | - $path = trim(reset($parts), '/'); |
|
214 | - return strpos($path, $component) === 0; |
|
215 | - } |
|
216 | - |
|
217 | - |
|
218 | - /** |
|
219 | - * @return bool |
|
220 | - */ |
|
221 | - private function isIframeRoute() |
|
222 | - { |
|
223 | - $is_iframe_route = apply_filters( |
|
224 | - 'FHEE__EventEspresso_core_domain_services_contexts_RequestTypeContextDetector__isIframeRoute', |
|
225 | - $this->request->getRequestParam('event_list', '') === 'iframe' |
|
226 | - || $this->request->getRequestParam('ticket_selector', '') === 'iframe' |
|
227 | - || $this->request->getRequestParam('calendar', '') === 'iframe', |
|
228 | - $this |
|
229 | - ); |
|
230 | - return filter_var($is_iframe_route, FILTER_VALIDATE_BOOLEAN); |
|
231 | - } |
|
20 | + /** |
|
21 | + * @var RequestTypeContextFactoryInterface $factory |
|
22 | + */ |
|
23 | + private $factory; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var RequestInterface $request |
|
27 | + */ |
|
28 | + private $request; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var array $globalRouteConditions |
|
32 | + */ |
|
33 | + private $globalRouteConditions; |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * RequestTypeContextDetector constructor. |
|
38 | + * |
|
39 | + * @param RequestInterface $request |
|
40 | + * @param RequestTypeContextFactoryInterface $factory |
|
41 | + * @param array $globalRouteConditions an array for injecting values that would |
|
42 | + * otherwise be defined as global constants |
|
43 | + * or other global variables for the current |
|
44 | + * request route such as DOING_AJAX |
|
45 | + */ |
|
46 | + public function __construct( |
|
47 | + RequestInterface $request, |
|
48 | + RequestTypeContextFactoryInterface $factory, |
|
49 | + array $globalRouteConditions = array() |
|
50 | + ) { |
|
51 | + $this->request = $request; |
|
52 | + $this->factory = $factory; |
|
53 | + $this->globalRouteConditions = $globalRouteConditions; |
|
54 | + } |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * @return mixed |
|
59 | + */ |
|
60 | + private function getGlobalRouteCondition($globalRouteCondition, $default) |
|
61 | + { |
|
62 | + return isset($this->globalRouteConditions[ $globalRouteCondition ]) |
|
63 | + ? $this->globalRouteConditions[ $globalRouteCondition ] |
|
64 | + : $default; |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * @return RequestTypeContext |
|
70 | + * @throws InvalidArgumentException |
|
71 | + */ |
|
72 | + public function detectRequestTypeContext() |
|
73 | + { |
|
74 | + // Detect error scrapes |
|
75 | + if ( |
|
76 | + $this->request->getRequestParam('wp_scrape_key') |
|
77 | + && $this->request->getRequestParam('wp_scrape_nonce') |
|
78 | + ) { |
|
79 | + return $this->factory->create(RequestTypeContext::WP_SCRAPE); |
|
80 | + } |
|
81 | + // Detect EE REST API |
|
82 | + if ($this->isEspressoRestApiRequest()) { |
|
83 | + return $this->factory->create(RequestTypeContext::API); |
|
84 | + } |
|
85 | + // Detect WP REST API |
|
86 | + if ($this->isWordPressRestApiRequest()) { |
|
87 | + return $this->factory->create(RequestTypeContext::WP_API); |
|
88 | + } |
|
89 | + // Detect AJAX |
|
90 | + if ($this->getGlobalRouteCondition('DOING_AJAX', false)) { |
|
91 | + return $this->isAjaxRequest(); |
|
92 | + } |
|
93 | + // make sure these constants are defined |
|
94 | + if (! defined('EE_ADMIN_AJAX')) { |
|
95 | + define('EE_ADMIN_AJAX', false); |
|
96 | + } |
|
97 | + if (! defined('EE_FRONT_AJAX')) { |
|
98 | + define('EE_FRONT_AJAX', false); |
|
99 | + } |
|
100 | + // Detect WP_Cron |
|
101 | + if ($this->isCronRequest()) { |
|
102 | + return $this->factory->create(RequestTypeContext::CRON); |
|
103 | + } |
|
104 | + // Detect command line requests |
|
105 | + if ($this->getGlobalRouteCondition('WP_CLI', false)) { |
|
106 | + return $this->factory->create(RequestTypeContext::CLI); |
|
107 | + } |
|
108 | + // detect WordPress admin (ie: "Dashboard") |
|
109 | + if ($this->getGlobalRouteCondition('is_admin', false)) { |
|
110 | + return $this->factory->create(RequestTypeContext::ADMIN); |
|
111 | + } |
|
112 | + // Detect iFrames |
|
113 | + if ($this->isIframeRoute()) { |
|
114 | + return $this->factory->create(RequestTypeContext::IFRAME); |
|
115 | + } |
|
116 | + // Detect Feeds |
|
117 | + if ($this->isFeedRequest()) { |
|
118 | + return $this->factory->create(RequestTypeContext::FEED); |
|
119 | + } |
|
120 | + // and by process of elimination... |
|
121 | + return $this->factory->create(RequestTypeContext::FRONTEND); |
|
122 | + } |
|
123 | + |
|
124 | + |
|
125 | + /** |
|
126 | + * @return RequestTypeContext |
|
127 | + */ |
|
128 | + private function isAjaxRequest() |
|
129 | + { |
|
130 | + if ( |
|
131 | + $this->request->getRequestParam('ee_front_ajax', false, 'bool') |
|
132 | + || $this->request->getRequestParam('data[ee_front_ajax]', false, 'bool') |
|
133 | + ) { |
|
134 | + if (! defined('EE_FRONT_AJAX')) { |
|
135 | + define('EE_FRONT_AJAX', true); |
|
136 | + } |
|
137 | + if (! defined('EE_ADMIN_AJAX')) { |
|
138 | + define('EE_ADMIN_AJAX', false); |
|
139 | + } |
|
140 | + return $this->factory->create(RequestTypeContext::AJAX_FRONT); |
|
141 | + } |
|
142 | + if ( |
|
143 | + $this->request->getRequestParam('ee_admin_ajax', false, 'bool') |
|
144 | + || $this->request->getRequestParam('data[ee_admin_ajax]', false, 'bool') |
|
145 | + ) { |
|
146 | + if (! defined('EE_ADMIN_AJAX')) { |
|
147 | + define('EE_ADMIN_AJAX', true); |
|
148 | + } |
|
149 | + if (! defined('EE_FRONT_AJAX')) { |
|
150 | + define('EE_FRONT_AJAX', false); |
|
151 | + } |
|
152 | + return $this->factory->create(RequestTypeContext::AJAX_ADMIN); |
|
153 | + } |
|
154 | + if ($this->request->getRequestParam('action') === 'heartbeat') { |
|
155 | + return $this->factory->create(RequestTypeContext::AJAX_HEARTBEAT); |
|
156 | + } |
|
157 | + return $this->factory->create(RequestTypeContext::AJAX_OTHER); |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + /** |
|
162 | + * @return bool |
|
163 | + */ |
|
164 | + private function isEspressoRestApiRequest() |
|
165 | + { |
|
166 | + // Check for URLs like http://mysite.com/?rest_route=/ee... and http://mysite.com/wp-json/ee/... |
|
167 | + return strpos( |
|
168 | + $this->request->getRequestParam('rest_route'), |
|
169 | + '/' . Domain::API_NAMESPACE |
|
170 | + ) === 0 |
|
171 | + || $this->uriPathMatches(trim(rest_get_url_prefix(), '/') . '/' . Domain::API_NAMESPACE); |
|
172 | + } |
|
173 | + |
|
174 | + |
|
175 | + |
|
176 | + /** |
|
177 | + * @return bool |
|
178 | + */ |
|
179 | + private function isWordPressRestApiRequest() |
|
180 | + { |
|
181 | + // Check for URLs like http://mysite.com/?rest_route=/.. and http://mysite.com/wp-json/... |
|
182 | + return $this->request->getRequestParam('rest_route') !== '' |
|
183 | + || $this->uriPathMatches(trim(rest_get_url_prefix(), '/')); |
|
184 | + } |
|
185 | + |
|
186 | + |
|
187 | + /** |
|
188 | + * @return bool |
|
189 | + */ |
|
190 | + private function isCronRequest() |
|
191 | + { |
|
192 | + return $this->uriPathMatches('wp-cron.php'); |
|
193 | + } |
|
194 | + |
|
195 | + |
|
196 | + /** |
|
197 | + * @return bool |
|
198 | + */ |
|
199 | + private function isFeedRequest() |
|
200 | + { |
|
201 | + return $this->uriPathMatches('feed'); |
|
202 | + } |
|
203 | + |
|
204 | + |
|
205 | + /** |
|
206 | + * @param string $component |
|
207 | + * @return bool |
|
208 | + */ |
|
209 | + private function uriPathMatches($component) |
|
210 | + { |
|
211 | + $request_uri = $this->request->requestUri(true); |
|
212 | + $parts = explode('?', $request_uri); |
|
213 | + $path = trim(reset($parts), '/'); |
|
214 | + return strpos($path, $component) === 0; |
|
215 | + } |
|
216 | + |
|
217 | + |
|
218 | + /** |
|
219 | + * @return bool |
|
220 | + */ |
|
221 | + private function isIframeRoute() |
|
222 | + { |
|
223 | + $is_iframe_route = apply_filters( |
|
224 | + 'FHEE__EventEspresso_core_domain_services_contexts_RequestTypeContextDetector__isIframeRoute', |
|
225 | + $this->request->getRequestParam('event_list', '') === 'iframe' |
|
226 | + || $this->request->getRequestParam('ticket_selector', '') === 'iframe' |
|
227 | + || $this->request->getRequestParam('calendar', '') === 'iframe', |
|
228 | + $this |
|
229 | + ); |
|
230 | + return filter_var($is_iframe_route, FILTER_VALIDATE_BOOLEAN); |
|
231 | + } |
|
232 | 232 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public static function add_json_linked_data_for_event(EE_Event $event) |
22 | 22 | { |
23 | 23 | // Check we have a valid datetime for the event |
24 | - if (! $event->primary_datetime() instanceof EE_Datetime) { |
|
24 | + if ( ! $event->primary_datetime() instanceof EE_Datetime) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | |
@@ -61,15 +61,15 @@ discard block |
||
61 | 61 | $event_status = 'EventScheduled'; |
62 | 62 | } |
63 | 63 | $template_args['event_attendance_mode'] = 'OfflineEventAttendanceMode'; |
64 | - $template_args['event_status'] = 'https://schema.org/' . $event_status; |
|
64 | + $template_args['event_status'] = 'https://schema.org/'.$event_status; |
|
65 | 65 | $template_args['currency'] = EE_Registry::instance()->CFG->currency->code; |
66 | 66 | foreach ($event->tickets() as $original_ticket) { |
67 | 67 | // clone tickets so that date formats don't override those for the original ticket |
68 | 68 | $ticket = clone $original_ticket; |
69 | 69 | $ID = $ticket->ID(); |
70 | - $template_args['event_tickets'][ $ID ]['start_date'] = $ticket->start_date(DateTime::ATOM, null); |
|
71 | - $template_args['event_tickets'][ $ID ]['end_date'] = $ticket->end_date(DateTime::ATOM, null); |
|
72 | - $template_args['event_tickets'][ $ID ]['price'] = number_format( |
|
70 | + $template_args['event_tickets'][$ID]['start_date'] = $ticket->start_date(DateTime::ATOM, null); |
|
71 | + $template_args['event_tickets'][$ID]['end_date'] = $ticket->end_date(DateTime::ATOM, null); |
|
72 | + $template_args['event_tickets'][$ID]['price'] = number_format( |
|
73 | 73 | $ticket->price(), |
74 | 74 | EE_Registry::instance()->CFG->currency->dec_plc, |
75 | 75 | EE_Registry::instance()->CFG->currency->dec_mrk, |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | $availability = null; |
87 | 87 | break; |
88 | 88 | } |
89 | - $template_args['event_tickets'][ $ID ]['availability'] = $availability; |
|
89 | + $template_args['event_tickets'][$ID]['availability'] = $availability; |
|
90 | 90 | unset($ticket); |
91 | 91 | } |
92 | 92 | $VNU_ID = espresso_venue_id(); |
93 | - if (! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) { |
|
93 | + if ( ! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) { |
|
94 | 94 | $venue = EEH_Venue_View::get_venue($VNU_ID); |
95 | 95 | $template_args['venue_name'] = get_the_title($VNU_ID); |
96 | 96 | $template_args['venue_url'] = get_permalink($VNU_ID); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $VNU_ID |
113 | 113 | ); |
114 | 114 | extract($template_args, EXTR_OVERWRITE); |
115 | - include EE_TEMPLATES . 'json_linked_data_for_event.template.php'; |
|
115 | + include EE_TEMPLATES.'json_linked_data_for_event.template.php'; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public static function name($name = null) |
146 | 146 | { |
147 | - return ! empty($name) ? '<span itemprop="name">' . $name . '</span>' : ''; |
|
147 | + return ! empty($name) ? '<span itemprop="name">'.$name.'</span>' : ''; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | public static function streetAddress(EEI_Address $obj_with_address = null) |
161 | 161 | { |
162 | 162 | return $obj_with_address->address() !== null && $obj_with_address->address() !== '' |
163 | - ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : ''; |
|
163 | + ? '<span itemprop="streetAddress">'.$obj_with_address->address().'</span>' : ''; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | ) |
184 | 184 | ) { |
185 | 185 | return $obj_with_address->address2() !== null && $obj_with_address->address2() !== '' |
186 | - ? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : ''; |
|
186 | + ? '<span itemprop="postOfficeBoxNumber">'.$obj_with_address->address2().'</span>' : ''; |
|
187 | 187 | } else { |
188 | 188 | return $obj_with_address->address2(); |
189 | 189 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | public static function addressLocality(EEI_Address $obj_with_address = null) |
203 | 203 | { |
204 | 204 | return $obj_with_address->city() !== null && $obj_with_address->city() !== '' |
205 | - ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : ''; |
|
205 | + ? '<span itemprop="addressLocality">'.$obj_with_address->city().'</span>' : ''; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | public static function addressRegion(EEI_Address $obj_with_address = null) |
219 | 219 | { |
220 | 220 | $state = $obj_with_address->state_name(); |
221 | - if (! empty($state)) { |
|
222 | - return '<span itemprop="addressRegion">' . $state . '</span>'; |
|
221 | + if ( ! empty($state)) { |
|
222 | + return '<span itemprop="addressRegion">'.$state.'</span>'; |
|
223 | 223 | } else { |
224 | 224 | return ''; |
225 | 225 | } |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | public static function addressCountry(EEI_Address $obj_with_address = null) |
239 | 239 | { |
240 | 240 | $country = $obj_with_address->country_name(); |
241 | - if (! empty($country)) { |
|
242 | - return '<span itemprop="addressCountry">' . $country . '</span>'; |
|
241 | + if ( ! empty($country)) { |
|
242 | + return '<span itemprop="addressCountry">'.$country.'</span>'; |
|
243 | 243 | } else { |
244 | 244 | return ''; |
245 | 245 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | */ |
275 | 275 | public static function telephone($phone_nmbr = null) |
276 | 276 | { |
277 | - return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">' . $phone_nmbr . '</span>' |
|
277 | + return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">'.$phone_nmbr.'</span>' |
|
278 | 278 | : ''; |
279 | 279 | } |
280 | 280 | |
@@ -295,15 +295,15 @@ discard block |
||
295 | 295 | // Check the URL includes a scheme |
296 | 296 | $parsed_url = parse_url($url); |
297 | 297 | if (empty($parsed_url['scheme'])) { |
298 | - $url = 'https://' . ltrim($url, '/'); |
|
298 | + $url = 'https://'.ltrim($url, '/'); |
|
299 | 299 | } |
300 | 300 | $atts = ''; |
301 | 301 | foreach ($attributes as $attribute => $value) { |
302 | - $atts .= ' ' . $attribute . '="' . $value . '"'; |
|
302 | + $atts .= ' '.$attribute.'="'.$value.'"'; |
|
303 | 303 | } |
304 | 304 | $text = $text !== null && $text !== '' ? $text : esc_url($url); |
305 | 305 | return ! empty($url) |
306 | - ? '<a itemprop="url" href="' . esc_url_raw($url) . '"' . $atts . '>' . $text . '</a>' |
|
306 | + ? '<a itemprop="url" href="'.esc_url_raw($url).'"'.$atts.'>'.$text.'</a>' |
|
307 | 307 | : ''; |
308 | 308 | } |
309 | 309 | } |
@@ -10,298 +10,298 @@ |
||
10 | 10 | */ |
11 | 11 | class EEH_Schema |
12 | 12 | { |
13 | - /** |
|
14 | - * generates JSON-based linked data for an event |
|
15 | - * |
|
16 | - * @param EE_Event $event |
|
17 | - * @throws EE_Error |
|
18 | - */ |
|
19 | - public static function add_json_linked_data_for_event(EE_Event $event) |
|
20 | - { |
|
21 | - // Check we have a valid datetime for the event |
|
22 | - if (! $event->primary_datetime() instanceof EE_Datetime) { |
|
23 | - return; |
|
24 | - } |
|
13 | + /** |
|
14 | + * generates JSON-based linked data for an event |
|
15 | + * |
|
16 | + * @param EE_Event $event |
|
17 | + * @throws EE_Error |
|
18 | + */ |
|
19 | + public static function add_json_linked_data_for_event(EE_Event $event) |
|
20 | + { |
|
21 | + // Check we have a valid datetime for the event |
|
22 | + if (! $event->primary_datetime() instanceof EE_Datetime) { |
|
23 | + return; |
|
24 | + } |
|
25 | 25 | |
26 | - $template_args = array( |
|
27 | - 'event_permalink' => '', |
|
28 | - 'event_name' => '', |
|
29 | - 'event_description' => '', |
|
30 | - 'event_start' => '', |
|
31 | - 'event_end' => '', |
|
32 | - 'event_attendance_mode' => '', |
|
33 | - 'event_status' => '', |
|
34 | - 'currency' => '', |
|
35 | - 'event_tickets' => array(), |
|
36 | - 'venue_name' => '', |
|
37 | - 'venue_url' => '', |
|
38 | - 'venue_locality' => '', |
|
39 | - 'venue_region' => '', |
|
40 | - 'venue_address' => '', |
|
41 | - 'event_image' => '', |
|
42 | - ); |
|
43 | - $template_args['event_permalink'] = $event->get_permalink(); |
|
44 | - $template_args['event_name'] = $event->name(); |
|
45 | - $template_args['event_description'] = wp_strip_all_tags($event->short_description(200)); |
|
46 | - // clone datetime so that date formats don't override those for the original datetime |
|
47 | - $primary_datetime = clone $event->primary_datetime(); |
|
48 | - $template_args['event_start'] = $primary_datetime->start_date(DateTime::ATOM); |
|
49 | - $template_args['event_end'] = $primary_datetime->end_date(DateTime::ATOM); |
|
50 | - unset($primary_datetime); |
|
51 | - switch ($event->status()) { |
|
52 | - case EEM_Event::cancelled: |
|
53 | - $event_status = 'EventCancelled'; |
|
54 | - break; |
|
55 | - case EEM_Event::postponed: |
|
56 | - $event_status = 'EventPostponed'; |
|
57 | - break; |
|
58 | - default: |
|
59 | - $event_status = 'EventScheduled'; |
|
60 | - } |
|
61 | - $template_args['event_attendance_mode'] = 'OfflineEventAttendanceMode'; |
|
62 | - $template_args['event_status'] = 'https://schema.org/' . $event_status; |
|
63 | - $template_args['currency'] = EE_Registry::instance()->CFG->currency->code; |
|
64 | - foreach ($event->tickets() as $original_ticket) { |
|
65 | - // clone tickets so that date formats don't override those for the original ticket |
|
66 | - $ticket = clone $original_ticket; |
|
67 | - $ID = $ticket->ID(); |
|
68 | - $template_args['event_tickets'][ $ID ]['start_date'] = $ticket->start_date(DateTime::ATOM, null); |
|
69 | - $template_args['event_tickets'][ $ID ]['end_date'] = $ticket->end_date(DateTime::ATOM, null); |
|
70 | - $template_args['event_tickets'][ $ID ]['price'] = number_format( |
|
71 | - $ticket->price(), |
|
72 | - EE_Registry::instance()->CFG->currency->dec_plc, |
|
73 | - EE_Registry::instance()->CFG->currency->dec_mrk, |
|
74 | - '' |
|
75 | - ); |
|
76 | - switch ($ticket->ticket_status()) { |
|
77 | - case 'TKO': |
|
78 | - $availability = 'InStock'; |
|
79 | - break; |
|
80 | - case 'TKS': |
|
81 | - $availability = 'SoldOut'; |
|
82 | - break; |
|
83 | - default: |
|
84 | - $availability = null; |
|
85 | - break; |
|
86 | - } |
|
87 | - $template_args['event_tickets'][ $ID ]['availability'] = $availability; |
|
88 | - unset($ticket); |
|
89 | - } |
|
90 | - $VNU_ID = espresso_venue_id(); |
|
91 | - if (! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) { |
|
92 | - $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
93 | - $template_args['venue_name'] = get_the_title($VNU_ID); |
|
94 | - $template_args['venue_url'] = get_permalink($VNU_ID); |
|
95 | - $template_args['venue_locality'] = $venue->city(); |
|
96 | - $template_args['venue_region'] = $venue->state_name(); |
|
97 | - $template_args['venue_address'] = $venue->address(); |
|
98 | - if ($venue->virtual_url() !== '') { |
|
99 | - $template_args['event_attendance_mode'] = 'OnlineEventAttendanceMode'; |
|
100 | - } |
|
101 | - if ($venue->virtual_url() !== '' && $venue->address() !== '') { |
|
102 | - $template_args['event_attendance_mode'] = 'MixedEventAttendanceMode'; |
|
103 | - } |
|
104 | - } |
|
105 | - $template_args['event_image'] = $event->feature_image_url(); |
|
106 | - $template_args = apply_filters( |
|
107 | - 'FHEE__EEH_Schema__add_json_linked_data_for_event__template_args', |
|
108 | - $template_args, |
|
109 | - $event, |
|
110 | - $VNU_ID |
|
111 | - ); |
|
112 | - extract($template_args, EXTR_OVERWRITE); |
|
113 | - include EE_TEMPLATES . 'json_linked_data_for_event.template.php'; |
|
114 | - } |
|
26 | + $template_args = array( |
|
27 | + 'event_permalink' => '', |
|
28 | + 'event_name' => '', |
|
29 | + 'event_description' => '', |
|
30 | + 'event_start' => '', |
|
31 | + 'event_end' => '', |
|
32 | + 'event_attendance_mode' => '', |
|
33 | + 'event_status' => '', |
|
34 | + 'currency' => '', |
|
35 | + 'event_tickets' => array(), |
|
36 | + 'venue_name' => '', |
|
37 | + 'venue_url' => '', |
|
38 | + 'venue_locality' => '', |
|
39 | + 'venue_region' => '', |
|
40 | + 'venue_address' => '', |
|
41 | + 'event_image' => '', |
|
42 | + ); |
|
43 | + $template_args['event_permalink'] = $event->get_permalink(); |
|
44 | + $template_args['event_name'] = $event->name(); |
|
45 | + $template_args['event_description'] = wp_strip_all_tags($event->short_description(200)); |
|
46 | + // clone datetime so that date formats don't override those for the original datetime |
|
47 | + $primary_datetime = clone $event->primary_datetime(); |
|
48 | + $template_args['event_start'] = $primary_datetime->start_date(DateTime::ATOM); |
|
49 | + $template_args['event_end'] = $primary_datetime->end_date(DateTime::ATOM); |
|
50 | + unset($primary_datetime); |
|
51 | + switch ($event->status()) { |
|
52 | + case EEM_Event::cancelled: |
|
53 | + $event_status = 'EventCancelled'; |
|
54 | + break; |
|
55 | + case EEM_Event::postponed: |
|
56 | + $event_status = 'EventPostponed'; |
|
57 | + break; |
|
58 | + default: |
|
59 | + $event_status = 'EventScheduled'; |
|
60 | + } |
|
61 | + $template_args['event_attendance_mode'] = 'OfflineEventAttendanceMode'; |
|
62 | + $template_args['event_status'] = 'https://schema.org/' . $event_status; |
|
63 | + $template_args['currency'] = EE_Registry::instance()->CFG->currency->code; |
|
64 | + foreach ($event->tickets() as $original_ticket) { |
|
65 | + // clone tickets so that date formats don't override those for the original ticket |
|
66 | + $ticket = clone $original_ticket; |
|
67 | + $ID = $ticket->ID(); |
|
68 | + $template_args['event_tickets'][ $ID ]['start_date'] = $ticket->start_date(DateTime::ATOM, null); |
|
69 | + $template_args['event_tickets'][ $ID ]['end_date'] = $ticket->end_date(DateTime::ATOM, null); |
|
70 | + $template_args['event_tickets'][ $ID ]['price'] = number_format( |
|
71 | + $ticket->price(), |
|
72 | + EE_Registry::instance()->CFG->currency->dec_plc, |
|
73 | + EE_Registry::instance()->CFG->currency->dec_mrk, |
|
74 | + '' |
|
75 | + ); |
|
76 | + switch ($ticket->ticket_status()) { |
|
77 | + case 'TKO': |
|
78 | + $availability = 'InStock'; |
|
79 | + break; |
|
80 | + case 'TKS': |
|
81 | + $availability = 'SoldOut'; |
|
82 | + break; |
|
83 | + default: |
|
84 | + $availability = null; |
|
85 | + break; |
|
86 | + } |
|
87 | + $template_args['event_tickets'][ $ID ]['availability'] = $availability; |
|
88 | + unset($ticket); |
|
89 | + } |
|
90 | + $VNU_ID = espresso_venue_id(); |
|
91 | + if (! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) { |
|
92 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
93 | + $template_args['venue_name'] = get_the_title($VNU_ID); |
|
94 | + $template_args['venue_url'] = get_permalink($VNU_ID); |
|
95 | + $template_args['venue_locality'] = $venue->city(); |
|
96 | + $template_args['venue_region'] = $venue->state_name(); |
|
97 | + $template_args['venue_address'] = $venue->address(); |
|
98 | + if ($venue->virtual_url() !== '') { |
|
99 | + $template_args['event_attendance_mode'] = 'OnlineEventAttendanceMode'; |
|
100 | + } |
|
101 | + if ($venue->virtual_url() !== '' && $venue->address() !== '') { |
|
102 | + $template_args['event_attendance_mode'] = 'MixedEventAttendanceMode'; |
|
103 | + } |
|
104 | + } |
|
105 | + $template_args['event_image'] = $event->feature_image_url(); |
|
106 | + $template_args = apply_filters( |
|
107 | + 'FHEE__EEH_Schema__add_json_linked_data_for_event__template_args', |
|
108 | + $template_args, |
|
109 | + $event, |
|
110 | + $VNU_ID |
|
111 | + ); |
|
112 | + extract($template_args, EXTR_OVERWRITE); |
|
113 | + include EE_TEMPLATES . 'json_linked_data_for_event.template.php'; |
|
114 | + } |
|
115 | 115 | |
116 | 116 | |
117 | - /** |
|
118 | - * location |
|
119 | - * The location of the event, organization or action. |
|
120 | - * Should include the Venue name AND schema formatted address info |
|
121 | - * |
|
122 | - * @access public |
|
123 | - * @param string $location |
|
124 | - * @return string |
|
125 | - */ |
|
126 | - public static function location($location = null) |
|
127 | - { |
|
128 | - return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">' |
|
129 | - . $location |
|
130 | - . '</div>' : ''; |
|
131 | - } |
|
117 | + /** |
|
118 | + * location |
|
119 | + * The location of the event, organization or action. |
|
120 | + * Should include the Venue name AND schema formatted address info |
|
121 | + * |
|
122 | + * @access public |
|
123 | + * @param string $location |
|
124 | + * @return string |
|
125 | + */ |
|
126 | + public static function location($location = null) |
|
127 | + { |
|
128 | + return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">' |
|
129 | + . $location |
|
130 | + . '</div>' : ''; |
|
131 | + } |
|
132 | 132 | |
133 | 133 | |
134 | 134 | |
135 | - /** |
|
136 | - * name |
|
137 | - * The name of the Event or Venue. |
|
138 | - * |
|
139 | - * @access public |
|
140 | - * @param string $name |
|
141 | - * @return string |
|
142 | - */ |
|
143 | - public static function name($name = null) |
|
144 | - { |
|
145 | - return ! empty($name) ? '<span itemprop="name">' . $name . '</span>' : ''; |
|
146 | - } |
|
135 | + /** |
|
136 | + * name |
|
137 | + * The name of the Event or Venue. |
|
138 | + * |
|
139 | + * @access public |
|
140 | + * @param string $name |
|
141 | + * @return string |
|
142 | + */ |
|
143 | + public static function name($name = null) |
|
144 | + { |
|
145 | + return ! empty($name) ? '<span itemprop="name">' . $name . '</span>' : ''; |
|
146 | + } |
|
147 | 147 | |
148 | 148 | |
149 | 149 | |
150 | - /** |
|
151 | - * streetAddress |
|
152 | - * The street address. For example, 1600 Amphitheatre Pkwy. |
|
153 | - * |
|
154 | - * @access public |
|
155 | - * @param EEI_Address $obj_with_address |
|
156 | - * @return string |
|
157 | - */ |
|
158 | - public static function streetAddress(EEI_Address $obj_with_address = null) |
|
159 | - { |
|
160 | - return $obj_with_address->address() !== null && $obj_with_address->address() !== '' |
|
161 | - ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : ''; |
|
162 | - } |
|
150 | + /** |
|
151 | + * streetAddress |
|
152 | + * The street address. For example, 1600 Amphitheatre Pkwy. |
|
153 | + * |
|
154 | + * @access public |
|
155 | + * @param EEI_Address $obj_with_address |
|
156 | + * @return string |
|
157 | + */ |
|
158 | + public static function streetAddress(EEI_Address $obj_with_address = null) |
|
159 | + { |
|
160 | + return $obj_with_address->address() !== null && $obj_with_address->address() !== '' |
|
161 | + ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : ''; |
|
162 | + } |
|
163 | 163 | |
164 | 164 | |
165 | 165 | |
166 | - /** |
|
167 | - * postOfficeBoxNumber |
|
168 | - * The post office box number for PO box addresses. |
|
169 | - * |
|
170 | - * @access public |
|
171 | - * @param EEI_Address $obj_with_address |
|
172 | - * @return string |
|
173 | - */ |
|
174 | - public static function postOfficeBoxNumber(EEI_Address $obj_with_address = null) |
|
175 | - { |
|
176 | - // regex check for some form of PO Box or P.O. Box, etc, etc, etc |
|
177 | - if ( |
|
178 | - preg_match( |
|
179 | - "/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", |
|
180 | - $obj_with_address->address2() |
|
181 | - ) |
|
182 | - ) { |
|
183 | - return $obj_with_address->address2() !== null && $obj_with_address->address2() !== '' |
|
184 | - ? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : ''; |
|
185 | - } else { |
|
186 | - return $obj_with_address->address2(); |
|
187 | - } |
|
188 | - } |
|
166 | + /** |
|
167 | + * postOfficeBoxNumber |
|
168 | + * The post office box number for PO box addresses. |
|
169 | + * |
|
170 | + * @access public |
|
171 | + * @param EEI_Address $obj_with_address |
|
172 | + * @return string |
|
173 | + */ |
|
174 | + public static function postOfficeBoxNumber(EEI_Address $obj_with_address = null) |
|
175 | + { |
|
176 | + // regex check for some form of PO Box or P.O. Box, etc, etc, etc |
|
177 | + if ( |
|
178 | + preg_match( |
|
179 | + "/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", |
|
180 | + $obj_with_address->address2() |
|
181 | + ) |
|
182 | + ) { |
|
183 | + return $obj_with_address->address2() !== null && $obj_with_address->address2() !== '' |
|
184 | + ? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : ''; |
|
185 | + } else { |
|
186 | + return $obj_with_address->address2(); |
|
187 | + } |
|
188 | + } |
|
189 | 189 | |
190 | 190 | |
191 | 191 | |
192 | - /** |
|
193 | - * addressLocality |
|
194 | - * The locality (city, town, etc). For example, Mountain View. |
|
195 | - * |
|
196 | - * @access public |
|
197 | - * @param EEI_Address $obj_with_address |
|
198 | - * @return string |
|
199 | - */ |
|
200 | - public static function addressLocality(EEI_Address $obj_with_address = null) |
|
201 | - { |
|
202 | - return $obj_with_address->city() !== null && $obj_with_address->city() !== '' |
|
203 | - ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : ''; |
|
204 | - } |
|
192 | + /** |
|
193 | + * addressLocality |
|
194 | + * The locality (city, town, etc). For example, Mountain View. |
|
195 | + * |
|
196 | + * @access public |
|
197 | + * @param EEI_Address $obj_with_address |
|
198 | + * @return string |
|
199 | + */ |
|
200 | + public static function addressLocality(EEI_Address $obj_with_address = null) |
|
201 | + { |
|
202 | + return $obj_with_address->city() !== null && $obj_with_address->city() !== '' |
|
203 | + ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : ''; |
|
204 | + } |
|
205 | 205 | |
206 | 206 | |
207 | 207 | |
208 | - /** |
|
209 | - * addressRegion |
|
210 | - * The region (state, province, etc). For example, CA. |
|
211 | - * |
|
212 | - * @access public |
|
213 | - * @param EEI_Address $obj_with_address |
|
214 | - * @return string |
|
215 | - */ |
|
216 | - public static function addressRegion(EEI_Address $obj_with_address = null) |
|
217 | - { |
|
218 | - $state = $obj_with_address->state_name(); |
|
219 | - if (! empty($state)) { |
|
220 | - return '<span itemprop="addressRegion">' . $state . '</span>'; |
|
221 | - } else { |
|
222 | - return ''; |
|
223 | - } |
|
224 | - } |
|
208 | + /** |
|
209 | + * addressRegion |
|
210 | + * The region (state, province, etc). For example, CA. |
|
211 | + * |
|
212 | + * @access public |
|
213 | + * @param EEI_Address $obj_with_address |
|
214 | + * @return string |
|
215 | + */ |
|
216 | + public static function addressRegion(EEI_Address $obj_with_address = null) |
|
217 | + { |
|
218 | + $state = $obj_with_address->state_name(); |
|
219 | + if (! empty($state)) { |
|
220 | + return '<span itemprop="addressRegion">' . $state . '</span>'; |
|
221 | + } else { |
|
222 | + return ''; |
|
223 | + } |
|
224 | + } |
|
225 | 225 | |
226 | 226 | |
227 | 227 | |
228 | - /** |
|
229 | - * addressCountry |
|
230 | - * The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code. |
|
231 | - * |
|
232 | - * @access public |
|
233 | - * @param EEI_Address $obj_with_address |
|
234 | - * @return string |
|
235 | - */ |
|
236 | - public static function addressCountry(EEI_Address $obj_with_address = null) |
|
237 | - { |
|
238 | - $country = $obj_with_address->country_name(); |
|
239 | - if (! empty($country)) { |
|
240 | - return '<span itemprop="addressCountry">' . $country . '</span>'; |
|
241 | - } else { |
|
242 | - return ''; |
|
243 | - } |
|
244 | - } |
|
228 | + /** |
|
229 | + * addressCountry |
|
230 | + * The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code. |
|
231 | + * |
|
232 | + * @access public |
|
233 | + * @param EEI_Address $obj_with_address |
|
234 | + * @return string |
|
235 | + */ |
|
236 | + public static function addressCountry(EEI_Address $obj_with_address = null) |
|
237 | + { |
|
238 | + $country = $obj_with_address->country_name(); |
|
239 | + if (! empty($country)) { |
|
240 | + return '<span itemprop="addressCountry">' . $country . '</span>'; |
|
241 | + } else { |
|
242 | + return ''; |
|
243 | + } |
|
244 | + } |
|
245 | 245 | |
246 | 246 | |
247 | 247 | |
248 | - /** |
|
249 | - * postalCode |
|
250 | - * The postal code. For example, 94043. |
|
251 | - * |
|
252 | - * @access public |
|
253 | - * @param EEI_Address $obj_with_address |
|
254 | - * @return string |
|
255 | - */ |
|
256 | - public static function postalCode(EEI_Address $obj_with_address = null) |
|
257 | - { |
|
258 | - return $obj_with_address->zip() !== null && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">' |
|
259 | - . $obj_with_address->zip() |
|
260 | - . '</span>' : ''; |
|
261 | - } |
|
248 | + /** |
|
249 | + * postalCode |
|
250 | + * The postal code. For example, 94043. |
|
251 | + * |
|
252 | + * @access public |
|
253 | + * @param EEI_Address $obj_with_address |
|
254 | + * @return string |
|
255 | + */ |
|
256 | + public static function postalCode(EEI_Address $obj_with_address = null) |
|
257 | + { |
|
258 | + return $obj_with_address->zip() !== null && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">' |
|
259 | + . $obj_with_address->zip() |
|
260 | + . '</span>' : ''; |
|
261 | + } |
|
262 | 262 | |
263 | 263 | |
264 | 264 | |
265 | - /** |
|
266 | - * telephone |
|
267 | - * The telephone number. |
|
268 | - * |
|
269 | - * @access public |
|
270 | - * @param string $phone_nmbr |
|
271 | - * @return string |
|
272 | - */ |
|
273 | - public static function telephone($phone_nmbr = null) |
|
274 | - { |
|
275 | - return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">' . $phone_nmbr . '</span>' |
|
276 | - : ''; |
|
277 | - } |
|
265 | + /** |
|
266 | + * telephone |
|
267 | + * The telephone number. |
|
268 | + * |
|
269 | + * @access public |
|
270 | + * @param string $phone_nmbr |
|
271 | + * @return string |
|
272 | + */ |
|
273 | + public static function telephone($phone_nmbr = null) |
|
274 | + { |
|
275 | + return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">' . $phone_nmbr . '</span>' |
|
276 | + : ''; |
|
277 | + } |
|
278 | 278 | |
279 | 279 | |
280 | 280 | |
281 | - /** |
|
282 | - * URL |
|
283 | - * URL of the item as a clickable link |
|
284 | - * |
|
285 | - * @access public |
|
286 | - * @param string $url - the URL that the link will resolve to |
|
287 | - * @param string $text - the text that will be used for the visible link |
|
288 | - * @param array $attributes - array of additional link attributes in attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' ) |
|
289 | - * @return string (link) |
|
290 | - */ |
|
291 | - public static function url($url = null, $text = null, $attributes = array()) |
|
292 | - { |
|
293 | - // Check the URL includes a scheme |
|
294 | - $parsed_url = parse_url($url); |
|
295 | - if (empty($parsed_url['scheme'])) { |
|
296 | - $url = 'https://' . ltrim($url, '/'); |
|
297 | - } |
|
298 | - $atts = ''; |
|
299 | - foreach ($attributes as $attribute => $value) { |
|
300 | - $atts .= ' ' . $attribute . '="' . $value . '"'; |
|
301 | - } |
|
302 | - $text = $text !== null && $text !== '' ? $text : esc_url($url); |
|
303 | - return ! empty($url) |
|
304 | - ? '<a itemprop="url" href="' . esc_url_raw($url) . '"' . $atts . '>' . $text . '</a>' |
|
305 | - : ''; |
|
306 | - } |
|
281 | + /** |
|
282 | + * URL |
|
283 | + * URL of the item as a clickable link |
|
284 | + * |
|
285 | + * @access public |
|
286 | + * @param string $url - the URL that the link will resolve to |
|
287 | + * @param string $text - the text that will be used for the visible link |
|
288 | + * @param array $attributes - array of additional link attributes in attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' ) |
|
289 | + * @return string (link) |
|
290 | + */ |
|
291 | + public static function url($url = null, $text = null, $attributes = array()) |
|
292 | + { |
|
293 | + // Check the URL includes a scheme |
|
294 | + $parsed_url = parse_url($url); |
|
295 | + if (empty($parsed_url['scheme'])) { |
|
296 | + $url = 'https://' . ltrim($url, '/'); |
|
297 | + } |
|
298 | + $atts = ''; |
|
299 | + foreach ($attributes as $attribute => $value) { |
|
300 | + $atts .= ' ' . $attribute . '="' . $value . '"'; |
|
301 | + } |
|
302 | + $text = $text !== null && $text !== '' ? $text : esc_url($url); |
|
303 | + return ! empty($url) |
|
304 | + ? '<a itemprop="url" href="' . esc_url_raw($url) . '"' . $atts . '>' . $text . '</a>' |
|
305 | + : ''; |
|
306 | + } |
|
307 | 307 | } |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | ) { |
205 | 205 | $class = trim($class, '\\'); |
206 | 206 | $registered = false; |
207 | - if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
208 | - self::$_instance->_dependency_map[ $class ] = []; |
|
207 | + if (empty(self::$_instance->_dependency_map[$class])) { |
|
208 | + self::$_instance->_dependency_map[$class] = []; |
|
209 | 209 | } |
210 | 210 | // we need to make sure that any aliases used when registering a dependency |
211 | 211 | // get resolved to the correct class name |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | $alias = self::$_instance->getFqnForAlias($dependency); |
214 | 214 | if ( |
215 | 215 | $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
216 | - || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
216 | + || ! isset(self::$_instance->_dependency_map[$class][$alias]) |
|
217 | 217 | ) { |
218 | - unset($dependencies[ $dependency ]); |
|
219 | - $dependencies[ $alias ] = $load_source; |
|
218 | + unset($dependencies[$dependency]); |
|
219 | + $dependencies[$alias] = $load_source; |
|
220 | 220 | $registered = true; |
221 | 221 | } |
222 | 222 | } |
@@ -226,13 +226,13 @@ discard block |
||
226 | 226 | // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
227 | 227 | // Union is way faster than array_merge() but should be used with caution... |
228 | 228 | // especially with numerically indexed arrays |
229 | - $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
229 | + $dependencies += self::$_instance->_dependency_map[$class]; |
|
230 | 230 | // now we need to ensure that the resulting dependencies |
231 | 231 | // array only has the entries that are required for the class |
232 | 232 | // so first count how many dependencies were originally registered for the class |
233 | - $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
233 | + $dependency_count = count(self::$_instance->_dependency_map[$class]); |
|
234 | 234 | // if that count is non-zero (meaning dependencies were already registered) |
235 | - self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
235 | + self::$_instance->_dependency_map[$class] = $dependency_count |
|
236 | 236 | // then truncate the final array to match that count |
237 | 237 | ? array_slice($dependencies, 0, $dependency_count) |
238 | 238 | // otherwise just take the incoming array because nothing previously existed |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public static function register_class_loader($class_name, $loader = 'load_core', $overwrite = false) |
252 | 252 | { |
253 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
253 | + if ( ! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
254 | 254 | throw new DomainException( |
255 | 255 | esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
256 | 256 | ); |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | ); |
275 | 275 | } |
276 | 276 | $class_name = self::$_instance->getFqnForAlias($class_name); |
277 | - if ($overwrite || ! isset(self::$_instance->_class_loaders[ $class_name ])) { |
|
278 | - self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
277 | + if ($overwrite || ! isset(self::$_instance->_class_loaders[$class_name])) { |
|
278 | + self::$_instance->_class_loaders[$class_name] = $loader; |
|
279 | 279 | return true; |
280 | 280 | } |
281 | 281 | return false; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | if (strpos($class_name, 'EEM_') === 0) { |
304 | 304 | $class_name = 'LEGACY_MODELS'; |
305 | 305 | } |
306 | - return isset($this->_dependency_map[ $class_name ]); |
|
306 | + return isset($this->_dependency_map[$class_name]); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $class_name = 'LEGACY_MODELS'; |
322 | 322 | } |
323 | 323 | $dependency = $this->getFqnForAlias($dependency, $class_name); |
324 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
324 | + return isset($this->_dependency_map[$class_name][$dependency]); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | } |
341 | 341 | $dependency = $this->getFqnForAlias($dependency); |
342 | 342 | return $this->has_dependency_for_class($class_name, $dependency) |
343 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
343 | + ? $this->_dependency_map[$class_name][$dependency] |
|
344 | 344 | : EE_Dependency_Map::not_registered; |
345 | 345 | } |
346 | 346 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | return 'load_core'; |
365 | 365 | } |
366 | 366 | $class_name = $this->getFqnForAlias($class_name); |
367 | - return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
367 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | { |
949 | 949 | $this->_class_loaders = [ |
950 | 950 | // load_core |
951 | - 'EE_Dependency_Map' => function () { |
|
951 | + 'EE_Dependency_Map' => function() { |
|
952 | 952 | return $this; |
953 | 953 | }, |
954 | 954 | 'EE_Capabilities' => 'load_core', |
@@ -956,13 +956,13 @@ discard block |
||
956 | 956 | 'EE_Front_Controller' => 'load_core', |
957 | 957 | 'EE_Module_Request_Router' => 'load_core', |
958 | 958 | 'EE_Registry' => 'load_core', |
959 | - 'EE_Request' => function () { |
|
959 | + 'EE_Request' => function() { |
|
960 | 960 | return $this->legacy_request; |
961 | 961 | }, |
962 | - 'EventEspresso\core\services\request\Request' => function () { |
|
962 | + 'EventEspresso\core\services\request\Request' => function() { |
|
963 | 963 | return $this->request; |
964 | 964 | }, |
965 | - 'EventEspresso\core\services\request\Response' => function () { |
|
965 | + 'EventEspresso\core\services\request\Response' => function() { |
|
966 | 966 | return $this->response; |
967 | 967 | }, |
968 | 968 | 'EE_Base' => 'load_core', |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | 'EE_DMS_Core_4_8_0' => 'load_dms', |
998 | 998 | 'EE_DMS_Core_4_9_0' => 'load_dms', |
999 | 999 | 'EE_DMS_Core_4_10_0' => 'load_dms', |
1000 | - 'EE_Messages_Generator' => function () { |
|
1000 | + 'EE_Messages_Generator' => function() { |
|
1001 | 1001 | return EE_Registry::instance()->load_lib( |
1002 | 1002 | 'Messages_Generator', |
1003 | 1003 | [], |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | false |
1006 | 1006 | ); |
1007 | 1007 | }, |
1008 | - 'EE_Messages_Template_Defaults' => function ($arguments = []) { |
|
1008 | + 'EE_Messages_Template_Defaults' => function($arguments = []) { |
|
1009 | 1009 | return EE_Registry::instance()->load_lib( |
1010 | 1010 | 'Messages_Template_Defaults', |
1011 | 1011 | $arguments, |
@@ -1014,49 +1014,49 @@ discard block |
||
1014 | 1014 | ); |
1015 | 1015 | }, |
1016 | 1016 | // load_helper |
1017 | - 'EEH_Parse_Shortcodes' => function () { |
|
1017 | + 'EEH_Parse_Shortcodes' => function() { |
|
1018 | 1018 | if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
1019 | 1019 | return new EEH_Parse_Shortcodes(); |
1020 | 1020 | } |
1021 | 1021 | return null; |
1022 | 1022 | }, |
1023 | - 'EE_Template_Config' => function () { |
|
1023 | + 'EE_Template_Config' => function() { |
|
1024 | 1024 | return EE_Config::instance()->template_settings; |
1025 | 1025 | }, |
1026 | - 'EE_Currency_Config' => function () { |
|
1026 | + 'EE_Currency_Config' => function() { |
|
1027 | 1027 | return EE_Config::instance()->currency; |
1028 | 1028 | }, |
1029 | - 'EE_Registration_Config' => function () { |
|
1029 | + 'EE_Registration_Config' => function() { |
|
1030 | 1030 | return EE_Config::instance()->registration; |
1031 | 1031 | }, |
1032 | - 'EE_Core_Config' => function () { |
|
1032 | + 'EE_Core_Config' => function() { |
|
1033 | 1033 | return EE_Config::instance()->core; |
1034 | 1034 | }, |
1035 | - 'EventEspresso\core\services\loaders\Loader' => function () { |
|
1035 | + 'EventEspresso\core\services\loaders\Loader' => function() { |
|
1036 | 1036 | return LoaderFactory::getLoader(); |
1037 | 1037 | }, |
1038 | - 'EE_Network_Config' => function () { |
|
1038 | + 'EE_Network_Config' => function() { |
|
1039 | 1039 | return EE_Network_Config::instance(); |
1040 | 1040 | }, |
1041 | - 'EE_Config' => function () { |
|
1041 | + 'EE_Config' => function() { |
|
1042 | 1042 | return EE_Config::instance(); |
1043 | 1043 | }, |
1044 | - 'EventEspresso\core\domain\Domain' => function () { |
|
1044 | + 'EventEspresso\core\domain\Domain' => function() { |
|
1045 | 1045 | return DomainFactory::getEventEspressoCoreDomain(); |
1046 | 1046 | }, |
1047 | - 'EE_Admin_Config' => function () { |
|
1047 | + 'EE_Admin_Config' => function() { |
|
1048 | 1048 | return EE_Config::instance()->admin; |
1049 | 1049 | }, |
1050 | - 'EE_Organization_Config' => function () { |
|
1050 | + 'EE_Organization_Config' => function() { |
|
1051 | 1051 | return EE_Config::instance()->organization; |
1052 | 1052 | }, |
1053 | - 'EE_Network_Core_Config' => function () { |
|
1053 | + 'EE_Network_Core_Config' => function() { |
|
1054 | 1054 | return EE_Network_Config::instance()->core; |
1055 | 1055 | }, |
1056 | - 'EE_Environment_Config' => function () { |
|
1056 | + 'EE_Environment_Config' => function() { |
|
1057 | 1057 | return EE_Config::instance()->environment; |
1058 | 1058 | }, |
1059 | - 'EE_Ticket_Selector_Config' => function () { |
|
1059 | + 'EE_Ticket_Selector_Config' => function() { |
|
1060 | 1060 | return EE_Config::instance()->template_settings->EED_Ticket_Selector; |
1061 | 1061 | }, |
1062 | 1062 | ]; |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | } |
1119 | 1119 | $this->class_cache->addAlias($fqn, $alias); |
1120 | 1120 | } |
1121 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1121 | + if ( ! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1122 | 1122 | $this->class_cache->addAlias( |
1123 | 1123 | 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
1124 | 1124 | 'EventEspresso\core\services\notices\NoticeConverterInterface' |
@@ -19,1173 +19,1173 @@ |
||
19 | 19 | */ |
20 | 20 | class EE_Dependency_Map |
21 | 21 | { |
22 | - /** |
|
23 | - * This means that the requested class dependency is not present in the dependency map |
|
24 | - */ |
|
25 | - const not_registered = 0; |
|
26 | - |
|
27 | - /** |
|
28 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
29 | - */ |
|
30 | - const load_new_object = 1; |
|
31 | - |
|
32 | - /** |
|
33 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
34 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
35 | - */ |
|
36 | - const load_from_cache = 2; |
|
37 | - |
|
38 | - /** |
|
39 | - * When registering a dependency, |
|
40 | - * this indicates to keep any existing dependencies that already exist, |
|
41 | - * and simply discard any new dependencies declared in the incoming data |
|
42 | - */ |
|
43 | - const KEEP_EXISTING_DEPENDENCIES = 0; |
|
44 | - |
|
45 | - /** |
|
46 | - * When registering a dependency, |
|
47 | - * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
48 | - */ |
|
49 | - const OVERWRITE_DEPENDENCIES = 1; |
|
50 | - |
|
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 | - */ |
|
108 | - public function initialize() |
|
109 | - { |
|
110 | - $this->_register_core_dependencies(); |
|
111 | - $this->_register_core_class_loaders(); |
|
112 | - $this->_register_core_aliases(); |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * @singleton method used to instantiate class object |
|
118 | - * @param ClassInterfaceCache|null $class_cache |
|
119 | - * @return EE_Dependency_Map |
|
120 | - */ |
|
121 | - public static function instance(ClassInterfaceCache $class_cache = null) |
|
122 | - { |
|
123 | - // check if class object is instantiated, and instantiated properly |
|
124 | - if ( |
|
125 | - ! self::$_instance instanceof EE_Dependency_Map |
|
126 | - && $class_cache instanceof ClassInterfaceCache |
|
127 | - ) { |
|
128 | - self::$_instance = new EE_Dependency_Map($class_cache); |
|
129 | - } |
|
130 | - return self::$_instance; |
|
131 | - } |
|
132 | - |
|
133 | - |
|
134 | - /** |
|
135 | - * @param RequestInterface $request |
|
136 | - */ |
|
137 | - public function setRequest(RequestInterface $request) |
|
138 | - { |
|
139 | - $this->request = $request; |
|
140 | - } |
|
141 | - |
|
142 | - |
|
143 | - /** |
|
144 | - * @param LegacyRequestInterface $legacy_request |
|
145 | - */ |
|
146 | - public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
147 | - { |
|
148 | - $this->legacy_request = $legacy_request; |
|
149 | - } |
|
150 | - |
|
151 | - |
|
152 | - /** |
|
153 | - * @param ResponseInterface $response |
|
154 | - */ |
|
155 | - public function setResponse(ResponseInterface $response) |
|
156 | - { |
|
157 | - $this->response = $response; |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - /** |
|
162 | - * @param LoaderInterface $loader |
|
163 | - */ |
|
164 | - public function setLoader(LoaderInterface $loader) |
|
165 | - { |
|
166 | - $this->loader = $loader; |
|
167 | - } |
|
168 | - |
|
169 | - |
|
170 | - /** |
|
171 | - * @param string $class |
|
172 | - * @param array $dependencies |
|
173 | - * @param int $overwrite |
|
174 | - * @return bool |
|
175 | - */ |
|
176 | - public static function register_dependencies( |
|
177 | - $class, |
|
178 | - array $dependencies, |
|
179 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
180 | - ) { |
|
181 | - return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
182 | - } |
|
183 | - |
|
184 | - |
|
185 | - /** |
|
186 | - * Assigns an array of class names and corresponding load sources (new or cached) |
|
187 | - * to the class specified by the first parameter. |
|
188 | - * IMPORTANT !!! |
|
189 | - * The order of elements in the incoming $dependencies array MUST match |
|
190 | - * the order of the constructor parameters for the class in question. |
|
191 | - * This is especially important when overriding any existing dependencies that are registered. |
|
192 | - * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
193 | - * |
|
194 | - * @param string $class |
|
195 | - * @param array $dependencies |
|
196 | - * @param int $overwrite |
|
197 | - * @return bool |
|
198 | - */ |
|
199 | - public function registerDependencies( |
|
200 | - $class, |
|
201 | - array $dependencies, |
|
202 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
203 | - ) { |
|
204 | - $class = trim($class, '\\'); |
|
205 | - $registered = false; |
|
206 | - if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
207 | - self::$_instance->_dependency_map[ $class ] = []; |
|
208 | - } |
|
209 | - // we need to make sure that any aliases used when registering a dependency |
|
210 | - // get resolved to the correct class name |
|
211 | - foreach ($dependencies as $dependency => $load_source) { |
|
212 | - $alias = self::$_instance->getFqnForAlias($dependency); |
|
213 | - if ( |
|
214 | - $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
215 | - || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
216 | - ) { |
|
217 | - unset($dependencies[ $dependency ]); |
|
218 | - $dependencies[ $alias ] = $load_source; |
|
219 | - $registered = true; |
|
220 | - } |
|
221 | - } |
|
222 | - // now add our two lists of dependencies together. |
|
223 | - // using Union (+=) favours the arrays in precedence from left to right, |
|
224 | - // so $dependencies is NOT overwritten because it is listed first |
|
225 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
226 | - // Union is way faster than array_merge() but should be used with caution... |
|
227 | - // especially with numerically indexed arrays |
|
228 | - $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
229 | - // now we need to ensure that the resulting dependencies |
|
230 | - // array only has the entries that are required for the class |
|
231 | - // so first count how many dependencies were originally registered for the class |
|
232 | - $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
233 | - // if that count is non-zero (meaning dependencies were already registered) |
|
234 | - self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
235 | - // then truncate the final array to match that count |
|
236 | - ? array_slice($dependencies, 0, $dependency_count) |
|
237 | - // otherwise just take the incoming array because nothing previously existed |
|
238 | - : $dependencies; |
|
239 | - return $registered; |
|
240 | - } |
|
241 | - |
|
242 | - |
|
243 | - /** |
|
244 | - * @param string $class_name |
|
245 | - * @param string $loader |
|
246 | - * @param bool $overwrite |
|
247 | - * @return bool |
|
248 | - * @throws DomainException |
|
249 | - */ |
|
250 | - public static function register_class_loader($class_name, $loader = 'load_core', $overwrite = false) |
|
251 | - { |
|
252 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
253 | - throw new DomainException( |
|
254 | - esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
255 | - ); |
|
256 | - } |
|
257 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
258 | - if ( |
|
259 | - ! is_callable($loader) |
|
260 | - && ( |
|
261 | - strpos($loader, 'load_') !== 0 |
|
262 | - || ! method_exists('EE_Registry', $loader) |
|
263 | - ) |
|
264 | - ) { |
|
265 | - throw new DomainException( |
|
266 | - sprintf( |
|
267 | - esc_html__( |
|
268 | - '"%1$s" is not a valid loader method on EE_Registry.', |
|
269 | - 'event_espresso' |
|
270 | - ), |
|
271 | - $loader |
|
272 | - ) |
|
273 | - ); |
|
274 | - } |
|
275 | - $class_name = self::$_instance->getFqnForAlias($class_name); |
|
276 | - if ($overwrite || ! isset(self::$_instance->_class_loaders[ $class_name ])) { |
|
277 | - self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
278 | - return true; |
|
279 | - } |
|
280 | - return false; |
|
281 | - } |
|
282 | - |
|
283 | - |
|
284 | - /** |
|
285 | - * @return array |
|
286 | - */ |
|
287 | - public function dependency_map() |
|
288 | - { |
|
289 | - return $this->_dependency_map; |
|
290 | - } |
|
291 | - |
|
292 | - |
|
293 | - /** |
|
294 | - * returns TRUE if dependency map contains a listing for the provided class name |
|
295 | - * |
|
296 | - * @param string $class_name |
|
297 | - * @return boolean |
|
298 | - */ |
|
299 | - public function has($class_name = '') |
|
300 | - { |
|
301 | - // all legacy models have the same dependencies |
|
302 | - if (strpos($class_name, 'EEM_') === 0) { |
|
303 | - $class_name = 'LEGACY_MODELS'; |
|
304 | - } |
|
305 | - return isset($this->_dependency_map[ $class_name ]); |
|
306 | - } |
|
307 | - |
|
308 | - |
|
309 | - /** |
|
310 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
311 | - * |
|
312 | - * @param string $class_name |
|
313 | - * @param string $dependency |
|
314 | - * @return bool |
|
315 | - */ |
|
316 | - public function has_dependency_for_class($class_name = '', $dependency = '') |
|
317 | - { |
|
318 | - // all legacy models have the same dependencies |
|
319 | - if (strpos($class_name, 'EEM_') === 0) { |
|
320 | - $class_name = 'LEGACY_MODELS'; |
|
321 | - } |
|
322 | - $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
323 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
324 | - } |
|
325 | - |
|
326 | - |
|
327 | - /** |
|
328 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
329 | - * |
|
330 | - * @param string $class_name |
|
331 | - * @param string $dependency |
|
332 | - * @return int |
|
333 | - */ |
|
334 | - public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
335 | - { |
|
336 | - // all legacy models have the same dependencies |
|
337 | - if (strpos($class_name, 'EEM_') === 0) { |
|
338 | - $class_name = 'LEGACY_MODELS'; |
|
339 | - } |
|
340 | - $dependency = $this->getFqnForAlias($dependency); |
|
341 | - return $this->has_dependency_for_class($class_name, $dependency) |
|
342 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
343 | - : EE_Dependency_Map::not_registered; |
|
344 | - } |
|
345 | - |
|
346 | - |
|
347 | - /** |
|
348 | - * @param string $class_name |
|
349 | - * @return string | Closure |
|
350 | - */ |
|
351 | - public function class_loader($class_name) |
|
352 | - { |
|
353 | - // all legacy models use load_model() |
|
354 | - if (strpos($class_name, 'EEM_') === 0) { |
|
355 | - return 'load_model'; |
|
356 | - } |
|
357 | - // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
358 | - // perform strpos() first to avoid loading regex every time we load a class |
|
359 | - if ( |
|
360 | - strpos($class_name, 'EE_CPT_') === 0 |
|
361 | - && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
362 | - ) { |
|
363 | - return 'load_core'; |
|
364 | - } |
|
365 | - $class_name = $this->getFqnForAlias($class_name); |
|
366 | - return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
367 | - } |
|
368 | - |
|
369 | - |
|
370 | - /** |
|
371 | - * @return array |
|
372 | - */ |
|
373 | - public function class_loaders() |
|
374 | - { |
|
375 | - return $this->_class_loaders; |
|
376 | - } |
|
377 | - |
|
378 | - |
|
379 | - /** |
|
380 | - * adds an alias for a classname |
|
381 | - * |
|
382 | - * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
383 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
384 | - * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
385 | - */ |
|
386 | - public function add_alias($fqcn, $alias, $for_class = '') |
|
387 | - { |
|
388 | - $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
389 | - } |
|
390 | - |
|
391 | - |
|
392 | - /** |
|
393 | - * Returns TRUE if the provided fully qualified name IS an alias |
|
394 | - * WHY? |
|
395 | - * Because if a class is type hinting for a concretion, |
|
396 | - * then why would we need to find another class to supply it? |
|
397 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
398 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
399 | - * Don't go looking for some substitute. |
|
400 | - * Whereas if a class is type hinting for an interface... |
|
401 | - * then we need to find an actual class to use. |
|
402 | - * So the interface IS the alias for some other FQN, |
|
403 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
404 | - * represents some other class. |
|
405 | - * |
|
406 | - * @param string $fqn |
|
407 | - * @param string $for_class |
|
408 | - * @return bool |
|
409 | - */ |
|
410 | - public function isAlias($fqn = '', $for_class = '') |
|
411 | - { |
|
412 | - return $this->class_cache->isAlias($fqn, $for_class); |
|
413 | - } |
|
414 | - |
|
415 | - |
|
416 | - /** |
|
417 | - * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
418 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
419 | - * for example: |
|
420 | - * if the following two entries were added to the _aliases array: |
|
421 | - * array( |
|
422 | - * 'interface_alias' => 'some\namespace\interface' |
|
423 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
424 | - * ) |
|
425 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
426 | - * to load an instance of 'some\namespace\classname' |
|
427 | - * |
|
428 | - * @param string $alias |
|
429 | - * @param string $for_class |
|
430 | - * @return string |
|
431 | - */ |
|
432 | - public function getFqnForAlias($alias = '', $for_class = '') |
|
433 | - { |
|
434 | - return $this->class_cache->getFqnForAlias($alias, $for_class); |
|
435 | - } |
|
436 | - |
|
437 | - |
|
438 | - /** |
|
439 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
440 | - * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
441 | - * This is done by using the following class constants: |
|
442 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
443 | - * EE_Dependency_Map::load_new_object - generates a new object every time |
|
444 | - */ |
|
445 | - protected function _register_core_dependencies() |
|
446 | - { |
|
447 | - $this->_dependency_map = [ |
|
448 | - 'EE_Admin' => [ |
|
449 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
450 | - ], |
|
451 | - 'EE_Request_Handler' => [ |
|
452 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
453 | - 'EventEspresso\core\services\request\Response' => EE_Dependency_Map::load_from_cache, |
|
454 | - ], |
|
455 | - 'EE_System' => [ |
|
456 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
457 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
458 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
459 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
460 | - ], |
|
461 | - 'EE_Session' => [ |
|
462 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
463 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
464 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
465 | - 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
466 | - 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
467 | - ], |
|
468 | - 'EE_Cart' => [ |
|
469 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
470 | - ], |
|
471 | - 'EE_Front_Controller' => [ |
|
472 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
473 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
474 | - 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
475 | - ], |
|
476 | - 'EE_Messenger_Collection_Loader' => [ |
|
477 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
478 | - ], |
|
479 | - 'EE_Message_Type_Collection_Loader' => [ |
|
480 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
481 | - ], |
|
482 | - 'EE_Message_Resource_Manager' => [ |
|
483 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
484 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
485 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
486 | - ], |
|
487 | - 'EE_Message_Factory' => [ |
|
488 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
489 | - ], |
|
490 | - 'EE_messages' => [ |
|
491 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
492 | - ], |
|
493 | - 'EE_Messages_Generator' => [ |
|
494 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
495 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
496 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
497 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
498 | - ], |
|
499 | - 'EE_Messages_Processor' => [ |
|
500 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
501 | - ], |
|
502 | - 'EE_Messages_Queue' => [ |
|
503 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
504 | - ], |
|
505 | - 'EE_Messages_Template_Defaults' => [ |
|
506 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
507 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
508 | - ], |
|
509 | - 'EE_Message_To_Generate_From_Request' => [ |
|
510 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
511 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
512 | - ], |
|
513 | - 'EventEspresso\core\services\commands\CommandBus' => [ |
|
514 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
515 | - ], |
|
516 | - 'EventEspresso\services\commands\CommandHandler' => [ |
|
517 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
518 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
519 | - ], |
|
520 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => [ |
|
521 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
522 | - ], |
|
523 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => [ |
|
524 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
525 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
526 | - ], |
|
527 | - 'EventEspresso\core\services\commands\CommandFactory' => [ |
|
528 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
529 | - ], |
|
530 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => [ |
|
531 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
532 | - ], |
|
533 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [ |
|
534 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
535 | - ], |
|
536 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [ |
|
537 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
538 | - ], |
|
539 | - 'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommandHandler' => [ |
|
540 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
541 | - ], |
|
542 | - 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [ |
|
543 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
544 | - ], |
|
545 | - 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [ |
|
546 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
547 | - ], |
|
548 | - 'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [ |
|
549 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
550 | - ], |
|
551 | - 'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [ |
|
552 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
553 | - ], |
|
554 | - 'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommandHandler' => [ |
|
555 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
556 | - ], |
|
557 | - 'EventEspresso\core\domain\services\commands\ticket\CancelTicketLineItemCommandHandler' => [ |
|
558 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
559 | - ], |
|
560 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [ |
|
561 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
562 | - ], |
|
563 | - 'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler' => [ |
|
564 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
565 | - ], |
|
566 | - 'EventEspresso\core\services\database\TableManager' => [ |
|
567 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
568 | - ], |
|
569 | - 'EE_Data_Migration_Class_Base' => [ |
|
570 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
571 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
572 | - ], |
|
573 | - 'EE_DMS_Core_4_1_0' => [ |
|
574 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
575 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
576 | - ], |
|
577 | - 'EE_DMS_Core_4_2_0' => [ |
|
578 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
579 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
580 | - ], |
|
581 | - 'EE_DMS_Core_4_3_0' => [ |
|
582 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
583 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
584 | - ], |
|
585 | - 'EE_DMS_Core_4_4_0' => [ |
|
586 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
587 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
588 | - ], |
|
589 | - 'EE_DMS_Core_4_5_0' => [ |
|
590 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
591 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
592 | - ], |
|
593 | - 'EE_DMS_Core_4_6_0' => [ |
|
594 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
595 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
596 | - ], |
|
597 | - 'EE_DMS_Core_4_7_0' => [ |
|
598 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
599 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
600 | - ], |
|
601 | - 'EE_DMS_Core_4_8_0' => [ |
|
602 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
603 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
604 | - ], |
|
605 | - 'EE_DMS_Core_4_9_0' => [ |
|
606 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
607 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
608 | - ], |
|
609 | - 'EE_DMS_Core_4_10_0' => [ |
|
610 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
611 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
612 | - 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
613 | - ], |
|
614 | - 'EventEspresso\core\services\assets\I18nRegistry' => [ |
|
615 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
616 | - ], |
|
617 | - 'EventEspresso\core\services\assets\Registry' => [ |
|
618 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
619 | - 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
620 | - ], |
|
621 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => [ |
|
622 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
623 | - ], |
|
624 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => [ |
|
625 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
626 | - ], |
|
627 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => [ |
|
628 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
629 | - ], |
|
630 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => [ |
|
631 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
632 | - ], |
|
633 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => [ |
|
634 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
635 | - ], |
|
636 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => [ |
|
637 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
638 | - ], |
|
639 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => [ |
|
640 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
641 | - ], |
|
642 | - 'EventEspresso\core\services\cache\BasicCacheManager' => [ |
|
643 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
644 | - ], |
|
645 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [ |
|
646 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
647 | - ], |
|
648 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [ |
|
649 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
650 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
651 | - ], |
|
652 | - 'EventEspresso\core\domain\values\EmailAddress' => [ |
|
653 | - null, |
|
654 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
655 | - ], |
|
656 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => [ |
|
657 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
658 | - ], |
|
659 | - 'LEGACY_MODELS' => [ |
|
660 | - null, |
|
661 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
662 | - ], |
|
663 | - 'EE_Module_Request_Router' => [ |
|
664 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
665 | - ], |
|
666 | - 'EE_Registration_Processor' => [ |
|
667 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
668 | - ], |
|
669 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [ |
|
670 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
671 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
672 | - ], |
|
673 | - 'EventEspresso\core\services\licensing\LicenseService' => [ |
|
674 | - 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
675 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
676 | - ], |
|
677 | - 'EE_Admin_Transactions_List_Table' => [ |
|
678 | - null, |
|
679 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
680 | - ], |
|
681 | - 'EventEspresso\core\domain\services\pue\Stats' => [ |
|
682 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
683 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
684 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache, |
|
685 | - ], |
|
686 | - 'EventEspresso\core\domain\services\pue\Config' => [ |
|
687 | - 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
688 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
689 | - ], |
|
690 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => [ |
|
691 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
692 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
693 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
694 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
695 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
696 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
697 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
698 | - ], |
|
699 | - 'EventEspresso\core\domain\services\admin\ExitModal' => [ |
|
700 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
701 | - ], |
|
702 | - 'EventEspresso\core\domain\services\admin\PluginUpsells' => [ |
|
703 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
704 | - ], |
|
705 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
706 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
707 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
708 | - ], |
|
709 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => [ |
|
710 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
711 | - ], |
|
712 | - 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [ |
|
713 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
714 | - 'EE_Ticket_Selector_Config' => EE_Dependency_Map::load_from_cache, |
|
715 | - ], |
|
716 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
717 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
718 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
719 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
720 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
721 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
722 | - ], |
|
723 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
724 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
725 | - ], |
|
726 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
727 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
728 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
729 | - ], |
|
730 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
731 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
732 | - ], |
|
733 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
734 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
735 | - ], |
|
736 | - 'EE_CPT_Strategy' => [ |
|
737 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
738 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
739 | - ], |
|
740 | - 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
741 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
742 | - ], |
|
743 | - 'EventEspresso\core\domain\services\assets\CoreAssetManager' => [ |
|
744 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
745 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
746 | - 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
747 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
748 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
749 | - ], |
|
750 | - 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => [ |
|
751 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
752 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
753 | - ], |
|
754 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => [ |
|
755 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
756 | - ], |
|
757 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => [ |
|
758 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
759 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
760 | - ], |
|
761 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => [ |
|
762 | - 'EEM_Checkin' => EE_Dependency_Map::load_from_cache, |
|
763 | - ], |
|
764 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => [ |
|
765 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
766 | - ], |
|
767 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => [ |
|
768 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
769 | - ], |
|
770 | - 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => [ |
|
771 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
772 | - ], |
|
773 | - 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => [ |
|
774 | - 'EEM_Answer' => EE_Dependency_Map::load_from_cache, |
|
775 | - 'EEM_Question' => EE_Dependency_Map::load_from_cache, |
|
776 | - ], |
|
777 | - 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
778 | - null, |
|
779 | - null, |
|
780 | - null, |
|
781 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
782 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
783 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
784 | - ], |
|
785 | - 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => [ |
|
786 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
787 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
788 | - ], |
|
789 | - 'EventEspresso\core\services\editor\BlockRegistrationManager' => [ |
|
790 | - 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
791 | - 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
792 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
793 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
794 | - ], |
|
795 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => [ |
|
796 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
797 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
798 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
799 | - ], |
|
800 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => [ |
|
801 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
802 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
803 | - ], |
|
804 | - 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => [ |
|
805 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache, |
|
806 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
807 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache, |
|
808 | - ], |
|
809 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => [ |
|
810 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
811 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
812 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
813 | - ], |
|
814 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => [ |
|
815 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
816 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
817 | - ], |
|
818 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => [ |
|
819 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
820 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
821 | - ], |
|
822 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => [ |
|
823 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache, |
|
824 | - ], |
|
825 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => [ |
|
826 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
827 | - ], |
|
828 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => [ |
|
829 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache, |
|
830 | - ], |
|
831 | - 'EventEspresso\core\libraries\rest_api\calculations\Datetime' => [ |
|
832 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
833 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
834 | - ], |
|
835 | - 'EventEspresso\core\libraries\rest_api\calculations\Event' => [ |
|
836 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
837 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
838 | - ], |
|
839 | - 'EventEspresso\core\libraries\rest_api\calculations\Registration' => [ |
|
840 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
841 | - ], |
|
842 | - 'EventEspresso\core\services\session\SessionStartHandler' => [ |
|
843 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
844 | - ], |
|
845 | - 'EE_URL_Validation_Strategy' => [ |
|
846 | - null, |
|
847 | - null, |
|
848 | - 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
849 | - ], |
|
850 | - 'EventEspresso\admin_pages\general_settings\OrganizationSettings' => [ |
|
851 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
852 | - 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
853 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
854 | - 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
855 | - 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
856 | - ], |
|
857 | - 'EventEspresso\core\services\address\CountrySubRegionDao' => [ |
|
858 | - 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
859 | - 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache, |
|
860 | - ], |
|
861 | - 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => [ |
|
862 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
863 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
864 | - ], |
|
865 | - 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => [ |
|
866 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
867 | - 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
868 | - ], |
|
869 | - 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
870 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
871 | - ], |
|
872 | - 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
873 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
874 | - ], |
|
875 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [ |
|
876 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
877 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
878 | - null, |
|
879 | - ], |
|
880 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [ |
|
881 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
882 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
883 | - ], |
|
884 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [ |
|
885 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
886 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
887 | - ], |
|
888 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [ |
|
889 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
890 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
891 | - ], |
|
892 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [ |
|
893 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
894 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
895 | - ], |
|
896 | - 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [ |
|
897 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
898 | - ], |
|
899 | - 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [ |
|
900 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
901 | - ], |
|
902 | - 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [ |
|
903 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
904 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
905 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
906 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
907 | - ], |
|
908 | - 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [ |
|
909 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
910 | - ], |
|
911 | - 'EventEspresso\core\services\request\CurrentPage' => [ |
|
912 | - 'EE_CPT_Strategy' => EE_Dependency_Map::load_from_cache, |
|
913 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
914 | - ], |
|
915 | - 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => [ |
|
916 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
917 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
918 | - ], |
|
919 | - 'EventEspresso\core\services\shortcodes\ShortcodesManager' => [ |
|
920 | - 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache, |
|
921 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
922 | - ], |
|
923 | - ]; |
|
924 | - } |
|
925 | - |
|
926 | - |
|
927 | - /** |
|
928 | - * Registers how core classes are loaded. |
|
929 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
930 | - * 'EE_Request_Handler' => 'load_core' |
|
931 | - * 'EE_Messages_Queue' => 'load_lib' |
|
932 | - * 'EEH_Debug_Tools' => 'load_helper' |
|
933 | - * or, if greater control is required, by providing a custom closure. For example: |
|
934 | - * 'Some_Class' => function () { |
|
935 | - * return new Some_Class(); |
|
936 | - * }, |
|
937 | - * This is required for instantiating dependencies |
|
938 | - * where an interface has been type hinted in a class constructor. For example: |
|
939 | - * 'Required_Interface' => function () { |
|
940 | - * return new A_Class_That_Implements_Required_Interface(); |
|
941 | - * }, |
|
942 | - */ |
|
943 | - protected function _register_core_class_loaders() |
|
944 | - { |
|
945 | - $this->_class_loaders = [ |
|
946 | - // load_core |
|
947 | - 'EE_Dependency_Map' => function () { |
|
948 | - return $this; |
|
949 | - }, |
|
950 | - 'EE_Capabilities' => 'load_core', |
|
951 | - 'EE_Encryption' => 'load_core', |
|
952 | - 'EE_Front_Controller' => 'load_core', |
|
953 | - 'EE_Module_Request_Router' => 'load_core', |
|
954 | - 'EE_Registry' => 'load_core', |
|
955 | - 'EE_Request' => function () { |
|
956 | - return $this->legacy_request; |
|
957 | - }, |
|
958 | - 'EventEspresso\core\services\request\Request' => function () { |
|
959 | - return $this->request; |
|
960 | - }, |
|
961 | - 'EventEspresso\core\services\request\Response' => function () { |
|
962 | - return $this->response; |
|
963 | - }, |
|
964 | - 'EE_Base' => 'load_core', |
|
965 | - 'EE_Request_Handler' => 'load_core', |
|
966 | - 'EE_Session' => 'load_core', |
|
967 | - 'EE_Cron_Tasks' => 'load_core', |
|
968 | - 'EE_System' => 'load_core', |
|
969 | - 'EE_Maintenance_Mode' => 'load_core', |
|
970 | - 'EE_Register_CPTs' => 'load_core', |
|
971 | - 'EE_Admin' => 'load_core', |
|
972 | - 'EE_CPT_Strategy' => 'load_core', |
|
973 | - // load_class |
|
974 | - 'EE_Registration_Processor' => 'load_class', |
|
975 | - // load_lib |
|
976 | - 'EE_Message_Resource_Manager' => 'load_lib', |
|
977 | - 'EE_Message_Type_Collection' => 'load_lib', |
|
978 | - 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
979 | - 'EE_Messenger_Collection' => 'load_lib', |
|
980 | - 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
981 | - 'EE_Messages_Processor' => 'load_lib', |
|
982 | - 'EE_Message_Repository' => 'load_lib', |
|
983 | - 'EE_Messages_Queue' => 'load_lib', |
|
984 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
985 | - 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
986 | - 'EE_Payment_Method_Manager' => 'load_lib', |
|
987 | - 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
988 | - 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
989 | - 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
990 | - 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
991 | - 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
992 | - 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
993 | - 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
994 | - 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
995 | - 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
996 | - 'EE_Messages_Generator' => function () { |
|
997 | - return EE_Registry::instance()->load_lib( |
|
998 | - 'Messages_Generator', |
|
999 | - [], |
|
1000 | - false, |
|
1001 | - false |
|
1002 | - ); |
|
1003 | - }, |
|
1004 | - 'EE_Messages_Template_Defaults' => function ($arguments = []) { |
|
1005 | - return EE_Registry::instance()->load_lib( |
|
1006 | - 'Messages_Template_Defaults', |
|
1007 | - $arguments, |
|
1008 | - false, |
|
1009 | - false |
|
1010 | - ); |
|
1011 | - }, |
|
1012 | - // load_helper |
|
1013 | - 'EEH_Parse_Shortcodes' => function () { |
|
1014 | - if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
1015 | - return new EEH_Parse_Shortcodes(); |
|
1016 | - } |
|
1017 | - return null; |
|
1018 | - }, |
|
1019 | - 'EE_Template_Config' => function () { |
|
1020 | - return EE_Config::instance()->template_settings; |
|
1021 | - }, |
|
1022 | - 'EE_Currency_Config' => function () { |
|
1023 | - return EE_Config::instance()->currency; |
|
1024 | - }, |
|
1025 | - 'EE_Registration_Config' => function () { |
|
1026 | - return EE_Config::instance()->registration; |
|
1027 | - }, |
|
1028 | - 'EE_Core_Config' => function () { |
|
1029 | - return EE_Config::instance()->core; |
|
1030 | - }, |
|
1031 | - 'EventEspresso\core\services\loaders\Loader' => function () { |
|
1032 | - return LoaderFactory::getLoader(); |
|
1033 | - }, |
|
1034 | - 'EE_Network_Config' => function () { |
|
1035 | - return EE_Network_Config::instance(); |
|
1036 | - }, |
|
1037 | - 'EE_Config' => function () { |
|
1038 | - return EE_Config::instance(); |
|
1039 | - }, |
|
1040 | - 'EventEspresso\core\domain\Domain' => function () { |
|
1041 | - return DomainFactory::getEventEspressoCoreDomain(); |
|
1042 | - }, |
|
1043 | - 'EE_Admin_Config' => function () { |
|
1044 | - return EE_Config::instance()->admin; |
|
1045 | - }, |
|
1046 | - 'EE_Organization_Config' => function () { |
|
1047 | - return EE_Config::instance()->organization; |
|
1048 | - }, |
|
1049 | - 'EE_Network_Core_Config' => function () { |
|
1050 | - return EE_Network_Config::instance()->core; |
|
1051 | - }, |
|
1052 | - 'EE_Environment_Config' => function () { |
|
1053 | - return EE_Config::instance()->environment; |
|
1054 | - }, |
|
1055 | - 'EE_Ticket_Selector_Config' => function () { |
|
1056 | - return EE_Config::instance()->template_settings->EED_Ticket_Selector; |
|
1057 | - }, |
|
1058 | - ]; |
|
1059 | - } |
|
1060 | - |
|
1061 | - |
|
1062 | - /** |
|
1063 | - * can be used for supplying alternate names for classes, |
|
1064 | - * or for connecting interface names to instantiable classes |
|
1065 | - */ |
|
1066 | - protected function _register_core_aliases() |
|
1067 | - { |
|
1068 | - $aliases = [ |
|
1069 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
1070 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
1071 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
1072 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
1073 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
1074 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
1075 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1076 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
1077 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1078 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
1079 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommand', |
|
1080 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommand', |
|
1081 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
1082 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
1083 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
1084 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommand', |
|
1085 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\domain\services\commands\transaction\CreateTransactionCommandHandler', |
|
1086 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler', |
|
1087 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
1088 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
1089 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1090 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
1091 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1092 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
1093 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
1094 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
1095 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
1096 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
1097 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
1098 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
1099 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
1100 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
1101 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
1102 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
1103 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
1104 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
1105 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
1106 | - 'Registration_Processor' => 'EE_Registration_Processor', |
|
1107 | - ]; |
|
1108 | - foreach ($aliases as $alias => $fqn) { |
|
1109 | - if (is_array($fqn)) { |
|
1110 | - foreach ($fqn as $class => $for_class) { |
|
1111 | - $this->class_cache->addAlias($class, $alias, $for_class); |
|
1112 | - } |
|
1113 | - continue; |
|
1114 | - } |
|
1115 | - $this->class_cache->addAlias($fqn, $alias); |
|
1116 | - } |
|
1117 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1118 | - $this->class_cache->addAlias( |
|
1119 | - 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
1120 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
1121 | - ); |
|
1122 | - } |
|
1123 | - } |
|
1124 | - |
|
1125 | - |
|
1126 | - public function debug($for_class = '') |
|
1127 | - { |
|
1128 | - $this->class_cache->debug($for_class); |
|
1129 | - } |
|
1130 | - |
|
1131 | - |
|
1132 | - /** |
|
1133 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
1134 | - * request Primarily used by unit tests. |
|
1135 | - */ |
|
1136 | - public function reset() |
|
1137 | - { |
|
1138 | - $this->_register_core_class_loaders(); |
|
1139 | - $this->_register_core_dependencies(); |
|
1140 | - } |
|
1141 | - |
|
1142 | - |
|
1143 | - /** |
|
1144 | - * PLZ NOTE: a better name for this method would be is_alias() |
|
1145 | - * because it returns TRUE if the provided fully qualified name IS an alias |
|
1146 | - * WHY? |
|
1147 | - * Because if a class is type hinting for a concretion, |
|
1148 | - * then why would we need to find another class to supply it? |
|
1149 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
1150 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
1151 | - * Don't go looking for some substitute. |
|
1152 | - * Whereas if a class is type hinting for an interface... |
|
1153 | - * then we need to find an actual class to use. |
|
1154 | - * So the interface IS the alias for some other FQN, |
|
1155 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
1156 | - * represents some other class. |
|
1157 | - * |
|
1158 | - * @param string $fqn |
|
1159 | - * @param string $for_class |
|
1160 | - * @return bool |
|
1161 | - * @deprecated 4.9.62.p |
|
1162 | - */ |
|
1163 | - public function has_alias($fqn = '', $for_class = '') |
|
1164 | - { |
|
1165 | - return $this->isAlias($fqn, $for_class); |
|
1166 | - } |
|
1167 | - |
|
1168 | - |
|
1169 | - /** |
|
1170 | - * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1171 | - * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1172 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1173 | - * for example: |
|
1174 | - * if the following two entries were added to the _aliases array: |
|
1175 | - * array( |
|
1176 | - * 'interface_alias' => 'some\namespace\interface' |
|
1177 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
1178 | - * ) |
|
1179 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1180 | - * to load an instance of 'some\namespace\classname' |
|
1181 | - * |
|
1182 | - * @param string $alias |
|
1183 | - * @param string $for_class |
|
1184 | - * @return string |
|
1185 | - * @deprecated 4.9.62.p |
|
1186 | - */ |
|
1187 | - public function get_alias($alias = '', $for_class = '') |
|
1188 | - { |
|
1189 | - return $this->getFqnForAlias($alias, $for_class); |
|
1190 | - } |
|
22 | + /** |
|
23 | + * This means that the requested class dependency is not present in the dependency map |
|
24 | + */ |
|
25 | + const not_registered = 0; |
|
26 | + |
|
27 | + /** |
|
28 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
29 | + */ |
|
30 | + const load_new_object = 1; |
|
31 | + |
|
32 | + /** |
|
33 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
34 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
35 | + */ |
|
36 | + const load_from_cache = 2; |
|
37 | + |
|
38 | + /** |
|
39 | + * When registering a dependency, |
|
40 | + * this indicates to keep any existing dependencies that already exist, |
|
41 | + * and simply discard any new dependencies declared in the incoming data |
|
42 | + */ |
|
43 | + const KEEP_EXISTING_DEPENDENCIES = 0; |
|
44 | + |
|
45 | + /** |
|
46 | + * When registering a dependency, |
|
47 | + * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
48 | + */ |
|
49 | + const OVERWRITE_DEPENDENCIES = 1; |
|
50 | + |
|
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 | + */ |
|
108 | + public function initialize() |
|
109 | + { |
|
110 | + $this->_register_core_dependencies(); |
|
111 | + $this->_register_core_class_loaders(); |
|
112 | + $this->_register_core_aliases(); |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * @singleton method used to instantiate class object |
|
118 | + * @param ClassInterfaceCache|null $class_cache |
|
119 | + * @return EE_Dependency_Map |
|
120 | + */ |
|
121 | + public static function instance(ClassInterfaceCache $class_cache = null) |
|
122 | + { |
|
123 | + // check if class object is instantiated, and instantiated properly |
|
124 | + if ( |
|
125 | + ! self::$_instance instanceof EE_Dependency_Map |
|
126 | + && $class_cache instanceof ClassInterfaceCache |
|
127 | + ) { |
|
128 | + self::$_instance = new EE_Dependency_Map($class_cache); |
|
129 | + } |
|
130 | + return self::$_instance; |
|
131 | + } |
|
132 | + |
|
133 | + |
|
134 | + /** |
|
135 | + * @param RequestInterface $request |
|
136 | + */ |
|
137 | + public function setRequest(RequestInterface $request) |
|
138 | + { |
|
139 | + $this->request = $request; |
|
140 | + } |
|
141 | + |
|
142 | + |
|
143 | + /** |
|
144 | + * @param LegacyRequestInterface $legacy_request |
|
145 | + */ |
|
146 | + public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
147 | + { |
|
148 | + $this->legacy_request = $legacy_request; |
|
149 | + } |
|
150 | + |
|
151 | + |
|
152 | + /** |
|
153 | + * @param ResponseInterface $response |
|
154 | + */ |
|
155 | + public function setResponse(ResponseInterface $response) |
|
156 | + { |
|
157 | + $this->response = $response; |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + /** |
|
162 | + * @param LoaderInterface $loader |
|
163 | + */ |
|
164 | + public function setLoader(LoaderInterface $loader) |
|
165 | + { |
|
166 | + $this->loader = $loader; |
|
167 | + } |
|
168 | + |
|
169 | + |
|
170 | + /** |
|
171 | + * @param string $class |
|
172 | + * @param array $dependencies |
|
173 | + * @param int $overwrite |
|
174 | + * @return bool |
|
175 | + */ |
|
176 | + public static function register_dependencies( |
|
177 | + $class, |
|
178 | + array $dependencies, |
|
179 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
180 | + ) { |
|
181 | + return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
182 | + } |
|
183 | + |
|
184 | + |
|
185 | + /** |
|
186 | + * Assigns an array of class names and corresponding load sources (new or cached) |
|
187 | + * to the class specified by the first parameter. |
|
188 | + * IMPORTANT !!! |
|
189 | + * The order of elements in the incoming $dependencies array MUST match |
|
190 | + * the order of the constructor parameters for the class in question. |
|
191 | + * This is especially important when overriding any existing dependencies that are registered. |
|
192 | + * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
193 | + * |
|
194 | + * @param string $class |
|
195 | + * @param array $dependencies |
|
196 | + * @param int $overwrite |
|
197 | + * @return bool |
|
198 | + */ |
|
199 | + public function registerDependencies( |
|
200 | + $class, |
|
201 | + array $dependencies, |
|
202 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
203 | + ) { |
|
204 | + $class = trim($class, '\\'); |
|
205 | + $registered = false; |
|
206 | + if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
207 | + self::$_instance->_dependency_map[ $class ] = []; |
|
208 | + } |
|
209 | + // we need to make sure that any aliases used when registering a dependency |
|
210 | + // get resolved to the correct class name |
|
211 | + foreach ($dependencies as $dependency => $load_source) { |
|
212 | + $alias = self::$_instance->getFqnForAlias($dependency); |
|
213 | + if ( |
|
214 | + $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
215 | + || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
216 | + ) { |
|
217 | + unset($dependencies[ $dependency ]); |
|
218 | + $dependencies[ $alias ] = $load_source; |
|
219 | + $registered = true; |
|
220 | + } |
|
221 | + } |
|
222 | + // now add our two lists of dependencies together. |
|
223 | + // using Union (+=) favours the arrays in precedence from left to right, |
|
224 | + // so $dependencies is NOT overwritten because it is listed first |
|
225 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
226 | + // Union is way faster than array_merge() but should be used with caution... |
|
227 | + // especially with numerically indexed arrays |
|
228 | + $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
229 | + // now we need to ensure that the resulting dependencies |
|
230 | + // array only has the entries that are required for the class |
|
231 | + // so first count how many dependencies were originally registered for the class |
|
232 | + $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
233 | + // if that count is non-zero (meaning dependencies were already registered) |
|
234 | + self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
235 | + // then truncate the final array to match that count |
|
236 | + ? array_slice($dependencies, 0, $dependency_count) |
|
237 | + // otherwise just take the incoming array because nothing previously existed |
|
238 | + : $dependencies; |
|
239 | + return $registered; |
|
240 | + } |
|
241 | + |
|
242 | + |
|
243 | + /** |
|
244 | + * @param string $class_name |
|
245 | + * @param string $loader |
|
246 | + * @param bool $overwrite |
|
247 | + * @return bool |
|
248 | + * @throws DomainException |
|
249 | + */ |
|
250 | + public static function register_class_loader($class_name, $loader = 'load_core', $overwrite = false) |
|
251 | + { |
|
252 | + if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
253 | + throw new DomainException( |
|
254 | + esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
255 | + ); |
|
256 | + } |
|
257 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
258 | + if ( |
|
259 | + ! is_callable($loader) |
|
260 | + && ( |
|
261 | + strpos($loader, 'load_') !== 0 |
|
262 | + || ! method_exists('EE_Registry', $loader) |
|
263 | + ) |
|
264 | + ) { |
|
265 | + throw new DomainException( |
|
266 | + sprintf( |
|
267 | + esc_html__( |
|
268 | + '"%1$s" is not a valid loader method on EE_Registry.', |
|
269 | + 'event_espresso' |
|
270 | + ), |
|
271 | + $loader |
|
272 | + ) |
|
273 | + ); |
|
274 | + } |
|
275 | + $class_name = self::$_instance->getFqnForAlias($class_name); |
|
276 | + if ($overwrite || ! isset(self::$_instance->_class_loaders[ $class_name ])) { |
|
277 | + self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
278 | + return true; |
|
279 | + } |
|
280 | + return false; |
|
281 | + } |
|
282 | + |
|
283 | + |
|
284 | + /** |
|
285 | + * @return array |
|
286 | + */ |
|
287 | + public function dependency_map() |
|
288 | + { |
|
289 | + return $this->_dependency_map; |
|
290 | + } |
|
291 | + |
|
292 | + |
|
293 | + /** |
|
294 | + * returns TRUE if dependency map contains a listing for the provided class name |
|
295 | + * |
|
296 | + * @param string $class_name |
|
297 | + * @return boolean |
|
298 | + */ |
|
299 | + public function has($class_name = '') |
|
300 | + { |
|
301 | + // all legacy models have the same dependencies |
|
302 | + if (strpos($class_name, 'EEM_') === 0) { |
|
303 | + $class_name = 'LEGACY_MODELS'; |
|
304 | + } |
|
305 | + return isset($this->_dependency_map[ $class_name ]); |
|
306 | + } |
|
307 | + |
|
308 | + |
|
309 | + /** |
|
310 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
311 | + * |
|
312 | + * @param string $class_name |
|
313 | + * @param string $dependency |
|
314 | + * @return bool |
|
315 | + */ |
|
316 | + public function has_dependency_for_class($class_name = '', $dependency = '') |
|
317 | + { |
|
318 | + // all legacy models have the same dependencies |
|
319 | + if (strpos($class_name, 'EEM_') === 0) { |
|
320 | + $class_name = 'LEGACY_MODELS'; |
|
321 | + } |
|
322 | + $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
323 | + return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
324 | + } |
|
325 | + |
|
326 | + |
|
327 | + /** |
|
328 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
329 | + * |
|
330 | + * @param string $class_name |
|
331 | + * @param string $dependency |
|
332 | + * @return int |
|
333 | + */ |
|
334 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
335 | + { |
|
336 | + // all legacy models have the same dependencies |
|
337 | + if (strpos($class_name, 'EEM_') === 0) { |
|
338 | + $class_name = 'LEGACY_MODELS'; |
|
339 | + } |
|
340 | + $dependency = $this->getFqnForAlias($dependency); |
|
341 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
342 | + ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
343 | + : EE_Dependency_Map::not_registered; |
|
344 | + } |
|
345 | + |
|
346 | + |
|
347 | + /** |
|
348 | + * @param string $class_name |
|
349 | + * @return string | Closure |
|
350 | + */ |
|
351 | + public function class_loader($class_name) |
|
352 | + { |
|
353 | + // all legacy models use load_model() |
|
354 | + if (strpos($class_name, 'EEM_') === 0) { |
|
355 | + return 'load_model'; |
|
356 | + } |
|
357 | + // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
358 | + // perform strpos() first to avoid loading regex every time we load a class |
|
359 | + if ( |
|
360 | + strpos($class_name, 'EE_CPT_') === 0 |
|
361 | + && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
362 | + ) { |
|
363 | + return 'load_core'; |
|
364 | + } |
|
365 | + $class_name = $this->getFqnForAlias($class_name); |
|
366 | + return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
367 | + } |
|
368 | + |
|
369 | + |
|
370 | + /** |
|
371 | + * @return array |
|
372 | + */ |
|
373 | + public function class_loaders() |
|
374 | + { |
|
375 | + return $this->_class_loaders; |
|
376 | + } |
|
377 | + |
|
378 | + |
|
379 | + /** |
|
380 | + * adds an alias for a classname |
|
381 | + * |
|
382 | + * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
383 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
384 | + * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
385 | + */ |
|
386 | + public function add_alias($fqcn, $alias, $for_class = '') |
|
387 | + { |
|
388 | + $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
389 | + } |
|
390 | + |
|
391 | + |
|
392 | + /** |
|
393 | + * Returns TRUE if the provided fully qualified name IS an alias |
|
394 | + * WHY? |
|
395 | + * Because if a class is type hinting for a concretion, |
|
396 | + * then why would we need to find another class to supply it? |
|
397 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
398 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
399 | + * Don't go looking for some substitute. |
|
400 | + * Whereas if a class is type hinting for an interface... |
|
401 | + * then we need to find an actual class to use. |
|
402 | + * So the interface IS the alias for some other FQN, |
|
403 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
404 | + * represents some other class. |
|
405 | + * |
|
406 | + * @param string $fqn |
|
407 | + * @param string $for_class |
|
408 | + * @return bool |
|
409 | + */ |
|
410 | + public function isAlias($fqn = '', $for_class = '') |
|
411 | + { |
|
412 | + return $this->class_cache->isAlias($fqn, $for_class); |
|
413 | + } |
|
414 | + |
|
415 | + |
|
416 | + /** |
|
417 | + * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
418 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
419 | + * for example: |
|
420 | + * if the following two entries were added to the _aliases array: |
|
421 | + * array( |
|
422 | + * 'interface_alias' => 'some\namespace\interface' |
|
423 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
424 | + * ) |
|
425 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
426 | + * to load an instance of 'some\namespace\classname' |
|
427 | + * |
|
428 | + * @param string $alias |
|
429 | + * @param string $for_class |
|
430 | + * @return string |
|
431 | + */ |
|
432 | + public function getFqnForAlias($alias = '', $for_class = '') |
|
433 | + { |
|
434 | + return $this->class_cache->getFqnForAlias($alias, $for_class); |
|
435 | + } |
|
436 | + |
|
437 | + |
|
438 | + /** |
|
439 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
440 | + * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
441 | + * This is done by using the following class constants: |
|
442 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
443 | + * EE_Dependency_Map::load_new_object - generates a new object every time |
|
444 | + */ |
|
445 | + protected function _register_core_dependencies() |
|
446 | + { |
|
447 | + $this->_dependency_map = [ |
|
448 | + 'EE_Admin' => [ |
|
449 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
450 | + ], |
|
451 | + 'EE_Request_Handler' => [ |
|
452 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
453 | + 'EventEspresso\core\services\request\Response' => EE_Dependency_Map::load_from_cache, |
|
454 | + ], |
|
455 | + 'EE_System' => [ |
|
456 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
457 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
458 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
459 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
460 | + ], |
|
461 | + 'EE_Session' => [ |
|
462 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
463 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
464 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
465 | + 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
466 | + 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
467 | + ], |
|
468 | + 'EE_Cart' => [ |
|
469 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
470 | + ], |
|
471 | + 'EE_Front_Controller' => [ |
|
472 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
473 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
474 | + 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
475 | + ], |
|
476 | + 'EE_Messenger_Collection_Loader' => [ |
|
477 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
478 | + ], |
|
479 | + 'EE_Message_Type_Collection_Loader' => [ |
|
480 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
481 | + ], |
|
482 | + 'EE_Message_Resource_Manager' => [ |
|
483 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
484 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
485 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
486 | + ], |
|
487 | + 'EE_Message_Factory' => [ |
|
488 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
489 | + ], |
|
490 | + 'EE_messages' => [ |
|
491 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
492 | + ], |
|
493 | + 'EE_Messages_Generator' => [ |
|
494 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
495 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
496 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
497 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
498 | + ], |
|
499 | + 'EE_Messages_Processor' => [ |
|
500 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
501 | + ], |
|
502 | + 'EE_Messages_Queue' => [ |
|
503 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
504 | + ], |
|
505 | + 'EE_Messages_Template_Defaults' => [ |
|
506 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
507 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
508 | + ], |
|
509 | + 'EE_Message_To_Generate_From_Request' => [ |
|
510 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
511 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
512 | + ], |
|
513 | + 'EventEspresso\core\services\commands\CommandBus' => [ |
|
514 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
515 | + ], |
|
516 | + 'EventEspresso\services\commands\CommandHandler' => [ |
|
517 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
518 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
519 | + ], |
|
520 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => [ |
|
521 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
522 | + ], |
|
523 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => [ |
|
524 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
525 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
526 | + ], |
|
527 | + 'EventEspresso\core\services\commands\CommandFactory' => [ |
|
528 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
529 | + ], |
|
530 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => [ |
|
531 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
532 | + ], |
|
533 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [ |
|
534 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
535 | + ], |
|
536 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [ |
|
537 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
538 | + ], |
|
539 | + 'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommandHandler' => [ |
|
540 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
541 | + ], |
|
542 | + 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [ |
|
543 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
544 | + ], |
|
545 | + 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [ |
|
546 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
547 | + ], |
|
548 | + 'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [ |
|
549 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
550 | + ], |
|
551 | + 'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [ |
|
552 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
553 | + ], |
|
554 | + 'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommandHandler' => [ |
|
555 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
556 | + ], |
|
557 | + 'EventEspresso\core\domain\services\commands\ticket\CancelTicketLineItemCommandHandler' => [ |
|
558 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
559 | + ], |
|
560 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [ |
|
561 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
562 | + ], |
|
563 | + 'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler' => [ |
|
564 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
565 | + ], |
|
566 | + 'EventEspresso\core\services\database\TableManager' => [ |
|
567 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
568 | + ], |
|
569 | + 'EE_Data_Migration_Class_Base' => [ |
|
570 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
571 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
572 | + ], |
|
573 | + 'EE_DMS_Core_4_1_0' => [ |
|
574 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
575 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
576 | + ], |
|
577 | + 'EE_DMS_Core_4_2_0' => [ |
|
578 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
579 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
580 | + ], |
|
581 | + 'EE_DMS_Core_4_3_0' => [ |
|
582 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
583 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
584 | + ], |
|
585 | + 'EE_DMS_Core_4_4_0' => [ |
|
586 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
587 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
588 | + ], |
|
589 | + 'EE_DMS_Core_4_5_0' => [ |
|
590 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
591 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
592 | + ], |
|
593 | + 'EE_DMS_Core_4_6_0' => [ |
|
594 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
595 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
596 | + ], |
|
597 | + 'EE_DMS_Core_4_7_0' => [ |
|
598 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
599 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
600 | + ], |
|
601 | + 'EE_DMS_Core_4_8_0' => [ |
|
602 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
603 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
604 | + ], |
|
605 | + 'EE_DMS_Core_4_9_0' => [ |
|
606 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
607 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
608 | + ], |
|
609 | + 'EE_DMS_Core_4_10_0' => [ |
|
610 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
611 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
612 | + 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
613 | + ], |
|
614 | + 'EventEspresso\core\services\assets\I18nRegistry' => [ |
|
615 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
616 | + ], |
|
617 | + 'EventEspresso\core\services\assets\Registry' => [ |
|
618 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
619 | + 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
620 | + ], |
|
621 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => [ |
|
622 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
623 | + ], |
|
624 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => [ |
|
625 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
626 | + ], |
|
627 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => [ |
|
628 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
629 | + ], |
|
630 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => [ |
|
631 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
632 | + ], |
|
633 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => [ |
|
634 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
635 | + ], |
|
636 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => [ |
|
637 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
638 | + ], |
|
639 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => [ |
|
640 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
641 | + ], |
|
642 | + 'EventEspresso\core\services\cache\BasicCacheManager' => [ |
|
643 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
644 | + ], |
|
645 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [ |
|
646 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
647 | + ], |
|
648 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [ |
|
649 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
650 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
651 | + ], |
|
652 | + 'EventEspresso\core\domain\values\EmailAddress' => [ |
|
653 | + null, |
|
654 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
655 | + ], |
|
656 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => [ |
|
657 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
658 | + ], |
|
659 | + 'LEGACY_MODELS' => [ |
|
660 | + null, |
|
661 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
662 | + ], |
|
663 | + 'EE_Module_Request_Router' => [ |
|
664 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
665 | + ], |
|
666 | + 'EE_Registration_Processor' => [ |
|
667 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
668 | + ], |
|
669 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [ |
|
670 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
671 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
672 | + ], |
|
673 | + 'EventEspresso\core\services\licensing\LicenseService' => [ |
|
674 | + 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
675 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
676 | + ], |
|
677 | + 'EE_Admin_Transactions_List_Table' => [ |
|
678 | + null, |
|
679 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
680 | + ], |
|
681 | + 'EventEspresso\core\domain\services\pue\Stats' => [ |
|
682 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
683 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
684 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache, |
|
685 | + ], |
|
686 | + 'EventEspresso\core\domain\services\pue\Config' => [ |
|
687 | + 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
688 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
689 | + ], |
|
690 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => [ |
|
691 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
692 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
693 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
694 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
695 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
696 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
697 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
698 | + ], |
|
699 | + 'EventEspresso\core\domain\services\admin\ExitModal' => [ |
|
700 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
701 | + ], |
|
702 | + 'EventEspresso\core\domain\services\admin\PluginUpsells' => [ |
|
703 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
704 | + ], |
|
705 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
706 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
707 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
708 | + ], |
|
709 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => [ |
|
710 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
711 | + ], |
|
712 | + 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [ |
|
713 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
714 | + 'EE_Ticket_Selector_Config' => EE_Dependency_Map::load_from_cache, |
|
715 | + ], |
|
716 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
717 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
718 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
719 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
720 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
721 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
722 | + ], |
|
723 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
724 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
725 | + ], |
|
726 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
727 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
728 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
729 | + ], |
|
730 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
731 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
732 | + ], |
|
733 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
734 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
735 | + ], |
|
736 | + 'EE_CPT_Strategy' => [ |
|
737 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
738 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
739 | + ], |
|
740 | + 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
741 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
742 | + ], |
|
743 | + 'EventEspresso\core\domain\services\assets\CoreAssetManager' => [ |
|
744 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
745 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
746 | + 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
747 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
748 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
749 | + ], |
|
750 | + 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => [ |
|
751 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
752 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
753 | + ], |
|
754 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => [ |
|
755 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
756 | + ], |
|
757 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => [ |
|
758 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
759 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
760 | + ], |
|
761 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => [ |
|
762 | + 'EEM_Checkin' => EE_Dependency_Map::load_from_cache, |
|
763 | + ], |
|
764 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => [ |
|
765 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
766 | + ], |
|
767 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => [ |
|
768 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
769 | + ], |
|
770 | + 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => [ |
|
771 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
772 | + ], |
|
773 | + 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => [ |
|
774 | + 'EEM_Answer' => EE_Dependency_Map::load_from_cache, |
|
775 | + 'EEM_Question' => EE_Dependency_Map::load_from_cache, |
|
776 | + ], |
|
777 | + 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
778 | + null, |
|
779 | + null, |
|
780 | + null, |
|
781 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
782 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
783 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
784 | + ], |
|
785 | + 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => [ |
|
786 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
787 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
788 | + ], |
|
789 | + 'EventEspresso\core\services\editor\BlockRegistrationManager' => [ |
|
790 | + 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
791 | + 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
792 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
793 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
794 | + ], |
|
795 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => [ |
|
796 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
797 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
798 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
799 | + ], |
|
800 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => [ |
|
801 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
802 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
803 | + ], |
|
804 | + 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => [ |
|
805 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache, |
|
806 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
807 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache, |
|
808 | + ], |
|
809 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => [ |
|
810 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
811 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
812 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
813 | + ], |
|
814 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => [ |
|
815 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
816 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
817 | + ], |
|
818 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => [ |
|
819 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
820 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
821 | + ], |
|
822 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => [ |
|
823 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache, |
|
824 | + ], |
|
825 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => [ |
|
826 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
827 | + ], |
|
828 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => [ |
|
829 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache, |
|
830 | + ], |
|
831 | + 'EventEspresso\core\libraries\rest_api\calculations\Datetime' => [ |
|
832 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
833 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
834 | + ], |
|
835 | + 'EventEspresso\core\libraries\rest_api\calculations\Event' => [ |
|
836 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
837 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
838 | + ], |
|
839 | + 'EventEspresso\core\libraries\rest_api\calculations\Registration' => [ |
|
840 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
841 | + ], |
|
842 | + 'EventEspresso\core\services\session\SessionStartHandler' => [ |
|
843 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
844 | + ], |
|
845 | + 'EE_URL_Validation_Strategy' => [ |
|
846 | + null, |
|
847 | + null, |
|
848 | + 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
849 | + ], |
|
850 | + 'EventEspresso\admin_pages\general_settings\OrganizationSettings' => [ |
|
851 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
852 | + 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
853 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
854 | + 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
855 | + 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
856 | + ], |
|
857 | + 'EventEspresso\core\services\address\CountrySubRegionDao' => [ |
|
858 | + 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
859 | + 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache, |
|
860 | + ], |
|
861 | + 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => [ |
|
862 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
863 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
864 | + ], |
|
865 | + 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => [ |
|
866 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
867 | + 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
868 | + ], |
|
869 | + 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
870 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
871 | + ], |
|
872 | + 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
873 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
874 | + ], |
|
875 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [ |
|
876 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
877 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
878 | + null, |
|
879 | + ], |
|
880 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [ |
|
881 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
882 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
883 | + ], |
|
884 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [ |
|
885 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
886 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
887 | + ], |
|
888 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [ |
|
889 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
890 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
891 | + ], |
|
892 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [ |
|
893 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
894 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
895 | + ], |
|
896 | + 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [ |
|
897 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
898 | + ], |
|
899 | + 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [ |
|
900 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
901 | + ], |
|
902 | + 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [ |
|
903 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
904 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
905 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
906 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
907 | + ], |
|
908 | + 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [ |
|
909 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
910 | + ], |
|
911 | + 'EventEspresso\core\services\request\CurrentPage' => [ |
|
912 | + 'EE_CPT_Strategy' => EE_Dependency_Map::load_from_cache, |
|
913 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
914 | + ], |
|
915 | + 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => [ |
|
916 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
917 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
918 | + ], |
|
919 | + 'EventEspresso\core\services\shortcodes\ShortcodesManager' => [ |
|
920 | + 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache, |
|
921 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
922 | + ], |
|
923 | + ]; |
|
924 | + } |
|
925 | + |
|
926 | + |
|
927 | + /** |
|
928 | + * Registers how core classes are loaded. |
|
929 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
930 | + * 'EE_Request_Handler' => 'load_core' |
|
931 | + * 'EE_Messages_Queue' => 'load_lib' |
|
932 | + * 'EEH_Debug_Tools' => 'load_helper' |
|
933 | + * or, if greater control is required, by providing a custom closure. For example: |
|
934 | + * 'Some_Class' => function () { |
|
935 | + * return new Some_Class(); |
|
936 | + * }, |
|
937 | + * This is required for instantiating dependencies |
|
938 | + * where an interface has been type hinted in a class constructor. For example: |
|
939 | + * 'Required_Interface' => function () { |
|
940 | + * return new A_Class_That_Implements_Required_Interface(); |
|
941 | + * }, |
|
942 | + */ |
|
943 | + protected function _register_core_class_loaders() |
|
944 | + { |
|
945 | + $this->_class_loaders = [ |
|
946 | + // load_core |
|
947 | + 'EE_Dependency_Map' => function () { |
|
948 | + return $this; |
|
949 | + }, |
|
950 | + 'EE_Capabilities' => 'load_core', |
|
951 | + 'EE_Encryption' => 'load_core', |
|
952 | + 'EE_Front_Controller' => 'load_core', |
|
953 | + 'EE_Module_Request_Router' => 'load_core', |
|
954 | + 'EE_Registry' => 'load_core', |
|
955 | + 'EE_Request' => function () { |
|
956 | + return $this->legacy_request; |
|
957 | + }, |
|
958 | + 'EventEspresso\core\services\request\Request' => function () { |
|
959 | + return $this->request; |
|
960 | + }, |
|
961 | + 'EventEspresso\core\services\request\Response' => function () { |
|
962 | + return $this->response; |
|
963 | + }, |
|
964 | + 'EE_Base' => 'load_core', |
|
965 | + 'EE_Request_Handler' => 'load_core', |
|
966 | + 'EE_Session' => 'load_core', |
|
967 | + 'EE_Cron_Tasks' => 'load_core', |
|
968 | + 'EE_System' => 'load_core', |
|
969 | + 'EE_Maintenance_Mode' => 'load_core', |
|
970 | + 'EE_Register_CPTs' => 'load_core', |
|
971 | + 'EE_Admin' => 'load_core', |
|
972 | + 'EE_CPT_Strategy' => 'load_core', |
|
973 | + // load_class |
|
974 | + 'EE_Registration_Processor' => 'load_class', |
|
975 | + // load_lib |
|
976 | + 'EE_Message_Resource_Manager' => 'load_lib', |
|
977 | + 'EE_Message_Type_Collection' => 'load_lib', |
|
978 | + 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
979 | + 'EE_Messenger_Collection' => 'load_lib', |
|
980 | + 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
981 | + 'EE_Messages_Processor' => 'load_lib', |
|
982 | + 'EE_Message_Repository' => 'load_lib', |
|
983 | + 'EE_Messages_Queue' => 'load_lib', |
|
984 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
985 | + 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
986 | + 'EE_Payment_Method_Manager' => 'load_lib', |
|
987 | + 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
988 | + 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
989 | + 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
990 | + 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
991 | + 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
992 | + 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
993 | + 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
994 | + 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
995 | + 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
996 | + 'EE_Messages_Generator' => function () { |
|
997 | + return EE_Registry::instance()->load_lib( |
|
998 | + 'Messages_Generator', |
|
999 | + [], |
|
1000 | + false, |
|
1001 | + false |
|
1002 | + ); |
|
1003 | + }, |
|
1004 | + 'EE_Messages_Template_Defaults' => function ($arguments = []) { |
|
1005 | + return EE_Registry::instance()->load_lib( |
|
1006 | + 'Messages_Template_Defaults', |
|
1007 | + $arguments, |
|
1008 | + false, |
|
1009 | + false |
|
1010 | + ); |
|
1011 | + }, |
|
1012 | + // load_helper |
|
1013 | + 'EEH_Parse_Shortcodes' => function () { |
|
1014 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
1015 | + return new EEH_Parse_Shortcodes(); |
|
1016 | + } |
|
1017 | + return null; |
|
1018 | + }, |
|
1019 | + 'EE_Template_Config' => function () { |
|
1020 | + return EE_Config::instance()->template_settings; |
|
1021 | + }, |
|
1022 | + 'EE_Currency_Config' => function () { |
|
1023 | + return EE_Config::instance()->currency; |
|
1024 | + }, |
|
1025 | + 'EE_Registration_Config' => function () { |
|
1026 | + return EE_Config::instance()->registration; |
|
1027 | + }, |
|
1028 | + 'EE_Core_Config' => function () { |
|
1029 | + return EE_Config::instance()->core; |
|
1030 | + }, |
|
1031 | + 'EventEspresso\core\services\loaders\Loader' => function () { |
|
1032 | + return LoaderFactory::getLoader(); |
|
1033 | + }, |
|
1034 | + 'EE_Network_Config' => function () { |
|
1035 | + return EE_Network_Config::instance(); |
|
1036 | + }, |
|
1037 | + 'EE_Config' => function () { |
|
1038 | + return EE_Config::instance(); |
|
1039 | + }, |
|
1040 | + 'EventEspresso\core\domain\Domain' => function () { |
|
1041 | + return DomainFactory::getEventEspressoCoreDomain(); |
|
1042 | + }, |
|
1043 | + 'EE_Admin_Config' => function () { |
|
1044 | + return EE_Config::instance()->admin; |
|
1045 | + }, |
|
1046 | + 'EE_Organization_Config' => function () { |
|
1047 | + return EE_Config::instance()->organization; |
|
1048 | + }, |
|
1049 | + 'EE_Network_Core_Config' => function () { |
|
1050 | + return EE_Network_Config::instance()->core; |
|
1051 | + }, |
|
1052 | + 'EE_Environment_Config' => function () { |
|
1053 | + return EE_Config::instance()->environment; |
|
1054 | + }, |
|
1055 | + 'EE_Ticket_Selector_Config' => function () { |
|
1056 | + return EE_Config::instance()->template_settings->EED_Ticket_Selector; |
|
1057 | + }, |
|
1058 | + ]; |
|
1059 | + } |
|
1060 | + |
|
1061 | + |
|
1062 | + /** |
|
1063 | + * can be used for supplying alternate names for classes, |
|
1064 | + * or for connecting interface names to instantiable classes |
|
1065 | + */ |
|
1066 | + protected function _register_core_aliases() |
|
1067 | + { |
|
1068 | + $aliases = [ |
|
1069 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
1070 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
1071 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
1072 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
1073 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
1074 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
1075 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1076 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
1077 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1078 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
1079 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommand', |
|
1080 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommand', |
|
1081 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
1082 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
1083 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
1084 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommand', |
|
1085 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\domain\services\commands\transaction\CreateTransactionCommandHandler', |
|
1086 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler', |
|
1087 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
1088 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
1089 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1090 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
1091 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1092 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
1093 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
1094 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
1095 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
1096 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
1097 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
1098 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
1099 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
1100 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
1101 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
1102 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
1103 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
1104 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
1105 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
1106 | + 'Registration_Processor' => 'EE_Registration_Processor', |
|
1107 | + ]; |
|
1108 | + foreach ($aliases as $alias => $fqn) { |
|
1109 | + if (is_array($fqn)) { |
|
1110 | + foreach ($fqn as $class => $for_class) { |
|
1111 | + $this->class_cache->addAlias($class, $alias, $for_class); |
|
1112 | + } |
|
1113 | + continue; |
|
1114 | + } |
|
1115 | + $this->class_cache->addAlias($fqn, $alias); |
|
1116 | + } |
|
1117 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1118 | + $this->class_cache->addAlias( |
|
1119 | + 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
1120 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
1121 | + ); |
|
1122 | + } |
|
1123 | + } |
|
1124 | + |
|
1125 | + |
|
1126 | + public function debug($for_class = '') |
|
1127 | + { |
|
1128 | + $this->class_cache->debug($for_class); |
|
1129 | + } |
|
1130 | + |
|
1131 | + |
|
1132 | + /** |
|
1133 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
1134 | + * request Primarily used by unit tests. |
|
1135 | + */ |
|
1136 | + public function reset() |
|
1137 | + { |
|
1138 | + $this->_register_core_class_loaders(); |
|
1139 | + $this->_register_core_dependencies(); |
|
1140 | + } |
|
1141 | + |
|
1142 | + |
|
1143 | + /** |
|
1144 | + * PLZ NOTE: a better name for this method would be is_alias() |
|
1145 | + * because it returns TRUE if the provided fully qualified name IS an alias |
|
1146 | + * WHY? |
|
1147 | + * Because if a class is type hinting for a concretion, |
|
1148 | + * then why would we need to find another class to supply it? |
|
1149 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
1150 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
1151 | + * Don't go looking for some substitute. |
|
1152 | + * Whereas if a class is type hinting for an interface... |
|
1153 | + * then we need to find an actual class to use. |
|
1154 | + * So the interface IS the alias for some other FQN, |
|
1155 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
1156 | + * represents some other class. |
|
1157 | + * |
|
1158 | + * @param string $fqn |
|
1159 | + * @param string $for_class |
|
1160 | + * @return bool |
|
1161 | + * @deprecated 4.9.62.p |
|
1162 | + */ |
|
1163 | + public function has_alias($fqn = '', $for_class = '') |
|
1164 | + { |
|
1165 | + return $this->isAlias($fqn, $for_class); |
|
1166 | + } |
|
1167 | + |
|
1168 | + |
|
1169 | + /** |
|
1170 | + * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1171 | + * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1172 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1173 | + * for example: |
|
1174 | + * if the following two entries were added to the _aliases array: |
|
1175 | + * array( |
|
1176 | + * 'interface_alias' => 'some\namespace\interface' |
|
1177 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
1178 | + * ) |
|
1179 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1180 | + * to load an instance of 'some\namespace\classname' |
|
1181 | + * |
|
1182 | + * @param string $alias |
|
1183 | + * @param string $for_class |
|
1184 | + * @return string |
|
1185 | + * @deprecated 4.9.62.p |
|
1186 | + */ |
|
1187 | + public function get_alias($alias = '', $for_class = '') |
|
1188 | + { |
|
1189 | + return $this->getFqnForAlias($alias, $for_class); |
|
1190 | + } |
|
1191 | 1191 | } |
@@ -73,7 +73,7 @@ |
||
73 | 73 | |
74 | 74 | private function getCurrentPage() |
75 | 75 | { |
76 | - if (! $this->current_page instanceof CurrentPage) { |
|
76 | + if ( ! $this->current_page instanceof CurrentPage) { |
|
77 | 77 | $this->current_page = LoaderFactory::getLoader()->getShared(CurrentPage::class); |
78 | 78 | } |
79 | 79 | return $this->current_page; |
@@ -16,273 +16,273 @@ |
||
16 | 16 | */ |
17 | 17 | final class EE_Request_Handler implements InterminableInterface |
18 | 18 | { |
19 | - /** |
|
20 | - * @var CurrentPage |
|
21 | - */ |
|
22 | - private $current_page; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var RequestInterface |
|
26 | - */ |
|
27 | - private $request; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var ResponseInterface |
|
31 | - */ |
|
32 | - private $response; |
|
33 | - |
|
34 | - /** |
|
35 | - * whether current request is via AJAX |
|
36 | - * |
|
37 | - * @var boolean |
|
38 | - */ |
|
39 | - public $ajax = false; |
|
40 | - |
|
41 | - /** |
|
42 | - * whether current request is via AJAX from the frontend of the site |
|
43 | - * |
|
44 | - * @var boolean |
|
45 | - */ |
|
46 | - public $front_ajax = false; |
|
47 | - |
|
48 | - |
|
49 | - /** |
|
50 | - * @param RequestInterface $request |
|
51 | - * @param ResponseInterface $response |
|
52 | - */ |
|
53 | - public function __construct(RequestInterface $request, ResponseInterface $response) |
|
54 | - { |
|
55 | - $this->request = $request; |
|
56 | - $this->response = $response; |
|
57 | - $this->ajax = $this->request->isAjax(); |
|
58 | - $this->front_ajax = $this->request->isFrontAjax(); |
|
59 | - do_action('AHEE__EE_Request_Handler__construct__complete'); |
|
60 | - } |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * @param WP $WP |
|
65 | - * @return void |
|
66 | - * @deprecated 4.10.14.p |
|
67 | - */ |
|
68 | - public function parse_request($WP = null) |
|
69 | - { |
|
70 | - } |
|
71 | - |
|
72 | - |
|
73 | - private function getCurrentPage() |
|
74 | - { |
|
75 | - if (! $this->current_page instanceof CurrentPage) { |
|
76 | - $this->current_page = LoaderFactory::getLoader()->getShared(CurrentPage::class); |
|
77 | - } |
|
78 | - return $this->current_page; |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - /** |
|
83 | - * @param WP $WP |
|
84 | - * @return void |
|
85 | - * @deprecated 4.10.14.p |
|
86 | - */ |
|
87 | - public function set_request_vars($WP = null) |
|
88 | - { |
|
89 | - $this->getCurrentPage()->parseQueryVars($WP); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * @param WP $WP |
|
95 | - * @return int |
|
96 | - * @deprecated 4.10.14.p |
|
97 | - */ |
|
98 | - public function get_post_id_from_request($WP = null) |
|
99 | - { |
|
100 | - return $this->getCurrentPage()->postId(); |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - /** |
|
105 | - * @param WP $WP |
|
106 | - * @return string |
|
107 | - * @deprecated 4.10.14.p |
|
108 | - */ |
|
109 | - public function get_post_name_from_request($WP = null) |
|
110 | - { |
|
111 | - return $this->getCurrentPage()->postName(); |
|
112 | - } |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * @param WP $WP |
|
117 | - * @return array |
|
118 | - * @deprecated 4.10.14.p |
|
119 | - */ |
|
120 | - public function get_post_type_from_request($WP = null) |
|
121 | - { |
|
122 | - return $this->getCurrentPage()->postType(); |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * Just a helper method for getting the url for the displayed page. |
|
128 | - * |
|
129 | - * @param WP $WP |
|
130 | - * @return string |
|
131 | - * @deprecated 4.10.14.p |
|
132 | - */ |
|
133 | - public function get_current_page_permalink($WP = null) |
|
134 | - { |
|
135 | - return $this->getCurrentPage()->getPermalink($WP); |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * @return bool |
|
141 | - * @deprecated 4.10.14.p |
|
142 | - */ |
|
143 | - public function test_for_espresso_page() |
|
144 | - { |
|
145 | - return $this->getCurrentPage()->isEspressoPage(); |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - /** |
|
150 | - * @param $key |
|
151 | - * @param $value |
|
152 | - * @return void |
|
153 | - * @deprecated 4.10.14.p |
|
154 | - */ |
|
155 | - public function set_notice($key, $value) |
|
156 | - { |
|
157 | - $this->response->setNotice($key, $value); |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - /** |
|
162 | - * @param $key |
|
163 | - * @return mixed |
|
164 | - * @deprecated 4.10.14.p |
|
165 | - */ |
|
166 | - public function get_notice($key) |
|
167 | - { |
|
168 | - return $this->response->getNotice($key); |
|
169 | - } |
|
170 | - |
|
171 | - |
|
172 | - /** |
|
173 | - * @param $string |
|
174 | - * @return void |
|
175 | - * @deprecated 4.10.14.p |
|
176 | - */ |
|
177 | - public function add_output($string) |
|
178 | - { |
|
179 | - $this->response->addOutput($string); |
|
180 | - } |
|
181 | - |
|
182 | - |
|
183 | - /** |
|
184 | - * @return string |
|
185 | - * @deprecated 4.10.14.p |
|
186 | - */ |
|
187 | - public function get_output() |
|
188 | - { |
|
189 | - return $this->response->getOutput(); |
|
190 | - } |
|
191 | - |
|
192 | - |
|
193 | - /** |
|
194 | - * @param $item |
|
195 | - * @param $key |
|
196 | - * @deprecated 4.10.14.p |
|
197 | - */ |
|
198 | - public function sanitize_text_field_for_array_walk(&$item, &$key) |
|
199 | - { |
|
200 | - $item = strpos($item, 'email') !== false |
|
201 | - ? sanitize_email($item) |
|
202 | - : sanitize_text_field($item); |
|
203 | - } |
|
204 | - |
|
205 | - |
|
206 | - /** |
|
207 | - * @param null|bool $value |
|
208 | - * @return void |
|
209 | - * @deprecated 4.10.14.p |
|
210 | - */ |
|
211 | - public function set_espresso_page($value = null) |
|
212 | - { |
|
213 | - $this->getCurrentPage()->setEspressoPage($value); |
|
214 | - } |
|
215 | - |
|
216 | - |
|
217 | - /** |
|
218 | - * @return bool |
|
219 | - * @deprecated 4.10.14.p |
|
220 | - */ |
|
221 | - public function is_espresso_page() |
|
222 | - { |
|
223 | - return $this->getCurrentPage()->isEspressoPage(); |
|
224 | - } |
|
225 | - |
|
226 | - |
|
227 | - /** |
|
228 | - * returns sanitized contents of $_REQUEST |
|
229 | - * |
|
230 | - * @return array |
|
231 | - * @deprecated 4.10.14.p |
|
232 | - */ |
|
233 | - public function params() |
|
234 | - { |
|
235 | - return $this->request->requestParams(); |
|
236 | - } |
|
237 | - |
|
238 | - |
|
239 | - /** |
|
240 | - * @param $key |
|
241 | - * @param $value |
|
242 | - * @param bool $override_ee |
|
243 | - * @return void |
|
244 | - * @deprecated 4.10.14.p |
|
245 | - */ |
|
246 | - public function set($key, $value, $override_ee = false) |
|
247 | - { |
|
248 | - $this->request->setRequestParam($key, $value, $override_ee); |
|
249 | - } |
|
250 | - |
|
251 | - |
|
252 | - /** |
|
253 | - * @param $key |
|
254 | - * @param null $default |
|
255 | - * @return mixed |
|
256 | - * @deprecated 4.10.14.p |
|
257 | - */ |
|
258 | - public function get($key, $default = null) |
|
259 | - { |
|
260 | - return $this->request->getRequestParam($key, $default); |
|
261 | - } |
|
262 | - |
|
263 | - |
|
264 | - /** |
|
265 | - * check if param exists |
|
266 | - * |
|
267 | - * @param $key |
|
268 | - * @return boolean |
|
269 | - * @deprecated 4.10.14.p |
|
270 | - */ |
|
271 | - public function is_set($key) |
|
272 | - { |
|
273 | - return $this->request->requestParamIsSet($key); |
|
274 | - } |
|
275 | - |
|
276 | - |
|
277 | - /** |
|
278 | - * remove param |
|
279 | - * |
|
280 | - * @param $key |
|
281 | - * @return void |
|
282 | - * @deprecated 4.10.14.p |
|
283 | - */ |
|
284 | - public function un_set($key) |
|
285 | - { |
|
286 | - $this->request->unSetRequestParam($key); |
|
287 | - } |
|
19 | + /** |
|
20 | + * @var CurrentPage |
|
21 | + */ |
|
22 | + private $current_page; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var RequestInterface |
|
26 | + */ |
|
27 | + private $request; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var ResponseInterface |
|
31 | + */ |
|
32 | + private $response; |
|
33 | + |
|
34 | + /** |
|
35 | + * whether current request is via AJAX |
|
36 | + * |
|
37 | + * @var boolean |
|
38 | + */ |
|
39 | + public $ajax = false; |
|
40 | + |
|
41 | + /** |
|
42 | + * whether current request is via AJAX from the frontend of the site |
|
43 | + * |
|
44 | + * @var boolean |
|
45 | + */ |
|
46 | + public $front_ajax = false; |
|
47 | + |
|
48 | + |
|
49 | + /** |
|
50 | + * @param RequestInterface $request |
|
51 | + * @param ResponseInterface $response |
|
52 | + */ |
|
53 | + public function __construct(RequestInterface $request, ResponseInterface $response) |
|
54 | + { |
|
55 | + $this->request = $request; |
|
56 | + $this->response = $response; |
|
57 | + $this->ajax = $this->request->isAjax(); |
|
58 | + $this->front_ajax = $this->request->isFrontAjax(); |
|
59 | + do_action('AHEE__EE_Request_Handler__construct__complete'); |
|
60 | + } |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * @param WP $WP |
|
65 | + * @return void |
|
66 | + * @deprecated 4.10.14.p |
|
67 | + */ |
|
68 | + public function parse_request($WP = null) |
|
69 | + { |
|
70 | + } |
|
71 | + |
|
72 | + |
|
73 | + private function getCurrentPage() |
|
74 | + { |
|
75 | + if (! $this->current_page instanceof CurrentPage) { |
|
76 | + $this->current_page = LoaderFactory::getLoader()->getShared(CurrentPage::class); |
|
77 | + } |
|
78 | + return $this->current_page; |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + /** |
|
83 | + * @param WP $WP |
|
84 | + * @return void |
|
85 | + * @deprecated 4.10.14.p |
|
86 | + */ |
|
87 | + public function set_request_vars($WP = null) |
|
88 | + { |
|
89 | + $this->getCurrentPage()->parseQueryVars($WP); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * @param WP $WP |
|
95 | + * @return int |
|
96 | + * @deprecated 4.10.14.p |
|
97 | + */ |
|
98 | + public function get_post_id_from_request($WP = null) |
|
99 | + { |
|
100 | + return $this->getCurrentPage()->postId(); |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + /** |
|
105 | + * @param WP $WP |
|
106 | + * @return string |
|
107 | + * @deprecated 4.10.14.p |
|
108 | + */ |
|
109 | + public function get_post_name_from_request($WP = null) |
|
110 | + { |
|
111 | + return $this->getCurrentPage()->postName(); |
|
112 | + } |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * @param WP $WP |
|
117 | + * @return array |
|
118 | + * @deprecated 4.10.14.p |
|
119 | + */ |
|
120 | + public function get_post_type_from_request($WP = null) |
|
121 | + { |
|
122 | + return $this->getCurrentPage()->postType(); |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * Just a helper method for getting the url for the displayed page. |
|
128 | + * |
|
129 | + * @param WP $WP |
|
130 | + * @return string |
|
131 | + * @deprecated 4.10.14.p |
|
132 | + */ |
|
133 | + public function get_current_page_permalink($WP = null) |
|
134 | + { |
|
135 | + return $this->getCurrentPage()->getPermalink($WP); |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * @return bool |
|
141 | + * @deprecated 4.10.14.p |
|
142 | + */ |
|
143 | + public function test_for_espresso_page() |
|
144 | + { |
|
145 | + return $this->getCurrentPage()->isEspressoPage(); |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + /** |
|
150 | + * @param $key |
|
151 | + * @param $value |
|
152 | + * @return void |
|
153 | + * @deprecated 4.10.14.p |
|
154 | + */ |
|
155 | + public function set_notice($key, $value) |
|
156 | + { |
|
157 | + $this->response->setNotice($key, $value); |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + /** |
|
162 | + * @param $key |
|
163 | + * @return mixed |
|
164 | + * @deprecated 4.10.14.p |
|
165 | + */ |
|
166 | + public function get_notice($key) |
|
167 | + { |
|
168 | + return $this->response->getNotice($key); |
|
169 | + } |
|
170 | + |
|
171 | + |
|
172 | + /** |
|
173 | + * @param $string |
|
174 | + * @return void |
|
175 | + * @deprecated 4.10.14.p |
|
176 | + */ |
|
177 | + public function add_output($string) |
|
178 | + { |
|
179 | + $this->response->addOutput($string); |
|
180 | + } |
|
181 | + |
|
182 | + |
|
183 | + /** |
|
184 | + * @return string |
|
185 | + * @deprecated 4.10.14.p |
|
186 | + */ |
|
187 | + public function get_output() |
|
188 | + { |
|
189 | + return $this->response->getOutput(); |
|
190 | + } |
|
191 | + |
|
192 | + |
|
193 | + /** |
|
194 | + * @param $item |
|
195 | + * @param $key |
|
196 | + * @deprecated 4.10.14.p |
|
197 | + */ |
|
198 | + public function sanitize_text_field_for_array_walk(&$item, &$key) |
|
199 | + { |
|
200 | + $item = strpos($item, 'email') !== false |
|
201 | + ? sanitize_email($item) |
|
202 | + : sanitize_text_field($item); |
|
203 | + } |
|
204 | + |
|
205 | + |
|
206 | + /** |
|
207 | + * @param null|bool $value |
|
208 | + * @return void |
|
209 | + * @deprecated 4.10.14.p |
|
210 | + */ |
|
211 | + public function set_espresso_page($value = null) |
|
212 | + { |
|
213 | + $this->getCurrentPage()->setEspressoPage($value); |
|
214 | + } |
|
215 | + |
|
216 | + |
|
217 | + /** |
|
218 | + * @return bool |
|
219 | + * @deprecated 4.10.14.p |
|
220 | + */ |
|
221 | + public function is_espresso_page() |
|
222 | + { |
|
223 | + return $this->getCurrentPage()->isEspressoPage(); |
|
224 | + } |
|
225 | + |
|
226 | + |
|
227 | + /** |
|
228 | + * returns sanitized contents of $_REQUEST |
|
229 | + * |
|
230 | + * @return array |
|
231 | + * @deprecated 4.10.14.p |
|
232 | + */ |
|
233 | + public function params() |
|
234 | + { |
|
235 | + return $this->request->requestParams(); |
|
236 | + } |
|
237 | + |
|
238 | + |
|
239 | + /** |
|
240 | + * @param $key |
|
241 | + * @param $value |
|
242 | + * @param bool $override_ee |
|
243 | + * @return void |
|
244 | + * @deprecated 4.10.14.p |
|
245 | + */ |
|
246 | + public function set($key, $value, $override_ee = false) |
|
247 | + { |
|
248 | + $this->request->setRequestParam($key, $value, $override_ee); |
|
249 | + } |
|
250 | + |
|
251 | + |
|
252 | + /** |
|
253 | + * @param $key |
|
254 | + * @param null $default |
|
255 | + * @return mixed |
|
256 | + * @deprecated 4.10.14.p |
|
257 | + */ |
|
258 | + public function get($key, $default = null) |
|
259 | + { |
|
260 | + return $this->request->getRequestParam($key, $default); |
|
261 | + } |
|
262 | + |
|
263 | + |
|
264 | + /** |
|
265 | + * check if param exists |
|
266 | + * |
|
267 | + * @param $key |
|
268 | + * @return boolean |
|
269 | + * @deprecated 4.10.14.p |
|
270 | + */ |
|
271 | + public function is_set($key) |
|
272 | + { |
|
273 | + return $this->request->requestParamIsSet($key); |
|
274 | + } |
|
275 | + |
|
276 | + |
|
277 | + /** |
|
278 | + * remove param |
|
279 | + * |
|
280 | + * @param $key |
|
281 | + * @return void |
|
282 | + * @deprecated 4.10.14.p |
|
283 | + */ |
|
284 | + public function un_set($key) |
|
285 | + { |
|
286 | + $this->request->unSetRequestParam($key); |
|
287 | + } |
|
288 | 288 | } |