@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | if (defined('TICKET_SELECTOR_ASSETS_URL')) { |
139 | 139 | return; |
140 | 140 | } |
141 | - define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/'); |
|
141 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets/'); |
|
142 | 142 | define( |
143 | 143 | 'TICKET_SELECTOR_TEMPLATES_PATH', |
144 | - str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/' |
|
144 | + str_replace('\\', '/', plugin_dir_path(__FILE__)).'templates/' |
|
145 | 145 | ); |
146 | 146 | // initialize config |
147 | 147 | EED_Ticket_Selector::instance()->set_config(); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public static function ticketSelector() |
165 | 165 | { |
166 | - if (! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) { |
|
166 | + if ( ! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) { |
|
167 | 167 | EED_Ticket_Selector::$ticket_selector = new DisplayTicketSelector( |
168 | 168 | EED_Ticket_Selector::getRequest(), |
169 | 169 | EED_Ticket_Selector::ticketConfig(), |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public static function getIframeEmbedButton() |
192 | 192 | { |
193 | - if (! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton) { |
|
193 | + if ( ! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton) { |
|
194 | 194 | self::$iframe_embed_button = new TicketSelectorIframeEmbedButton(); |
195 | 195 | } |
196 | 196 | return self::$iframe_embed_button; |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | // add some style |
299 | 299 | wp_register_style( |
300 | 300 | 'ticket_selector', |
301 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css', |
|
301 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css', |
|
302 | 302 | [], |
303 | 303 | EVENT_ESPRESSO_VERSION |
304 | 304 | ); |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | // make it dance |
307 | 307 | wp_register_script( |
308 | 308 | 'ticket_selector', |
309 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', |
|
309 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.js', |
|
310 | 310 | ['espresso_core'], |
311 | 311 | EVENT_ESPRESSO_VERSION, |
312 | 312 | true |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | */ |
354 | 354 | public static function iframeCss(array $iframe_css) |
355 | 355 | { |
356 | - $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'; |
|
356 | + $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'; |
|
357 | 357 | return $iframe_css; |
358 | 358 | } |
359 | 359 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | */ |
367 | 367 | public static function iframeJs(array $iframe_js) |
368 | 368 | { |
369 | - $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js'; |
|
369 | + $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL.'ticket_selector.js'; |
|
370 | 370 | return $iframe_js; |
371 | 371 | } |
372 | 372 |
@@ -18,491 +18,491 @@ |
||
18 | 18 | */ |
19 | 19 | class EED_Ticket_Selector extends EED_Module |
20 | 20 | { |
21 | - /** |
|
22 | - * @var DisplayTicketSelector $ticket_selector |
|
23 | - */ |
|
24 | - private static $ticket_selector; |
|
25 | - |
|
26 | - /** |
|
27 | - * @var TicketSelectorIframeEmbedButton $iframe_embed_button |
|
28 | - */ |
|
29 | - private static $iframe_embed_button; |
|
30 | - |
|
31 | - |
|
32 | - /** |
|
33 | - * @return EED_Module|EED_Ticket_Selector |
|
34 | - * @throws EE_Error |
|
35 | - * @throws ReflectionException |
|
36 | - */ |
|
37 | - public static function instance() |
|
38 | - { |
|
39 | - return parent::get_instance(__CLASS__); |
|
40 | - } |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @return EE_Ticket_Selector_Config |
|
45 | - * @throws EE_Error |
|
46 | - * @throws ReflectionException |
|
47 | - */ |
|
48 | - public static function ticketConfig() |
|
49 | - { |
|
50 | - EED_Ticket_Selector::instance()->set_config(); |
|
51 | - return EED_Ticket_Selector::instance()->config(); |
|
52 | - } |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * @return void |
|
57 | - */ |
|
58 | - protected function set_config() |
|
59 | - { |
|
60 | - if ($this->_config instanceof EE_Ticket_Selector_Config) { |
|
61 | - return; |
|
62 | - } |
|
63 | - $this->set_config_section('template_settings'); |
|
64 | - $this->set_config_class('EE_Ticket_Selector_Config'); |
|
65 | - $this->set_config_name('EED_Ticket_Selector'); |
|
66 | - } |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
71 | - * |
|
72 | - * @return void |
|
73 | - */ |
|
74 | - public static function set_hooks() |
|
75 | - { |
|
76 | - // routing |
|
77 | - EE_Config::register_route( |
|
78 | - 'iframe', |
|
79 | - 'EED_Ticket_Selector', |
|
80 | - 'ticket_selector_iframe', |
|
81 | - 'ticket_selector' |
|
82 | - ); |
|
83 | - EE_Config::register_route( |
|
84 | - 'process_ticket_selections', |
|
85 | - 'EED_Ticket_Selector', |
|
86 | - 'process_ticket_selections' |
|
87 | - ); |
|
88 | - EE_Config::register_route( |
|
89 | - 'cancel_ticket_selections', |
|
90 | - 'EED_Ticket_Selector', |
|
91 | - 'cancel_ticket_selections' |
|
92 | - ); |
|
93 | - add_action('wp_loaded', ['EED_Ticket_Selector', 'set_definitions'], 2); |
|
94 | - add_action('AHEE_event_details_header_bottom', ['EED_Ticket_Selector', 'display_ticket_selector'], 10, 1); |
|
95 | - add_action('wp_enqueue_scripts', ['EED_Ticket_Selector', 'translate_js_strings'], 0); |
|
96 | - add_action('wp_enqueue_scripts', ['EED_Ticket_Selector', 'load_tckt_slctr_assets'], 10); |
|
97 | - EED_Ticket_Selector::loadIframeAssets(); |
|
98 | - } |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
103 | - * |
|
104 | - * @return void |
|
105 | - */ |
|
106 | - public static function set_hooks_admin() |
|
107 | - { |
|
108 | - // hook into the end of the \EE_Admin_Page::_load_page_dependencies() |
|
109 | - // to load assets for "espresso_events" page on the "edit" route (action) |
|
110 | - add_action( |
|
111 | - 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__edit', |
|
112 | - ['EED_Ticket_Selector', 'ticket_selector_iframe_embed_button'], |
|
113 | - 10 |
|
114 | - ); |
|
115 | - /** |
|
116 | - * Make sure assets for the ticket selector are loaded on the espresso registrations route so admin side |
|
117 | - * registrations work. |
|
118 | - */ |
|
119 | - add_action( |
|
120 | - 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_registrations__new_registration', |
|
121 | - ['EED_Ticket_Selector', 'set_definitions'], |
|
122 | - 10 |
|
123 | - ); |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - /** |
|
128 | - * set_definitions |
|
129 | - * |
|
130 | - * @return void |
|
131 | - * @throws EE_Error |
|
132 | - * @throws ReflectionException |
|
133 | - */ |
|
134 | - public static function set_definitions() |
|
135 | - { |
|
136 | - // don't do this twice |
|
137 | - if (defined('TICKET_SELECTOR_ASSETS_URL')) { |
|
138 | - return; |
|
139 | - } |
|
140 | - define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/'); |
|
141 | - define( |
|
142 | - 'TICKET_SELECTOR_TEMPLATES_PATH', |
|
143 | - str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/' |
|
144 | - ); |
|
145 | - // initialize config |
|
146 | - EED_Ticket_Selector::instance()->set_config(); |
|
147 | - // if config is not set, initialize |
|
148 | - if ( |
|
149 | - ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config |
|
150 | - ) { |
|
151 | - EED_Ticket_Selector::instance()->set_config(); |
|
152 | - EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = |
|
153 | - EED_Ticket_Selector::instance()->config(); |
|
154 | - } |
|
155 | - } |
|
156 | - |
|
157 | - |
|
158 | - /** |
|
159 | - * @return DisplayTicketSelector |
|
160 | - * @throws EE_Error |
|
161 | - * @throws ReflectionException |
|
162 | - */ |
|
163 | - public static function ticketSelector() |
|
164 | - { |
|
165 | - if (! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) { |
|
166 | - EED_Ticket_Selector::$ticket_selector = new DisplayTicketSelector( |
|
167 | - EED_Ticket_Selector::getRequest(), |
|
168 | - EED_Ticket_Selector::ticketConfig(), |
|
169 | - EED_Events_Archive::is_iframe() |
|
170 | - ); |
|
171 | - } |
|
172 | - return EED_Ticket_Selector::$ticket_selector; |
|
173 | - } |
|
174 | - |
|
175 | - |
|
176 | - /** |
|
177 | - * gets the ball rolling |
|
178 | - * |
|
179 | - * @param WP $WP |
|
180 | - * @return void |
|
181 | - */ |
|
182 | - public function run($WP) |
|
183 | - { |
|
184 | - } |
|
185 | - |
|
186 | - |
|
187 | - /** |
|
188 | - * @return TicketSelectorIframeEmbedButton |
|
189 | - */ |
|
190 | - public static function getIframeEmbedButton() |
|
191 | - { |
|
192 | - if (! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton) { |
|
193 | - self::$iframe_embed_button = new TicketSelectorIframeEmbedButton(); |
|
194 | - } |
|
195 | - return self::$iframe_embed_button; |
|
196 | - } |
|
197 | - |
|
198 | - |
|
199 | - /** |
|
200 | - * ticket_selector_iframe_embed_button |
|
201 | - * |
|
202 | - * @return void |
|
203 | - */ |
|
204 | - public static function ticket_selector_iframe_embed_button() |
|
205 | - { |
|
206 | - $iframe_embed_button = EED_Ticket_Selector::getIframeEmbedButton(); |
|
207 | - $iframe_embed_button->addEventEditorIframeEmbedButton(); |
|
208 | - } |
|
209 | - |
|
210 | - |
|
211 | - /** |
|
212 | - * ticket_selector_iframe |
|
213 | - * |
|
214 | - * @return void |
|
215 | - * @throws DomainException |
|
216 | - */ |
|
217 | - public function ticket_selector_iframe() |
|
218 | - { |
|
219 | - EE_Dependency_Map::register_dependencies( |
|
220 | - TicketSelectorIframe::class, |
|
221 | - [ |
|
222 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
223 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
224 | - 'EventEspresso\core\services\request\RequestInterface' => EE_Dependency_Map::load_from_cache, |
|
225 | - ] |
|
226 | - ); |
|
227 | - $ticket_selector_iframe = LoaderFactory::getLoader()->getNew(TicketSelectorIframe::class); |
|
228 | - $ticket_selector_iframe->display(); |
|
229 | - } |
|
230 | - |
|
231 | - |
|
232 | - /** |
|
233 | - * creates buttons for selecting number of attendees for an event |
|
234 | - * |
|
235 | - * @param WP_Post|int $event |
|
236 | - * @param bool $view_details |
|
237 | - * @return string |
|
238 | - * @throws EE_Error |
|
239 | - * @throws ReflectionException |
|
240 | - */ |
|
241 | - public static function display_ticket_selector($event = null, $view_details = false) |
|
242 | - { |
|
243 | - return EED_Ticket_Selector::ticketSelector()->display($event, $view_details); |
|
244 | - } |
|
245 | - |
|
246 | - |
|
247 | - /** |
|
248 | - * @return bool or FALSE |
|
249 | - * @throws EE_Error |
|
250 | - * @throws InvalidArgumentException |
|
251 | - * @throws InvalidInterfaceException |
|
252 | - * @throws InvalidDataTypeException |
|
253 | - * @throws ReflectionException |
|
254 | - */ |
|
255 | - public function process_ticket_selections() |
|
256 | - { |
|
257 | - /** @var EventEspresso\modules\ticket_selector\ProcessTicketSelector $form */ |
|
258 | - $form = LoaderFactory::getLoader()->getShared('EventEspresso\modules\ticket_selector\ProcessTicketSelector'); |
|
259 | - return $form->processTicketSelections(); |
|
260 | - } |
|
261 | - |
|
262 | - |
|
263 | - /** |
|
264 | - * @return bool |
|
265 | - * @throws InvalidArgumentException |
|
266 | - * @throws InvalidInterfaceException |
|
267 | - * @throws InvalidDataTypeException |
|
268 | - * @throws EE_Error |
|
269 | - * @throws ReflectionException |
|
270 | - */ |
|
271 | - public static function cancel_ticket_selections() |
|
272 | - { |
|
273 | - /** @var EventEspresso\modules\ticket_selector\ProcessTicketSelector $form */ |
|
274 | - $form = LoaderFactory::getLoader()->getShared('EventEspresso\modules\ticket_selector\ProcessTicketSelector'); |
|
275 | - return $form->cancelTicketSelections(); |
|
276 | - } |
|
277 | - |
|
278 | - |
|
279 | - /** |
|
280 | - * @return void |
|
281 | - */ |
|
282 | - public static function translate_js_strings() |
|
283 | - { |
|
284 | - EE_Registry::$i18n_js_strings['please_select_date_filter_notice'] = esc_html__( |
|
285 | - 'please select a datetime', |
|
286 | - 'event_espresso' |
|
287 | - ); |
|
288 | - } |
|
289 | - |
|
290 | - |
|
291 | - /** |
|
292 | - * @return void |
|
293 | - */ |
|
294 | - public static function load_tckt_slctr_assets() |
|
295 | - { |
|
296 | - if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', false)) { |
|
297 | - // add some style |
|
298 | - wp_register_style( |
|
299 | - 'ticket_selector', |
|
300 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css', |
|
301 | - [], |
|
302 | - EVENT_ESPRESSO_VERSION |
|
303 | - ); |
|
304 | - wp_enqueue_style('ticket_selector'); |
|
305 | - // make it dance |
|
306 | - wp_register_script( |
|
307 | - 'ticket_selector', |
|
308 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', |
|
309 | - ['espresso_core'], |
|
310 | - EVENT_ESPRESSO_VERSION, |
|
311 | - true |
|
312 | - ); |
|
313 | - wp_enqueue_script('ticket_selector'); |
|
314 | - require_once EE_LIBRARIES |
|
315 | - . 'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php'; |
|
316 | - EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts(); |
|
317 | - } |
|
318 | - } |
|
319 | - |
|
320 | - |
|
321 | - /** |
|
322 | - * @return void |
|
323 | - */ |
|
324 | - public static function loadIframeAssets() |
|
325 | - { |
|
326 | - // for event lists |
|
327 | - add_filter( |
|
328 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
329 | - ['EED_Ticket_Selector', 'iframeCss'] |
|
330 | - ); |
|
331 | - add_filter( |
|
332 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
333 | - ['EED_Ticket_Selector', 'iframeJs'] |
|
334 | - ); |
|
335 | - // for ticket selectors |
|
336 | - add_filter( |
|
337 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
338 | - ['EED_Ticket_Selector', 'iframeCss'] |
|
339 | - ); |
|
340 | - add_filter( |
|
341 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
342 | - ['EED_Ticket_Selector', 'iframeJs'] |
|
343 | - ); |
|
344 | - } |
|
345 | - |
|
346 | - |
|
347 | - /** |
|
348 | - * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
349 | - * |
|
350 | - * @param array $iframe_css |
|
351 | - * @return array |
|
352 | - */ |
|
353 | - public static function iframeCss(array $iframe_css) |
|
354 | - { |
|
355 | - $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'; |
|
356 | - return $iframe_css; |
|
357 | - } |
|
358 | - |
|
359 | - |
|
360 | - /** |
|
361 | - * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
362 | - * |
|
363 | - * @param array $iframe_js |
|
364 | - * @return array |
|
365 | - */ |
|
366 | - public static function iframeJs(array $iframe_js) |
|
367 | - { |
|
368 | - $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js'; |
|
369 | - return $iframe_js; |
|
370 | - } |
|
371 | - |
|
372 | - |
|
373 | - /****************************** DEPRECATED ******************************/ |
|
374 | - |
|
375 | - |
|
376 | - /** |
|
377 | - * @return string |
|
378 | - * @throws EE_Error |
|
379 | - * @throws ReflectionException |
|
380 | - * @deprecated |
|
381 | - */ |
|
382 | - public static function display_view_details_btn() |
|
383 | - { |
|
384 | - // todo add doing_it_wrong() notice during next major version |
|
385 | - return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton(); |
|
386 | - } |
|
387 | - |
|
388 | - |
|
389 | - /** |
|
390 | - * @return string |
|
391 | - * @throws EE_Error |
|
392 | - * @throws ReflectionException |
|
393 | - * @deprecated |
|
394 | - */ |
|
395 | - public static function display_ticket_selector_submit() |
|
396 | - { |
|
397 | - // todo add doing_it_wrong() notice during next major version |
|
398 | - return EED_Ticket_Selector::ticketSelector()->displaySubmitButton(); |
|
399 | - } |
|
400 | - |
|
401 | - |
|
402 | - /** |
|
403 | - * @param string $permalink_string |
|
404 | - * @param int $id |
|
405 | - * @param string $new_title |
|
406 | - * @param string $new_slug |
|
407 | - * @return string |
|
408 | - * @throws InvalidArgumentException |
|
409 | - * @throws InvalidDataTypeException |
|
410 | - * @throws InvalidInterfaceException |
|
411 | - * @deprecated |
|
412 | - */ |
|
413 | - public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '') |
|
414 | - { |
|
415 | - $request = self::getRequest(); |
|
416 | - // todo add doing_it_wrong() notice during next major version |
|
417 | - if ( |
|
418 | - $request->getRequestParam('page') === 'espresso_events' |
|
419 | - && $request->getRequestParam('action') === 'edit' |
|
420 | - ) { |
|
421 | - $iframe_embed_button = EED_Ticket_Selector::getIframeEmbedButton(); |
|
422 | - $iframe_embed_button->addEventEditorIframeEmbedButton(); |
|
423 | - } |
|
424 | - return ''; |
|
425 | - } |
|
426 | - |
|
427 | - |
|
428 | - /** |
|
429 | - * @param int $ID |
|
430 | - * @param string $external_url |
|
431 | - * @return string |
|
432 | - * @throws EE_Error |
|
433 | - * @throws ReflectionException |
|
434 | - * @deprecated |
|
435 | - */ |
|
436 | - public static function ticket_selector_form_open($ID = 0, $external_url = '') |
|
437 | - { |
|
438 | - // todo add doing_it_wrong() notice during next major version |
|
439 | - return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url); |
|
440 | - } |
|
441 | - |
|
442 | - |
|
443 | - /** |
|
444 | - * @return string |
|
445 | - * @throws EE_Error |
|
446 | - * @throws ReflectionException |
|
447 | - * @deprecated |
|
448 | - */ |
|
449 | - public static function ticket_selector_form_close() |
|
450 | - { |
|
451 | - // todo add doing_it_wrong() notice during next major version |
|
452 | - return EED_Ticket_Selector::ticketSelector()->formClose(); |
|
453 | - } |
|
454 | - |
|
455 | - |
|
456 | - /** |
|
457 | - * @return string |
|
458 | - * @throws EE_Error |
|
459 | - * @throws ReflectionException |
|
460 | - * @deprecated |
|
461 | - */ |
|
462 | - public static function no_tkt_slctr_end_dv() |
|
463 | - { |
|
464 | - // todo add doing_it_wrong() notice during next major version |
|
465 | - return EED_Ticket_Selector::ticketSelector()->ticketSelectorEndDiv(); |
|
466 | - } |
|
467 | - |
|
468 | - |
|
469 | - /** |
|
470 | - * @return string |
|
471 | - * @throws EE_Error |
|
472 | - * @throws ReflectionException |
|
473 | - * @deprecated 4.9.13 |
|
474 | - */ |
|
475 | - public static function tkt_slctr_end_dv() |
|
476 | - { |
|
477 | - return EED_Ticket_Selector::ticketSelector()->clearTicketSelector(); |
|
478 | - } |
|
479 | - |
|
480 | - |
|
481 | - /** |
|
482 | - * @return string |
|
483 | - * @throws EE_Error |
|
484 | - * @throws ReflectionException |
|
485 | - * @deprecated |
|
486 | - */ |
|
487 | - public static function clear_tkt_slctr() |
|
488 | - { |
|
489 | - return EED_Ticket_Selector::ticketSelector()->clearTicketSelector(); |
|
490 | - } |
|
491 | - |
|
492 | - |
|
493 | - /** |
|
494 | - * @deprecated |
|
495 | - */ |
|
496 | - public static function load_tckt_slctr_assets_admin() |
|
497 | - { |
|
498 | - $request = self::getRequest(); |
|
499 | - // todo add doing_it_wrong() notice during next major version |
|
500 | - if ( |
|
501 | - $request->getRequestParam('page') === 'espresso_events' |
|
502 | - && $request->getRequestParam('action') === 'edit' |
|
503 | - ) { |
|
504 | - $iframe_embed_button = EED_Ticket_Selector::getIframeEmbedButton(); |
|
505 | - $iframe_embed_button->embedButtonAssets(); |
|
506 | - } |
|
507 | - } |
|
21 | + /** |
|
22 | + * @var DisplayTicketSelector $ticket_selector |
|
23 | + */ |
|
24 | + private static $ticket_selector; |
|
25 | + |
|
26 | + /** |
|
27 | + * @var TicketSelectorIframeEmbedButton $iframe_embed_button |
|
28 | + */ |
|
29 | + private static $iframe_embed_button; |
|
30 | + |
|
31 | + |
|
32 | + /** |
|
33 | + * @return EED_Module|EED_Ticket_Selector |
|
34 | + * @throws EE_Error |
|
35 | + * @throws ReflectionException |
|
36 | + */ |
|
37 | + public static function instance() |
|
38 | + { |
|
39 | + return parent::get_instance(__CLASS__); |
|
40 | + } |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @return EE_Ticket_Selector_Config |
|
45 | + * @throws EE_Error |
|
46 | + * @throws ReflectionException |
|
47 | + */ |
|
48 | + public static function ticketConfig() |
|
49 | + { |
|
50 | + EED_Ticket_Selector::instance()->set_config(); |
|
51 | + return EED_Ticket_Selector::instance()->config(); |
|
52 | + } |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * @return void |
|
57 | + */ |
|
58 | + protected function set_config() |
|
59 | + { |
|
60 | + if ($this->_config instanceof EE_Ticket_Selector_Config) { |
|
61 | + return; |
|
62 | + } |
|
63 | + $this->set_config_section('template_settings'); |
|
64 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
65 | + $this->set_config_name('EED_Ticket_Selector'); |
|
66 | + } |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
71 | + * |
|
72 | + * @return void |
|
73 | + */ |
|
74 | + public static function set_hooks() |
|
75 | + { |
|
76 | + // routing |
|
77 | + EE_Config::register_route( |
|
78 | + 'iframe', |
|
79 | + 'EED_Ticket_Selector', |
|
80 | + 'ticket_selector_iframe', |
|
81 | + 'ticket_selector' |
|
82 | + ); |
|
83 | + EE_Config::register_route( |
|
84 | + 'process_ticket_selections', |
|
85 | + 'EED_Ticket_Selector', |
|
86 | + 'process_ticket_selections' |
|
87 | + ); |
|
88 | + EE_Config::register_route( |
|
89 | + 'cancel_ticket_selections', |
|
90 | + 'EED_Ticket_Selector', |
|
91 | + 'cancel_ticket_selections' |
|
92 | + ); |
|
93 | + add_action('wp_loaded', ['EED_Ticket_Selector', 'set_definitions'], 2); |
|
94 | + add_action('AHEE_event_details_header_bottom', ['EED_Ticket_Selector', 'display_ticket_selector'], 10, 1); |
|
95 | + add_action('wp_enqueue_scripts', ['EED_Ticket_Selector', 'translate_js_strings'], 0); |
|
96 | + add_action('wp_enqueue_scripts', ['EED_Ticket_Selector', 'load_tckt_slctr_assets'], 10); |
|
97 | + EED_Ticket_Selector::loadIframeAssets(); |
|
98 | + } |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
103 | + * |
|
104 | + * @return void |
|
105 | + */ |
|
106 | + public static function set_hooks_admin() |
|
107 | + { |
|
108 | + // hook into the end of the \EE_Admin_Page::_load_page_dependencies() |
|
109 | + // to load assets for "espresso_events" page on the "edit" route (action) |
|
110 | + add_action( |
|
111 | + 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__edit', |
|
112 | + ['EED_Ticket_Selector', 'ticket_selector_iframe_embed_button'], |
|
113 | + 10 |
|
114 | + ); |
|
115 | + /** |
|
116 | + * Make sure assets for the ticket selector are loaded on the espresso registrations route so admin side |
|
117 | + * registrations work. |
|
118 | + */ |
|
119 | + add_action( |
|
120 | + 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_registrations__new_registration', |
|
121 | + ['EED_Ticket_Selector', 'set_definitions'], |
|
122 | + 10 |
|
123 | + ); |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + /** |
|
128 | + * set_definitions |
|
129 | + * |
|
130 | + * @return void |
|
131 | + * @throws EE_Error |
|
132 | + * @throws ReflectionException |
|
133 | + */ |
|
134 | + public static function set_definitions() |
|
135 | + { |
|
136 | + // don't do this twice |
|
137 | + if (defined('TICKET_SELECTOR_ASSETS_URL')) { |
|
138 | + return; |
|
139 | + } |
|
140 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/'); |
|
141 | + define( |
|
142 | + 'TICKET_SELECTOR_TEMPLATES_PATH', |
|
143 | + str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/' |
|
144 | + ); |
|
145 | + // initialize config |
|
146 | + EED_Ticket_Selector::instance()->set_config(); |
|
147 | + // if config is not set, initialize |
|
148 | + if ( |
|
149 | + ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config |
|
150 | + ) { |
|
151 | + EED_Ticket_Selector::instance()->set_config(); |
|
152 | + EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = |
|
153 | + EED_Ticket_Selector::instance()->config(); |
|
154 | + } |
|
155 | + } |
|
156 | + |
|
157 | + |
|
158 | + /** |
|
159 | + * @return DisplayTicketSelector |
|
160 | + * @throws EE_Error |
|
161 | + * @throws ReflectionException |
|
162 | + */ |
|
163 | + public static function ticketSelector() |
|
164 | + { |
|
165 | + if (! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) { |
|
166 | + EED_Ticket_Selector::$ticket_selector = new DisplayTicketSelector( |
|
167 | + EED_Ticket_Selector::getRequest(), |
|
168 | + EED_Ticket_Selector::ticketConfig(), |
|
169 | + EED_Events_Archive::is_iframe() |
|
170 | + ); |
|
171 | + } |
|
172 | + return EED_Ticket_Selector::$ticket_selector; |
|
173 | + } |
|
174 | + |
|
175 | + |
|
176 | + /** |
|
177 | + * gets the ball rolling |
|
178 | + * |
|
179 | + * @param WP $WP |
|
180 | + * @return void |
|
181 | + */ |
|
182 | + public function run($WP) |
|
183 | + { |
|
184 | + } |
|
185 | + |
|
186 | + |
|
187 | + /** |
|
188 | + * @return TicketSelectorIframeEmbedButton |
|
189 | + */ |
|
190 | + public static function getIframeEmbedButton() |
|
191 | + { |
|
192 | + if (! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton) { |
|
193 | + self::$iframe_embed_button = new TicketSelectorIframeEmbedButton(); |
|
194 | + } |
|
195 | + return self::$iframe_embed_button; |
|
196 | + } |
|
197 | + |
|
198 | + |
|
199 | + /** |
|
200 | + * ticket_selector_iframe_embed_button |
|
201 | + * |
|
202 | + * @return void |
|
203 | + */ |
|
204 | + public static function ticket_selector_iframe_embed_button() |
|
205 | + { |
|
206 | + $iframe_embed_button = EED_Ticket_Selector::getIframeEmbedButton(); |
|
207 | + $iframe_embed_button->addEventEditorIframeEmbedButton(); |
|
208 | + } |
|
209 | + |
|
210 | + |
|
211 | + /** |
|
212 | + * ticket_selector_iframe |
|
213 | + * |
|
214 | + * @return void |
|
215 | + * @throws DomainException |
|
216 | + */ |
|
217 | + public function ticket_selector_iframe() |
|
218 | + { |
|
219 | + EE_Dependency_Map::register_dependencies( |
|
220 | + TicketSelectorIframe::class, |
|
221 | + [ |
|
222 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
223 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
224 | + 'EventEspresso\core\services\request\RequestInterface' => EE_Dependency_Map::load_from_cache, |
|
225 | + ] |
|
226 | + ); |
|
227 | + $ticket_selector_iframe = LoaderFactory::getLoader()->getNew(TicketSelectorIframe::class); |
|
228 | + $ticket_selector_iframe->display(); |
|
229 | + } |
|
230 | + |
|
231 | + |
|
232 | + /** |
|
233 | + * creates buttons for selecting number of attendees for an event |
|
234 | + * |
|
235 | + * @param WP_Post|int $event |
|
236 | + * @param bool $view_details |
|
237 | + * @return string |
|
238 | + * @throws EE_Error |
|
239 | + * @throws ReflectionException |
|
240 | + */ |
|
241 | + public static function display_ticket_selector($event = null, $view_details = false) |
|
242 | + { |
|
243 | + return EED_Ticket_Selector::ticketSelector()->display($event, $view_details); |
|
244 | + } |
|
245 | + |
|
246 | + |
|
247 | + /** |
|
248 | + * @return bool or FALSE |
|
249 | + * @throws EE_Error |
|
250 | + * @throws InvalidArgumentException |
|
251 | + * @throws InvalidInterfaceException |
|
252 | + * @throws InvalidDataTypeException |
|
253 | + * @throws ReflectionException |
|
254 | + */ |
|
255 | + public function process_ticket_selections() |
|
256 | + { |
|
257 | + /** @var EventEspresso\modules\ticket_selector\ProcessTicketSelector $form */ |
|
258 | + $form = LoaderFactory::getLoader()->getShared('EventEspresso\modules\ticket_selector\ProcessTicketSelector'); |
|
259 | + return $form->processTicketSelections(); |
|
260 | + } |
|
261 | + |
|
262 | + |
|
263 | + /** |
|
264 | + * @return bool |
|
265 | + * @throws InvalidArgumentException |
|
266 | + * @throws InvalidInterfaceException |
|
267 | + * @throws InvalidDataTypeException |
|
268 | + * @throws EE_Error |
|
269 | + * @throws ReflectionException |
|
270 | + */ |
|
271 | + public static function cancel_ticket_selections() |
|
272 | + { |
|
273 | + /** @var EventEspresso\modules\ticket_selector\ProcessTicketSelector $form */ |
|
274 | + $form = LoaderFactory::getLoader()->getShared('EventEspresso\modules\ticket_selector\ProcessTicketSelector'); |
|
275 | + return $form->cancelTicketSelections(); |
|
276 | + } |
|
277 | + |
|
278 | + |
|
279 | + /** |
|
280 | + * @return void |
|
281 | + */ |
|
282 | + public static function translate_js_strings() |
|
283 | + { |
|
284 | + EE_Registry::$i18n_js_strings['please_select_date_filter_notice'] = esc_html__( |
|
285 | + 'please select a datetime', |
|
286 | + 'event_espresso' |
|
287 | + ); |
|
288 | + } |
|
289 | + |
|
290 | + |
|
291 | + /** |
|
292 | + * @return void |
|
293 | + */ |
|
294 | + public static function load_tckt_slctr_assets() |
|
295 | + { |
|
296 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', false)) { |
|
297 | + // add some style |
|
298 | + wp_register_style( |
|
299 | + 'ticket_selector', |
|
300 | + TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css', |
|
301 | + [], |
|
302 | + EVENT_ESPRESSO_VERSION |
|
303 | + ); |
|
304 | + wp_enqueue_style('ticket_selector'); |
|
305 | + // make it dance |
|
306 | + wp_register_script( |
|
307 | + 'ticket_selector', |
|
308 | + TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', |
|
309 | + ['espresso_core'], |
|
310 | + EVENT_ESPRESSO_VERSION, |
|
311 | + true |
|
312 | + ); |
|
313 | + wp_enqueue_script('ticket_selector'); |
|
314 | + require_once EE_LIBRARIES |
|
315 | + . 'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php'; |
|
316 | + EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts(); |
|
317 | + } |
|
318 | + } |
|
319 | + |
|
320 | + |
|
321 | + /** |
|
322 | + * @return void |
|
323 | + */ |
|
324 | + public static function loadIframeAssets() |
|
325 | + { |
|
326 | + // for event lists |
|
327 | + add_filter( |
|
328 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
329 | + ['EED_Ticket_Selector', 'iframeCss'] |
|
330 | + ); |
|
331 | + add_filter( |
|
332 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
333 | + ['EED_Ticket_Selector', 'iframeJs'] |
|
334 | + ); |
|
335 | + // for ticket selectors |
|
336 | + add_filter( |
|
337 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
338 | + ['EED_Ticket_Selector', 'iframeCss'] |
|
339 | + ); |
|
340 | + add_filter( |
|
341 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
342 | + ['EED_Ticket_Selector', 'iframeJs'] |
|
343 | + ); |
|
344 | + } |
|
345 | + |
|
346 | + |
|
347 | + /** |
|
348 | + * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
349 | + * |
|
350 | + * @param array $iframe_css |
|
351 | + * @return array |
|
352 | + */ |
|
353 | + public static function iframeCss(array $iframe_css) |
|
354 | + { |
|
355 | + $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'; |
|
356 | + return $iframe_css; |
|
357 | + } |
|
358 | + |
|
359 | + |
|
360 | + /** |
|
361 | + * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
362 | + * |
|
363 | + * @param array $iframe_js |
|
364 | + * @return array |
|
365 | + */ |
|
366 | + public static function iframeJs(array $iframe_js) |
|
367 | + { |
|
368 | + $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js'; |
|
369 | + return $iframe_js; |
|
370 | + } |
|
371 | + |
|
372 | + |
|
373 | + /****************************** DEPRECATED ******************************/ |
|
374 | + |
|
375 | + |
|
376 | + /** |
|
377 | + * @return string |
|
378 | + * @throws EE_Error |
|
379 | + * @throws ReflectionException |
|
380 | + * @deprecated |
|
381 | + */ |
|
382 | + public static function display_view_details_btn() |
|
383 | + { |
|
384 | + // todo add doing_it_wrong() notice during next major version |
|
385 | + return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton(); |
|
386 | + } |
|
387 | + |
|
388 | + |
|
389 | + /** |
|
390 | + * @return string |
|
391 | + * @throws EE_Error |
|
392 | + * @throws ReflectionException |
|
393 | + * @deprecated |
|
394 | + */ |
|
395 | + public static function display_ticket_selector_submit() |
|
396 | + { |
|
397 | + // todo add doing_it_wrong() notice during next major version |
|
398 | + return EED_Ticket_Selector::ticketSelector()->displaySubmitButton(); |
|
399 | + } |
|
400 | + |
|
401 | + |
|
402 | + /** |
|
403 | + * @param string $permalink_string |
|
404 | + * @param int $id |
|
405 | + * @param string $new_title |
|
406 | + * @param string $new_slug |
|
407 | + * @return string |
|
408 | + * @throws InvalidArgumentException |
|
409 | + * @throws InvalidDataTypeException |
|
410 | + * @throws InvalidInterfaceException |
|
411 | + * @deprecated |
|
412 | + */ |
|
413 | + public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '') |
|
414 | + { |
|
415 | + $request = self::getRequest(); |
|
416 | + // todo add doing_it_wrong() notice during next major version |
|
417 | + if ( |
|
418 | + $request->getRequestParam('page') === 'espresso_events' |
|
419 | + && $request->getRequestParam('action') === 'edit' |
|
420 | + ) { |
|
421 | + $iframe_embed_button = EED_Ticket_Selector::getIframeEmbedButton(); |
|
422 | + $iframe_embed_button->addEventEditorIframeEmbedButton(); |
|
423 | + } |
|
424 | + return ''; |
|
425 | + } |
|
426 | + |
|
427 | + |
|
428 | + /** |
|
429 | + * @param int $ID |
|
430 | + * @param string $external_url |
|
431 | + * @return string |
|
432 | + * @throws EE_Error |
|
433 | + * @throws ReflectionException |
|
434 | + * @deprecated |
|
435 | + */ |
|
436 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') |
|
437 | + { |
|
438 | + // todo add doing_it_wrong() notice during next major version |
|
439 | + return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url); |
|
440 | + } |
|
441 | + |
|
442 | + |
|
443 | + /** |
|
444 | + * @return string |
|
445 | + * @throws EE_Error |
|
446 | + * @throws ReflectionException |
|
447 | + * @deprecated |
|
448 | + */ |
|
449 | + public static function ticket_selector_form_close() |
|
450 | + { |
|
451 | + // todo add doing_it_wrong() notice during next major version |
|
452 | + return EED_Ticket_Selector::ticketSelector()->formClose(); |
|
453 | + } |
|
454 | + |
|
455 | + |
|
456 | + /** |
|
457 | + * @return string |
|
458 | + * @throws EE_Error |
|
459 | + * @throws ReflectionException |
|
460 | + * @deprecated |
|
461 | + */ |
|
462 | + public static function no_tkt_slctr_end_dv() |
|
463 | + { |
|
464 | + // todo add doing_it_wrong() notice during next major version |
|
465 | + return EED_Ticket_Selector::ticketSelector()->ticketSelectorEndDiv(); |
|
466 | + } |
|
467 | + |
|
468 | + |
|
469 | + /** |
|
470 | + * @return string |
|
471 | + * @throws EE_Error |
|
472 | + * @throws ReflectionException |
|
473 | + * @deprecated 4.9.13 |
|
474 | + */ |
|
475 | + public static function tkt_slctr_end_dv() |
|
476 | + { |
|
477 | + return EED_Ticket_Selector::ticketSelector()->clearTicketSelector(); |
|
478 | + } |
|
479 | + |
|
480 | + |
|
481 | + /** |
|
482 | + * @return string |
|
483 | + * @throws EE_Error |
|
484 | + * @throws ReflectionException |
|
485 | + * @deprecated |
|
486 | + */ |
|
487 | + public static function clear_tkt_slctr() |
|
488 | + { |
|
489 | + return EED_Ticket_Selector::ticketSelector()->clearTicketSelector(); |
|
490 | + } |
|
491 | + |
|
492 | + |
|
493 | + /** |
|
494 | + * @deprecated |
|
495 | + */ |
|
496 | + public static function load_tckt_slctr_assets_admin() |
|
497 | + { |
|
498 | + $request = self::getRequest(); |
|
499 | + // todo add doing_it_wrong() notice during next major version |
|
500 | + if ( |
|
501 | + $request->getRequestParam('page') === 'espresso_events' |
|
502 | + && $request->getRequestParam('action') === 'edit' |
|
503 | + ) { |
|
504 | + $iframe_embed_button = EED_Ticket_Selector::getIframeEmbedButton(); |
|
505 | + $iframe_embed_button->embedButtonAssets(); |
|
506 | + } |
|
507 | + } |
|
508 | 508 | } |
@@ -94,16 +94,16 @@ |
||
94 | 94 | ? $this->_extra_data['template']['question_list'] |
95 | 95 | : $template; |
96 | 96 | $ans_result = ''; |
97 | - $answers = ! empty($this->_extra_data['data']->registrations[ $reg_obj->ID() ]['ans_objs']) |
|
98 | - ? $this->_extra_data['data']->registrations[ $reg_obj->ID() ]['ans_objs'] |
|
97 | + $answers = ! empty($this->_extra_data['data']->registrations[$reg_obj->ID()]['ans_objs']) |
|
98 | + ? $this->_extra_data['data']->registrations[$reg_obj->ID()]['ans_objs'] |
|
99 | 99 | : []; |
100 | 100 | $questions = ! empty($this->_extra_data['data']->questions) |
101 | 101 | ? $this->_extra_data['data']->questions |
102 | 102 | : []; |
103 | 103 | foreach ($answers as $answer) { |
104 | 104 | // first see if the question is in our $questions array. If not then try to get from answer object |
105 | - $question = isset($questions[ $answer->ID() ]) |
|
106 | - ? $questions[ $answer->ID() ] |
|
105 | + $question = isset($questions[$answer->ID()]) |
|
106 | + ? $questions[$answer->ID()] |
|
107 | 107 | : null; |
108 | 108 | $question = ! $question instanceof EE_Question |
109 | 109 | ? $answer->question() |
@@ -15,109 +15,109 @@ |
||
15 | 15 | */ |
16 | 16 | class EE_Question_List_Shortcodes extends EE_Shortcodes |
17 | 17 | { |
18 | - public function __construct() |
|
19 | - { |
|
20 | - parent::__construct(); |
|
21 | - } |
|
18 | + public function __construct() |
|
19 | + { |
|
20 | + parent::__construct(); |
|
21 | + } |
|
22 | 22 | |
23 | 23 | |
24 | - protected function _init_props() |
|
25 | - { |
|
26 | - $this->label = esc_html__('Questions and Answers Shortcodes', 'event_espresso'); |
|
27 | - $this->description = esc_html__('All shortcodes related to custom questions and answers', 'event_espresso'); |
|
28 | - $this->_shortcodes = [ |
|
29 | - '[QUESTION_LIST]' => esc_html__( |
|
30 | - 'This is used to indicate where you want the list of questions and answers to show for the registrant. You place this within the "[attendee_list]" field.', |
|
31 | - 'event_espresso' |
|
32 | - ), |
|
33 | - ]; |
|
34 | - } |
|
24 | + protected function _init_props() |
|
25 | + { |
|
26 | + $this->label = esc_html__('Questions and Answers Shortcodes', 'event_espresso'); |
|
27 | + $this->description = esc_html__('All shortcodes related to custom questions and answers', 'event_espresso'); |
|
28 | + $this->_shortcodes = [ |
|
29 | + '[QUESTION_LIST]' => esc_html__( |
|
30 | + 'This is used to indicate where you want the list of questions and answers to show for the registrant. You place this within the "[attendee_list]" field.', |
|
31 | + 'event_espresso' |
|
32 | + ), |
|
33 | + ]; |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @throws EE_Error |
|
39 | - * @throws ReflectionException |
|
40 | - */ |
|
41 | - protected function _parser($shortcode) |
|
42 | - { |
|
43 | - switch ($shortcode) { |
|
44 | - case '[QUESTION_LIST]': |
|
45 | - return $this->_get_question_list(); |
|
46 | - } |
|
47 | - return ''; |
|
48 | - } |
|
37 | + /** |
|
38 | + * @throws EE_Error |
|
39 | + * @throws ReflectionException |
|
40 | + */ |
|
41 | + protected function _parser($shortcode) |
|
42 | + { |
|
43 | + switch ($shortcode) { |
|
44 | + case '[QUESTION_LIST]': |
|
45 | + return $this->_get_question_list(); |
|
46 | + } |
|
47 | + return ''; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | |
51 | - /** |
|
52 | - * @throws EE_Error |
|
53 | - * @throws ReflectionException |
|
54 | - */ |
|
55 | - protected function _get_question_list() |
|
56 | - { |
|
57 | - $this->_validate_list_requirements(); |
|
51 | + /** |
|
52 | + * @throws EE_Error |
|
53 | + * @throws ReflectionException |
|
54 | + */ |
|
55 | + protected function _get_question_list() |
|
56 | + { |
|
57 | + $this->_validate_list_requirements(); |
|
58 | 58 | |
59 | - if ($this->_data['data'] instanceof EE_Registration) { |
|
60 | - // for when [QUESTION_LIST] is used in the [attendee_list] field. |
|
61 | - return $this->_get_question_answer_list_for_attendee(); |
|
62 | - } |
|
63 | - // for when [QUESTION_LIST] is used in the main content field. |
|
64 | - if ( |
|
65 | - $this->_data['data'] instanceof EE_Messages_Addressee |
|
66 | - && $this->_data['data']->reg_obj instanceof EE_Registration |
|
67 | - ) { |
|
68 | - return $this->_get_question_answer_list_for_attendee($this->_data['data']->reg_obj); |
|
69 | - } |
|
70 | - return ''; |
|
71 | - } |
|
59 | + if ($this->_data['data'] instanceof EE_Registration) { |
|
60 | + // for when [QUESTION_LIST] is used in the [attendee_list] field. |
|
61 | + return $this->_get_question_answer_list_for_attendee(); |
|
62 | + } |
|
63 | + // for when [QUESTION_LIST] is used in the main content field. |
|
64 | + if ( |
|
65 | + $this->_data['data'] instanceof EE_Messages_Addressee |
|
66 | + && $this->_data['data']->reg_obj instanceof EE_Registration |
|
67 | + ) { |
|
68 | + return $this->_get_question_answer_list_for_attendee($this->_data['data']->reg_obj); |
|
69 | + } |
|
70 | + return ''; |
|
71 | + } |
|
72 | 72 | |
73 | 73 | |
74 | - /** |
|
75 | - * Note when we parse the "[question_list]" shortcode for attendees we're actually going to retrieve the list of |
|
76 | - * answers for that attendee since that is what we really need (we can derive the questions from the answers); |
|
77 | - * |
|
78 | - * @param null $reg_obj |
|
79 | - * @return string parsed template. |
|
80 | - * @throws EE_Error |
|
81 | - * @throws ReflectionException |
|
82 | - */ |
|
83 | - private function _get_question_answer_list_for_attendee($reg_obj = null) |
|
84 | - { |
|
85 | - $valid_shortcodes = ['question']; |
|
86 | - $reg_obj = $reg_obj instanceof EE_Registration |
|
87 | - ? $reg_obj |
|
88 | - : $this->_data['data']; |
|
89 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['question_list']) |
|
90 | - ? $this->_data['template']['question_list'] |
|
91 | - : ''; |
|
92 | - $template = empty($template) && isset($this->_extra_data['template']['question_list']) |
|
93 | - ? $this->_extra_data['template']['question_list'] |
|
94 | - : $template; |
|
95 | - $ans_result = ''; |
|
96 | - $answers = ! empty($this->_extra_data['data']->registrations[ $reg_obj->ID() ]['ans_objs']) |
|
97 | - ? $this->_extra_data['data']->registrations[ $reg_obj->ID() ]['ans_objs'] |
|
98 | - : []; |
|
99 | - $questions = ! empty($this->_extra_data['data']->questions) |
|
100 | - ? $this->_extra_data['data']->questions |
|
101 | - : []; |
|
102 | - foreach ($answers as $answer) { |
|
103 | - // first see if the question is in our $questions array. If not then try to get from answer object |
|
104 | - $question = isset($questions[ $answer->ID() ]) |
|
105 | - ? $questions[ $answer->ID() ] |
|
106 | - : null; |
|
107 | - $question = ! $question instanceof EE_Question |
|
108 | - ? $answer->question() |
|
109 | - : $question; |
|
110 | - if ($question instanceof EE_Question and $question->admin_only()) { |
|
111 | - continue; |
|
112 | - } |
|
113 | - $ans_result .= $this->_shortcode_helper->parse_question_list_template( |
|
114 | - $template, |
|
115 | - $answer, |
|
116 | - $valid_shortcodes, |
|
117 | - $this->_extra_data |
|
118 | - ); |
|
119 | - } |
|
74 | + /** |
|
75 | + * Note when we parse the "[question_list]" shortcode for attendees we're actually going to retrieve the list of |
|
76 | + * answers for that attendee since that is what we really need (we can derive the questions from the answers); |
|
77 | + * |
|
78 | + * @param null $reg_obj |
|
79 | + * @return string parsed template. |
|
80 | + * @throws EE_Error |
|
81 | + * @throws ReflectionException |
|
82 | + */ |
|
83 | + private function _get_question_answer_list_for_attendee($reg_obj = null) |
|
84 | + { |
|
85 | + $valid_shortcodes = ['question']; |
|
86 | + $reg_obj = $reg_obj instanceof EE_Registration |
|
87 | + ? $reg_obj |
|
88 | + : $this->_data['data']; |
|
89 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['question_list']) |
|
90 | + ? $this->_data['template']['question_list'] |
|
91 | + : ''; |
|
92 | + $template = empty($template) && isset($this->_extra_data['template']['question_list']) |
|
93 | + ? $this->_extra_data['template']['question_list'] |
|
94 | + : $template; |
|
95 | + $ans_result = ''; |
|
96 | + $answers = ! empty($this->_extra_data['data']->registrations[ $reg_obj->ID() ]['ans_objs']) |
|
97 | + ? $this->_extra_data['data']->registrations[ $reg_obj->ID() ]['ans_objs'] |
|
98 | + : []; |
|
99 | + $questions = ! empty($this->_extra_data['data']->questions) |
|
100 | + ? $this->_extra_data['data']->questions |
|
101 | + : []; |
|
102 | + foreach ($answers as $answer) { |
|
103 | + // first see if the question is in our $questions array. If not then try to get from answer object |
|
104 | + $question = isset($questions[ $answer->ID() ]) |
|
105 | + ? $questions[ $answer->ID() ] |
|
106 | + : null; |
|
107 | + $question = ! $question instanceof EE_Question |
|
108 | + ? $answer->question() |
|
109 | + : $question; |
|
110 | + if ($question instanceof EE_Question and $question->admin_only()) { |
|
111 | + continue; |
|
112 | + } |
|
113 | + $ans_result .= $this->_shortcode_helper->parse_question_list_template( |
|
114 | + $template, |
|
115 | + $answer, |
|
116 | + $valid_shortcodes, |
|
117 | + $this->_extra_data |
|
118 | + ); |
|
119 | + } |
|
120 | 120 | |
121 | - return $ans_result; |
|
122 | - } |
|
121 | + return $ans_result; |
|
122 | + } |
|
123 | 123 | } |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | use EventEspresso\core\services\database\TableAnalysis; |
13 | 13 | |
14 | 14 | // defined some new constants related to caffeinated folder |
15 | -define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/'); |
|
16 | -define('EE_CAF_CORE', EE_CAFF_PATH . 'core/'); |
|
17 | -define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries/'); |
|
18 | -define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods/'); |
|
15 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
16 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core/'); |
|
17 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries/'); |
|
18 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods/'); |
|
19 | 19 | |
20 | 20 | |
21 | 21 | /** |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | add_filter('FHEE__EE_Registry__load_helper__helper_paths', [$this, 'caf_helper_paths'], 10); |
66 | 66 | add_filter( |
67 | 67 | 'AHEE__EE_System__load_core_configuration__complete', |
68 | - function () { |
|
68 | + function() { |
|
69 | 69 | EE_Register_Payment_Method::register( |
70 | 70 | 'caffeinated_payment_methods', |
71 | 71 | [ |
72 | - 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
72 | + 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR), |
|
73 | 73 | ] |
74 | 74 | ); |
75 | 75 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function caf_helper_paths($paths) |
126 | 126 | { |
127 | - $paths[] = EE_CAF_CORE . 'helpers/'; |
|
127 | + $paths[] = EE_CAF_CORE.'helpers/'; |
|
128 | 128 | return $paths; |
129 | 129 | } |
130 | 130 | |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | global $wpdb; |
146 | 146 | // use same method of getting creator id as the version introducing the change |
147 | 147 | $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
148 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
149 | - $price_table = $wpdb->prefix . "esp_price"; |
|
148 | + $price_type_table = $wpdb->prefix."esp_price_type"; |
|
149 | + $price_table = $wpdb->prefix."esp_price"; |
|
150 | 150 | if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
151 | 151 | $SQL = |
152 | - 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
152 | + 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; // include trashed price types |
|
153 | 153 | $tax_price_type_count = $wpdb->get_var($SQL); |
154 | 154 | if ($tax_price_type_count <= 1) { |
155 | 155 | $wpdb->insert( |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | 'PRT_wp_user' => $default_creator_id, |
164 | 164 | ], |
165 | 165 | [ |
166 | - '%s',// PRT_name |
|
167 | - '%d',// PBT_id |
|
168 | - '%d',// PRT_is_percent |
|
169 | - '%d',// PRT_order |
|
170 | - '%d',// PRT_deleted |
|
166 | + '%s', // PRT_name |
|
167 | + '%d', // PBT_id |
|
168 | + '%d', // PRT_is_percent |
|
169 | + '%d', // PRT_order |
|
170 | + '%d', // PRT_deleted |
|
171 | 171 | '%d', // PRT_wp_user |
172 | 172 | ] |
173 | 173 | ); |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | 'PRT_wp_user' => $default_creator_id, |
184 | 184 | ], |
185 | 185 | [ |
186 | - '%s',// PRT_name |
|
187 | - '%d',// PBT_id |
|
188 | - '%d',// PRT_is_percent |
|
189 | - '%d',// PRT_order |
|
190 | - '%d',// PRT_deleted |
|
186 | + '%s', // PRT_name |
|
187 | + '%d', // PBT_id |
|
188 | + '%d', // PRT_is_percent |
|
189 | + '%d', // PRT_order |
|
190 | + '%d', // PRT_deleted |
|
191 | 191 | '%d' // PRT_wp_user |
192 | 192 | ] |
193 | 193 | ); |
@@ -207,15 +207,15 @@ discard block |
||
207 | 207 | 'PRC_wp_user' => $default_creator_id, |
208 | 208 | ], |
209 | 209 | [ |
210 | - '%d',// PRT_id |
|
211 | - '%f',// PRC_amount |
|
212 | - '%s',// PRC_name |
|
213 | - '%s',// PRC_desc |
|
214 | - '%d',// PRC_is_default |
|
215 | - '%d',// PRC_overrides |
|
216 | - '%d',// PRC_deleted |
|
217 | - '%d',// PRC_order |
|
218 | - '%d',// PRC_parent |
|
210 | + '%d', // PRT_id |
|
211 | + '%f', // PRC_amount |
|
212 | + '%s', // PRC_name |
|
213 | + '%s', // PRC_desc |
|
214 | + '%d', // PRC_is_default |
|
215 | + '%d', // PRC_overrides |
|
216 | + '%d', // PRC_deleted |
|
217 | + '%d', // PRC_order |
|
218 | + '%d', // PRC_parent |
|
219 | 219 | '%d' // PRC_wp_user |
220 | 220 | ] |
221 | 221 | ); |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function caffeinated_modules_to_register($modules_to_register = []) |
236 | 236 | { |
237 | - if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
238 | - $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules/*', GLOB_ONLYDIR); |
|
237 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
238 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules/*', GLOB_ONLYDIR); |
|
239 | 239 | if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
240 | 240 | $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
241 | 241 | } |
@@ -27,323 +27,323 @@ |
||
27 | 27 | */ |
28 | 28 | class EE_Brewing_Regular extends EE_BASE implements InterminableInterface |
29 | 29 | { |
30 | - /** |
|
31 | - * @var TableAnalysis $table_analysis |
|
32 | - */ |
|
33 | - protected $_table_analysis; |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * EE_Brewing_Regular constructor. |
|
38 | - * |
|
39 | - * @param TableAnalysis $table_analysis |
|
40 | - */ |
|
41 | - public function __construct(TableAnalysis $table_analysis) |
|
42 | - { |
|
43 | - $this->_table_analysis = $table_analysis; |
|
44 | - if (defined('EE_CAFF_PATH')) { |
|
45 | - $this->setInitializationHooks(); |
|
46 | - $this->setApiRegistrationHooks(); |
|
47 | - $this->setSwitchHooks(); |
|
48 | - $this->setDefaultFilterHooks(); |
|
49 | - // caffeinated constructed |
|
50 | - do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
51 | - } |
|
52 | - } |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * Various hooks used for extending features via registration of modules or extensions. |
|
57 | - */ |
|
58 | - private function setApiRegistrationHooks() |
|
59 | - { |
|
60 | - add_filter( |
|
61 | - 'FHEE__EE_Config__register_modules__modules_to_register', |
|
62 | - [$this, 'caffeinated_modules_to_register'] |
|
63 | - ); |
|
64 | - add_filter('FHEE__EE_Registry__load_helper__helper_paths', [$this, 'caf_helper_paths'], 10); |
|
65 | - add_filter( |
|
66 | - 'AHEE__EE_System__load_core_configuration__complete', |
|
67 | - function () { |
|
68 | - EE_Register_Payment_Method::register( |
|
69 | - 'caffeinated_payment_methods', |
|
70 | - [ |
|
71 | - 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
72 | - ] |
|
73 | - ); |
|
74 | - } |
|
75 | - ); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * Various hooks used for modifying initialization or activation processes. |
|
81 | - */ |
|
82 | - private function setInitializationHooks() |
|
83 | - { |
|
84 | - // activation |
|
85 | - add_action('AHEE__EEH_Activation__initialize_db_content', [$this, 'initialize_caf_db_content']); |
|
86 | - // load caff init |
|
87 | - add_action('AHEE__EE_System__set_hooks_for_core', [$this, 'caffeinated_init']); |
|
88 | - // load caff scripts |
|
89 | - add_action('wp_enqueue_scripts', [$this, 'enqueue_caffeinated_scripts'], 10); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * Various hooks used for switch (on/off) type filters. |
|
95 | - */ |
|
96 | - private function setSwitchHooks() |
|
97 | - { |
|
98 | - // remove the "powered by" credit link from receipts and invoices |
|
99 | - add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false'); |
|
100 | - // seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
|
101 | - add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * Various filters for affecting default configuration values in the caffeinated |
|
107 | - * context. |
|
108 | - */ |
|
109 | - private function setDefaultFilterHooks() |
|
110 | - { |
|
111 | - add_filter( |
|
112 | - 'FHEE__EE_Admin_Config__show_reg_footer__default', |
|
113 | - '__return_true' |
|
114 | - ); |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - /** |
|
119 | - * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths |
|
120 | - * |
|
121 | - * @param array $paths original helper paths array |
|
122 | - * @return array new array of paths |
|
123 | - */ |
|
124 | - public function caf_helper_paths($paths) |
|
125 | - { |
|
126 | - $paths[] = EE_CAF_CORE . 'helpers/'; |
|
127 | - return $paths; |
|
128 | - } |
|
129 | - |
|
130 | - |
|
131 | - /** |
|
132 | - * Upon brand-new activation, if this is a new activation of CAF, we want to add |
|
133 | - * some global prices that will show off EE4's capabilities. However, if they're upgrading |
|
134 | - * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices. |
|
135 | - * This action should only be called when EE 4.x.0.P is initially activated. |
|
136 | - * Right now the only CAF content are these global prices. If there's more in the future, then |
|
137 | - * we should probably create a caf file to contain it all instead just a function like this. |
|
138 | - * Right now, we ASSUME the only price types in the system are default ones |
|
139 | - * |
|
140 | - * @global wpdb $wpdb |
|
141 | - */ |
|
142 | - public function initialize_caf_db_content() |
|
143 | - { |
|
144 | - global $wpdb; |
|
145 | - // use same method of getting creator id as the version introducing the change |
|
146 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
147 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
148 | - $price_table = $wpdb->prefix . "esp_price"; |
|
149 | - if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
150 | - $SQL = |
|
151 | - 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
152 | - $tax_price_type_count = $wpdb->get_var($SQL); |
|
153 | - if ($tax_price_type_count <= 1) { |
|
154 | - $wpdb->insert( |
|
155 | - $price_type_table, |
|
156 | - [ |
|
157 | - 'PRT_name' => esc_html__("Regional Tax", "event_espresso"), |
|
158 | - 'PBT_ID' => 4, |
|
159 | - 'PRT_is_percent' => true, |
|
160 | - 'PRT_order' => 60, |
|
161 | - 'PRT_deleted' => false, |
|
162 | - 'PRT_wp_user' => $default_creator_id, |
|
163 | - ], |
|
164 | - [ |
|
165 | - '%s',// PRT_name |
|
166 | - '%d',// PBT_id |
|
167 | - '%d',// PRT_is_percent |
|
168 | - '%d',// PRT_order |
|
169 | - '%d',// PRT_deleted |
|
170 | - '%d', // PRT_wp_user |
|
171 | - ] |
|
172 | - ); |
|
173 | - // federal tax |
|
174 | - $result = $wpdb->insert( |
|
175 | - $price_type_table, |
|
176 | - [ |
|
177 | - 'PRT_name' => esc_html__("Federal Tax", "event_espresso"), |
|
178 | - 'PBT_ID' => 4, |
|
179 | - 'PRT_is_percent' => true, |
|
180 | - 'PRT_order' => 70, |
|
181 | - 'PRT_deleted' => false, |
|
182 | - 'PRT_wp_user' => $default_creator_id, |
|
183 | - ], |
|
184 | - [ |
|
185 | - '%s',// PRT_name |
|
186 | - '%d',// PBT_id |
|
187 | - '%d',// PRT_is_percent |
|
188 | - '%d',// PRT_order |
|
189 | - '%d',// PRT_deleted |
|
190 | - '%d' // PRT_wp_user |
|
191 | - ] |
|
192 | - ); |
|
193 | - if ($result) { |
|
194 | - $wpdb->insert( |
|
195 | - $price_table, |
|
196 | - [ |
|
197 | - 'PRT_ID' => $wpdb->insert_id, |
|
198 | - 'PRC_amount' => 15.00, |
|
199 | - 'PRC_name' => esc_html__("Sales Tax", "event_espresso"), |
|
200 | - 'PRC_desc' => '', |
|
201 | - 'PRC_is_default' => true, |
|
202 | - 'PRC_overrides' => null, |
|
203 | - 'PRC_deleted' => false, |
|
204 | - 'PRC_order' => 50, |
|
205 | - 'PRC_parent' => null, |
|
206 | - 'PRC_wp_user' => $default_creator_id, |
|
207 | - ], |
|
208 | - [ |
|
209 | - '%d',// PRT_id |
|
210 | - '%f',// PRC_amount |
|
211 | - '%s',// PRC_name |
|
212 | - '%s',// PRC_desc |
|
213 | - '%d',// PRC_is_default |
|
214 | - '%d',// PRC_overrides |
|
215 | - '%d',// PRC_deleted |
|
216 | - '%d',// PRC_order |
|
217 | - '%d',// PRC_parent |
|
218 | - '%d' // PRC_wp_user |
|
219 | - ] |
|
220 | - ); |
|
221 | - } |
|
222 | - } |
|
223 | - } |
|
224 | - } |
|
225 | - |
|
226 | - |
|
227 | - /** |
|
228 | - * caffeinated_modules_to_register |
|
229 | - * |
|
230 | - * @access public |
|
231 | - * @param array $modules_to_register |
|
232 | - * @return array |
|
233 | - */ |
|
234 | - public function caffeinated_modules_to_register($modules_to_register = []) |
|
235 | - { |
|
236 | - if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
237 | - $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules/*', GLOB_ONLYDIR); |
|
238 | - if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
239 | - $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
240 | - } |
|
241 | - } |
|
242 | - return $modules_to_register; |
|
243 | - } |
|
244 | - |
|
245 | - |
|
246 | - /** |
|
247 | - * @throws EE_Error |
|
248 | - * @throws InvalidArgumentException |
|
249 | - * @throws ReflectionException |
|
250 | - * @throws InvalidDataTypeException |
|
251 | - * @throws InvalidInterfaceException |
|
252 | - */ |
|
253 | - public function caffeinated_init() |
|
254 | - { |
|
255 | - // Custom Post Type hooks |
|
256 | - add_filter( |
|
257 | - 'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies', |
|
258 | - [$this, 'filter_taxonomies'] |
|
259 | - ); |
|
260 | - add_filter( |
|
261 | - 'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes', |
|
262 | - [$this, 'filter_cpts'] |
|
263 | - ); |
|
264 | - add_filter( |
|
265 | - 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', |
|
266 | - [$this, 'nav_metabox_items'] |
|
267 | - ); |
|
268 | - EE_Registry::instance()->load_file( |
|
269 | - EE_CAFF_PATH, |
|
270 | - 'EE_Caf_Messages', |
|
271 | - 'class', |
|
272 | - [], |
|
273 | - false |
|
274 | - ); |
|
275 | - // caffeinated_init__complete hook |
|
276 | - do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
277 | - } |
|
278 | - |
|
279 | - |
|
280 | - public function enqueue_caffeinated_scripts() |
|
281 | - { |
|
282 | - // sound of crickets... |
|
283 | - } |
|
284 | - |
|
285 | - |
|
286 | - /** |
|
287 | - * callbacks below here |
|
288 | - * |
|
289 | - * @param array $taxonomy_array |
|
290 | - * @return array |
|
291 | - */ |
|
292 | - public function filter_taxonomies(array $taxonomy_array) |
|
293 | - { |
|
294 | - $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true; |
|
295 | - return $taxonomy_array; |
|
296 | - } |
|
297 | - |
|
298 | - |
|
299 | - /** |
|
300 | - * @param array $cpt_array |
|
301 | - * @return mixed |
|
302 | - */ |
|
303 | - public function filter_cpts(array $cpt_array) |
|
304 | - { |
|
305 | - $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true; |
|
306 | - return $cpt_array; |
|
307 | - } |
|
308 | - |
|
309 | - |
|
310 | - /** |
|
311 | - * @param array $menuitems |
|
312 | - * @return array |
|
313 | - */ |
|
314 | - public function nav_metabox_items(array $menuitems) |
|
315 | - { |
|
316 | - $menuitems[] = [ |
|
317 | - 'title' => esc_html__('Venue List', 'event_espresso'), |
|
318 | - 'url' => get_post_type_archive_link('espresso_venues'), |
|
319 | - 'description' => esc_html__('Archive page for all venues.', 'event_espresso'), |
|
320 | - ]; |
|
321 | - return $menuitems; |
|
322 | - } |
|
323 | - |
|
324 | - |
|
325 | - /** |
|
326 | - * Gets the injected table analyzer, or throws an exception |
|
327 | - * |
|
328 | - * @return TableAnalysis |
|
329 | - * @throws \EE_Error |
|
330 | - */ |
|
331 | - protected function _get_table_analysis() |
|
332 | - { |
|
333 | - if ($this->_table_analysis instanceof TableAnalysis) { |
|
334 | - return $this->_table_analysis; |
|
335 | - } else { |
|
336 | - throw new \EE_Error( |
|
337 | - sprintf( |
|
338 | - esc_html__('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
339 | - get_class($this) |
|
340 | - ) |
|
341 | - ); |
|
342 | - } |
|
343 | - } |
|
30 | + /** |
|
31 | + * @var TableAnalysis $table_analysis |
|
32 | + */ |
|
33 | + protected $_table_analysis; |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * EE_Brewing_Regular constructor. |
|
38 | + * |
|
39 | + * @param TableAnalysis $table_analysis |
|
40 | + */ |
|
41 | + public function __construct(TableAnalysis $table_analysis) |
|
42 | + { |
|
43 | + $this->_table_analysis = $table_analysis; |
|
44 | + if (defined('EE_CAFF_PATH')) { |
|
45 | + $this->setInitializationHooks(); |
|
46 | + $this->setApiRegistrationHooks(); |
|
47 | + $this->setSwitchHooks(); |
|
48 | + $this->setDefaultFilterHooks(); |
|
49 | + // caffeinated constructed |
|
50 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
51 | + } |
|
52 | + } |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * Various hooks used for extending features via registration of modules or extensions. |
|
57 | + */ |
|
58 | + private function setApiRegistrationHooks() |
|
59 | + { |
|
60 | + add_filter( |
|
61 | + 'FHEE__EE_Config__register_modules__modules_to_register', |
|
62 | + [$this, 'caffeinated_modules_to_register'] |
|
63 | + ); |
|
64 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', [$this, 'caf_helper_paths'], 10); |
|
65 | + add_filter( |
|
66 | + 'AHEE__EE_System__load_core_configuration__complete', |
|
67 | + function () { |
|
68 | + EE_Register_Payment_Method::register( |
|
69 | + 'caffeinated_payment_methods', |
|
70 | + [ |
|
71 | + 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
72 | + ] |
|
73 | + ); |
|
74 | + } |
|
75 | + ); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * Various hooks used for modifying initialization or activation processes. |
|
81 | + */ |
|
82 | + private function setInitializationHooks() |
|
83 | + { |
|
84 | + // activation |
|
85 | + add_action('AHEE__EEH_Activation__initialize_db_content', [$this, 'initialize_caf_db_content']); |
|
86 | + // load caff init |
|
87 | + add_action('AHEE__EE_System__set_hooks_for_core', [$this, 'caffeinated_init']); |
|
88 | + // load caff scripts |
|
89 | + add_action('wp_enqueue_scripts', [$this, 'enqueue_caffeinated_scripts'], 10); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * Various hooks used for switch (on/off) type filters. |
|
95 | + */ |
|
96 | + private function setSwitchHooks() |
|
97 | + { |
|
98 | + // remove the "powered by" credit link from receipts and invoices |
|
99 | + add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false'); |
|
100 | + // seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
|
101 | + add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * Various filters for affecting default configuration values in the caffeinated |
|
107 | + * context. |
|
108 | + */ |
|
109 | + private function setDefaultFilterHooks() |
|
110 | + { |
|
111 | + add_filter( |
|
112 | + 'FHEE__EE_Admin_Config__show_reg_footer__default', |
|
113 | + '__return_true' |
|
114 | + ); |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + /** |
|
119 | + * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths |
|
120 | + * |
|
121 | + * @param array $paths original helper paths array |
|
122 | + * @return array new array of paths |
|
123 | + */ |
|
124 | + public function caf_helper_paths($paths) |
|
125 | + { |
|
126 | + $paths[] = EE_CAF_CORE . 'helpers/'; |
|
127 | + return $paths; |
|
128 | + } |
|
129 | + |
|
130 | + |
|
131 | + /** |
|
132 | + * Upon brand-new activation, if this is a new activation of CAF, we want to add |
|
133 | + * some global prices that will show off EE4's capabilities. However, if they're upgrading |
|
134 | + * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices. |
|
135 | + * This action should only be called when EE 4.x.0.P is initially activated. |
|
136 | + * Right now the only CAF content are these global prices. If there's more in the future, then |
|
137 | + * we should probably create a caf file to contain it all instead just a function like this. |
|
138 | + * Right now, we ASSUME the only price types in the system are default ones |
|
139 | + * |
|
140 | + * @global wpdb $wpdb |
|
141 | + */ |
|
142 | + public function initialize_caf_db_content() |
|
143 | + { |
|
144 | + global $wpdb; |
|
145 | + // use same method of getting creator id as the version introducing the change |
|
146 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
147 | + $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
148 | + $price_table = $wpdb->prefix . "esp_price"; |
|
149 | + if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
150 | + $SQL = |
|
151 | + 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
152 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
153 | + if ($tax_price_type_count <= 1) { |
|
154 | + $wpdb->insert( |
|
155 | + $price_type_table, |
|
156 | + [ |
|
157 | + 'PRT_name' => esc_html__("Regional Tax", "event_espresso"), |
|
158 | + 'PBT_ID' => 4, |
|
159 | + 'PRT_is_percent' => true, |
|
160 | + 'PRT_order' => 60, |
|
161 | + 'PRT_deleted' => false, |
|
162 | + 'PRT_wp_user' => $default_creator_id, |
|
163 | + ], |
|
164 | + [ |
|
165 | + '%s',// PRT_name |
|
166 | + '%d',// PBT_id |
|
167 | + '%d',// PRT_is_percent |
|
168 | + '%d',// PRT_order |
|
169 | + '%d',// PRT_deleted |
|
170 | + '%d', // PRT_wp_user |
|
171 | + ] |
|
172 | + ); |
|
173 | + // federal tax |
|
174 | + $result = $wpdb->insert( |
|
175 | + $price_type_table, |
|
176 | + [ |
|
177 | + 'PRT_name' => esc_html__("Federal Tax", "event_espresso"), |
|
178 | + 'PBT_ID' => 4, |
|
179 | + 'PRT_is_percent' => true, |
|
180 | + 'PRT_order' => 70, |
|
181 | + 'PRT_deleted' => false, |
|
182 | + 'PRT_wp_user' => $default_creator_id, |
|
183 | + ], |
|
184 | + [ |
|
185 | + '%s',// PRT_name |
|
186 | + '%d',// PBT_id |
|
187 | + '%d',// PRT_is_percent |
|
188 | + '%d',// PRT_order |
|
189 | + '%d',// PRT_deleted |
|
190 | + '%d' // PRT_wp_user |
|
191 | + ] |
|
192 | + ); |
|
193 | + if ($result) { |
|
194 | + $wpdb->insert( |
|
195 | + $price_table, |
|
196 | + [ |
|
197 | + 'PRT_ID' => $wpdb->insert_id, |
|
198 | + 'PRC_amount' => 15.00, |
|
199 | + 'PRC_name' => esc_html__("Sales Tax", "event_espresso"), |
|
200 | + 'PRC_desc' => '', |
|
201 | + 'PRC_is_default' => true, |
|
202 | + 'PRC_overrides' => null, |
|
203 | + 'PRC_deleted' => false, |
|
204 | + 'PRC_order' => 50, |
|
205 | + 'PRC_parent' => null, |
|
206 | + 'PRC_wp_user' => $default_creator_id, |
|
207 | + ], |
|
208 | + [ |
|
209 | + '%d',// PRT_id |
|
210 | + '%f',// PRC_amount |
|
211 | + '%s',// PRC_name |
|
212 | + '%s',// PRC_desc |
|
213 | + '%d',// PRC_is_default |
|
214 | + '%d',// PRC_overrides |
|
215 | + '%d',// PRC_deleted |
|
216 | + '%d',// PRC_order |
|
217 | + '%d',// PRC_parent |
|
218 | + '%d' // PRC_wp_user |
|
219 | + ] |
|
220 | + ); |
|
221 | + } |
|
222 | + } |
|
223 | + } |
|
224 | + } |
|
225 | + |
|
226 | + |
|
227 | + /** |
|
228 | + * caffeinated_modules_to_register |
|
229 | + * |
|
230 | + * @access public |
|
231 | + * @param array $modules_to_register |
|
232 | + * @return array |
|
233 | + */ |
|
234 | + public function caffeinated_modules_to_register($modules_to_register = []) |
|
235 | + { |
|
236 | + if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
237 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules/*', GLOB_ONLYDIR); |
|
238 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
239 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
240 | + } |
|
241 | + } |
|
242 | + return $modules_to_register; |
|
243 | + } |
|
244 | + |
|
245 | + |
|
246 | + /** |
|
247 | + * @throws EE_Error |
|
248 | + * @throws InvalidArgumentException |
|
249 | + * @throws ReflectionException |
|
250 | + * @throws InvalidDataTypeException |
|
251 | + * @throws InvalidInterfaceException |
|
252 | + */ |
|
253 | + public function caffeinated_init() |
|
254 | + { |
|
255 | + // Custom Post Type hooks |
|
256 | + add_filter( |
|
257 | + 'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies', |
|
258 | + [$this, 'filter_taxonomies'] |
|
259 | + ); |
|
260 | + add_filter( |
|
261 | + 'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes', |
|
262 | + [$this, 'filter_cpts'] |
|
263 | + ); |
|
264 | + add_filter( |
|
265 | + 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', |
|
266 | + [$this, 'nav_metabox_items'] |
|
267 | + ); |
|
268 | + EE_Registry::instance()->load_file( |
|
269 | + EE_CAFF_PATH, |
|
270 | + 'EE_Caf_Messages', |
|
271 | + 'class', |
|
272 | + [], |
|
273 | + false |
|
274 | + ); |
|
275 | + // caffeinated_init__complete hook |
|
276 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
277 | + } |
|
278 | + |
|
279 | + |
|
280 | + public function enqueue_caffeinated_scripts() |
|
281 | + { |
|
282 | + // sound of crickets... |
|
283 | + } |
|
284 | + |
|
285 | + |
|
286 | + /** |
|
287 | + * callbacks below here |
|
288 | + * |
|
289 | + * @param array $taxonomy_array |
|
290 | + * @return array |
|
291 | + */ |
|
292 | + public function filter_taxonomies(array $taxonomy_array) |
|
293 | + { |
|
294 | + $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true; |
|
295 | + return $taxonomy_array; |
|
296 | + } |
|
297 | + |
|
298 | + |
|
299 | + /** |
|
300 | + * @param array $cpt_array |
|
301 | + * @return mixed |
|
302 | + */ |
|
303 | + public function filter_cpts(array $cpt_array) |
|
304 | + { |
|
305 | + $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true; |
|
306 | + return $cpt_array; |
|
307 | + } |
|
308 | + |
|
309 | + |
|
310 | + /** |
|
311 | + * @param array $menuitems |
|
312 | + * @return array |
|
313 | + */ |
|
314 | + public function nav_metabox_items(array $menuitems) |
|
315 | + { |
|
316 | + $menuitems[] = [ |
|
317 | + 'title' => esc_html__('Venue List', 'event_espresso'), |
|
318 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
319 | + 'description' => esc_html__('Archive page for all venues.', 'event_espresso'), |
|
320 | + ]; |
|
321 | + return $menuitems; |
|
322 | + } |
|
323 | + |
|
324 | + |
|
325 | + /** |
|
326 | + * Gets the injected table analyzer, or throws an exception |
|
327 | + * |
|
328 | + * @return TableAnalysis |
|
329 | + * @throws \EE_Error |
|
330 | + */ |
|
331 | + protected function _get_table_analysis() |
|
332 | + { |
|
333 | + if ($this->_table_analysis instanceof TableAnalysis) { |
|
334 | + return $this->_table_analysis; |
|
335 | + } else { |
|
336 | + throw new \EE_Error( |
|
337 | + sprintf( |
|
338 | + esc_html__('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
339 | + get_class($this) |
|
340 | + ) |
|
341 | + ); |
|
342 | + } |
|
343 | + } |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
347 | 347 | $brewing = new EE_Brewing_Regular( |
348 | - EE_Registry::instance()->create('TableAnalysis', [], true) |
|
348 | + EE_Registry::instance()->create('TableAnalysis', [], true) |
|
349 | 349 | ); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | ? null |
115 | 115 | : $this->_data; |
116 | 116 | |
117 | - if (! $registration instanceof EE_Registration) { |
|
117 | + if ( ! $registration instanceof EE_Registration) { |
|
118 | 118 | // let's attempt to get the txn_id for the error message. |
119 | 119 | $txn_id = isset($this->_extra->txn) && $this->_extra->txn instanceof EE_Transaction |
120 | 120 | ? $this->_extra->txn->ID() |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | // attendee obj for this registration |
134 | - $attendee = isset($this->_extra->registrations[ $registration->ID() ]['att_obj']) |
|
135 | - ? $this->_extra->registrations[ $registration->ID() ]['att_obj'] |
|
134 | + $attendee = isset($this->_extra->registrations[$registration->ID()]['att_obj']) |
|
135 | + ? $this->_extra->registrations[$registration->ID()]['att_obj'] |
|
136 | 136 | : null; |
137 | 137 | |
138 | - if (! $attendee instanceof EE_Attendee) { |
|
139 | - $msg = esc_html__( |
|
138 | + if ( ! $attendee instanceof EE_Attendee) { |
|
139 | + $msg = esc_html__( |
|
140 | 140 | 'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', |
141 | 141 | 'event_espresso' |
142 | 142 | ); |
@@ -15,192 +15,192 @@ |
||
15 | 15 | */ |
16 | 16 | class EE_Attendee_Shortcodes extends EE_Shortcodes |
17 | 17 | { |
18 | - /** |
|
19 | - * hold all extra data. |
|
20 | - * |
|
21 | - * @var array |
|
22 | - */ |
|
23 | - protected $_extra; |
|
24 | - |
|
25 | - |
|
26 | - /** |
|
27 | - * EE_Attendee_Shortcodes constructor. |
|
28 | - */ |
|
29 | - public function __construct() |
|
30 | - { |
|
31 | - parent::__construct(); |
|
32 | - } |
|
33 | - |
|
34 | - |
|
35 | - protected function _init_props() |
|
36 | - { |
|
37 | - $this->label = esc_html__('Attendee Shortcodes', 'event_espresso'); |
|
38 | - $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso'); |
|
39 | - $this->_shortcodes = [ |
|
40 | - '[FNAME]' => esc_html__('First Name of an attendee.', 'event_espresso'), |
|
41 | - '[LNAME]' => esc_html__('Last Name of an attendee.', 'event_espresso'), |
|
42 | - '[ATTENDEE_EMAIL]' => esc_html__('Email address for the attendee.', 'event_espresso'), |
|
43 | - '[EDIT_ATTENDEE_LINK]' => esc_html__( |
|
44 | - 'Edit Registration Link (typically you\'d only use this for messages going to event administrators)', |
|
45 | - 'event_espresso' |
|
46 | - ), |
|
47 | - '[REGISTRATION_ID]' => esc_html__( |
|
48 | - 'Unique Registration ID for the registration', |
|
49 | - 'event_espresso' |
|
50 | - ), |
|
51 | - '[REGISTRATION_CODE]' => esc_html__( |
|
52 | - 'Unique Registration Code for the registration', |
|
53 | - 'event_espresso' |
|
54 | - ), |
|
55 | - '[REGISTRATION_STATUS_ID]' => esc_html__( |
|
56 | - 'Parses to the registration status for the attendee', |
|
57 | - 'event_espresso' |
|
58 | - ), |
|
59 | - '[REGISTRATION_STATUS_LABEL]' => esc_html__( |
|
60 | - 'Parses to the status label for the registrant', |
|
61 | - 'event_espresso' |
|
62 | - ), |
|
63 | - '[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__( |
|
64 | - 'Parses to the total amount paid for this registration.', |
|
65 | - 'event_espresso' |
|
66 | - ), |
|
67 | - '[FRONTEND_EDIT_REG_LINK]' => esc_html__( |
|
68 | - 'Generates a link for the given registration to edit this registration details on the frontend.', |
|
69 | - 'event_espresso' |
|
70 | - ), |
|
71 | - '[PHONE_NUMBER]' => esc_html__( |
|
72 | - 'The Phone Number for the Registration.', |
|
73 | - 'event_espresso' |
|
74 | - ), |
|
75 | - '[ADDRESS]' => esc_html__('The Address for the Registration', 'event_espresso'), |
|
76 | - '[ADDRESS2]' => esc_html__( |
|
77 | - 'Whatever was in the address 2 field for the registration.', |
|
78 | - 'event_espresso' |
|
79 | - ), |
|
80 | - '[CITY]' => esc_html__('The city for the registration.', 'event_espresso'), |
|
81 | - '[ZIP_PC]' => esc_html__( |
|
82 | - 'The ZIP (or Postal) Code for the Registration.', |
|
83 | - 'event_espresso' |
|
84 | - ), |
|
85 | - '[ADDRESS_STATE]' => esc_html__( |
|
86 | - 'The state/province for the registration.', |
|
87 | - 'event_espresso' |
|
88 | - ), |
|
89 | - '[COUNTRY]' => esc_html__('The country for the registration.', 'event_espresso'), |
|
90 | - ]; |
|
91 | - } |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * handles shortcode parsing |
|
96 | - * |
|
97 | - * @access protected |
|
98 | - * @param string $shortcode the shortcode to be parsed. |
|
99 | - * @return string |
|
100 | - * @throws EE_Error |
|
101 | - * @throws ReflectionException |
|
102 | - */ |
|
103 | - protected function _parser($shortcode) |
|
104 | - { |
|
105 | - |
|
106 | - |
|
107 | - $this->_extra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
108 | - ? $this->_extra_data['data'] |
|
109 | - : null; |
|
110 | - |
|
111 | - // incoming object should only be a registration object. |
|
112 | - $registration = ! $this->_data instanceof EE_Registration |
|
113 | - ? null |
|
114 | - : $this->_data; |
|
115 | - |
|
116 | - if (! $registration instanceof EE_Registration) { |
|
117 | - // let's attempt to get the txn_id for the error message. |
|
118 | - $txn_id = isset($this->_extra->txn) && $this->_extra->txn instanceof EE_Transaction |
|
119 | - ? $this->_extra->txn->ID() |
|
120 | - : esc_html__('Unknown', 'event_espresso'); |
|
121 | - $msg = esc_html__( |
|
122 | - 'There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', |
|
123 | - 'event_espresso' |
|
124 | - ); |
|
125 | - $dev_msg = sprintf( |
|
126 | - esc_html__('The transaction ID for this request is: %s', 'event_espresso'), |
|
127 | - $txn_id |
|
128 | - ); |
|
129 | - throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
130 | - } |
|
131 | - |
|
132 | - // attendee obj for this registration |
|
133 | - $attendee = isset($this->_extra->registrations[ $registration->ID() ]['att_obj']) |
|
134 | - ? $this->_extra->registrations[ $registration->ID() ]['att_obj'] |
|
135 | - : null; |
|
136 | - |
|
137 | - if (! $attendee instanceof EE_Attendee) { |
|
138 | - $msg = esc_html__( |
|
139 | - 'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', |
|
140 | - 'event_espresso' |
|
141 | - ); |
|
142 | - $dev_msg = sprintf( |
|
143 | - esc_html__('The registration ID for this request is: %s', 'event_espresso'), |
|
144 | - $registration->ID() |
|
145 | - ); |
|
146 | - throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
147 | - } |
|
148 | - |
|
149 | - switch ($shortcode) { |
|
150 | - case '[FNAME]': |
|
151 | - return $attendee->fname(); |
|
152 | - |
|
153 | - case '[LNAME]': |
|
154 | - return $attendee->lname(); |
|
155 | - |
|
156 | - case '[ATTENDEE_EMAIL]': |
|
157 | - return $attendee->email(); |
|
158 | - |
|
159 | - case '[EDIT_ATTENDEE_LINK]': |
|
160 | - return $registration->get_admin_edit_url(); |
|
161 | - |
|
162 | - case '[REGISTRATION_CODE]': |
|
163 | - return $registration->reg_code(); |
|
164 | - |
|
165 | - case '[REGISTRATION_ID]': |
|
166 | - return $registration->ID(); |
|
167 | - |
|
168 | - case '[FRONTEND_EDIT_REG_LINK]': |
|
169 | - return $registration->edit_attendee_information_url(); |
|
170 | - |
|
171 | - case '[PHONE_NUMBER]': |
|
172 | - return $attendee->phone(); |
|
173 | - |
|
174 | - case '[ADDRESS]': |
|
175 | - return $attendee->address(); |
|
176 | - |
|
177 | - case '[ADDRESS2]': |
|
178 | - return $attendee->address2(); |
|
179 | - |
|
180 | - case '[CITY]': |
|
181 | - return $attendee->city(); |
|
182 | - |
|
183 | - case '[ZIP_PC]': |
|
184 | - return $attendee->zip(); |
|
185 | - |
|
186 | - case '[ADDRESS_STATE]': |
|
187 | - $state_obj = $attendee->state_obj(); |
|
188 | - return $state_obj instanceof EE_State ? $state_obj->name() : ''; |
|
189 | - |
|
190 | - case '[COUNTRY]': |
|
191 | - $country_obj = $attendee->country_obj(); |
|
192 | - return $country_obj instanceof EE_Country ? $country_obj->name() : ''; |
|
193 | - |
|
194 | - case '[REGISTRATION_STATUS_ID]': |
|
195 | - return $registration->status_ID(); |
|
196 | - |
|
197 | - case '[REGISTRATION_STATUS_LABEL]': |
|
198 | - return $registration->pretty_status(); |
|
199 | - |
|
200 | - case '[REGISTRATION_TOTAL_AMOUNT_PAID]': |
|
201 | - return $registration->pretty_paid(); |
|
202 | - } |
|
203 | - |
|
204 | - return ''; |
|
205 | - } |
|
18 | + /** |
|
19 | + * hold all extra data. |
|
20 | + * |
|
21 | + * @var array |
|
22 | + */ |
|
23 | + protected $_extra; |
|
24 | + |
|
25 | + |
|
26 | + /** |
|
27 | + * EE_Attendee_Shortcodes constructor. |
|
28 | + */ |
|
29 | + public function __construct() |
|
30 | + { |
|
31 | + parent::__construct(); |
|
32 | + } |
|
33 | + |
|
34 | + |
|
35 | + protected function _init_props() |
|
36 | + { |
|
37 | + $this->label = esc_html__('Attendee Shortcodes', 'event_espresso'); |
|
38 | + $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso'); |
|
39 | + $this->_shortcodes = [ |
|
40 | + '[FNAME]' => esc_html__('First Name of an attendee.', 'event_espresso'), |
|
41 | + '[LNAME]' => esc_html__('Last Name of an attendee.', 'event_espresso'), |
|
42 | + '[ATTENDEE_EMAIL]' => esc_html__('Email address for the attendee.', 'event_espresso'), |
|
43 | + '[EDIT_ATTENDEE_LINK]' => esc_html__( |
|
44 | + 'Edit Registration Link (typically you\'d only use this for messages going to event administrators)', |
|
45 | + 'event_espresso' |
|
46 | + ), |
|
47 | + '[REGISTRATION_ID]' => esc_html__( |
|
48 | + 'Unique Registration ID for the registration', |
|
49 | + 'event_espresso' |
|
50 | + ), |
|
51 | + '[REGISTRATION_CODE]' => esc_html__( |
|
52 | + 'Unique Registration Code for the registration', |
|
53 | + 'event_espresso' |
|
54 | + ), |
|
55 | + '[REGISTRATION_STATUS_ID]' => esc_html__( |
|
56 | + 'Parses to the registration status for the attendee', |
|
57 | + 'event_espresso' |
|
58 | + ), |
|
59 | + '[REGISTRATION_STATUS_LABEL]' => esc_html__( |
|
60 | + 'Parses to the status label for the registrant', |
|
61 | + 'event_espresso' |
|
62 | + ), |
|
63 | + '[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__( |
|
64 | + 'Parses to the total amount paid for this registration.', |
|
65 | + 'event_espresso' |
|
66 | + ), |
|
67 | + '[FRONTEND_EDIT_REG_LINK]' => esc_html__( |
|
68 | + 'Generates a link for the given registration to edit this registration details on the frontend.', |
|
69 | + 'event_espresso' |
|
70 | + ), |
|
71 | + '[PHONE_NUMBER]' => esc_html__( |
|
72 | + 'The Phone Number for the Registration.', |
|
73 | + 'event_espresso' |
|
74 | + ), |
|
75 | + '[ADDRESS]' => esc_html__('The Address for the Registration', 'event_espresso'), |
|
76 | + '[ADDRESS2]' => esc_html__( |
|
77 | + 'Whatever was in the address 2 field for the registration.', |
|
78 | + 'event_espresso' |
|
79 | + ), |
|
80 | + '[CITY]' => esc_html__('The city for the registration.', 'event_espresso'), |
|
81 | + '[ZIP_PC]' => esc_html__( |
|
82 | + 'The ZIP (or Postal) Code for the Registration.', |
|
83 | + 'event_espresso' |
|
84 | + ), |
|
85 | + '[ADDRESS_STATE]' => esc_html__( |
|
86 | + 'The state/province for the registration.', |
|
87 | + 'event_espresso' |
|
88 | + ), |
|
89 | + '[COUNTRY]' => esc_html__('The country for the registration.', 'event_espresso'), |
|
90 | + ]; |
|
91 | + } |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * handles shortcode parsing |
|
96 | + * |
|
97 | + * @access protected |
|
98 | + * @param string $shortcode the shortcode to be parsed. |
|
99 | + * @return string |
|
100 | + * @throws EE_Error |
|
101 | + * @throws ReflectionException |
|
102 | + */ |
|
103 | + protected function _parser($shortcode) |
|
104 | + { |
|
105 | + |
|
106 | + |
|
107 | + $this->_extra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
108 | + ? $this->_extra_data['data'] |
|
109 | + : null; |
|
110 | + |
|
111 | + // incoming object should only be a registration object. |
|
112 | + $registration = ! $this->_data instanceof EE_Registration |
|
113 | + ? null |
|
114 | + : $this->_data; |
|
115 | + |
|
116 | + if (! $registration instanceof EE_Registration) { |
|
117 | + // let's attempt to get the txn_id for the error message. |
|
118 | + $txn_id = isset($this->_extra->txn) && $this->_extra->txn instanceof EE_Transaction |
|
119 | + ? $this->_extra->txn->ID() |
|
120 | + : esc_html__('Unknown', 'event_espresso'); |
|
121 | + $msg = esc_html__( |
|
122 | + 'There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', |
|
123 | + 'event_espresso' |
|
124 | + ); |
|
125 | + $dev_msg = sprintf( |
|
126 | + esc_html__('The transaction ID for this request is: %s', 'event_espresso'), |
|
127 | + $txn_id |
|
128 | + ); |
|
129 | + throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
130 | + } |
|
131 | + |
|
132 | + // attendee obj for this registration |
|
133 | + $attendee = isset($this->_extra->registrations[ $registration->ID() ]['att_obj']) |
|
134 | + ? $this->_extra->registrations[ $registration->ID() ]['att_obj'] |
|
135 | + : null; |
|
136 | + |
|
137 | + if (! $attendee instanceof EE_Attendee) { |
|
138 | + $msg = esc_html__( |
|
139 | + 'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', |
|
140 | + 'event_espresso' |
|
141 | + ); |
|
142 | + $dev_msg = sprintf( |
|
143 | + esc_html__('The registration ID for this request is: %s', 'event_espresso'), |
|
144 | + $registration->ID() |
|
145 | + ); |
|
146 | + throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
147 | + } |
|
148 | + |
|
149 | + switch ($shortcode) { |
|
150 | + case '[FNAME]': |
|
151 | + return $attendee->fname(); |
|
152 | + |
|
153 | + case '[LNAME]': |
|
154 | + return $attendee->lname(); |
|
155 | + |
|
156 | + case '[ATTENDEE_EMAIL]': |
|
157 | + return $attendee->email(); |
|
158 | + |
|
159 | + case '[EDIT_ATTENDEE_LINK]': |
|
160 | + return $registration->get_admin_edit_url(); |
|
161 | + |
|
162 | + case '[REGISTRATION_CODE]': |
|
163 | + return $registration->reg_code(); |
|
164 | + |
|
165 | + case '[REGISTRATION_ID]': |
|
166 | + return $registration->ID(); |
|
167 | + |
|
168 | + case '[FRONTEND_EDIT_REG_LINK]': |
|
169 | + return $registration->edit_attendee_information_url(); |
|
170 | + |
|
171 | + case '[PHONE_NUMBER]': |
|
172 | + return $attendee->phone(); |
|
173 | + |
|
174 | + case '[ADDRESS]': |
|
175 | + return $attendee->address(); |
|
176 | + |
|
177 | + case '[ADDRESS2]': |
|
178 | + return $attendee->address2(); |
|
179 | + |
|
180 | + case '[CITY]': |
|
181 | + return $attendee->city(); |
|
182 | + |
|
183 | + case '[ZIP_PC]': |
|
184 | + return $attendee->zip(); |
|
185 | + |
|
186 | + case '[ADDRESS_STATE]': |
|
187 | + $state_obj = $attendee->state_obj(); |
|
188 | + return $state_obj instanceof EE_State ? $state_obj->name() : ''; |
|
189 | + |
|
190 | + case '[COUNTRY]': |
|
191 | + $country_obj = $attendee->country_obj(); |
|
192 | + return $country_obj instanceof EE_Country ? $country_obj->name() : ''; |
|
193 | + |
|
194 | + case '[REGISTRATION_STATUS_ID]': |
|
195 | + return $registration->status_ID(); |
|
196 | + |
|
197 | + case '[REGISTRATION_STATUS_LABEL]': |
|
198 | + return $registration->pretty_status(); |
|
199 | + |
|
200 | + case '[REGISTRATION_TOTAL_AMOUNT_PAID]': |
|
201 | + return $registration->pretty_paid(); |
|
202 | + } |
|
203 | + |
|
204 | + return ''; |
|
205 | + } |
|
206 | 206 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $att_result = ''; |
160 | 160 | $registrations = |
161 | 161 | isset($this->_extra_data['data']->tickets) |
162 | - ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['reg_objs'] |
|
162 | + ? $this->_extra_data['data']->tickets[$ticket->ID()]['reg_objs'] |
|
163 | 163 | : []; |
164 | 164 | |
165 | 165 | // each attendee in this case should be an attendee object. |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | private function _get_registrations_from_event(EE_Event $event) |
186 | 186 | { |
187 | 187 | return isset($this->_extra_data['data']->events) |
188 | - ? $this->_extra_data['data']->events[ $event->ID() ]['reg_objs'] |
|
188 | + ? $this->_extra_data['data']->events[$event->ID()]['reg_objs'] |
|
189 | 189 | : []; |
190 | 190 | } |
191 | 191 | } |
@@ -18,172 +18,172 @@ |
||
18 | 18 | */ |
19 | 19 | class EE_Attendee_List_Shortcodes extends EE_Shortcodes |
20 | 20 | { |
21 | - public function __construct() |
|
22 | - { |
|
23 | - parent::__construct(); |
|
24 | - } |
|
25 | - |
|
26 | - |
|
27 | - protected function _init_props() |
|
28 | - { |
|
29 | - $this->label = esc_html__('Attendee List Shortcodes', 'event_espresso'); |
|
30 | - $this->description = esc_html__('All shortcodes specific to attendee lists', 'event_espresso'); |
|
31 | - $this->_shortcodes = [ |
|
32 | - '[ATTENDEE_LIST]' => esc_html__('Will output a list of attendees', 'event_espresso'), |
|
33 | - ]; |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * @param string $shortcode |
|
39 | - * @return string |
|
40 | - * @throws EE_Error |
|
41 | - * @throws ReflectionException |
|
42 | - */ |
|
43 | - protected function _parser($shortcode) |
|
44 | - { |
|
45 | - switch ($shortcode) { |
|
46 | - case '[ATTENDEE_LIST]': |
|
47 | - return $this->_get_attendee_list(); |
|
48 | - } |
|
49 | - return ''; |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * figure out what the incoming data is and then return the appropriate parsed value. |
|
55 | - * |
|
56 | - * @return string |
|
57 | - * @throws EE_Error |
|
58 | - * @throws ReflectionException |
|
59 | - */ |
|
60 | - private function _get_attendee_list() |
|
61 | - { |
|
62 | - $this->_validate_list_requirements(); |
|
63 | - |
|
64 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
65 | - return $this->_get_attendee_list_for_main(); |
|
66 | - } |
|
67 | - if ($this->_data['data'] instanceof EE_Event) { |
|
68 | - return $this->_get_attendee_list_for_event(); |
|
69 | - } |
|
70 | - if ($this->_data['data'] instanceof EE_Ticket) { |
|
71 | - return $this->_get_registration_list_for_ticket(); |
|
72 | - } |
|
73 | - // prevent recursive loop |
|
74 | - return ''; |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * This returns the parsed attendee list for main template; |
|
80 | - */ |
|
81 | - private function _get_attendee_list_for_main() |
|
82 | - { |
|
83 | - $valid_shortcodes = ['attendee', 'event_list', 'ticket_list', 'question_list', 'recipient_details']; |
|
84 | - $template = $this->_data['template']; |
|
85 | - $data = $this->_data['data']; |
|
86 | - $attendees = ''; |
|
87 | - |
|
88 | - // now we need to loop through the attendee list and send data to the EE_Parser helper. |
|
89 | - foreach ($data->reg_objs as $registration) { |
|
90 | - $attendees .= $this->_shortcode_helper->parse_attendee_list_template( |
|
91 | - $template, |
|
92 | - $registration, |
|
93 | - $valid_shortcodes, |
|
94 | - $this->_extra_data |
|
95 | - ); |
|
96 | - } |
|
97 | - |
|
98 | - return $attendees; |
|
99 | - } |
|
100 | - |
|
101 | - |
|
102 | - /** |
|
103 | - * return parsed list of attendees for an event |
|
104 | - * |
|
105 | - * @return string |
|
106 | - * @throws EE_Error |
|
107 | - * @throws ReflectionException |
|
108 | - */ |
|
109 | - private function _get_attendee_list_for_event() |
|
110 | - { |
|
111 | - $valid_shortcodes = ['attendee', 'ticket_list', 'question_list', 'recipient_details']; |
|
112 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['attendee_list']) |
|
113 | - ? $this->_data['template']['attendee_list'] |
|
114 | - : $this->_extra_data['template']['attendee_list']; |
|
115 | - $event = $this->_data['data']; |
|
116 | - |
|
117 | - // let's remove any existing [EVENT_LIST] shortcode from the attendee list template so that we don't get recursion. |
|
118 | - $template = str_replace('[EVENT_LIST]', '', $template); |
|
119 | - |
|
120 | - // here we're setting up the attendees for the attendee_list template for THIS event. |
|
121 | - $att_result = ''; |
|
122 | - $registrations = $this->_get_registrations_from_event($event); |
|
123 | - |
|
124 | - // each attendee in this case should be an attendee object. |
|
125 | - foreach ($registrations as $registration) { |
|
126 | - $att_result .= $this->_shortcode_helper->parse_attendee_list_template( |
|
127 | - $template, |
|
128 | - $registration, |
|
129 | - $valid_shortcodes, |
|
130 | - $this->_extra_data |
|
131 | - ); |
|
132 | - } |
|
133 | - |
|
134 | - return $att_result; |
|
135 | - } |
|
136 | - |
|
137 | - |
|
138 | - /** |
|
139 | - * return parsed list of attendees for a ticket |
|
140 | - * |
|
141 | - * @return string |
|
142 | - */ |
|
143 | - private function _get_registration_list_for_ticket() |
|
144 | - { |
|
145 | - $valid_shortcodes = ['attendee', 'event_list', 'question_list', 'recipient_details']; |
|
146 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['attendee_list']) |
|
147 | - ? $this->_data['template']['attendee_list'] |
|
148 | - : $this->_extra_data['template']['attendee_list']; |
|
149 | - $ticket = $this->_data['data']; |
|
150 | - |
|
151 | - // let's remove any existing [TICKET_LIST] (or related) shortcode from the attendee list template so that we don't get recursion. |
|
152 | - $template = str_replace('[TICKET_LIST]', '', $template); |
|
153 | - $template = str_replace('[RECIPIENT_TICKET_LIST]', '', $template); |
|
154 | - $template = str_replace('[PRIMARY_REGISTRANT_TICKET_LIST]', '', $template); |
|
155 | - |
|
156 | - // here we're setting up the attendees for the attendee_list template for THIS ticket. |
|
157 | - $att_result = ''; |
|
158 | - $registrations = |
|
159 | - isset($this->_extra_data['data']->tickets) |
|
160 | - ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['reg_objs'] |
|
161 | - : []; |
|
162 | - |
|
163 | - // each attendee in this case should be an attendee object. |
|
164 | - foreach ($registrations as $registration) { |
|
165 | - $att_result .= $this->_shortcode_helper->parse_attendee_list_template( |
|
166 | - $template, |
|
167 | - $registration, |
|
168 | - $valid_shortcodes, |
|
169 | - $this->_extra_data |
|
170 | - ); |
|
171 | - } |
|
172 | - |
|
173 | - return $att_result; |
|
174 | - } |
|
175 | - |
|
176 | - |
|
177 | - /** |
|
178 | - * @param EE_Event $event |
|
179 | - * @return array|mixed |
|
180 | - * @throws EE_Error |
|
181 | - * @throws ReflectionException |
|
182 | - */ |
|
183 | - private function _get_registrations_from_event(EE_Event $event) |
|
184 | - { |
|
185 | - return isset($this->_extra_data['data']->events) |
|
186 | - ? $this->_extra_data['data']->events[ $event->ID() ]['reg_objs'] |
|
187 | - : []; |
|
188 | - } |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + parent::__construct(); |
|
24 | + } |
|
25 | + |
|
26 | + |
|
27 | + protected function _init_props() |
|
28 | + { |
|
29 | + $this->label = esc_html__('Attendee List Shortcodes', 'event_espresso'); |
|
30 | + $this->description = esc_html__('All shortcodes specific to attendee lists', 'event_espresso'); |
|
31 | + $this->_shortcodes = [ |
|
32 | + '[ATTENDEE_LIST]' => esc_html__('Will output a list of attendees', 'event_espresso'), |
|
33 | + ]; |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * @param string $shortcode |
|
39 | + * @return string |
|
40 | + * @throws EE_Error |
|
41 | + * @throws ReflectionException |
|
42 | + */ |
|
43 | + protected function _parser($shortcode) |
|
44 | + { |
|
45 | + switch ($shortcode) { |
|
46 | + case '[ATTENDEE_LIST]': |
|
47 | + return $this->_get_attendee_list(); |
|
48 | + } |
|
49 | + return ''; |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * figure out what the incoming data is and then return the appropriate parsed value. |
|
55 | + * |
|
56 | + * @return string |
|
57 | + * @throws EE_Error |
|
58 | + * @throws ReflectionException |
|
59 | + */ |
|
60 | + private function _get_attendee_list() |
|
61 | + { |
|
62 | + $this->_validate_list_requirements(); |
|
63 | + |
|
64 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
65 | + return $this->_get_attendee_list_for_main(); |
|
66 | + } |
|
67 | + if ($this->_data['data'] instanceof EE_Event) { |
|
68 | + return $this->_get_attendee_list_for_event(); |
|
69 | + } |
|
70 | + if ($this->_data['data'] instanceof EE_Ticket) { |
|
71 | + return $this->_get_registration_list_for_ticket(); |
|
72 | + } |
|
73 | + // prevent recursive loop |
|
74 | + return ''; |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * This returns the parsed attendee list for main template; |
|
80 | + */ |
|
81 | + private function _get_attendee_list_for_main() |
|
82 | + { |
|
83 | + $valid_shortcodes = ['attendee', 'event_list', 'ticket_list', 'question_list', 'recipient_details']; |
|
84 | + $template = $this->_data['template']; |
|
85 | + $data = $this->_data['data']; |
|
86 | + $attendees = ''; |
|
87 | + |
|
88 | + // now we need to loop through the attendee list and send data to the EE_Parser helper. |
|
89 | + foreach ($data->reg_objs as $registration) { |
|
90 | + $attendees .= $this->_shortcode_helper->parse_attendee_list_template( |
|
91 | + $template, |
|
92 | + $registration, |
|
93 | + $valid_shortcodes, |
|
94 | + $this->_extra_data |
|
95 | + ); |
|
96 | + } |
|
97 | + |
|
98 | + return $attendees; |
|
99 | + } |
|
100 | + |
|
101 | + |
|
102 | + /** |
|
103 | + * return parsed list of attendees for an event |
|
104 | + * |
|
105 | + * @return string |
|
106 | + * @throws EE_Error |
|
107 | + * @throws ReflectionException |
|
108 | + */ |
|
109 | + private function _get_attendee_list_for_event() |
|
110 | + { |
|
111 | + $valid_shortcodes = ['attendee', 'ticket_list', 'question_list', 'recipient_details']; |
|
112 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['attendee_list']) |
|
113 | + ? $this->_data['template']['attendee_list'] |
|
114 | + : $this->_extra_data['template']['attendee_list']; |
|
115 | + $event = $this->_data['data']; |
|
116 | + |
|
117 | + // let's remove any existing [EVENT_LIST] shortcode from the attendee list template so that we don't get recursion. |
|
118 | + $template = str_replace('[EVENT_LIST]', '', $template); |
|
119 | + |
|
120 | + // here we're setting up the attendees for the attendee_list template for THIS event. |
|
121 | + $att_result = ''; |
|
122 | + $registrations = $this->_get_registrations_from_event($event); |
|
123 | + |
|
124 | + // each attendee in this case should be an attendee object. |
|
125 | + foreach ($registrations as $registration) { |
|
126 | + $att_result .= $this->_shortcode_helper->parse_attendee_list_template( |
|
127 | + $template, |
|
128 | + $registration, |
|
129 | + $valid_shortcodes, |
|
130 | + $this->_extra_data |
|
131 | + ); |
|
132 | + } |
|
133 | + |
|
134 | + return $att_result; |
|
135 | + } |
|
136 | + |
|
137 | + |
|
138 | + /** |
|
139 | + * return parsed list of attendees for a ticket |
|
140 | + * |
|
141 | + * @return string |
|
142 | + */ |
|
143 | + private function _get_registration_list_for_ticket() |
|
144 | + { |
|
145 | + $valid_shortcodes = ['attendee', 'event_list', 'question_list', 'recipient_details']; |
|
146 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['attendee_list']) |
|
147 | + ? $this->_data['template']['attendee_list'] |
|
148 | + : $this->_extra_data['template']['attendee_list']; |
|
149 | + $ticket = $this->_data['data']; |
|
150 | + |
|
151 | + // let's remove any existing [TICKET_LIST] (or related) shortcode from the attendee list template so that we don't get recursion. |
|
152 | + $template = str_replace('[TICKET_LIST]', '', $template); |
|
153 | + $template = str_replace('[RECIPIENT_TICKET_LIST]', '', $template); |
|
154 | + $template = str_replace('[PRIMARY_REGISTRANT_TICKET_LIST]', '', $template); |
|
155 | + |
|
156 | + // here we're setting up the attendees for the attendee_list template for THIS ticket. |
|
157 | + $att_result = ''; |
|
158 | + $registrations = |
|
159 | + isset($this->_extra_data['data']->tickets) |
|
160 | + ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['reg_objs'] |
|
161 | + : []; |
|
162 | + |
|
163 | + // each attendee in this case should be an attendee object. |
|
164 | + foreach ($registrations as $registration) { |
|
165 | + $att_result .= $this->_shortcode_helper->parse_attendee_list_template( |
|
166 | + $template, |
|
167 | + $registration, |
|
168 | + $valid_shortcodes, |
|
169 | + $this->_extra_data |
|
170 | + ); |
|
171 | + } |
|
172 | + |
|
173 | + return $att_result; |
|
174 | + } |
|
175 | + |
|
176 | + |
|
177 | + /** |
|
178 | + * @param EE_Event $event |
|
179 | + * @return array|mixed |
|
180 | + * @throws EE_Error |
|
181 | + * @throws ReflectionException |
|
182 | + */ |
|
183 | + private function _get_registrations_from_event(EE_Event $event) |
|
184 | + { |
|
185 | + return isset($this->_extra_data['data']->events) |
|
186 | + ? $this->_extra_data['data']->events[ $event->ID() ]['reg_objs'] |
|
187 | + : []; |
|
188 | + } |
|
189 | 189 | } |
@@ -39,6 +39,6 @@ |
||
39 | 39 | |
40 | 40 | private function _group_link() |
41 | 41 | { |
42 | - return '<span class="ee_menu_group" onclick="return false;">' . $this->menu_label . '</span>'; |
|
42 | + return '<span class="ee_menu_group" onclick="return false;">'.$this->menu_label.'</span>'; |
|
43 | 43 | } |
44 | 44 | } |
@@ -13,31 +13,31 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Admin_Page_Menu_Group extends EE_Admin_Page_Menu_Map |
15 | 15 | { |
16 | - /** |
|
17 | - * @throws EE_Error |
|
18 | - */ |
|
19 | - public function __construct($menu_args = []) |
|
20 | - { |
|
21 | - $required = ['menu_label', 'menu_slug', 'menu_order', 'parent_slug']; |
|
22 | - parent::__construct($menu_args, $required); |
|
23 | - } |
|
16 | + /** |
|
17 | + * @throws EE_Error |
|
18 | + */ |
|
19 | + public function __construct($menu_args = []) |
|
20 | + { |
|
21 | + $required = ['menu_label', 'menu_slug', 'menu_order', 'parent_slug']; |
|
22 | + parent::__construct($menu_args, $required); |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | - protected function _add_menu_page() |
|
27 | - { |
|
28 | - return add_submenu_page( |
|
29 | - $this->parent_slug, |
|
30 | - $this->menu_label, |
|
31 | - $this->_group_link(), |
|
32 | - $this->capability, |
|
33 | - $this->menu_slug, |
|
34 | - '__return_false' |
|
35 | - ); |
|
36 | - } |
|
26 | + protected function _add_menu_page() |
|
27 | + { |
|
28 | + return add_submenu_page( |
|
29 | + $this->parent_slug, |
|
30 | + $this->menu_label, |
|
31 | + $this->_group_link(), |
|
32 | + $this->capability, |
|
33 | + $this->menu_slug, |
|
34 | + '__return_false' |
|
35 | + ); |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - private function _group_link() |
|
40 | - { |
|
41 | - return '<span class="ee_menu_group" onclick="return false;">' . $this->menu_label . '</span>'; |
|
42 | - } |
|
39 | + private function _group_link() |
|
40 | + { |
|
41 | + return '<span class="ee_menu_group" onclick="return false;">' . $this->menu_label . '</span>'; |
|
42 | + } |
|
43 | 43 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | $this->icon_url, |
71 | 71 | $this->position |
72 | 72 | ); |
73 | - if (! empty($this->subtitle)) { |
|
73 | + if ( ! empty($this->subtitle)) { |
|
74 | 74 | add_submenu_page( |
75 | 75 | $this->parent_slug, |
76 | 76 | $this->subtitle, |
@@ -9,76 +9,76 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_Admin_Page_Main_Menu extends EE_Admin_Page_Menu_Map |
11 | 11 | { |
12 | - /** |
|
13 | - * If included int incoming params, then this class will also register a Sub Menue Admin page with a different |
|
14 | - * subtitle than the main menu item. |
|
15 | - * |
|
16 | - * @since 4.4.0 |
|
17 | - * |
|
18 | - * @var string |
|
19 | - */ |
|
20 | - public $subtitle; |
|
12 | + /** |
|
13 | + * If included int incoming params, then this class will also register a Sub Menue Admin page with a different |
|
14 | + * subtitle than the main menu item. |
|
15 | + * |
|
16 | + * @since 4.4.0 |
|
17 | + * |
|
18 | + * @var string |
|
19 | + */ |
|
20 | + public $subtitle; |
|
21 | 21 | |
22 | - /** |
|
23 | - * The page to a icon used for this menu. |
|
24 | - * |
|
25 | - * @since 4.4.0 |
|
26 | - * @see http://codex.wordpress.org/Function_Reference/add_menu_page#Parameters |
|
27 | - * for what can be set for this property. |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - public $icon_url; |
|
22 | + /** |
|
23 | + * The page to a icon used for this menu. |
|
24 | + * |
|
25 | + * @since 4.4.0 |
|
26 | + * @see http://codex.wordpress.org/Function_Reference/add_menu_page#Parameters |
|
27 | + * for what can be set for this property. |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + public $icon_url; |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * What position in the main menu order for the WP admin menu this menu item |
|
35 | - * should show. |
|
36 | - * |
|
37 | - * @since 4.4.0 |
|
38 | - * @see http://codex.wordpress.org/Function_Reference/add_menu_page#Parameters |
|
39 | - * for what can be set for this property. |
|
40 | - * @var integer |
|
41 | - */ |
|
42 | - public $position; |
|
33 | + /** |
|
34 | + * What position in the main menu order for the WP admin menu this menu item |
|
35 | + * should show. |
|
36 | + * |
|
37 | + * @since 4.4.0 |
|
38 | + * @see http://codex.wordpress.org/Function_Reference/add_menu_page#Parameters |
|
39 | + * for what can be set for this property. |
|
40 | + * @var integer |
|
41 | + */ |
|
42 | + public $position; |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @throws EE_Error |
|
47 | - */ |
|
48 | - public function __construct($menu_args) |
|
49 | - { |
|
50 | - $required = ['menu_label', 'parent_slug', 'menu_slug', 'menu_group', 'menu_order', 'admin_init_page']; |
|
45 | + /** |
|
46 | + * @throws EE_Error |
|
47 | + */ |
|
48 | + public function __construct($menu_args) |
|
49 | + { |
|
50 | + $required = ['menu_label', 'parent_slug', 'menu_slug', 'menu_group', 'menu_order', 'admin_init_page']; |
|
51 | 51 | |
52 | - parent::__construct($menu_args, $required); |
|
52 | + parent::__construct($menu_args, $required); |
|
53 | 53 | |
54 | - $this->position = ! empty($this->position) ? (int) $this->position : $this->position; |
|
55 | - } |
|
54 | + $this->position = ! empty($this->position) ? (int) $this->position : $this->position; |
|
55 | + } |
|
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * Uses the proper WP utility for registering a menu page for the main WP pages. |
|
60 | - */ |
|
61 | - protected function _add_menu_page() |
|
62 | - { |
|
63 | - $main = add_menu_page( |
|
64 | - $this->title, |
|
65 | - $this->menu_label, |
|
66 | - $this->capability, |
|
67 | - $this->parent_slug, |
|
68 | - $this->menu_callback, |
|
69 | - $this->icon_url, |
|
70 | - $this->position |
|
71 | - ); |
|
72 | - if (! empty($this->subtitle)) { |
|
73 | - add_submenu_page( |
|
74 | - $this->parent_slug, |
|
75 | - $this->subtitle, |
|
76 | - $this->subtitle, |
|
77 | - $this->capability, |
|
78 | - $this->menu_slug, |
|
79 | - $this->menu_callback |
|
80 | - ); |
|
81 | - } |
|
82 | - return $main; |
|
83 | - } |
|
58 | + /** |
|
59 | + * Uses the proper WP utility for registering a menu page for the main WP pages. |
|
60 | + */ |
|
61 | + protected function _add_menu_page() |
|
62 | + { |
|
63 | + $main = add_menu_page( |
|
64 | + $this->title, |
|
65 | + $this->menu_label, |
|
66 | + $this->capability, |
|
67 | + $this->parent_slug, |
|
68 | + $this->menu_callback, |
|
69 | + $this->icon_url, |
|
70 | + $this->position |
|
71 | + ); |
|
72 | + if (! empty($this->subtitle)) { |
|
73 | + add_submenu_page( |
|
74 | + $this->parent_slug, |
|
75 | + $this->subtitle, |
|
76 | + $this->subtitle, |
|
77 | + $this->capability, |
|
78 | + $this->menu_slug, |
|
79 | + $this->menu_callback |
|
80 | + ); |
|
81 | + } |
|
82 | + return $main; |
|
83 | + } |
|
84 | 84 | } |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | ?> |
8 | 8 | <h2><?php esc_html_e('Event Registration Data', 'event_espresso'); ?></h2> |
9 | 9 | <p><?php |
10 | - esc_html_e( |
|
11 | - 'We collect information about you during event registration. This information may include but is not limited to:', |
|
12 | - 'event_espresso' |
|
13 | - ); ?></p> |
|
10 | + esc_html_e( |
|
11 | + 'We collect information about you during event registration. This information may include but is not limited to:', |
|
12 | + 'event_espresso' |
|
13 | + ); ?></p> |
|
14 | 14 | <ul> |
15 | 15 | <li><?php esc_html_e('Your names', 'event_espresso'); ?></li> |
16 | 16 | <li><?php esc_html_e('Billing address', 'event_espresso'); ?></li> |
@@ -18,16 +18,16 @@ discard block |
||
18 | 18 | <li><?php esc_html_e('Email address', 'event_espresso'); ?></li> |
19 | 19 | <li><?php esc_html_e('Phone number', 'event_espresso'); ?></li> |
20 | 20 | <li><?php |
21 | - esc_html_e( |
|
22 | - 'Location and traffic data (including partial IP address and browser type)', |
|
23 | - 'event_espresso' |
|
24 | - ); ?> |
|
21 | + esc_html_e( |
|
22 | + 'Location and traffic data (including partial IP address and browser type)', |
|
23 | + 'event_espresso' |
|
24 | + ); ?> |
|
25 | 25 | </li> |
26 | 26 | <li><?php |
27 | - esc_html_e( |
|
28 | - 'Any other details that might be requested from you for the purpose of processing your registration or ticket purchase', |
|
29 | - 'event_espresso' |
|
30 | - ); ?> |
|
27 | + esc_html_e( |
|
28 | + 'Any other details that might be requested from you for the purpose of processing your registration or ticket purchase', |
|
29 | + 'event_espresso' |
|
30 | + ); ?> |
|
31 | 31 | </li> |
32 | 32 | </ul> |
33 | 33 | |
@@ -36,101 +36,101 @@ discard block |
||
36 | 36 | <li><?php esc_html_e('Send you important account/purchase/service information.', 'event_espresso'); ?></li> |
37 | 37 | <li><?php esc_html_e('Respond to your queries, refund requests, or complaints.', 'event_espresso'); ?></li> |
38 | 38 | <li><?php |
39 | - esc_html_e( |
|
40 | - 'Process payments and prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', |
|
41 | - 'event_espresso' |
|
42 | - ); ?></li> |
|
39 | + esc_html_e( |
|
40 | + 'Process payments and prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', |
|
41 | + 'event_espresso' |
|
42 | + ); ?></li> |
|
43 | 43 | <li><?php |
44 | - esc_html_e( |
|
45 | - 'Set up and administer your account, provide technical and customer support, and to verify your identity.', |
|
46 | - 'event_espresso' |
|
47 | - ); ?></li> |
|
44 | + esc_html_e( |
|
45 | + 'Set up and administer your account, provide technical and customer support, and to verify your identity.', |
|
46 | + 'event_espresso' |
|
47 | + ); ?></li> |
|
48 | 48 | </ul> |
49 | 49 | |
50 | 50 | <?php if (! empty($active_onsite_payment_methods) || ! empty($active_offsite_payment_methods)) { ?> |
51 | 51 | <h2><?php esc_html_e('Billing Information', 'event_espresso'); ?> </h2> |
52 | 52 | <?php |
53 | - // if onsite or offsite payment methods are active |
|
54 | - if (! empty($active_onsite_payment_methods)) { ?> |
|
53 | + // if onsite or offsite payment methods are active |
|
54 | + if (! empty($active_onsite_payment_methods)) { ?> |
|
55 | 55 | <p><?php |
56 | - esc_html_e( |
|
57 | - 'In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.', |
|
58 | - 'event_espresso' |
|
59 | - ); ?></p> |
|
56 | + esc_html_e( |
|
57 | + 'In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.', |
|
58 | + 'event_espresso' |
|
59 | + ); ?></p> |
|
60 | 60 | <p><?php |
61 | - printf( |
|
62 | - esc_html_x( |
|
63 | - 'Please see the privacy policy of %1$s.', |
|
64 | - 'Please see the privacy policy of PayPal Pro', |
|
65 | - 'event_espresso' |
|
66 | - ), |
|
67 | - implode( |
|
68 | - ', ', |
|
69 | - array_merge( |
|
70 | - $active_onsite_payment_methods, |
|
71 | - $active_offsite_payment_methods |
|
72 | - ) |
|
73 | - ) |
|
74 | - ); ?></p> |
|
61 | + printf( |
|
62 | + esc_html_x( |
|
63 | + 'Please see the privacy policy of %1$s.', |
|
64 | + 'Please see the privacy policy of PayPal Pro', |
|
65 | + 'event_espresso' |
|
66 | + ), |
|
67 | + implode( |
|
68 | + ', ', |
|
69 | + array_merge( |
|
70 | + $active_onsite_payment_methods, |
|
71 | + $active_offsite_payment_methods |
|
72 | + ) |
|
73 | + ) |
|
74 | + ); ?></p> |
|
75 | 75 | <p><?php |
76 | - esc_html_e( |
|
77 | - 'Masked billing information may be stored on our servers (eg only the last 4 digits of credit card numbers are stored: **** **** **** 1234).', |
|
78 | - 'event_espresso' |
|
79 | - ); ?></p> |
|
76 | + esc_html_e( |
|
77 | + 'Masked billing information may be stored on our servers (eg only the last 4 digits of credit card numbers are stored: **** **** **** 1234).', |
|
78 | + 'event_espresso' |
|
79 | + ); ?></p> |
|
80 | 80 | <?php } elseif (! empty($active_offsite_payment_methods)) { // IF OFFSITE PAYMENT METHOD ACTIVE ?> |
81 | 81 | <p><?php |
82 | - printf( |
|
83 | - esc_html_x( |
|
84 | - 'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of %1$s.', |
|
85 | - 'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of PayPal Pro.', |
|
86 | - 'event_espresso' |
|
87 | - ), |
|
88 | - implode(', ', $active_offsite_payment_methods) |
|
89 | - ); ?></p> |
|
82 | + printf( |
|
83 | + esc_html_x( |
|
84 | + 'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of %1$s.', |
|
85 | + 'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of PayPal Pro.', |
|
86 | + 'event_espresso' |
|
87 | + ), |
|
88 | + implode(', ', $active_offsite_payment_methods) |
|
89 | + ); ?></p> |
|
90 | 90 | <?php } ?> |
91 | 91 | <h2><?php esc_html_e('Payment Logging', 'event_espresso'); ?></h2> |
92 | 92 | <p><?php |
93 | - esc_html_e( |
|
94 | - 'Site administrators may keep a log of communications with the payment processors in order to verify payments are being processed correctly. These logs are automatically deleted after a week.', |
|
95 | - 'event_espresso' |
|
96 | - ); ?></p> |
|
93 | + esc_html_e( |
|
94 | + 'Site administrators may keep a log of communications with the payment processors in order to verify payments are being processed correctly. These logs are automatically deleted after a week.', |
|
95 | + 'event_espresso' |
|
96 | + ); ?></p> |
|
97 | 97 | <?php } ?> |
98 | 98 | |
99 | 99 | <h2><?php esc_html_e('Event Registration Cookies', 'event_espresso'); ?></h2> |
100 | 100 | <p><?php |
101 | - printf( |
|
102 | - esc_html_x( |
|
103 | - 'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts %1$s.', |
|
104 | - 'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts 2 hours.', |
|
105 | - 'event_espresso' |
|
106 | - ), |
|
107 | - $session_lifespan |
|
108 | - ); ?></p> |
|
101 | + printf( |
|
102 | + esc_html_x( |
|
103 | + 'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts %1$s.', |
|
104 | + 'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts 2 hours.', |
|
105 | + 'event_espresso' |
|
106 | + ), |
|
107 | + $session_lifespan |
|
108 | + ); ?></p> |
|
109 | 109 | |
110 | 110 | <h2><?php esc_html_e('Email History Data', 'event_espresso'); ?></h2> |
111 | 111 | <p><?php |
112 | - esc_html_e( |
|
113 | - 'We keep a record of the emails sent to you. This is to ensure communication is successfully sent and its information is accurate.', |
|
114 | - 'event_espresso' |
|
115 | - ); ?></p> |
|
112 | + esc_html_e( |
|
113 | + 'We keep a record of the emails sent to you. This is to ensure communication is successfully sent and its information is accurate.', |
|
114 | + 'event_espresso' |
|
115 | + ); ?></p> |
|
116 | 116 | |
117 | 117 | <h2><?php esc_html_e('Event Check-In Record', 'event_espresso'); ?></h2> |
118 | 118 | <p><?php |
119 | - esc_html_e( |
|
120 | - 'When you attend an event, an event manager may record the time you check in or out of the event.', |
|
121 | - 'event_espresso' |
|
122 | - ); ?></p> |
|
119 | + esc_html_e( |
|
120 | + 'When you attend an event, an event manager may record the time you check in or out of the event.', |
|
121 | + 'event_espresso' |
|
122 | + ); ?></p> |
|
123 | 123 | |
124 | 124 | <h2><?php esc_html_e('Event Registration Data Retention', 'event_espresso'); ?></h2> |
125 | 125 | <p><?php |
126 | - esc_html_e( |
|
127 | - 'Personal data is stored at least until the date of the event, and may be kept indefinitely in case of future registrations.', |
|
128 | - 'event_espresso' |
|
129 | - ); ?></p> |
|
126 | + esc_html_e( |
|
127 | + 'Personal data is stored at least until the date of the event, and may be kept indefinitely in case of future registrations.', |
|
128 | + 'event_espresso' |
|
129 | + ); ?></p> |
|
130 | 130 | |
131 | 131 | <h2><?php esc_html_e('Event Registration Data Erasure and Export', 'event_espresso'); ?></h2> |
132 | 132 | <p><?php |
133 | - esc_html_e( |
|
134 | - 'You have the right to request your personal data be sent to you electronically, and the right to request your registration data be erased after the event. To do so, please contact the event manager or site administrator.', |
|
135 | - 'event_espresso' |
|
136 | - ); ?></p> |
|
133 | + esc_html_e( |
|
134 | + 'You have the right to request your personal data be sent to you electronically, and the right to request your registration data be erased after the event. To do so, please contact the event manager or site administrator.', |
|
135 | + 'event_espresso' |
|
136 | + ); ?></p> |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | ); ?></li> |
48 | 48 | </ul> |
49 | 49 | |
50 | -<?php if (! empty($active_onsite_payment_methods) || ! empty($active_offsite_payment_methods)) { ?> |
|
50 | +<?php if ( ! empty($active_onsite_payment_methods) || ! empty($active_offsite_payment_methods)) { ?> |
|
51 | 51 | <h2><?php esc_html_e('Billing Information', 'event_espresso'); ?> </h2> |
52 | 52 | <?php |
53 | 53 | // if onsite or offsite payment methods are active |
54 | - if (! empty($active_onsite_payment_methods)) { ?> |
|
54 | + if ( ! empty($active_onsite_payment_methods)) { ?> |
|
55 | 55 | <p><?php |
56 | 56 | esc_html_e( |
57 | 57 | 'In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.', |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | 'Masked billing information may be stored on our servers (eg only the last 4 digits of credit card numbers are stored: **** **** **** 1234).', |
78 | 78 | 'event_espresso' |
79 | 79 | ); ?></p> |
80 | - <?php } elseif (! empty($active_offsite_payment_methods)) { // IF OFFSITE PAYMENT METHOD ACTIVE ?> |
|
80 | + <?php } elseif ( ! empty($active_offsite_payment_methods)) { // IF OFFSITE PAYMENT METHOD ACTIVE ?> |
|
81 | 81 | <p><?php |
82 | 82 | printf( |
83 | 83 | esc_html_x( |
@@ -11,48 +11,48 @@ |
||
11 | 11 | * @version 4+ |
12 | 12 | */ |
13 | 13 | if (have_posts()) : |
14 | - if (apply_filters('FHEE__archive_espresso_events_template__show_header', true)) : ?> |
|
14 | + if (apply_filters('FHEE__archive_espresso_events_template__show_header', true)) : ?> |
|
15 | 15 | <header class="page-header"> |
16 | 16 | <h1 class="page-title"> |
17 | 17 | <?php |
18 | - if (is_day()) : |
|
19 | - printf(esc_html__('Today\'s Events: %s', 'event_espresso'), get_the_date()); |
|
20 | - elseif (is_month()) : |
|
21 | - printf( |
|
22 | - esc_html__('Events This Month: %s', 'event_espresso'), |
|
23 | - get_the_date(_x('F Y', 'monthly archives date format', 'event_espresso')) |
|
24 | - ); |
|
25 | - elseif (is_year()) : |
|
26 | - printf( |
|
27 | - esc_html__('Events This Year: %s', 'event_espresso'), |
|
28 | - get_the_date(_x('Y', 'yearly archives date format', 'event_espresso')) |
|
29 | - ); |
|
30 | - else : |
|
31 | - echo apply_filters( |
|
32 | - 'FHEE__archive_espresso_events_template__upcoming_events_h1', |
|
33 | - esc_html__('Upcoming Events', 'event_espresso') |
|
34 | - ); |
|
35 | - endif; |
|
36 | - ?> |
|
18 | + if (is_day()) : |
|
19 | + printf(esc_html__('Today\'s Events: %s', 'event_espresso'), get_the_date()); |
|
20 | + elseif (is_month()) : |
|
21 | + printf( |
|
22 | + esc_html__('Events This Month: %s', 'event_espresso'), |
|
23 | + get_the_date(_x('F Y', 'monthly archives date format', 'event_espresso')) |
|
24 | + ); |
|
25 | + elseif (is_year()) : |
|
26 | + printf( |
|
27 | + esc_html__('Events This Year: %s', 'event_espresso'), |
|
28 | + get_the_date(_x('Y', 'yearly archives date format', 'event_espresso')) |
|
29 | + ); |
|
30 | + else : |
|
31 | + echo apply_filters( |
|
32 | + 'FHEE__archive_espresso_events_template__upcoming_events_h1', |
|
33 | + esc_html__('Upcoming Events', 'event_espresso') |
|
34 | + ); |
|
35 | + endif; |
|
36 | + ?> |
|
37 | 37 | </h1> |
38 | 38 | |
39 | 39 | </header><!-- .page-header --> |
40 | 40 | |
41 | 41 | <?php |
42 | - endif; |
|
43 | - // allow other stuff |
|
44 | - do_action('AHEE__archive_espresso_events_template__before_loop'); |
|
45 | - // Start the Loop. |
|
46 | - while (have_posts()) : the_post(); |
|
47 | - // Include the post TYPE-specific template for the content. |
|
48 | - espresso_get_template_part('content', 'espresso_events-shortcode'); |
|
49 | - endwhile; |
|
50 | - // Previous/next page navigation. |
|
51 | - espresso_pagination(); |
|
52 | - // allow moar other stuff |
|
53 | - do_action('AHEE__archive_espresso_events_template__after_loop'); |
|
42 | + endif; |
|
43 | + // allow other stuff |
|
44 | + do_action('AHEE__archive_espresso_events_template__before_loop'); |
|
45 | + // Start the Loop. |
|
46 | + while (have_posts()) : the_post(); |
|
47 | + // Include the post TYPE-specific template for the content. |
|
48 | + espresso_get_template_part('content', 'espresso_events-shortcode'); |
|
49 | + endwhile; |
|
50 | + // Previous/next page navigation. |
|
51 | + espresso_pagination(); |
|
52 | + // allow moar other stuff |
|
53 | + do_action('AHEE__archive_espresso_events_template__after_loop'); |
|
54 | 54 | else : |
55 | - // If no content, include the "No posts found" template. |
|
56 | - espresso_get_template_part('content', 'none'); |
|
55 | + // If no content, include the "No posts found" template. |
|
56 | + espresso_get_template_part('content', 'none'); |
|
57 | 57 | endif; |
58 | 58 |
@@ -27,11 +27,13 @@ discard block |
||
27 | 27 | esc_html__('Events This Year: %s', 'event_espresso'), |
28 | 28 | get_the_date(_x('Y', 'yearly archives date format', 'event_espresso')) |
29 | 29 | ); |
30 | - else : |
|
30 | + else { |
|
31 | + : |
|
31 | 32 | echo apply_filters( |
32 | 33 | 'FHEE__archive_espresso_events_template__upcoming_events_h1', |
33 | 34 | esc_html__('Upcoming Events', 'event_espresso') |
34 | 35 | ); |
36 | + } |
|
35 | 37 | endif; |
36 | 38 | ?> |
37 | 39 | </h1> |
@@ -51,8 +53,10 @@ discard block |
||
51 | 53 | espresso_pagination(); |
52 | 54 | // allow moar other stuff |
53 | 55 | do_action('AHEE__archive_espresso_events_template__after_loop'); |
54 | -else : |
|
56 | +else { |
|
57 | + : |
|
55 | 58 | // If no content, include the "No posts found" template. |
56 | 59 | espresso_get_template_part('content', 'none'); |
60 | +} |
|
57 | 61 | endif; |
58 | 62 |