1
|
|
|
<?php |
2
|
|
|
namespace EventEspresso\core\domain\entities\shortcodes; |
3
|
|
|
|
4
|
|
|
use EE_Registry; |
5
|
|
|
use EventEspresso\core\services\shortcodes\EspressoShortcode; |
6
|
|
|
|
7
|
|
|
defined('EVENT_ESPRESSO_VERSION') || exit; |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class EspressoTicketSelector |
13
|
|
|
* ESPRESSO_TICKET_SELECTOR shortcode |
14
|
|
|
* |
15
|
|
|
* @package Event Espresso |
16
|
|
|
* @author Brent Christensen |
17
|
|
|
* @since $VID:$ |
18
|
|
|
*/ |
19
|
|
|
class EspressoTicketSelector extends EspressoShortcode |
20
|
|
|
{ |
21
|
|
|
|
22
|
|
|
|
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* the actual shortcode tag that gets registered with WordPress |
26
|
|
|
* |
27
|
|
|
* @return string |
28
|
|
|
*/ |
29
|
|
|
public function getTag() |
30
|
|
|
{ |
31
|
|
|
return 'ESPRESSO_TICKET_SELECTOR'; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
|
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* the time in seconds to cache the results of the processShortcode() method |
38
|
|
|
* 0 means the processShortcode() results will NOT be cached at all |
39
|
|
|
* |
40
|
|
|
* @return int |
41
|
|
|
*/ |
42
|
|
|
public function cacheExpiration() |
43
|
|
|
{ |
44
|
|
|
return MINUTE_IN_SECONDS * 5; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* a place for adding any initialization code that needs to run prior to wp_header(). |
50
|
|
|
* this may be required for shortcodes that utilize a corresponding module, |
51
|
|
|
* and need to enqueue assets for that module |
52
|
|
|
* |
53
|
|
|
* @return void |
54
|
|
|
*/ |
55
|
|
|
public function initializeShortcode() |
56
|
|
|
{ |
57
|
|
|
add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
|
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* callback that runs when the shortcode is encountered in post content. |
64
|
|
|
* IMPORTANT !!! |
65
|
|
|
* remember that shortcode content should be RETURNED and NOT echoed out |
66
|
|
|
* |
67
|
|
|
* @param array $attributes |
68
|
|
|
* @return string |
69
|
|
|
*/ |
70
|
|
|
public function processShortcode($attributes = array()) |
71
|
|
|
{ |
72
|
|
|
extract($attributes, EXTR_OVERWRITE); |
73
|
|
|
$event_id = isset($event_id) ? $event_id : 0; |
74
|
|
|
$event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($event_id); |
75
|
|
|
ob_start(); |
76
|
|
|
do_action('AHEE_event_details_before_post', $event_id); |
77
|
|
|
espresso_ticket_selector($event); |
78
|
|
|
do_action('AHEE_event_details_after_post'); |
79
|
|
|
return ob_get_clean(); } |
80
|
|
|
} |
81
|
|
|
// End of file EspressoTicketSelector.php |
82
|
|
|
// Location: EventEspresso\core\domain\entities\shortcodes/EspressoTicketSelector.php |