@@ -14,472 +14,472 @@ discard block |
||
14 | 14 | class EED_Event_Single extends EED_Module |
15 | 15 | { |
16 | 16 | |
17 | - const EVENT_DETAILS_PRIORITY = 100; |
|
18 | - const EVENT_DATETIMES_PRIORITY = 110; |
|
19 | - const EVENT_TICKETS_PRIORITY = 120; |
|
20 | - const EVENT_VENUES_PRIORITY = 130; |
|
21 | - |
|
22 | - /** |
|
23 | - * @type bool $using_get_the_excerpt |
|
24 | - */ |
|
25 | - protected static $using_get_the_excerpt = false; |
|
26 | - |
|
27 | - |
|
28 | - /** |
|
29 | - * @type EE_Template_Part_Manager $template_parts |
|
30 | - */ |
|
31 | - protected $template_parts; |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * @return EED_Module|EED_Event_Single |
|
36 | - */ |
|
37 | - public static function instance() |
|
38 | - { |
|
39 | - return parent::get_instance(__CLASS__); |
|
40 | - } |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
45 | - * |
|
46 | - * @return void |
|
47 | - * @throws InvalidArgumentException |
|
48 | - * @throws InvalidDataTypeException |
|
49 | - * @throws InvalidInterfaceException |
|
50 | - */ |
|
51 | - public static function set_hooks() |
|
52 | - { |
|
53 | - add_filter('FHEE_run_EE_wp', '__return_true'); |
|
54 | - add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
55 | - /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
56 | - $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
57 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
58 | - ); |
|
59 | - $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
60 | - EE_Config::register_route( |
|
61 | - $custom_post_types['espresso_events']['singular_slug'], |
|
62 | - 'Event_Single', |
|
63 | - 'run' |
|
64 | - ); |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
69 | - * |
|
70 | - * @return void |
|
71 | - */ |
|
72 | - public static function set_hooks_admin() |
|
73 | - { |
|
74 | - add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * set_definitions |
|
80 | - * |
|
81 | - * @static |
|
82 | - * @return void |
|
83 | - */ |
|
84 | - public static function set_definitions() |
|
85 | - { |
|
86 | - define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
87 | - define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates' . DS); |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * set_config |
|
93 | - * |
|
94 | - * @void |
|
95 | - */ |
|
96 | - protected function set_config() |
|
97 | - { |
|
98 | - $this->set_config_section('template_settings'); |
|
99 | - $this->set_config_class('EE_Event_Single_Config'); |
|
100 | - $this->set_config_name('EED_Event_Single'); |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - /** |
|
105 | - * initialize_template_parts |
|
106 | - * |
|
107 | - * @param EE_Config_Base|EE_Event_Single_Config $config |
|
108 | - * @return EE_Template_Part_Manager |
|
109 | - */ |
|
110 | - public function initialize_template_parts(EE_Event_Single_Config $config = null) |
|
111 | - { |
|
112 | - /** @type EE_Event_Single_Config $config */ |
|
113 | - $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
|
114 | - EEH_Autoloader::instance()->register_template_part_autoloaders(); |
|
115 | - $template_parts = new EE_Template_Part_Manager(); |
|
116 | - $template_parts->add_template_part( |
|
117 | - 'tickets', |
|
118 | - __('Ticket Selector', 'event_espresso'), |
|
119 | - 'content-espresso_events-tickets.php', |
|
120 | - $config->display_order_tickets |
|
121 | - ); |
|
122 | - $template_parts->add_template_part( |
|
123 | - 'datetimes', |
|
124 | - __('Dates and Times', 'event_espresso'), |
|
125 | - 'content-espresso_events-datetimes.php', |
|
126 | - $config->display_order_datetimes |
|
127 | - ); |
|
128 | - $template_parts->add_template_part( |
|
129 | - 'event', |
|
130 | - __('Event Description', 'event_espresso'), |
|
131 | - 'content-espresso_events-details.php', |
|
132 | - $config->display_order_event |
|
133 | - ); |
|
134 | - $template_parts->add_template_part( |
|
135 | - 'venue', |
|
136 | - __('Venue Information', 'event_espresso'), |
|
137 | - 'content-espresso_events-venues.php', |
|
138 | - $config->display_order_venue |
|
139 | - ); |
|
140 | - do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
141 | - return $template_parts; |
|
142 | - } |
|
143 | - |
|
144 | - |
|
145 | - /** |
|
146 | - * run - initial module setup |
|
147 | - * |
|
148 | - * @param WP $WP |
|
149 | - * @return void |
|
150 | - */ |
|
151 | - public function run($WP) |
|
152 | - { |
|
153 | - // ensure valid EE_Events_Single_Config() object exists |
|
154 | - $this->set_config(); |
|
155 | - // check what template is loaded |
|
156 | - add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
157 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
158 | - // load css |
|
159 | - add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
160 | - } |
|
161 | - |
|
162 | - |
|
163 | - /** |
|
164 | - * template_include |
|
165 | - * |
|
166 | - * @param string $template |
|
167 | - * @return string |
|
168 | - */ |
|
169 | - public function template_include($template) |
|
170 | - { |
|
171 | - global $post; |
|
172 | - /** @type EE_Event_Single_Config $config */ |
|
173 | - $config = $this->config(); |
|
174 | - if ($config->display_status_banner_single) { |
|
175 | - add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
176 | - } |
|
177 | - // not a custom template? |
|
178 | - if (! post_password_required($post) |
|
179 | - && ( |
|
180 | - apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', false) |
|
181 | - || EE_Registry::instance() |
|
182 | - ->load_core('Front_Controller') |
|
183 | - ->get_selected_template() !== 'single-espresso_events.php' |
|
184 | - ) |
|
185 | - |
|
186 | - ) { |
|
187 | - EEH_Template::load_espresso_theme_functions(); |
|
188 | - // then add extra event data via hooks |
|
189 | - add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
190 | - add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
191 | - add_filter( |
|
192 | - 'the_content', |
|
193 | - array('EED_Event_Single', 'event_details'), |
|
194 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
195 | - ); |
|
196 | - add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
197 | - // don't display entry meta because the existing theme will take car of that |
|
198 | - add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
199 | - } |
|
200 | - return $template; |
|
201 | - } |
|
202 | - |
|
203 | - |
|
204 | - /** |
|
205 | - * loop_start |
|
206 | - * |
|
207 | - * @param array $wp_query_array an array containing the WP_Query object |
|
208 | - * @return void |
|
209 | - */ |
|
210 | - public static function loop_start($wp_query_array) |
|
211 | - { |
|
212 | - global $post; |
|
213 | - do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
214 | - } |
|
215 | - |
|
216 | - |
|
217 | - /** |
|
218 | - * the_title |
|
219 | - * |
|
220 | - * @param string $title |
|
221 | - * @param int $id |
|
222 | - * @return string |
|
223 | - */ |
|
224 | - public static function the_title($title = '', $id = 0) |
|
225 | - { |
|
226 | - global $post; |
|
227 | - return in_the_loop() && $post->ID === (int) $id |
|
228 | - ? espresso_event_status_banner($post->ID) . $title |
|
229 | - : $title; |
|
230 | - } |
|
231 | - |
|
232 | - |
|
233 | - /** |
|
234 | - * get_the_excerpt |
|
235 | - * kinda hacky, but if a theme is using get_the_excerpt(), |
|
236 | - * then we need to remove our filters on the_content() |
|
237 | - * |
|
238 | - * @param string $excerpt |
|
239 | - * @return string |
|
240 | - */ |
|
241 | - public static function get_the_excerpt($excerpt = '') |
|
242 | - { |
|
243 | - EED_Event_Single::$using_get_the_excerpt = true; |
|
244 | - add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
245 | - return $excerpt; |
|
246 | - } |
|
247 | - |
|
248 | - |
|
249 | - /** |
|
250 | - * end_get_the_excerpt |
|
251 | - * |
|
252 | - * @param string $text |
|
253 | - * @return string |
|
254 | - */ |
|
255 | - public static function end_get_the_excerpt($text = '') |
|
256 | - { |
|
257 | - EED_Event_Single::$using_get_the_excerpt = false; |
|
258 | - return $text; |
|
259 | - } |
|
260 | - |
|
261 | - |
|
262 | - /** |
|
263 | - * event_details |
|
264 | - * |
|
265 | - * @param string $content |
|
266 | - * @return string |
|
267 | - */ |
|
268 | - public static function event_details($content) |
|
269 | - { |
|
270 | - global $post; |
|
271 | - static $current_post_ID = 0; |
|
272 | - if ($current_post_ID !== $post->ID |
|
273 | - && $post->post_type === 'espresso_events' |
|
274 | - && ! EED_Event_Single::$using_get_the_excerpt |
|
275 | - && ! post_password_required() |
|
276 | - ) { |
|
277 | - // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
|
278 | - // Reason being is that some plugins, like Yoast, need to run through a copy of the loop early |
|
279 | - // BEFORE headers are sent in order to examine the post content and generate content for the HTML header. |
|
280 | - // We want to allow those plugins to still do their thing and have access to our content, but depending on |
|
281 | - // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
|
282 | - // so the following allows this filter to be applied multiple times, but only once for real |
|
283 | - $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
284 | - if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
285 | - // we need to first remove this callback from being applied to the_content() |
|
286 | - // (otherwise it will recurse and blow up the interweb) |
|
287 | - remove_filter( |
|
288 | - 'the_content', |
|
289 | - array('EED_Event_Single', 'event_details'), |
|
290 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
291 | - ); |
|
292 | - EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts( |
|
293 | - ); |
|
294 | - $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
295 | - $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
296 | - add_filter( |
|
297 | - 'the_content', |
|
298 | - array('EED_Event_Single', 'event_details'), |
|
299 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
300 | - ); |
|
301 | - } else { |
|
302 | - $content = EED_Event_Single::use_filterable_display_order(); |
|
303 | - } |
|
304 | - } |
|
305 | - return $content; |
|
306 | - } |
|
307 | - |
|
308 | - |
|
309 | - /** |
|
310 | - * use_filterable_display_order |
|
311 | - * |
|
312 | - * @return string |
|
313 | - */ |
|
314 | - protected static function use_filterable_display_order() |
|
315 | - { |
|
316 | - // since the 'content-espresso_events-details.php' template might be used directly from within a theme, |
|
317 | - // it uses the_content() for displaying the $post->post_content |
|
318 | - // so in order to load a template that uses the_content() |
|
319 | - // from within a callback being used to filter the_content(), |
|
320 | - // we need to first remove this callback from being applied to the_content() |
|
321 | - // (otherwise it will recurse and blow up the interweb) |
|
322 | - remove_filter( |
|
323 | - 'the_content', |
|
324 | - array('EED_Event_Single', 'event_details'), |
|
325 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
326 | - ); |
|
327 | - // now add additional content |
|
328 | - add_filter( |
|
329 | - 'the_content', |
|
330 | - array('EED_Event_Single', 'event_datetimes'), |
|
331 | - EED_Event_Single::EVENT_DATETIMES_PRIORITY, |
|
332 | - 1 |
|
333 | - ); |
|
334 | - add_filter( |
|
335 | - 'the_content', |
|
336 | - array('EED_Event_Single', 'event_tickets'), |
|
337 | - EED_Event_Single::EVENT_TICKETS_PRIORITY, |
|
338 | - 1 |
|
339 | - ); |
|
340 | - add_filter( |
|
341 | - 'the_content', |
|
342 | - array('EED_Event_Single', 'event_venues'), |
|
343 | - EED_Event_Single::EVENT_VENUES_PRIORITY, |
|
344 | - 1 |
|
345 | - ); |
|
346 | - do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
347 | - // now load our template |
|
348 | - $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
349 | - // now add our filter back in, plus some others |
|
350 | - add_filter( |
|
351 | - 'the_content', |
|
352 | - array('EED_Event_Single', 'event_details'), |
|
353 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
354 | - ); |
|
355 | - remove_filter( |
|
356 | - 'the_content', |
|
357 | - array('EED_Event_Single', 'event_datetimes'), |
|
358 | - EED_Event_Single::EVENT_DATETIMES_PRIORITY |
|
359 | - ); |
|
360 | - remove_filter( |
|
361 | - 'the_content', |
|
362 | - array('EED_Event_Single', 'event_tickets'), |
|
363 | - EED_Event_Single::EVENT_TICKETS_PRIORITY |
|
364 | - ); |
|
365 | - remove_filter( |
|
366 | - 'the_content', |
|
367 | - array('EED_Event_Single', 'event_venues'), |
|
368 | - EED_Event_Single::EVENT_VENUES_PRIORITY |
|
369 | - ); |
|
370 | - do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_remove_filters'); |
|
371 | - // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
372 | - return $content; |
|
373 | - } |
|
374 | - |
|
375 | - |
|
376 | - /** |
|
377 | - * event_datetimes - adds datetimes ABOVE content |
|
378 | - * |
|
379 | - * @param string $content |
|
380 | - * @return string |
|
381 | - */ |
|
382 | - public static function event_datetimes($content) |
|
383 | - { |
|
384 | - return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content; |
|
385 | - } |
|
386 | - |
|
387 | - |
|
388 | - /** |
|
389 | - * event_tickets - adds tickets ABOVE content (which includes datetimes) |
|
390 | - * |
|
391 | - * @param string $content |
|
392 | - * @return string |
|
393 | - */ |
|
394 | - public static function event_tickets($content) |
|
395 | - { |
|
396 | - return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content; |
|
397 | - } |
|
398 | - |
|
399 | - |
|
400 | - /** |
|
401 | - * event_venues |
|
402 | - * |
|
403 | - * @param string $content |
|
404 | - * @return string |
|
405 | - */ |
|
406 | - public static function event_venue($content) |
|
407 | - { |
|
408 | - return EED_Event_Single::event_venues($content); |
|
409 | - } |
|
410 | - |
|
411 | - |
|
412 | - /** |
|
413 | - * event_venues - adds venues BELOW content |
|
414 | - * |
|
415 | - * @param string $content |
|
416 | - * @return string |
|
417 | - */ |
|
418 | - public static function event_venues($content) |
|
419 | - { |
|
420 | - return $content . EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
421 | - } |
|
422 | - |
|
423 | - |
|
424 | - /** |
|
425 | - * loop_end |
|
426 | - * |
|
427 | - * @param array $wp_query_array an array containing the WP_Query object |
|
428 | - * @return void |
|
429 | - */ |
|
430 | - public static function loop_end($wp_query_array) |
|
431 | - { |
|
432 | - global $post; |
|
433 | - do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
434 | - } |
|
435 | - |
|
436 | - |
|
437 | - /** |
|
438 | - * wp_enqueue_scripts |
|
439 | - * |
|
440 | - * @return void |
|
441 | - */ |
|
442 | - public function wp_enqueue_scripts() |
|
443 | - { |
|
444 | - // get some style |
|
445 | - if (apply_filters('FHEE_enable_default_espresso_css', true) |
|
446 | - && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', true) |
|
447 | - ) { |
|
448 | - // first check uploads folder |
|
449 | - if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) { |
|
450 | - wp_register_style( |
|
451 | - $this->theme, |
|
452 | - get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', |
|
453 | - array('dashicons', 'espresso_default') |
|
454 | - ); |
|
455 | - } else { |
|
456 | - wp_register_style( |
|
457 | - $this->theme, |
|
458 | - EE_TEMPLATES_URL . $this->theme . DS . 'style.css', |
|
459 | - array('dashicons', 'espresso_default') |
|
460 | - ); |
|
461 | - } |
|
462 | - wp_enqueue_script($this->theme); |
|
463 | - if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
464 | - add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
465 | - } |
|
466 | - } |
|
467 | - } |
|
468 | - |
|
469 | - |
|
470 | - /** |
|
471 | - * display_venue |
|
472 | - * |
|
473 | - * @return bool |
|
474 | - */ |
|
475 | - public static function display_venue() |
|
476 | - { |
|
477 | - /** @type EE_Event_Single_Config $config */ |
|
478 | - $config = EED_Event_Single::instance()->config(); |
|
479 | - $display_venue = $config->display_venue === null ? true : $config->display_venue; |
|
480 | - $venue_name = EEH_Venue_View::venue_name(); |
|
481 | - return $display_venue && ! empty($venue_name); |
|
482 | - } |
|
17 | + const EVENT_DETAILS_PRIORITY = 100; |
|
18 | + const EVENT_DATETIMES_PRIORITY = 110; |
|
19 | + const EVENT_TICKETS_PRIORITY = 120; |
|
20 | + const EVENT_VENUES_PRIORITY = 130; |
|
21 | + |
|
22 | + /** |
|
23 | + * @type bool $using_get_the_excerpt |
|
24 | + */ |
|
25 | + protected static $using_get_the_excerpt = false; |
|
26 | + |
|
27 | + |
|
28 | + /** |
|
29 | + * @type EE_Template_Part_Manager $template_parts |
|
30 | + */ |
|
31 | + protected $template_parts; |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * @return EED_Module|EED_Event_Single |
|
36 | + */ |
|
37 | + public static function instance() |
|
38 | + { |
|
39 | + return parent::get_instance(__CLASS__); |
|
40 | + } |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
45 | + * |
|
46 | + * @return void |
|
47 | + * @throws InvalidArgumentException |
|
48 | + * @throws InvalidDataTypeException |
|
49 | + * @throws InvalidInterfaceException |
|
50 | + */ |
|
51 | + public static function set_hooks() |
|
52 | + { |
|
53 | + add_filter('FHEE_run_EE_wp', '__return_true'); |
|
54 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
55 | + /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
56 | + $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
57 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
58 | + ); |
|
59 | + $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
60 | + EE_Config::register_route( |
|
61 | + $custom_post_types['espresso_events']['singular_slug'], |
|
62 | + 'Event_Single', |
|
63 | + 'run' |
|
64 | + ); |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
69 | + * |
|
70 | + * @return void |
|
71 | + */ |
|
72 | + public static function set_hooks_admin() |
|
73 | + { |
|
74 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * set_definitions |
|
80 | + * |
|
81 | + * @static |
|
82 | + * @return void |
|
83 | + */ |
|
84 | + public static function set_definitions() |
|
85 | + { |
|
86 | + define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
87 | + define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates' . DS); |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * set_config |
|
93 | + * |
|
94 | + * @void |
|
95 | + */ |
|
96 | + protected function set_config() |
|
97 | + { |
|
98 | + $this->set_config_section('template_settings'); |
|
99 | + $this->set_config_class('EE_Event_Single_Config'); |
|
100 | + $this->set_config_name('EED_Event_Single'); |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + /** |
|
105 | + * initialize_template_parts |
|
106 | + * |
|
107 | + * @param EE_Config_Base|EE_Event_Single_Config $config |
|
108 | + * @return EE_Template_Part_Manager |
|
109 | + */ |
|
110 | + public function initialize_template_parts(EE_Event_Single_Config $config = null) |
|
111 | + { |
|
112 | + /** @type EE_Event_Single_Config $config */ |
|
113 | + $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
|
114 | + EEH_Autoloader::instance()->register_template_part_autoloaders(); |
|
115 | + $template_parts = new EE_Template_Part_Manager(); |
|
116 | + $template_parts->add_template_part( |
|
117 | + 'tickets', |
|
118 | + __('Ticket Selector', 'event_espresso'), |
|
119 | + 'content-espresso_events-tickets.php', |
|
120 | + $config->display_order_tickets |
|
121 | + ); |
|
122 | + $template_parts->add_template_part( |
|
123 | + 'datetimes', |
|
124 | + __('Dates and Times', 'event_espresso'), |
|
125 | + 'content-espresso_events-datetimes.php', |
|
126 | + $config->display_order_datetimes |
|
127 | + ); |
|
128 | + $template_parts->add_template_part( |
|
129 | + 'event', |
|
130 | + __('Event Description', 'event_espresso'), |
|
131 | + 'content-espresso_events-details.php', |
|
132 | + $config->display_order_event |
|
133 | + ); |
|
134 | + $template_parts->add_template_part( |
|
135 | + 'venue', |
|
136 | + __('Venue Information', 'event_espresso'), |
|
137 | + 'content-espresso_events-venues.php', |
|
138 | + $config->display_order_venue |
|
139 | + ); |
|
140 | + do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
141 | + return $template_parts; |
|
142 | + } |
|
143 | + |
|
144 | + |
|
145 | + /** |
|
146 | + * run - initial module setup |
|
147 | + * |
|
148 | + * @param WP $WP |
|
149 | + * @return void |
|
150 | + */ |
|
151 | + public function run($WP) |
|
152 | + { |
|
153 | + // ensure valid EE_Events_Single_Config() object exists |
|
154 | + $this->set_config(); |
|
155 | + // check what template is loaded |
|
156 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
157 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
158 | + // load css |
|
159 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
160 | + } |
|
161 | + |
|
162 | + |
|
163 | + /** |
|
164 | + * template_include |
|
165 | + * |
|
166 | + * @param string $template |
|
167 | + * @return string |
|
168 | + */ |
|
169 | + public function template_include($template) |
|
170 | + { |
|
171 | + global $post; |
|
172 | + /** @type EE_Event_Single_Config $config */ |
|
173 | + $config = $this->config(); |
|
174 | + if ($config->display_status_banner_single) { |
|
175 | + add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
176 | + } |
|
177 | + // not a custom template? |
|
178 | + if (! post_password_required($post) |
|
179 | + && ( |
|
180 | + apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', false) |
|
181 | + || EE_Registry::instance() |
|
182 | + ->load_core('Front_Controller') |
|
183 | + ->get_selected_template() !== 'single-espresso_events.php' |
|
184 | + ) |
|
185 | + |
|
186 | + ) { |
|
187 | + EEH_Template::load_espresso_theme_functions(); |
|
188 | + // then add extra event data via hooks |
|
189 | + add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
190 | + add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
191 | + add_filter( |
|
192 | + 'the_content', |
|
193 | + array('EED_Event_Single', 'event_details'), |
|
194 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
195 | + ); |
|
196 | + add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
197 | + // don't display entry meta because the existing theme will take car of that |
|
198 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
199 | + } |
|
200 | + return $template; |
|
201 | + } |
|
202 | + |
|
203 | + |
|
204 | + /** |
|
205 | + * loop_start |
|
206 | + * |
|
207 | + * @param array $wp_query_array an array containing the WP_Query object |
|
208 | + * @return void |
|
209 | + */ |
|
210 | + public static function loop_start($wp_query_array) |
|
211 | + { |
|
212 | + global $post; |
|
213 | + do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
214 | + } |
|
215 | + |
|
216 | + |
|
217 | + /** |
|
218 | + * the_title |
|
219 | + * |
|
220 | + * @param string $title |
|
221 | + * @param int $id |
|
222 | + * @return string |
|
223 | + */ |
|
224 | + public static function the_title($title = '', $id = 0) |
|
225 | + { |
|
226 | + global $post; |
|
227 | + return in_the_loop() && $post->ID === (int) $id |
|
228 | + ? espresso_event_status_banner($post->ID) . $title |
|
229 | + : $title; |
|
230 | + } |
|
231 | + |
|
232 | + |
|
233 | + /** |
|
234 | + * get_the_excerpt |
|
235 | + * kinda hacky, but if a theme is using get_the_excerpt(), |
|
236 | + * then we need to remove our filters on the_content() |
|
237 | + * |
|
238 | + * @param string $excerpt |
|
239 | + * @return string |
|
240 | + */ |
|
241 | + public static function get_the_excerpt($excerpt = '') |
|
242 | + { |
|
243 | + EED_Event_Single::$using_get_the_excerpt = true; |
|
244 | + add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
245 | + return $excerpt; |
|
246 | + } |
|
247 | + |
|
248 | + |
|
249 | + /** |
|
250 | + * end_get_the_excerpt |
|
251 | + * |
|
252 | + * @param string $text |
|
253 | + * @return string |
|
254 | + */ |
|
255 | + public static function end_get_the_excerpt($text = '') |
|
256 | + { |
|
257 | + EED_Event_Single::$using_get_the_excerpt = false; |
|
258 | + return $text; |
|
259 | + } |
|
260 | + |
|
261 | + |
|
262 | + /** |
|
263 | + * event_details |
|
264 | + * |
|
265 | + * @param string $content |
|
266 | + * @return string |
|
267 | + */ |
|
268 | + public static function event_details($content) |
|
269 | + { |
|
270 | + global $post; |
|
271 | + static $current_post_ID = 0; |
|
272 | + if ($current_post_ID !== $post->ID |
|
273 | + && $post->post_type === 'espresso_events' |
|
274 | + && ! EED_Event_Single::$using_get_the_excerpt |
|
275 | + && ! post_password_required() |
|
276 | + ) { |
|
277 | + // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
|
278 | + // Reason being is that some plugins, like Yoast, need to run through a copy of the loop early |
|
279 | + // BEFORE headers are sent in order to examine the post content and generate content for the HTML header. |
|
280 | + // We want to allow those plugins to still do their thing and have access to our content, but depending on |
|
281 | + // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
|
282 | + // so the following allows this filter to be applied multiple times, but only once for real |
|
283 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
284 | + if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
285 | + // we need to first remove this callback from being applied to the_content() |
|
286 | + // (otherwise it will recurse and blow up the interweb) |
|
287 | + remove_filter( |
|
288 | + 'the_content', |
|
289 | + array('EED_Event_Single', 'event_details'), |
|
290 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
291 | + ); |
|
292 | + EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts( |
|
293 | + ); |
|
294 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
295 | + $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
296 | + add_filter( |
|
297 | + 'the_content', |
|
298 | + array('EED_Event_Single', 'event_details'), |
|
299 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
300 | + ); |
|
301 | + } else { |
|
302 | + $content = EED_Event_Single::use_filterable_display_order(); |
|
303 | + } |
|
304 | + } |
|
305 | + return $content; |
|
306 | + } |
|
307 | + |
|
308 | + |
|
309 | + /** |
|
310 | + * use_filterable_display_order |
|
311 | + * |
|
312 | + * @return string |
|
313 | + */ |
|
314 | + protected static function use_filterable_display_order() |
|
315 | + { |
|
316 | + // since the 'content-espresso_events-details.php' template might be used directly from within a theme, |
|
317 | + // it uses the_content() for displaying the $post->post_content |
|
318 | + // so in order to load a template that uses the_content() |
|
319 | + // from within a callback being used to filter the_content(), |
|
320 | + // we need to first remove this callback from being applied to the_content() |
|
321 | + // (otherwise it will recurse and blow up the interweb) |
|
322 | + remove_filter( |
|
323 | + 'the_content', |
|
324 | + array('EED_Event_Single', 'event_details'), |
|
325 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
326 | + ); |
|
327 | + // now add additional content |
|
328 | + add_filter( |
|
329 | + 'the_content', |
|
330 | + array('EED_Event_Single', 'event_datetimes'), |
|
331 | + EED_Event_Single::EVENT_DATETIMES_PRIORITY, |
|
332 | + 1 |
|
333 | + ); |
|
334 | + add_filter( |
|
335 | + 'the_content', |
|
336 | + array('EED_Event_Single', 'event_tickets'), |
|
337 | + EED_Event_Single::EVENT_TICKETS_PRIORITY, |
|
338 | + 1 |
|
339 | + ); |
|
340 | + add_filter( |
|
341 | + 'the_content', |
|
342 | + array('EED_Event_Single', 'event_venues'), |
|
343 | + EED_Event_Single::EVENT_VENUES_PRIORITY, |
|
344 | + 1 |
|
345 | + ); |
|
346 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
347 | + // now load our template |
|
348 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
349 | + // now add our filter back in, plus some others |
|
350 | + add_filter( |
|
351 | + 'the_content', |
|
352 | + array('EED_Event_Single', 'event_details'), |
|
353 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
354 | + ); |
|
355 | + remove_filter( |
|
356 | + 'the_content', |
|
357 | + array('EED_Event_Single', 'event_datetimes'), |
|
358 | + EED_Event_Single::EVENT_DATETIMES_PRIORITY |
|
359 | + ); |
|
360 | + remove_filter( |
|
361 | + 'the_content', |
|
362 | + array('EED_Event_Single', 'event_tickets'), |
|
363 | + EED_Event_Single::EVENT_TICKETS_PRIORITY |
|
364 | + ); |
|
365 | + remove_filter( |
|
366 | + 'the_content', |
|
367 | + array('EED_Event_Single', 'event_venues'), |
|
368 | + EED_Event_Single::EVENT_VENUES_PRIORITY |
|
369 | + ); |
|
370 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_remove_filters'); |
|
371 | + // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
372 | + return $content; |
|
373 | + } |
|
374 | + |
|
375 | + |
|
376 | + /** |
|
377 | + * event_datetimes - adds datetimes ABOVE content |
|
378 | + * |
|
379 | + * @param string $content |
|
380 | + * @return string |
|
381 | + */ |
|
382 | + public static function event_datetimes($content) |
|
383 | + { |
|
384 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content; |
|
385 | + } |
|
386 | + |
|
387 | + |
|
388 | + /** |
|
389 | + * event_tickets - adds tickets ABOVE content (which includes datetimes) |
|
390 | + * |
|
391 | + * @param string $content |
|
392 | + * @return string |
|
393 | + */ |
|
394 | + public static function event_tickets($content) |
|
395 | + { |
|
396 | + return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content; |
|
397 | + } |
|
398 | + |
|
399 | + |
|
400 | + /** |
|
401 | + * event_venues |
|
402 | + * |
|
403 | + * @param string $content |
|
404 | + * @return string |
|
405 | + */ |
|
406 | + public static function event_venue($content) |
|
407 | + { |
|
408 | + return EED_Event_Single::event_venues($content); |
|
409 | + } |
|
410 | + |
|
411 | + |
|
412 | + /** |
|
413 | + * event_venues - adds venues BELOW content |
|
414 | + * |
|
415 | + * @param string $content |
|
416 | + * @return string |
|
417 | + */ |
|
418 | + public static function event_venues($content) |
|
419 | + { |
|
420 | + return $content . EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
421 | + } |
|
422 | + |
|
423 | + |
|
424 | + /** |
|
425 | + * loop_end |
|
426 | + * |
|
427 | + * @param array $wp_query_array an array containing the WP_Query object |
|
428 | + * @return void |
|
429 | + */ |
|
430 | + public static function loop_end($wp_query_array) |
|
431 | + { |
|
432 | + global $post; |
|
433 | + do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
434 | + } |
|
435 | + |
|
436 | + |
|
437 | + /** |
|
438 | + * wp_enqueue_scripts |
|
439 | + * |
|
440 | + * @return void |
|
441 | + */ |
|
442 | + public function wp_enqueue_scripts() |
|
443 | + { |
|
444 | + // get some style |
|
445 | + if (apply_filters('FHEE_enable_default_espresso_css', true) |
|
446 | + && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', true) |
|
447 | + ) { |
|
448 | + // first check uploads folder |
|
449 | + if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) { |
|
450 | + wp_register_style( |
|
451 | + $this->theme, |
|
452 | + get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', |
|
453 | + array('dashicons', 'espresso_default') |
|
454 | + ); |
|
455 | + } else { |
|
456 | + wp_register_style( |
|
457 | + $this->theme, |
|
458 | + EE_TEMPLATES_URL . $this->theme . DS . 'style.css', |
|
459 | + array('dashicons', 'espresso_default') |
|
460 | + ); |
|
461 | + } |
|
462 | + wp_enqueue_script($this->theme); |
|
463 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
464 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
465 | + } |
|
466 | + } |
|
467 | + } |
|
468 | + |
|
469 | + |
|
470 | + /** |
|
471 | + * display_venue |
|
472 | + * |
|
473 | + * @return bool |
|
474 | + */ |
|
475 | + public static function display_venue() |
|
476 | + { |
|
477 | + /** @type EE_Event_Single_Config $config */ |
|
478 | + $config = EED_Event_Single::instance()->config(); |
|
479 | + $display_venue = $config->display_venue === null ? true : $config->display_venue; |
|
480 | + $venue_name = EEH_Venue_View::venue_name(); |
|
481 | + return $display_venue && ! empty($venue_name); |
|
482 | + } |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | |
@@ -491,5 +491,5 @@ discard block |
||
491 | 491 | */ |
492 | 492 | function espresso_display_venue_in_event_details() |
493 | 493 | { |
494 | - return EED_Event_Single::display_venue(); |
|
494 | + return EED_Event_Single::display_venue(); |
|
495 | 495 | } |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public static function set_definitions() |
85 | 85 | { |
86 | - define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
87 | - define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates' . DS); |
|
86 | + define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
87 | + define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
176 | 176 | } |
177 | 177 | // not a custom template? |
178 | - if (! post_password_required($post) |
|
178 | + if ( ! post_password_required($post) |
|
179 | 179 | && ( |
180 | 180 | apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', false) |
181 | 181 | || EE_Registry::instance() |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | { |
226 | 226 | global $post; |
227 | 227 | return in_the_loop() && $post->ID === (int) $id |
228 | - ? espresso_event_status_banner($post->ID) . $title |
|
228 | + ? espresso_event_status_banner($post->ID).$title |
|
229 | 229 | : $title; |
230 | 230 | } |
231 | 231 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | */ |
382 | 382 | public static function event_datetimes($content) |
383 | 383 | { |
384 | - return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content; |
|
384 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | */ |
394 | 394 | public static function event_tickets($content) |
395 | 395 | { |
396 | - return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content; |
|
396 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public static function event_venues($content) |
419 | 419 | { |
420 | - return $content . EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
420 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | |
@@ -446,16 +446,16 @@ discard block |
||
446 | 446 | && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', true) |
447 | 447 | ) { |
448 | 448 | // first check uploads folder |
449 | - if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) { |
|
449 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
450 | 450 | wp_register_style( |
451 | 451 | $this->theme, |
452 | - get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', |
|
452 | + get_stylesheet_directory_uri().$this->theme.DS.'style.css', |
|
453 | 453 | array('dashicons', 'espresso_default') |
454 | 454 | ); |
455 | 455 | } else { |
456 | 456 | wp_register_style( |
457 | 457 | $this->theme, |
458 | - EE_TEMPLATES_URL . $this->theme . DS . 'style.css', |
|
458 | + EE_TEMPLATES_URL.$this->theme.DS.'style.css', |
|
459 | 459 | array('dashicons', 'espresso_default') |
460 | 460 | ); |
461 | 461 | } |
@@ -13,82 +13,82 @@ |
||
13 | 13 | class EED_Invalid_Checkout_Access extends EED_Module |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @var InvalidCheckoutAccess $invalid_checkout_access_form |
|
18 | - */ |
|
19 | - private static $invalid_checkout_access_form; |
|
16 | + /** |
|
17 | + * @var InvalidCheckoutAccess $invalid_checkout_access_form |
|
18 | + */ |
|
19 | + private static $invalid_checkout_access_form; |
|
20 | 20 | |
21 | - /** |
|
22 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
23 | - */ |
|
24 | - public static function set_hooks() |
|
25 | - { |
|
26 | - } |
|
21 | + /** |
|
22 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
23 | + */ |
|
24 | + public static function set_hooks() |
|
25 | + { |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
31 | - */ |
|
32 | - public static function set_hooks_admin() |
|
33 | - { |
|
34 | - add_action( |
|
35 | - 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
|
36 | - array('EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form'), |
|
37 | - 15 |
|
38 | - ); |
|
39 | - add_filter( |
|
40 | - 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', |
|
41 | - array('EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form') |
|
42 | - ); |
|
43 | - } |
|
29 | + /** |
|
30 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
31 | + */ |
|
32 | + public static function set_hooks_admin() |
|
33 | + { |
|
34 | + add_action( |
|
35 | + 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
|
36 | + array('EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form'), |
|
37 | + 15 |
|
38 | + ); |
|
39 | + add_filter( |
|
40 | + 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', |
|
41 | + array('EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form') |
|
42 | + ); |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * run - initial module setup |
|
48 | - * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
49 | - * |
|
50 | - * @var WP $WP |
|
51 | - */ |
|
52 | - public function run($WP) |
|
53 | - { |
|
54 | - // TODO: Implement run() method. |
|
55 | - } |
|
46 | + /** |
|
47 | + * run - initial module setup |
|
48 | + * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
49 | + * |
|
50 | + * @var WP $WP |
|
51 | + */ |
|
52 | + public function run($WP) |
|
53 | + { |
|
54 | + // TODO: Implement run() method. |
|
55 | + } |
|
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * @return InvalidCheckoutAccess |
|
60 | - */ |
|
61 | - public static function getInvalidCheckoutAccess() |
|
62 | - { |
|
63 | - if (! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) { |
|
64 | - self::$invalid_checkout_access_form = new InvalidCheckoutAccess(); |
|
65 | - } |
|
66 | - return self::$invalid_checkout_access_form; |
|
67 | - } |
|
58 | + /** |
|
59 | + * @return InvalidCheckoutAccess |
|
60 | + */ |
|
61 | + public static function getInvalidCheckoutAccess() |
|
62 | + { |
|
63 | + if (! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) { |
|
64 | + self::$invalid_checkout_access_form = new InvalidCheckoutAccess(); |
|
65 | + } |
|
66 | + return self::$invalid_checkout_access_form; |
|
67 | + } |
|
68 | 68 | |
69 | 69 | |
70 | - /** |
|
71 | - * email_validation_settings_form |
|
72 | - * |
|
73 | - * @return void |
|
74 | - * @throws \EE_Error |
|
75 | - */ |
|
76 | - public static function display_invalid_checkout_access_form() |
|
77 | - { |
|
78 | - $invalid_checkout_access_form = \EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
79 | - echo $invalid_checkout_access_form->getForm()->get_html(); |
|
80 | - } |
|
70 | + /** |
|
71 | + * email_validation_settings_form |
|
72 | + * |
|
73 | + * @return void |
|
74 | + * @throws \EE_Error |
|
75 | + */ |
|
76 | + public static function display_invalid_checkout_access_form() |
|
77 | + { |
|
78 | + $invalid_checkout_access_form = \EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
79 | + echo $invalid_checkout_access_form->getForm()->get_html(); |
|
80 | + } |
|
81 | 81 | |
82 | 82 | |
83 | - /** |
|
84 | - * email_validation_settings_form |
|
85 | - * |
|
86 | - * @param \EE_Registration_Config $EE_Registration_Config |
|
87 | - * @return \EE_Registration_Config |
|
88 | - */ |
|
89 | - public static function process_invalid_checkout_access_form(\EE_Registration_Config $EE_Registration_Config) |
|
90 | - { |
|
91 | - $invalid_checkout_access_form = \EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
92 | - return $invalid_checkout_access_form->processForm($EE_Registration_Config); |
|
93 | - } |
|
83 | + /** |
|
84 | + * email_validation_settings_form |
|
85 | + * |
|
86 | + * @param \EE_Registration_Config $EE_Registration_Config |
|
87 | + * @return \EE_Registration_Config |
|
88 | + */ |
|
89 | + public static function process_invalid_checkout_access_form(\EE_Registration_Config $EE_Registration_Config) |
|
90 | + { |
|
91 | + $invalid_checkout_access_form = \EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
92 | + return $invalid_checkout_access_form->processForm($EE_Registration_Config); |
|
93 | + } |
|
94 | 94 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | */ |
61 | 61 | public static function getInvalidCheckoutAccess() |
62 | 62 | { |
63 | - if (! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) { |
|
63 | + if ( ! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) { |
|
64 | 64 | self::$invalid_checkout_access_form = new InvalidCheckoutAccess(); |
65 | 65 | } |
66 | 66 | return self::$invalid_checkout_access_form; |
@@ -12,69 +12,69 @@ |
||
12 | 12 | { |
13 | 13 | |
14 | 14 | |
15 | - /** |
|
16 | - * @return EED_Csv |
|
17 | - */ |
|
18 | - public static function instance() |
|
19 | - { |
|
20 | - return parent::get_instance(__CLASS__); |
|
21 | - } |
|
15 | + /** |
|
16 | + * @return EED_Csv |
|
17 | + */ |
|
18 | + public static function instance() |
|
19 | + { |
|
20 | + return parent::get_instance(__CLASS__); |
|
21 | + } |
|
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
26 | - * |
|
27 | - * @access public |
|
28 | - * @return void |
|
29 | - */ |
|
30 | - public static function set_hooks() |
|
31 | - { |
|
32 | - } |
|
24 | + /** |
|
25 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
26 | + * |
|
27 | + * @access public |
|
28 | + * @return void |
|
29 | + */ |
|
30 | + public static function set_hooks() |
|
31 | + { |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
36 | - * |
|
37 | - * @access public |
|
38 | - * @return void |
|
39 | - */ |
|
40 | - public static function set_hooks_admin() |
|
41 | - { |
|
42 | - } |
|
34 | + /** |
|
35 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
36 | + * |
|
37 | + * @access public |
|
38 | + * @return void |
|
39 | + */ |
|
40 | + public static function set_hooks_admin() |
|
41 | + { |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * run - initial module setup |
|
47 | - * |
|
48 | - * @access public |
|
49 | - * @return void |
|
50 | - */ |
|
51 | - public function run($WP) |
|
52 | - { |
|
53 | - } |
|
45 | + /** |
|
46 | + * run - initial module setup |
|
47 | + * |
|
48 | + * @access public |
|
49 | + * @return void |
|
50 | + */ |
|
51 | + public function run($WP) |
|
52 | + { |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * export |
|
58 | - * |
|
59 | - * @access public |
|
60 | - * @return void |
|
61 | - */ |
|
62 | - public function export() |
|
63 | - { |
|
64 | - $Export = EE_Registry::instance()->load_class('Export'); |
|
65 | - $Export->export(); |
|
66 | - } |
|
56 | + /** |
|
57 | + * export |
|
58 | + * |
|
59 | + * @access public |
|
60 | + * @return void |
|
61 | + */ |
|
62 | + public function export() |
|
63 | + { |
|
64 | + $Export = EE_Registry::instance()->load_class('Export'); |
|
65 | + $Export->export(); |
|
66 | + } |
|
67 | 67 | |
68 | 68 | |
69 | - /** |
|
70 | - * import |
|
71 | - * |
|
72 | - * @access public |
|
73 | - * @return void |
|
74 | - */ |
|
75 | - public function import() |
|
76 | - { |
|
77 | - $Import = EE_Registry::instance()->load_class('Import'); |
|
78 | - $Import->import(); |
|
79 | - } |
|
69 | + /** |
|
70 | + * import |
|
71 | + * |
|
72 | + * @access public |
|
73 | + * @return void |
|
74 | + */ |
|
75 | + public function import() |
|
76 | + { |
|
77 | + $Import = EE_Registry::instance()->load_class('Import'); |
|
78 | + $Import->import(); |
|
79 | + } |
|
80 | 80 | } |
@@ -11,239 +11,239 @@ |
||
11 | 11 | class EED_Ical extends EED_Module |
12 | 12 | { |
13 | 13 | |
14 | - const iCal_datetime_format = 'Ymd\THis\Z'; |
|
15 | - |
|
16 | - |
|
17 | - /** |
|
18 | - * @return EED_Ical|EED_Module |
|
19 | - */ |
|
20 | - public static function instance() |
|
21 | - { |
|
22 | - return parent::get_instance(__CLASS__); |
|
23 | - } |
|
24 | - |
|
25 | - |
|
26 | - /** |
|
27 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
28 | - * |
|
29 | - * @access public |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - public static function set_hooks() |
|
33 | - { |
|
34 | - // create download buttons |
|
35 | - add_filter( |
|
36 | - 'FHEE__espresso_list_of_event_dates__datetime_html', |
|
37 | - array('EED_Ical', 'generate_add_to_iCal_button'), |
|
38 | - 10, |
|
39 | - 2 |
|
40 | - ); |
|
41 | - // process ics download request |
|
42 | - EE_Config::register_route('download_ics_file', 'EED_Ical', 'download_ics_file'); |
|
43 | - } |
|
44 | - |
|
45 | - |
|
46 | - /** |
|
47 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
48 | - * |
|
49 | - * @access public |
|
50 | - * @return void |
|
51 | - */ |
|
52 | - public static function set_hooks_admin() |
|
53 | - { |
|
54 | - } |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * run - initial module setup |
|
59 | - * |
|
60 | - * @access public |
|
61 | - * @param WP $WP |
|
62 | - * @return void |
|
63 | - */ |
|
64 | - public function run($WP) |
|
65 | - { |
|
66 | - } |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * generate_add_to_iCal_button |
|
71 | - * |
|
72 | - * @access public |
|
73 | - * @param $html |
|
74 | - * @param $datetime |
|
75 | - * @return string |
|
76 | - * @throws \EE_Error |
|
77 | - */ |
|
78 | - public static function generate_add_to_iCal_button($html, $datetime) |
|
79 | - { |
|
80 | - // first verify a proper datetime object has been received |
|
81 | - if ($datetime instanceof EE_Datetime) { |
|
82 | - // set whether a link or submit button is shown |
|
83 | - $iCal_type = apply_filters('FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit'); |
|
84 | - // generate a link to the route we registered in set_hooks() |
|
85 | - $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $datetime->ID()), site_url()); |
|
86 | - // what type ? |
|
87 | - switch ($iCal_type) { |
|
88 | - // submit buttons appear as buttons and are very compatible with a theme's style |
|
89 | - case 'submit': |
|
90 | - $html .= '<form id="download-iCal-frm-' . $datetime->ID(); |
|
91 | - $html .= '" class="download-iCal-frm" action="' . $URL . '" method="post" >'; |
|
92 | - $html .= '<input type="submit" class="ee-ical-sbmt" value="" title="'; |
|
93 | - $html .= __('Add to iCal Calendar', 'event_espresso') . '"/>'; |
|
94 | - $html .= '</form>'; |
|
95 | - break; |
|
96 | - // buttons are just links that have been styled to appear as buttons, |
|
97 | - // but may not be blend with a theme as well as submit buttons |
|
98 | - case 'button': |
|
99 | - $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL; |
|
100 | - $html .= '" title="' . __('Add to iCal Calendar', 'event_espresso') . '">'; |
|
101 | - $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
|
102 | - $html .= '</a>'; |
|
103 | - break; |
|
104 | - // links are just links that use the calendar dashicon |
|
105 | - case 'icon': |
|
106 | - $html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="'; |
|
107 | - $html .= __('Add to iCal Calendar', 'event_espresso') . '">'; |
|
108 | - $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
|
109 | - $html .= '</a>'; |
|
110 | - break; |
|
111 | - } |
|
112 | - } |
|
113 | - return $html; |
|
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * download_ics_file |
|
119 | - * |
|
120 | - * @access public |
|
121 | - * @return void |
|
122 | - * @throws \EE_Error |
|
123 | - */ |
|
124 | - public static function download_ics_file() |
|
125 | - { |
|
126 | - if (EE_Registry::instance()->REQ->is_set('ics_id')) { |
|
127 | - $DTT_ID = absint(EE_Registry::instance()->REQ->get('ics_id')); |
|
128 | - $datetime = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($DTT_ID); |
|
129 | - if ($datetime instanceof EE_Datetime) { |
|
130 | - // get related event, venues, and event categories |
|
131 | - $event = $datetime->event(); |
|
132 | - // get related category Term object and it's name |
|
133 | - $category = $event->first_event_category(); |
|
134 | - if ($category instanceof EE_Term) { |
|
135 | - $category = $category->name(); |
|
136 | - } |
|
137 | - $location = ''; |
|
138 | - // get first related venue and convert to CSV string |
|
139 | - $venue = $event->venues(array('limit' => 1)); |
|
140 | - if (is_array($venue) && ! empty($venue)) { |
|
141 | - $venue = array_shift($venue); |
|
142 | - if ($venue instanceof EE_Venue) { |
|
143 | - $location = espresso_venue_raw_address('inline', $venue->ID(), false); |
|
144 | - } |
|
145 | - } |
|
146 | - |
|
147 | - // Generate filename |
|
148 | - $filename = $event->slug() . '-' . $datetime->start_date('Y-m-d') . '.ics'; |
|
149 | - |
|
150 | - // Check the datetime status has not been cancelled and set the ics value accordingly |
|
151 | - $status = $datetime->get_active_status(); |
|
152 | - $status = $status === EE_Datetime::cancelled ? 'CANCELLED' : 'CONFIRMED'; |
|
153 | - |
|
154 | - // Create array of ics details, escape strings, convert timestamps to ics format, etc |
|
155 | - $ics_data = array( |
|
156 | - 'ORGANIZER_NAME' => EE_Registry::instance()->CFG->organization->name, |
|
157 | - 'UID' => md5($event->name() . $event->ID() . $datetime->ID()), |
|
158 | - 'ORGANIZER' => EE_Registry::instance()->CFG->organization->email, |
|
159 | - 'DTSTAMP' => date(EED_Ical::iCal_datetime_format), |
|
160 | - 'LOCATION' => $location, |
|
161 | - 'SUMMARY' => $event->name(), |
|
162 | - 'DESCRIPTION' => wp_strip_all_tags($event->description()), |
|
163 | - 'STATUS' => $status, |
|
164 | - 'CATEGORIES' => $category, |
|
165 | - 'URL;VALUE=URI' => get_permalink($event->ID()), |
|
166 | - 'DTSTART' => date(EED_Ical::iCal_datetime_format, $datetime->start()), |
|
167 | - 'DTEND' => date(EED_Ical::iCal_datetime_format, $datetime->end()), |
|
168 | - ); |
|
169 | - |
|
170 | - // Filter the values used within the ics output. |
|
171 | - // NOTE - all values within ics_data will be escaped automatically. |
|
172 | - $ics_data = apply_filters('FHEE__EED_Ical__download_ics_file_ics_data', $ics_data, $datetime); |
|
173 | - |
|
174 | - // Escape all ics data |
|
175 | - foreach ($ics_data as $key => $value) { |
|
176 | - // Description is escaped differently from all all values |
|
177 | - if ($key === 'DESCRIPTION') { |
|
178 | - $ics_data[ $key ] = EED_Ical::_escape_ICal_description(wp_strip_all_tags($value)); |
|
179 | - } else { |
|
180 | - $ics_data[ $key ] = EED_Ical::_escape_ICal_data($value); |
|
181 | - } |
|
182 | - } |
|
183 | - |
|
184 | - // Pull the organizer name from ics_data and remove it from the array. |
|
185 | - $organizer_name = isset($ics_data['ORGANIZER_NAME']) ? $ics_data['ORGANIZER_NAME'] : ''; |
|
186 | - unset($ics_data['ORGANIZER_NAME']); |
|
187 | - |
|
188 | - // set headers |
|
189 | - header('Content-type: text/calendar; charset=utf-8'); |
|
190 | - header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
191 | - header('Cache-Control: private, max-age=0, must-revalidate'); |
|
192 | - header('Pragma: public'); |
|
193 | - header('Content-Type: application/octet-stream'); |
|
194 | - header('Content-Type: application/force-download'); |
|
195 | - header('Cache-Control: no-cache, must-revalidate'); |
|
196 | - header('Content-Transfer-Encoding: binary'); |
|
197 | - header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date |
|
198 | - ini_set('zlib.output_compression', '0'); |
|
199 | - // echo the output |
|
200 | - echo "BEGIN:VCALENDAR\r\n"; |
|
201 | - echo "VERSION:2.0\r\n"; |
|
202 | - echo "PRODID:-//{$organizer_name}//NONSGML PDA Calendar Version 1.0//EN\r\n"; |
|
203 | - echo "CALSCALE:GREGORIAN\r\n"; |
|
204 | - echo "BEGIN:VEVENT\r\n"; |
|
205 | - |
|
206 | - // Output all remaining values from ics_data. |
|
207 | - foreach ($ics_data as $key => $value) { |
|
208 | - echo $key . ':' . $value . "\r\n"; |
|
209 | - } |
|
210 | - |
|
211 | - echo "END:VEVENT\r\n"; |
|
212 | - echo "END:VCALENDAR\r\n"; |
|
213 | - } |
|
214 | - } |
|
215 | - die(); |
|
216 | - } |
|
217 | - |
|
218 | - |
|
219 | - /** |
|
220 | - * _escape_ICal_data |
|
221 | - * |
|
222 | - * @access private |
|
223 | - * @param string $string |
|
224 | - * @return string |
|
225 | - */ |
|
226 | - private static function _escape_ICal_data($string = '') |
|
227 | - { |
|
228 | - return preg_replace('/([\,;])/', '\\\$1', $string); |
|
229 | - } |
|
230 | - |
|
231 | - /** |
|
232 | - * _escape_ICal_description |
|
233 | - * |
|
234 | - * @access private |
|
235 | - * @param string $description |
|
236 | - * @return string |
|
237 | - */ |
|
238 | - private static function _escape_ICal_description($description = '') |
|
239 | - { |
|
240 | - |
|
241 | - // Escape special chars within the description |
|
242 | - $description = EED_Ical::_escape_ICal_data($description); |
|
243 | - |
|
244 | - // Remove line breaks and output in iCal format |
|
245 | - $description = str_replace(array("\r\n", "\n"), '\n', $description); |
|
246 | - |
|
247 | - return $description; |
|
248 | - } |
|
14 | + const iCal_datetime_format = 'Ymd\THis\Z'; |
|
15 | + |
|
16 | + |
|
17 | + /** |
|
18 | + * @return EED_Ical|EED_Module |
|
19 | + */ |
|
20 | + public static function instance() |
|
21 | + { |
|
22 | + return parent::get_instance(__CLASS__); |
|
23 | + } |
|
24 | + |
|
25 | + |
|
26 | + /** |
|
27 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
28 | + * |
|
29 | + * @access public |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + public static function set_hooks() |
|
33 | + { |
|
34 | + // create download buttons |
|
35 | + add_filter( |
|
36 | + 'FHEE__espresso_list_of_event_dates__datetime_html', |
|
37 | + array('EED_Ical', 'generate_add_to_iCal_button'), |
|
38 | + 10, |
|
39 | + 2 |
|
40 | + ); |
|
41 | + // process ics download request |
|
42 | + EE_Config::register_route('download_ics_file', 'EED_Ical', 'download_ics_file'); |
|
43 | + } |
|
44 | + |
|
45 | + |
|
46 | + /** |
|
47 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
48 | + * |
|
49 | + * @access public |
|
50 | + * @return void |
|
51 | + */ |
|
52 | + public static function set_hooks_admin() |
|
53 | + { |
|
54 | + } |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * run - initial module setup |
|
59 | + * |
|
60 | + * @access public |
|
61 | + * @param WP $WP |
|
62 | + * @return void |
|
63 | + */ |
|
64 | + public function run($WP) |
|
65 | + { |
|
66 | + } |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * generate_add_to_iCal_button |
|
71 | + * |
|
72 | + * @access public |
|
73 | + * @param $html |
|
74 | + * @param $datetime |
|
75 | + * @return string |
|
76 | + * @throws \EE_Error |
|
77 | + */ |
|
78 | + public static function generate_add_to_iCal_button($html, $datetime) |
|
79 | + { |
|
80 | + // first verify a proper datetime object has been received |
|
81 | + if ($datetime instanceof EE_Datetime) { |
|
82 | + // set whether a link or submit button is shown |
|
83 | + $iCal_type = apply_filters('FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit'); |
|
84 | + // generate a link to the route we registered in set_hooks() |
|
85 | + $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $datetime->ID()), site_url()); |
|
86 | + // what type ? |
|
87 | + switch ($iCal_type) { |
|
88 | + // submit buttons appear as buttons and are very compatible with a theme's style |
|
89 | + case 'submit': |
|
90 | + $html .= '<form id="download-iCal-frm-' . $datetime->ID(); |
|
91 | + $html .= '" class="download-iCal-frm" action="' . $URL . '" method="post" >'; |
|
92 | + $html .= '<input type="submit" class="ee-ical-sbmt" value="" title="'; |
|
93 | + $html .= __('Add to iCal Calendar', 'event_espresso') . '"/>'; |
|
94 | + $html .= '</form>'; |
|
95 | + break; |
|
96 | + // buttons are just links that have been styled to appear as buttons, |
|
97 | + // but may not be blend with a theme as well as submit buttons |
|
98 | + case 'button': |
|
99 | + $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL; |
|
100 | + $html .= '" title="' . __('Add to iCal Calendar', 'event_espresso') . '">'; |
|
101 | + $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
|
102 | + $html .= '</a>'; |
|
103 | + break; |
|
104 | + // links are just links that use the calendar dashicon |
|
105 | + case 'icon': |
|
106 | + $html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="'; |
|
107 | + $html .= __('Add to iCal Calendar', 'event_espresso') . '">'; |
|
108 | + $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
|
109 | + $html .= '</a>'; |
|
110 | + break; |
|
111 | + } |
|
112 | + } |
|
113 | + return $html; |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * download_ics_file |
|
119 | + * |
|
120 | + * @access public |
|
121 | + * @return void |
|
122 | + * @throws \EE_Error |
|
123 | + */ |
|
124 | + public static function download_ics_file() |
|
125 | + { |
|
126 | + if (EE_Registry::instance()->REQ->is_set('ics_id')) { |
|
127 | + $DTT_ID = absint(EE_Registry::instance()->REQ->get('ics_id')); |
|
128 | + $datetime = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($DTT_ID); |
|
129 | + if ($datetime instanceof EE_Datetime) { |
|
130 | + // get related event, venues, and event categories |
|
131 | + $event = $datetime->event(); |
|
132 | + // get related category Term object and it's name |
|
133 | + $category = $event->first_event_category(); |
|
134 | + if ($category instanceof EE_Term) { |
|
135 | + $category = $category->name(); |
|
136 | + } |
|
137 | + $location = ''; |
|
138 | + // get first related venue and convert to CSV string |
|
139 | + $venue = $event->venues(array('limit' => 1)); |
|
140 | + if (is_array($venue) && ! empty($venue)) { |
|
141 | + $venue = array_shift($venue); |
|
142 | + if ($venue instanceof EE_Venue) { |
|
143 | + $location = espresso_venue_raw_address('inline', $venue->ID(), false); |
|
144 | + } |
|
145 | + } |
|
146 | + |
|
147 | + // Generate filename |
|
148 | + $filename = $event->slug() . '-' . $datetime->start_date('Y-m-d') . '.ics'; |
|
149 | + |
|
150 | + // Check the datetime status has not been cancelled and set the ics value accordingly |
|
151 | + $status = $datetime->get_active_status(); |
|
152 | + $status = $status === EE_Datetime::cancelled ? 'CANCELLED' : 'CONFIRMED'; |
|
153 | + |
|
154 | + // Create array of ics details, escape strings, convert timestamps to ics format, etc |
|
155 | + $ics_data = array( |
|
156 | + 'ORGANIZER_NAME' => EE_Registry::instance()->CFG->organization->name, |
|
157 | + 'UID' => md5($event->name() . $event->ID() . $datetime->ID()), |
|
158 | + 'ORGANIZER' => EE_Registry::instance()->CFG->organization->email, |
|
159 | + 'DTSTAMP' => date(EED_Ical::iCal_datetime_format), |
|
160 | + 'LOCATION' => $location, |
|
161 | + 'SUMMARY' => $event->name(), |
|
162 | + 'DESCRIPTION' => wp_strip_all_tags($event->description()), |
|
163 | + 'STATUS' => $status, |
|
164 | + 'CATEGORIES' => $category, |
|
165 | + 'URL;VALUE=URI' => get_permalink($event->ID()), |
|
166 | + 'DTSTART' => date(EED_Ical::iCal_datetime_format, $datetime->start()), |
|
167 | + 'DTEND' => date(EED_Ical::iCal_datetime_format, $datetime->end()), |
|
168 | + ); |
|
169 | + |
|
170 | + // Filter the values used within the ics output. |
|
171 | + // NOTE - all values within ics_data will be escaped automatically. |
|
172 | + $ics_data = apply_filters('FHEE__EED_Ical__download_ics_file_ics_data', $ics_data, $datetime); |
|
173 | + |
|
174 | + // Escape all ics data |
|
175 | + foreach ($ics_data as $key => $value) { |
|
176 | + // Description is escaped differently from all all values |
|
177 | + if ($key === 'DESCRIPTION') { |
|
178 | + $ics_data[ $key ] = EED_Ical::_escape_ICal_description(wp_strip_all_tags($value)); |
|
179 | + } else { |
|
180 | + $ics_data[ $key ] = EED_Ical::_escape_ICal_data($value); |
|
181 | + } |
|
182 | + } |
|
183 | + |
|
184 | + // Pull the organizer name from ics_data and remove it from the array. |
|
185 | + $organizer_name = isset($ics_data['ORGANIZER_NAME']) ? $ics_data['ORGANIZER_NAME'] : ''; |
|
186 | + unset($ics_data['ORGANIZER_NAME']); |
|
187 | + |
|
188 | + // set headers |
|
189 | + header('Content-type: text/calendar; charset=utf-8'); |
|
190 | + header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
191 | + header('Cache-Control: private, max-age=0, must-revalidate'); |
|
192 | + header('Pragma: public'); |
|
193 | + header('Content-Type: application/octet-stream'); |
|
194 | + header('Content-Type: application/force-download'); |
|
195 | + header('Cache-Control: no-cache, must-revalidate'); |
|
196 | + header('Content-Transfer-Encoding: binary'); |
|
197 | + header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date |
|
198 | + ini_set('zlib.output_compression', '0'); |
|
199 | + // echo the output |
|
200 | + echo "BEGIN:VCALENDAR\r\n"; |
|
201 | + echo "VERSION:2.0\r\n"; |
|
202 | + echo "PRODID:-//{$organizer_name}//NONSGML PDA Calendar Version 1.0//EN\r\n"; |
|
203 | + echo "CALSCALE:GREGORIAN\r\n"; |
|
204 | + echo "BEGIN:VEVENT\r\n"; |
|
205 | + |
|
206 | + // Output all remaining values from ics_data. |
|
207 | + foreach ($ics_data as $key => $value) { |
|
208 | + echo $key . ':' . $value . "\r\n"; |
|
209 | + } |
|
210 | + |
|
211 | + echo "END:VEVENT\r\n"; |
|
212 | + echo "END:VCALENDAR\r\n"; |
|
213 | + } |
|
214 | + } |
|
215 | + die(); |
|
216 | + } |
|
217 | + |
|
218 | + |
|
219 | + /** |
|
220 | + * _escape_ICal_data |
|
221 | + * |
|
222 | + * @access private |
|
223 | + * @param string $string |
|
224 | + * @return string |
|
225 | + */ |
|
226 | + private static function _escape_ICal_data($string = '') |
|
227 | + { |
|
228 | + return preg_replace('/([\,;])/', '\\\$1', $string); |
|
229 | + } |
|
230 | + |
|
231 | + /** |
|
232 | + * _escape_ICal_description |
|
233 | + * |
|
234 | + * @access private |
|
235 | + * @param string $description |
|
236 | + * @return string |
|
237 | + */ |
|
238 | + private static function _escape_ICal_description($description = '') |
|
239 | + { |
|
240 | + |
|
241 | + // Escape special chars within the description |
|
242 | + $description = EED_Ical::_escape_ICal_data($description); |
|
243 | + |
|
244 | + // Remove line breaks and output in iCal format |
|
245 | + $description = str_replace(array("\r\n", "\n"), '\n', $description); |
|
246 | + |
|
247 | + return $description; |
|
248 | + } |
|
249 | 249 | } |
@@ -87,24 +87,24 @@ discard block |
||
87 | 87 | switch ($iCal_type) { |
88 | 88 | // submit buttons appear as buttons and are very compatible with a theme's style |
89 | 89 | case 'submit': |
90 | - $html .= '<form id="download-iCal-frm-' . $datetime->ID(); |
|
91 | - $html .= '" class="download-iCal-frm" action="' . $URL . '" method="post" >'; |
|
90 | + $html .= '<form id="download-iCal-frm-'.$datetime->ID(); |
|
91 | + $html .= '" class="download-iCal-frm" action="'.$URL.'" method="post" >'; |
|
92 | 92 | $html .= '<input type="submit" class="ee-ical-sbmt" value="" title="'; |
93 | - $html .= __('Add to iCal Calendar', 'event_espresso') . '"/>'; |
|
93 | + $html .= __('Add to iCal Calendar', 'event_espresso').'"/>'; |
|
94 | 94 | $html .= '</form>'; |
95 | 95 | break; |
96 | 96 | // buttons are just links that have been styled to appear as buttons, |
97 | 97 | // but may not be blend with a theme as well as submit buttons |
98 | 98 | case 'button': |
99 | - $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL; |
|
100 | - $html .= '" title="' . __('Add to iCal Calendar', 'event_espresso') . '">'; |
|
99 | + $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="'.$URL; |
|
100 | + $html .= '" title="'.__('Add to iCal Calendar', 'event_espresso').'">'; |
|
101 | 101 | $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
102 | 102 | $html .= '</a>'; |
103 | 103 | break; |
104 | 104 | // links are just links that use the calendar dashicon |
105 | 105 | case 'icon': |
106 | - $html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="'; |
|
107 | - $html .= __('Add to iCal Calendar', 'event_espresso') . '">'; |
|
106 | + $html .= '<a class="ee-ical-lnk" href="'.$URL.'" title="'; |
|
107 | + $html .= __('Add to iCal Calendar', 'event_espresso').'">'; |
|
108 | 108 | $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
109 | 109 | $html .= '</a>'; |
110 | 110 | break; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | // Generate filename |
148 | - $filename = $event->slug() . '-' . $datetime->start_date('Y-m-d') . '.ics'; |
|
148 | + $filename = $event->slug().'-'.$datetime->start_date('Y-m-d').'.ics'; |
|
149 | 149 | |
150 | 150 | // Check the datetime status has not been cancelled and set the ics value accordingly |
151 | 151 | $status = $datetime->get_active_status(); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | // Create array of ics details, escape strings, convert timestamps to ics format, etc |
155 | 155 | $ics_data = array( |
156 | 156 | 'ORGANIZER_NAME' => EE_Registry::instance()->CFG->organization->name, |
157 | - 'UID' => md5($event->name() . $event->ID() . $datetime->ID()), |
|
157 | + 'UID' => md5($event->name().$event->ID().$datetime->ID()), |
|
158 | 158 | 'ORGANIZER' => EE_Registry::instance()->CFG->organization->email, |
159 | 159 | 'DTSTAMP' => date(EED_Ical::iCal_datetime_format), |
160 | 160 | 'LOCATION' => $location, |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | foreach ($ics_data as $key => $value) { |
176 | 176 | // Description is escaped differently from all all values |
177 | 177 | if ($key === 'DESCRIPTION') { |
178 | - $ics_data[ $key ] = EED_Ical::_escape_ICal_description(wp_strip_all_tags($value)); |
|
178 | + $ics_data[$key] = EED_Ical::_escape_ICal_description(wp_strip_all_tags($value)); |
|
179 | 179 | } else { |
180 | - $ics_data[ $key ] = EED_Ical::_escape_ICal_data($value); |
|
180 | + $ics_data[$key] = EED_Ical::_escape_ICal_data($value); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | // set headers |
189 | 189 | header('Content-type: text/calendar; charset=utf-8'); |
190 | - header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
190 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
191 | 191 | header('Cache-Control: private, max-age=0, must-revalidate'); |
192 | 192 | header('Pragma: public'); |
193 | 193 | header('Content-Type: application/octet-stream'); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | // Output all remaining values from ics_data. |
207 | 207 | foreach ($ics_data as $key => $value) { |
208 | - echo $key . ':' . $value . "\r\n"; |
|
208 | + echo $key.':'.$value."\r\n"; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | echo "END:VEVENT\r\n"; |
@@ -29,48 +29,48 @@ discard block |
||
29 | 29 | <tr> |
30 | 30 | <th id="details-<?php echo $EVT_ID; ?>" scope="col" class="ee-ticket-selector-ticket-details-th"> |
31 | 31 | <?php |
32 | - echo apply_filters( |
|
33 | - 'FHEE__ticket_selector_chart_template__table_header_available_tickets', |
|
34 | - esc_html__('Details', 'event_espresso'), |
|
35 | - $EVT_ID |
|
36 | - ); |
|
37 | - ?> |
|
32 | + echo apply_filters( |
|
33 | + 'FHEE__ticket_selector_chart_template__table_header_available_tickets', |
|
34 | + esc_html__('Details', 'event_espresso'), |
|
35 | + $EVT_ID |
|
36 | + ); |
|
37 | + ?> |
|
38 | 38 | </th> |
39 | 39 | <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { ?> |
40 | 40 | <th id="price-<?php echo $EVT_ID; ?>" scope="col" class="ee-ticket-selector-ticket-price-th cntr"> |
41 | 41 | <?php |
42 | - /** |
|
43 | - * Filters the text printed for the header of the price column in the ticket selector table |
|
44 | - * |
|
45 | - * @since 4.7.2 |
|
46 | - * |
|
47 | - * @param string 'Price' The translatable text to display in the table header for price |
|
48 | - * @param int $EVT_ID The Event ID |
|
49 | - */ |
|
50 | - echo apply_filters( |
|
51 | - 'FHEE__ticket_selector_chart_template__table_header_price', |
|
52 | - esc_html__('Price', 'event_espresso'), |
|
53 | - $EVT_ID |
|
54 | - ); |
|
55 | - ?> |
|
42 | + /** |
|
43 | + * Filters the text printed for the header of the price column in the ticket selector table |
|
44 | + * |
|
45 | + * @since 4.7.2 |
|
46 | + * |
|
47 | + * @param string 'Price' The translatable text to display in the table header for price |
|
48 | + * @param int $EVT_ID The Event ID |
|
49 | + */ |
|
50 | + echo apply_filters( |
|
51 | + 'FHEE__ticket_selector_chart_template__table_header_price', |
|
52 | + esc_html__('Price', 'event_espresso'), |
|
53 | + $EVT_ID |
|
54 | + ); |
|
55 | + ?> |
|
56 | 56 | </th> |
57 | 57 | <?php } ?> |
58 | 58 | <th id="quantity-<?php echo $EVT_ID; ?>" scope="col" class="ee-ticket-selector-ticket-qty-th cntr"> |
59 | 59 | <?php |
60 | - /** |
|
61 | - * Filters the text printed for the header of the quantity column in the ticket selector table |
|
62 | - * |
|
63 | - * @since 4.7.2 |
|
64 | - * |
|
65 | - * @param string 'Qty' The translatable text to display in the table header for the Quantity of tickets |
|
66 | - * @param int $EVT_ID The Event ID |
|
67 | - */ |
|
68 | - echo apply_filters( |
|
69 | - 'FHEE__ticket_selector_chart_template__table_header_qty', |
|
70 | - esc_html__('Qty', 'event_espresso'), |
|
71 | - $EVT_ID |
|
72 | - ); |
|
73 | - ?> |
|
60 | + /** |
|
61 | + * Filters the text printed for the header of the quantity column in the ticket selector table |
|
62 | + * |
|
63 | + * @since 4.7.2 |
|
64 | + * |
|
65 | + * @param string 'Qty' The translatable text to display in the table header for the Quantity of tickets |
|
66 | + * @param int $EVT_ID The Event ID |
|
67 | + */ |
|
68 | + echo apply_filters( |
|
69 | + 'FHEE__ticket_selector_chart_template__table_header_qty', |
|
70 | + esc_html__('Qty', 'event_espresso'), |
|
71 | + $EVT_ID |
|
72 | + ); |
|
73 | + ?> |
|
74 | 74 | </th> |
75 | 75 | </tr> |
76 | 76 | </thead> |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | </table> |
81 | 81 | <?php |
82 | 82 | if ($taxable_tickets && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
83 | - if ($prices_displayed_including_taxes) { |
|
84 | - $ticket_price_includes_taxes = esc_html__('* price includes taxes', 'event_espresso'); |
|
85 | - } else { |
|
86 | - $ticket_price_includes_taxes = esc_html__('* price does not include taxes', 'event_espresso'); |
|
87 | - } |
|
88 | - echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">' . $ticket_price_includes_taxes . '</p>'; |
|
83 | + if ($prices_displayed_including_taxes) { |
|
84 | + $ticket_price_includes_taxes = esc_html__('* price includes taxes', 'event_espresso'); |
|
85 | + } else { |
|
86 | + $ticket_price_includes_taxes = esc_html__('* price does not include taxes', 'event_espresso'); |
|
87 | + } |
|
88 | + echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">' . $ticket_price_includes_taxes . '</p>'; |
|
89 | 89 | } |
90 | 90 | ?> |
91 | 91 | |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | |
95 | 95 | <?php |
96 | 96 | if ($max_atndz > 0) { |
97 | - echo apply_filters( |
|
98 | - 'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote', |
|
99 | - esc_html('') |
|
100 | - ); |
|
97 | + echo apply_filters( |
|
98 | + 'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote', |
|
99 | + esc_html('') |
|
100 | + ); |
|
101 | 101 | } |
102 | 102 | if (! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) { |
103 | - add_filter('FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true'); |
|
103 | + add_filter('FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true'); |
|
104 | 104 | } |
105 | 105 | do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
106 | 106 | \ No newline at end of file |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } else { |
86 | 86 | $ticket_price_includes_taxes = esc_html__('* price does not include taxes', 'event_espresso'); |
87 | 87 | } |
88 | - echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">' . $ticket_price_includes_taxes . '</p>'; |
|
88 | + echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">'.$ticket_price_includes_taxes.'</p>'; |
|
89 | 89 | } |
90 | 90 | ?> |
91 | 91 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | esc_html('') |
100 | 100 | ); |
101 | 101 | } |
102 | -if (! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) { |
|
102 | +if ( ! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) { |
|
103 | 103 | add_filter('FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true'); |
104 | 104 | } |
105 | 105 | do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
106 | 106 | \ No newline at end of file |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
13 | 13 | <?php |
14 | 14 | if ($ticket instanceof EE_Ticket) { |
15 | - do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
16 | - $ticket_description .= ! empty($ticket_description) |
|
17 | - ? '<br />' . $ticket_status_display |
|
18 | - : $ticket_status_display; |
|
19 | - if (strpos($ticket_description, '<div') === false) { |
|
20 | - $ticket_description = "<p>{$ticket_description}</p>"; |
|
21 | - } |
|
15 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
16 | + $ticket_description .= ! empty($ticket_description) |
|
17 | + ? '<br />' . $ticket_status_display |
|
18 | + : $ticket_status_display; |
|
19 | + if (strpos($ticket_description, '<div') === false) { |
|
20 | + $ticket_description = "<p>{$ticket_description}</p>"; |
|
21 | + } |
|
22 | 22 | ?> |
23 | 23 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
24 | 24 | <div class="no-tkt-slctr-ticket-content-dv"> |
@@ -28,5 +28,5 @@ discard block |
||
28 | 28 | <?php } ?> |
29 | 29 | </div><!-- .no-tkt-slctr-ticket-content-dv --> |
30 | 30 | <?php |
31 | - do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
31 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
32 | 32 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | if ($ticket instanceof EE_Ticket) { |
15 | 15 | do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
16 | 16 | $ticket_description .= ! empty($ticket_description) |
17 | - ? '<br />' . $ticket_status_display |
|
17 | + ? '<br />'.$ticket_status_display |
|
18 | 18 | : $ticket_status_display; |
19 | 19 | if (strpos($ticket_description, '<div') === false) { |
20 | 20 | $ticket_description = "<p>{$ticket_description}</p>"; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
24 | 24 | <div class="no-tkt-slctr-ticket-content-dv"> |
25 | 25 | <h5><?php echo $ticket->name(); ?></h5> |
26 | - <?php if (! empty($ticket_description)) { ?> |
|
26 | + <?php if ( ! empty($ticket_description)) { ?> |
|
27 | 27 | <?php echo $ticket_description; ?> |
28 | 28 | <?php } ?> |
29 | 29 | </div><!-- .no-tkt-slctr-ticket-content-dv --> |
@@ -22,32 +22,32 @@ discard block |
||
22 | 22 | <p><?php echo $ticket->description(); ?></p> |
23 | 23 | |
24 | 24 | <?php |
25 | - do_action( |
|
26 | - 'AHEE__ticket_selector_chart_template__ticket_details__after_description', |
|
27 | - $ticket, |
|
28 | - $ticket_price, |
|
29 | - $display_ticket_price |
|
30 | - ); |
|
31 | - ?> |
|
25 | + do_action( |
|
26 | + 'AHEE__ticket_selector_chart_template__ticket_details__after_description', |
|
27 | + $ticket, |
|
28 | + $ticket_price, |
|
29 | + $display_ticket_price |
|
30 | + ); |
|
31 | + ?> |
|
32 | 32 | |
33 | 33 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
34 | 34 | <h5> |
35 | 35 | <?php echo apply_filters( |
36 | - 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', |
|
37 | - esc_html__('Sale Dates', 'event_espresso') |
|
38 | - ); ?> |
|
36 | + 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', |
|
37 | + esc_html__('Sale Dates', 'event_espresso') |
|
38 | + ); ?> |
|
39 | 39 | </h5> |
40 | 40 | <span class="drk-grey-text small-text no-bold"> - |
41 | 41 | <?php echo apply_filters( |
42 | - 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', |
|
43 | - esc_html__('The dates when this option is available for purchase.', 'event_espresso') |
|
44 | - ); ?></span> |
|
42 | + 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', |
|
43 | + esc_html__('The dates when this option is available for purchase.', 'event_espresso') |
|
44 | + ); ?></span> |
|
45 | 45 | <br/> |
46 | 46 | <span class="ticket-details-label-spn drk-grey-text"> |
47 | 47 | <?php echo apply_filters( |
48 | - 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', |
|
49 | - esc_html__('Goes On Sale:', 'event_espresso') |
|
50 | - ); ?></span> |
|
48 | + 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', |
|
49 | + esc_html__('Goes On Sale:', 'event_espresso') |
|
50 | + ); ?></span> |
|
51 | 51 | <span class="dashicons dashicons-calendar"></span> |
52 | 52 | <?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format) . ' '; ?> |
53 | 53 | <span class="dashicons dashicons-clock"></span> |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | <br/> |
56 | 56 | <span class="ticket-details-label-spn drk-grey-text"> |
57 | 57 | <?php echo apply_filters( |
58 | - 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', |
|
59 | - esc_html__('Sales End:', 'event_espresso') |
|
60 | - ); ?></span> |
|
58 | + 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', |
|
59 | + esc_html__('Sales End:', 'event_espresso') |
|
60 | + ); ?></span> |
|
61 | 61 | <span class="dashicons dashicons-calendar"></span> |
62 | 62 | <?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format) . ' '; ?> |
63 | 63 | <span class="dashicons dashicons-clock"></span> |
@@ -72,46 +72,46 @@ discard block |
||
72 | 72 | <section class="tckt-slctr-tkt-quantities-sctn"> |
73 | 73 | <h5> |
74 | 74 | <?php echo apply_filters( |
75 | - 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', |
|
76 | - esc_html__('Purchasable Quantities', 'event_espresso') |
|
77 | - ); ?></h5> |
|
75 | + 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', |
|
76 | + esc_html__('Purchasable Quantities', 'event_espresso') |
|
77 | + ); ?></h5> |
|
78 | 78 | <span class="drk-grey-text small-text no-bold"> - |
79 | 79 | <?php echo apply_filters( |
80 | - 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', |
|
81 | - esc_html__( |
|
82 | - 'The number of tickets that can be purchased per transaction (if available).', |
|
83 | - 'event_espresso' |
|
84 | - ) |
|
85 | - ); ?></span><br/> |
|
80 | + 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', |
|
81 | + esc_html__( |
|
82 | + 'The number of tickets that can be purchased per transaction (if available).', |
|
83 | + 'event_espresso' |
|
84 | + ) |
|
85 | + ); ?></span><br/> |
|
86 | 86 | <span class="ticket-details-label-spn drk-grey-text"> |
87 | 87 | <?php echo apply_filters( |
88 | - 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', |
|
89 | - esc_html__('Minimum Qty:', 'event_espresso') |
|
90 | - ); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
88 | + 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', |
|
89 | + esc_html__('Minimum Qty:', 'event_espresso') |
|
90 | + ); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
91 | 91 | <?php |
92 | - if ($ticket->min() > $remaining) { |
|
93 | - ?> <span |
|
92 | + if ($ticket->min() > $remaining) { |
|
93 | + ?> <span |
|
94 | 94 | class="important-notice small-text"> |
95 | 95 | <?php echo apply_filters( |
96 | - 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', |
|
97 | - esc_html__( |
|
98 | - 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', |
|
99 | - 'event_espresso' |
|
100 | - ) |
|
101 | - ); ?></span> |
|
96 | + 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', |
|
97 | + esc_html__( |
|
98 | + 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', |
|
99 | + 'event_espresso' |
|
100 | + ) |
|
101 | + ); ?></span> |
|
102 | 102 | <?php |
103 | - } ?><br/> |
|
103 | + } ?><br/> |
|
104 | 104 | <?php // $max = min( $max, $max_atndz );?> |
105 | 105 | <span class="ticket-details-label-spn drk-grey-text"> |
106 | 106 | <?php echo apply_filters( |
107 | - 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', |
|
108 | - esc_html__('Maximum Qty:', 'event_espresso') |
|
109 | - ); ?></span> |
|
107 | + 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', |
|
108 | + esc_html__('Maximum Qty:', 'event_espresso') |
|
109 | + ); ?></span> |
|
110 | 110 | <?php echo $ticket->max() === EE_INF ? esc_html__( |
111 | - 'no limit', |
|
112 | - 'event_espresso' |
|
113 | - ) |
|
114 | - : max($ticket->max(), 1); ?><br/> |
|
111 | + 'no limit', |
|
112 | + 'event_espresso' |
|
113 | + ) |
|
114 | + : max($ticket->max(), 1); ?><br/> |
|
115 | 115 | </section> |
116 | 116 | <br/> |
117 | 117 | <?php } ?> |
@@ -120,50 +120,50 @@ discard block |
||
120 | 120 | <section class="tckt-slctr-tkt-uses-sctn"> |
121 | 121 | <h5> |
122 | 122 | <?php echo apply_filters( |
123 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', |
|
124 | - esc_html__('Event Date Ticket Uses', 'event_espresso') |
|
125 | - ); ?></h5> |
|
123 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', |
|
124 | + esc_html__('Event Date Ticket Uses', 'event_espresso') |
|
125 | + ); ?></h5> |
|
126 | 126 | <span class="drk-grey-text small-text no-bold"> - |
127 | 127 | <?php |
128 | - echo apply_filters( |
|
129 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
|
130 | - sprintf( |
|
131 | - esc_html__( |
|
132 | - 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', |
|
133 | - 'event_espresso' |
|
134 | - ), |
|
135 | - '<br/>', |
|
136 | - '<strong>', |
|
137 | - '</strong>' |
|
138 | - ) |
|
139 | - ); |
|
140 | - ?></span><br/> |
|
128 | + echo apply_filters( |
|
129 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
|
130 | + sprintf( |
|
131 | + esc_html__( |
|
132 | + 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', |
|
133 | + 'event_espresso' |
|
134 | + ), |
|
135 | + '<br/>', |
|
136 | + '<strong>', |
|
137 | + '</strong>' |
|
138 | + ) |
|
139 | + ); |
|
140 | + ?></span><br/> |
|
141 | 141 | <span class="ticket-details-label-spn drk-grey-text"> |
142 | 142 | <?php echo apply_filters( |
143 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', |
|
144 | - esc_html__('# Datetimes:', 'event_espresso') |
|
145 | - ); ?></span><?php echo $ticket->uses(); ?><br/> |
|
143 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', |
|
144 | + esc_html__('# Datetimes:', 'event_espresso') |
|
145 | + ); ?></span><?php echo $ticket->uses(); ?><br/> |
|
146 | 146 | </section> |
147 | 147 | <?php } ?> |
148 | 148 | |
149 | 149 | <?php |
150 | - $datetimes = $ticket->datetimes_ordered($event_is_expired, false); |
|
151 | - $chart_column_width = $show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
|
152 | - if (! empty($datetimes)) { ?> |
|
150 | + $datetimes = $ticket->datetimes_ordered($event_is_expired, false); |
|
151 | + $chart_column_width = $show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
|
152 | + if (! empty($datetimes)) { ?> |
|
153 | 153 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
154 | 154 | <h5> |
155 | 155 | <?php echo apply_filters( |
156 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', |
|
157 | - esc_html__('Access', 'event_espresso') |
|
158 | - ); ?></h5> |
|
156 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', |
|
157 | + esc_html__('Access', 'event_espresso') |
|
158 | + ); ?></h5> |
|
159 | 159 | <span class="drk-grey-text small-text no-bold"> - |
160 | 160 | <?php echo apply_filters( |
161 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', |
|
162 | - esc_html__( |
|
163 | - 'This option allows access to the following dates and times.', |
|
164 | - 'event_espresso' |
|
165 | - ) |
|
166 | - ); ?></span> |
|
161 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', |
|
162 | + esc_html__( |
|
163 | + 'This option allows access to the following dates and times.', |
|
164 | + 'event_espresso' |
|
165 | + ) |
|
166 | + ); ?></span> |
|
167 | 167 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
168 | 168 | <table class="tckt-slctr-tkt-details-tbl"> |
169 | 169 | <thead> |
@@ -172,122 +172,122 @@ discard block |
||
172 | 172 | <span class="dashicons dashicons-calendar"></span><span |
173 | 173 | class="small-text"> |
174 | 174 | <?php echo apply_filters( |
175 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', |
|
176 | - esc_html__('Date ', 'event_espresso') |
|
177 | - ); ?></span> |
|
175 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', |
|
176 | + esc_html__('Date ', 'event_espresso') |
|
177 | + ); ?></span> |
|
178 | 178 | </th> |
179 | 179 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
180 | 180 | <span class="dashicons dashicons-clock"></span><span |
181 | 181 | class="small-text"> |
182 | 182 | <?php esc_html_e( |
183 | - 'Time ', |
|
184 | - 'event_espresso' |
|
185 | - ); ?></span> |
|
183 | + 'Time ', |
|
184 | + 'event_espresso' |
|
185 | + ); ?></span> |
|
186 | 186 | </th> |
187 | 187 | <?php if ($show_ticket_sale_columns) : ?> |
188 | 188 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
189 | 189 | <span class="smaller-text"> |
190 | 190 | <?php echo apply_filters( |
191 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', |
|
192 | - sprintf(esc_html__('Sold', 'event_espresso'), '<br/>') |
|
193 | - ); ?></span> |
|
191 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', |
|
192 | + sprintf(esc_html__('Sold', 'event_espresso'), '<br/>') |
|
193 | + ); ?></span> |
|
194 | 194 | </th> |
195 | 195 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
196 | 196 | <span class="smaller-text"> |
197 | 197 | <?php echo apply_filters( |
198 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', |
|
199 | - sprintf(esc_html__('Remaining', 'event_espresso'), '<br/>') |
|
200 | - ); ?></span> |
|
198 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', |
|
199 | + sprintf(esc_html__('Remaining', 'event_espresso'), '<br/>') |
|
200 | + ); ?></span> |
|
201 | 201 | </th> |
202 | 202 | <th |
203 | 203 | class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
204 | 204 | <span class="smaller-text"> |
205 | 205 | <?php echo apply_filters( |
206 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', |
|
207 | - sprintf(esc_html__('Total%sSold', 'event_espresso'), '<br/>') |
|
208 | - ); ?></span> |
|
206 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', |
|
207 | + sprintf(esc_html__('Total%sSold', 'event_espresso'), '<br/>') |
|
208 | + ); ?></span> |
|
209 | 209 | </th> |
210 | 210 | <th |
211 | 211 | class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
212 | 212 | <span class="smaller-text"> |
213 | 213 | <?php echo apply_filters( |
214 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', |
|
215 | - sprintf(esc_html__('Total Spaces%sLeft', 'event_espresso'), '<br/>') |
|
216 | - ); ?></span> |
|
214 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', |
|
215 | + sprintf(esc_html__('Total Spaces%sLeft', 'event_espresso'), '<br/>') |
|
216 | + ); ?></span> |
|
217 | 217 | </th> |
218 | 218 | <?php endif; // end $show_ticket_sale_columns conditional ?> |
219 | 219 | </tr> |
220 | 220 | </thead> |
221 | 221 | <tbody> |
222 | 222 | <?php |
223 | - foreach ($datetimes as $datetime) { |
|
224 | - if ($datetime instanceof EE_Datetime) { |
|
225 | - ?> |
|
223 | + foreach ($datetimes as $datetime) { |
|
224 | + if ($datetime instanceof EE_Datetime) { |
|
225 | + ?> |
|
226 | 226 | |
227 | 227 | <tr> |
228 | 228 | <td data-th="<?php |
229 | - echo apply_filters( |
|
230 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', |
|
231 | - esc_html__('Event Date ', 'event_espresso') |
|
232 | - ); ?>" class="small-text"> |
|
229 | + echo apply_filters( |
|
230 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', |
|
231 | + esc_html__('Event Date ', 'event_espresso') |
|
232 | + ); ?>" class="small-text"> |
|
233 | 233 | <?php $datetime_name = $datetime->name(); ?> |
234 | 234 | <?php echo ! empty($datetime_name) ? '<b>' |
235 | - . $datetime_name |
|
236 | - . '</b><br/>' : ''; ?> |
|
235 | + . $datetime_name |
|
236 | + . '</b><br/>' : ''; ?> |
|
237 | 237 | <?php echo $datetime->date_range( |
238 | - $date_format, |
|
239 | - esc_html__(' to ', 'event_espresso') |
|
240 | - ); ?> |
|
238 | + $date_format, |
|
239 | + esc_html__(' to ', 'event_espresso') |
|
240 | + ); ?> |
|
241 | 241 | </td> |
242 | 242 | <td data-th="<?php esc_html_e('Time ', 'event_espresso'); ?>" |
243 | 243 | class="cntr small-text"> |
244 | 244 | <?php echo $datetime->time_range( |
245 | - $time_format, |
|
246 | - esc_html__(' to ', 'event_espresso') |
|
247 | - ); ?> |
|
245 | + $time_format, |
|
246 | + esc_html__(' to ', 'event_espresso') |
|
247 | + ); ?> |
|
248 | 248 | </td> |
249 | 249 | <?php if ($show_ticket_sale_columns) : ?> |
250 | 250 | <td data-th="<?php |
251 | - echo apply_filters( |
|
252 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', |
|
253 | - esc_html__('Sold', 'event_espresso') |
|
254 | - ); ?>" class="cntr small-text"> |
|
251 | + echo apply_filters( |
|
252 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', |
|
253 | + esc_html__('Sold', 'event_espresso') |
|
254 | + ); ?>" class="cntr small-text"> |
|
255 | 255 | <?php echo $ticket->sold(); ?> |
256 | 256 | </td> |
257 | 257 | <td data-th="<?php |
258 | - echo apply_filters( |
|
259 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', |
|
260 | - esc_html__('Remaining', 'event_espresso') |
|
261 | - ); ?>" class="cntr small-text"> |
|
258 | + echo apply_filters( |
|
259 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', |
|
260 | + esc_html__('Remaining', 'event_espresso') |
|
261 | + ); ?>" class="cntr small-text"> |
|
262 | 262 | <?php echo $remaining === EE_INF |
263 | - ? '<span class="smaller-text">' . esc_html__( |
|
264 | - 'unlimited ', |
|
265 | - 'event_espresso' |
|
266 | - ) . '</span>' : $remaining; ?> |
|
263 | + ? '<span class="smaller-text">' . esc_html__( |
|
264 | + 'unlimited ', |
|
265 | + 'event_espresso' |
|
266 | + ) . '</span>' : $remaining; ?> |
|
267 | 267 | </td> |
268 | 268 | <td data-th="<?php |
269 | - echo apply_filters( |
|
270 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', |
|
271 | - esc_html__('Total Sold', 'event_espresso') |
|
272 | - ); ?>" class="cntr small-text"> |
|
269 | + echo apply_filters( |
|
270 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', |
|
271 | + esc_html__('Total Sold', 'event_espresso') |
|
272 | + ); ?>" class="cntr small-text"> |
|
273 | 273 | <?php echo $datetime->sold(); ?> |
274 | 274 | </td> |
275 | 275 | <?php $tkts_left = $datetime->sold_out() |
276 | - ? '<span class="sold-out smaller-text">' . esc_html__( |
|
277 | - 'Sold Out', |
|
278 | - 'event_espresso' |
|
279 | - ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
276 | + ? '<span class="sold-out smaller-text">' . esc_html__( |
|
277 | + 'Sold Out', |
|
278 | + 'event_espresso' |
|
279 | + ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
280 | 280 | <td data-th="<?php |
281 | - echo apply_filters( |
|
282 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', |
|
283 | - esc_html__('Total Spaces Left', 'event_espresso') |
|
284 | - ); ?>" class="cntr small-text"> |
|
281 | + echo apply_filters( |
|
282 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', |
|
283 | + esc_html__('Total Spaces Left', 'event_espresso') |
|
284 | + ); ?>" class="cntr small-text"> |
|
285 | 285 | <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' |
286 | - . esc_html__( |
|
287 | - 'unlimited ', |
|
288 | - 'event_espresso' |
|
289 | - ) |
|
290 | - . '</span>' : $tkts_left; ?> |
|
286 | + . esc_html__( |
|
287 | + 'unlimited ', |
|
288 | + 'event_espresso' |
|
289 | + ) |
|
290 | + . '</span>' : $tkts_left; ?> |
|
291 | 291 | </td> |
292 | 292 | <?php endif; // end $show_ticket_sale_columns conditional ?> |
293 | 293 | </tr> |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | esc_html__('Goes On Sale:', 'event_espresso') |
50 | 50 | ); ?></span> |
51 | 51 | <span class="dashicons dashicons-calendar"></span> |
52 | - <?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format) . ' '; ?> |
|
52 | + <?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' '; ?> |
|
53 | 53 | <span class="dashicons dashicons-clock"></span> |
54 | 54 | <?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?> |
55 | 55 | <br/> |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | esc_html__('Sales End:', 'event_espresso') |
60 | 60 | ); ?></span> |
61 | 61 | <span class="dashicons dashicons-calendar"></span> |
62 | - <?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format) . ' '; ?> |
|
62 | + <?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' '; ?> |
|
63 | 63 | <span class="dashicons dashicons-clock"></span> |
64 | 64 | <?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?> |
65 | 65 | <br/> |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | <br/> |
117 | 117 | <?php } ?> |
118 | 118 | |
119 | - <?php if ((! defined('EE_DECAF') || EE_DECAF !== true) && $ticket->uses() !== EE_INF) { ?> |
|
119 | + <?php if (( ! defined('EE_DECAF') || EE_DECAF !== true) && $ticket->uses() !== EE_INF) { ?> |
|
120 | 120 | <section class="tckt-slctr-tkt-uses-sctn"> |
121 | 121 | <h5> |
122 | 122 | <?php echo apply_filters( |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | <?php |
150 | 150 | $datetimes = $ticket->datetimes_ordered($event_is_expired, false); |
151 | 151 | $chart_column_width = $show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
152 | - if (! empty($datetimes)) { ?> |
|
152 | + if ( ! empty($datetimes)) { ?> |
|
153 | 153 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
154 | 154 | <h5> |
155 | 155 | <?php echo apply_filters( |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | esc_html__('Remaining', 'event_espresso') |
261 | 261 | ); ?>" class="cntr small-text"> |
262 | 262 | <?php echo $remaining === EE_INF |
263 | - ? '<span class="smaller-text">' . esc_html__( |
|
263 | + ? '<span class="smaller-text">'.esc_html__( |
|
264 | 264 | 'unlimited ', |
265 | 265 | 'event_espresso' |
266 | - ) . '</span>' : $remaining; ?> |
|
266 | + ).'</span>' : $remaining; ?> |
|
267 | 267 | </td> |
268 | 268 | <td data-th="<?php |
269 | 269 | echo apply_filters( |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | <?php echo $datetime->sold(); ?> |
274 | 274 | </td> |
275 | 275 | <?php $tkts_left = $datetime->sold_out() |
276 | - ? '<span class="sold-out smaller-text">' . esc_html__( |
|
276 | + ? '<span class="sold-out smaller-text">'.esc_html__( |
|
277 | 277 | 'Sold Out', |
278 | 278 | 'event_espresso' |
279 | - ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
279 | + ).'</span>' : $datetime->spaces_remaining(); ?> |
|
280 | 280 | <td data-th="<?php |
281 | 281 | echo apply_filters( |
282 | 282 | 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', |
@@ -305,4 +305,4 @@ discard block |
||
305 | 305 | </div> |
306 | 306 | </td> |
307 | 307 | </tr> |
308 | -<?php endif; // end template_settings->show_ticket_details check |
|
308 | +<?php endif; // end template_settings->show_ticket_details check |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | </thead> |
66 | 66 | <tbody> |
67 | 67 | <?php |
68 | - /** |
|
69 | - * Recursive function for traversing all the sub-items of each line item |
|
70 | - * and displaying them in the table |
|
71 | - * |
|
72 | - * @param EE_Line_Item $line_item |
|
73 | - * @param boolean $odd for indicating whether to style this line item as an 'odd' or 'even' |
|
74 | - */ |
|
75 | - function ee_invoice_display_line_item(EE_Line_Item $line_item, $show_line_item_description, $odd = false) |
|
76 | - { |
|
77 | - switch ($line_item->type()) { |
|
78 | - case EEM_Line_Item::type_total: |
|
79 | - foreach ($line_item->children() as $child_line_item) { |
|
80 | - ee_invoice_display_line_item($child_line_item, $show_line_item_description); |
|
81 | - } ?> |
|
68 | + /** |
|
69 | + * Recursive function for traversing all the sub-items of each line item |
|
70 | + * and displaying them in the table |
|
71 | + * |
|
72 | + * @param EE_Line_Item $line_item |
|
73 | + * @param boolean $odd for indicating whether to style this line item as an 'odd' or 'even' |
|
74 | + */ |
|
75 | + function ee_invoice_display_line_item(EE_Line_Item $line_item, $show_line_item_description, $odd = false) |
|
76 | + { |
|
77 | + switch ($line_item->type()) { |
|
78 | + case EEM_Line_Item::type_total: |
|
79 | + foreach ($line_item->children() as $child_line_item) { |
|
80 | + ee_invoice_display_line_item($child_line_item, $show_line_item_description); |
|
81 | + } ?> |
|
82 | 82 | <tr> |
83 | 83 | <td colspan="<?php echo $show_line_item_description ? 5 : 4 ?>"> |
84 | 84 | <hr> |
@@ -90,50 +90,50 @@ discard block |
||
90 | 90 | <td class="total"><?php echo $line_item->total_no_code(); ?></td> |
91 | 91 | </tr> |
92 | 92 | <?php |
93 | - break; |
|
93 | + break; |
|
94 | 94 | |
95 | 95 | |
96 | - case EEM_Line_Item::type_sub_total: |
|
97 | - foreach ($line_item->children() as $child_line_item) { |
|
98 | - // $odd = !$odd; |
|
99 | - ee_invoice_display_line_item($child_line_item, $show_line_item_description, $odd); |
|
100 | - } ?> |
|
96 | + case EEM_Line_Item::type_sub_total: |
|
97 | + foreach ($line_item->children() as $child_line_item) { |
|
98 | + // $odd = !$odd; |
|
99 | + ee_invoice_display_line_item($child_line_item, $show_line_item_description, $odd); |
|
100 | + } ?> |
|
101 | 101 | <tr class="total_tr odd"> |
102 | 102 | <td colspan="<?php echo $show_line_item_description ? 2 : 1 ?>"> </td> |
103 | 103 | <td colspan="2" class="total" id="total_currency"> |
104 | 104 | <?php _e( |
105 | - 'Sub-Total', |
|
106 | - 'event_espresso' |
|
107 | - ); ?></td> |
|
105 | + 'Sub-Total', |
|
106 | + 'event_espresso' |
|
107 | + ); ?></td> |
|
108 | 108 | <td class="total"><?php echo $line_item->total_no_code(); ?></td> |
109 | 109 | </tr> |
110 | 110 | <?php |
111 | - break; |
|
111 | + break; |
|
112 | 112 | |
113 | 113 | |
114 | - case EEM_Line_Item::type_tax_sub_total: |
|
115 | - foreach ($line_item->children() as $child_line_item) { |
|
116 | - $odd = ! $odd; |
|
117 | - ee_invoice_display_line_item($child_line_item, $show_line_item_description, $odd); |
|
118 | - } ?> |
|
114 | + case EEM_Line_Item::type_tax_sub_total: |
|
115 | + foreach ($line_item->children() as $child_line_item) { |
|
116 | + $odd = ! $odd; |
|
117 | + ee_invoice_display_line_item($child_line_item, $show_line_item_description, $odd); |
|
118 | + } ?> |
|
119 | 119 | <tr class="total_tr odd"> |
120 | 120 | <td colspan="<?php echo $show_line_item_description ? 2 : 1 ?>"> </td> |
121 | 121 | <td colspan="2" class="total" id="total_currency"> |
122 | 122 | <?php _e( |
123 | - 'Tax Total', |
|
124 | - 'event_espresso' |
|
125 | - ); ?></td> |
|
123 | + 'Tax Total', |
|
124 | + 'event_espresso' |
|
125 | + ); ?></td> |
|
126 | 126 | <td class="total"><?php echo $line_item->total_no_code(); ?></td> |
127 | 127 | </tr> |
128 | 128 | <?php |
129 | - break; |
|
129 | + break; |
|
130 | 130 | |
131 | 131 | |
132 | - case EEM_Line_Item::type_line_item: |
|
133 | - $subitems = $line_item->children(); |
|
134 | - $has_subitems = count($subitems) > 1; |
|
135 | - if ($has_subitems) { |
|
136 | - ?> |
|
132 | + case EEM_Line_Item::type_line_item: |
|
133 | + $subitems = $line_item->children(); |
|
134 | + $has_subitems = count($subitems) > 1; |
|
135 | + if ($has_subitems) { |
|
136 | + ?> |
|
137 | 137 | <tr class="item <?php echo $odd ? 'odd' : ''; ?>"> |
138 | 138 | <td class="item_l"><?php echo $line_item->name() ?></td> |
139 | 139 | <?php if ($show_line_item_description) { ?> |
@@ -144,18 +144,18 @@ discard block |
||
144 | 144 | <td class="item_c"><?php echo $line_item->unit_price_no_code() ?></td> |
145 | 145 | |
146 | 146 | <td class="item_r"> <?php echo $line_item->total_no_code(); |
147 | - echo $line_item->is_taxable() ? '*' : '' ?> </td> |
|
147 | + echo $line_item->is_taxable() ? '*' : '' ?> </td> |
|
148 | 148 | <?php // <td class="item_l"><?php $datetimes_strings = array(); foreach($datetimes as $datetime){ $datetimes_strings[]= $datetime->start_date_and_time();} echo implode(", ",$datetimes_strings); |
149 | - ?> |
|
149 | + ?> |
|
150 | 150 | </tr> |
151 | 151 | <?php |
152 | - if ($has_subitems) { |
|
153 | - foreach ($line_item->children() as $child_line_item) { |
|
154 | - ee_invoice_display_line_item($child_line_item, $show_line_item_description, $odd); |
|
155 | - } |
|
156 | - } |
|
157 | - } else {// no subitems - just show this line item |
|
158 | - ?> |
|
152 | + if ($has_subitems) { |
|
153 | + foreach ($line_item->children() as $child_line_item) { |
|
154 | + ee_invoice_display_line_item($child_line_item, $show_line_item_description, $odd); |
|
155 | + } |
|
156 | + } |
|
157 | + } else {// no subitems - just show this line item |
|
158 | + ?> |
|
159 | 159 | <tr class="item <?php echo $odd ? 'odd' : ''; ?>"> |
160 | 160 | <td class="item_l"><?php echo $line_item->name() ?></td> |
161 | 161 | <?php if ($show_line_item_description) { ?> |
@@ -164,15 +164,15 @@ discard block |
||
164 | 164 | <td class="item_l"><?php echo $line_item->quantity() ?></td> |
165 | 165 | <td class="item_c"><?php echo $line_item->unit_price_no_code() ?></td> |
166 | 166 | <td class="item_r"> <?php echo $line_item->total_no_code(); |
167 | - echo $line_item->is_taxable() ? '*' : '' ?> </td> |
|
167 | + echo $line_item->is_taxable() ? '*' : '' ?> </td> |
|
168 | 168 | <?php // <td class="item_l"><?php $datetimes_strings = array(); foreach($datetimes as $datetime){ $datetimes_strings[]= $datetime->start_date_and_time();} echo implode(", ",$datetimes_strings); |
169 | - ?> |
|
169 | + ?> |
|
170 | 170 | </tr> |
171 | 171 | <?php } |
172 | 172 | |
173 | - break; |
|
174 | - case EEM_Line_Item::type_sub_line_item: |
|
175 | - ?> |
|
173 | + break; |
|
174 | + case EEM_Line_Item::type_sub_line_item: |
|
175 | + ?> |
|
176 | 176 | <tr class="item subitem-row"> |
177 | 177 | <td class="item_l subitem"><?php echo $line_item->name(); ?></td> |
178 | 178 | <?php if ($show_line_item_description) { ?> |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | <td class="item_r"><?php echo $line_item->total_no_code(); ?></td> |
189 | 189 | </tr> |
190 | 190 | <?php |
191 | - break; |
|
192 | - case EEM_Line_Item::type_tax: |
|
193 | - ?> |
|
191 | + break; |
|
192 | + case EEM_Line_Item::type_tax: |
|
193 | + ?> |
|
194 | 194 | <tr class="item sub-item tax-total"> |
195 | 195 | <td class="item_l"><?php echo $line_item->name(); ?></td> |
196 | 196 | <?php if ($show_line_item_description) { ?> |
@@ -200,15 +200,15 @@ discard block |
||
200 | 200 | |
201 | 201 | <td class="item_r"><?php echo $line_item->total_no_code(); ?></td> |
202 | 202 | </tr><?php |
203 | - break; |
|
204 | - } |
|
205 | - } |
|
203 | + break; |
|
204 | + } |
|
205 | + } |
|
206 | 206 | |
207 | - $c = false; |
|
208 | - /* @var $transaction EE_Transaction */ |
|
209 | - $total_line_item = $transaction->total_line_item(); |
|
210 | - ee_invoice_display_line_item($total_line_item, $show_line_item_description); |
|
211 | - /* foreach($transaction->registrations() as $registration){ |
|
207 | + $c = false; |
|
208 | + /* @var $transaction EE_Transaction */ |
|
209 | + $total_line_item = $transaction->total_line_item(); |
|
210 | + ee_invoice_display_line_item($total_line_item, $show_line_item_description); |
|
211 | + /* foreach($transaction->registrations() as $registration){ |
|
212 | 212 | ?> |
213 | 213 | <tr class="item <?php echo ($c = !$c) ? ' odd' : ''; ?>"> |
214 | 214 | <td class="item_l">1</td> |
@@ -237,11 +237,11 @@ discard block |
||
237 | 237 | </thead> |
238 | 238 | <tbody> |
239 | 239 | <?php |
240 | - $c = false; |
|
241 | - if (! empty($payments)) { |
|
242 | - foreach ($payments as $payment) { |
|
243 | - /* @var $payment EE_Payment */ |
|
244 | - ?> |
|
240 | + $c = false; |
|
241 | + if (! empty($payments)) { |
|
242 | + foreach ($payments as $payment) { |
|
243 | + /* @var $payment EE_Payment */ |
|
244 | + ?> |
|
245 | 245 | <tr class='item <?php echo(($c = ! $c) ? ' odd' : '') ?>'> |
246 | 246 | <td><?php $payment->e('PAY_gateway') ?></td> |
247 | 247 | <td><?php echo $payment->timestamp('D M j, Y') ?></td> |
@@ -251,17 +251,17 @@ discard block |
||
251 | 251 | <td class='item_r'><?php echo EEH_Template::format_currency($payment->amount()); ?></td> |
252 | 252 | </tr> |
253 | 253 | <?php } |
254 | - } else { |
|
255 | - ?> |
|
254 | + } else { |
|
255 | + ?> |
|
256 | 256 | <tr class='item'> |
257 | 257 | <td class='aln-cntr' colspan=6> |
258 | 258 | <?php _e( |
259 | - "No approved payments have been received", |
|
260 | - 'event_espresso' |
|
261 | - ) ?></td> |
|
259 | + "No approved payments have been received", |
|
260 | + 'event_espresso' |
|
261 | + ) ?></td> |
|
262 | 262 | </tr> |
263 | 263 | <?php } |
264 | - ?> |
|
264 | + ?> |
|
265 | 265 | </tbody> |
266 | 266 | <tfoot> |
267 | 267 | <tr class='total_tr'> |
@@ -238,7 +238,7 @@ |
||
238 | 238 | <tbody> |
239 | 239 | <?php |
240 | 240 | $c = false; |
241 | - if (! empty($payments)) { |
|
241 | + if ( ! empty($payments)) { |
|
242 | 242 | foreach ($payments as $payment) { |
243 | 243 | /* @var $payment EE_Payment */ |
244 | 244 | ?> |
@@ -8,9 +8,9 @@ |
||
8 | 8 | <head> |
9 | 9 | <title>[organization]<?php __(' Invoice #', 'event_espresso'); ?>[registration_code] |
10 | 10 | <?php __( |
11 | - ' for ', |
|
12 | - 'event_espresso' |
|
13 | - ); ?>[name]</title> |
|
11 | + ' for ', |
|
12 | + 'event_espresso' |
|
13 | + ); ?>[name]</title> |
|
14 | 14 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
15 | 15 | <!-- Base Stylesheet do not change or remove --> |
16 | 16 | <link rel="stylesheet" type="text/css" href="[base_url]base.css" media="screen"/> |