@@ -13,142 +13,142 @@ |
||
13 | 13 | class EE_Receipt_message_type extends EE_message_type |
14 | 14 | { |
15 | 15 | |
16 | - public function __construct() |
|
17 | - { |
|
18 | - $this->name = 'receipt'; |
|
19 | - $this->description = __('The receipt message type is triggered via a url on the thank you page and via at url generated by the [RECEIPT_URL] shortcode.', 'event_espresso'); |
|
20 | - $this->label = array( |
|
21 | - 'singular' => __('receipt', 'event_espresso'), |
|
22 | - 'plural' => __('receipts', 'event_espresso') |
|
23 | - ); |
|
24 | - $this->_master_templates = array(); |
|
25 | - parent::__construct(); |
|
26 | - } |
|
16 | + public function __construct() |
|
17 | + { |
|
18 | + $this->name = 'receipt'; |
|
19 | + $this->description = __('The receipt message type is triggered via a url on the thank you page and via at url generated by the [RECEIPT_URL] shortcode.', 'event_espresso'); |
|
20 | + $this->label = array( |
|
21 | + 'singular' => __('receipt', 'event_espresso'), |
|
22 | + 'plural' => __('receipts', 'event_espresso') |
|
23 | + ); |
|
24 | + $this->_master_templates = array(); |
|
25 | + parent::__construct(); |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @see parent::get_priority() for documentation. |
|
32 | - * @return int |
|
33 | - */ |
|
34 | - public function get_priority() |
|
35 | - { |
|
36 | - return EEM_Message::priority_high; |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - |
|
41 | - /** |
|
42 | - * This method returns whether this message type should always generate a new copy |
|
43 | - * when requested, or if links can be to the already generated copy. |
|
44 | - * Note: this does NOT affect viewing/resending already generated messages in the EE_Message list table. |
|
45 | - * Receipts always generate |
|
46 | - * @return bool false means can link to generated EE_Message. true must regenerate. |
|
47 | - */ |
|
48 | - public function always_generate() |
|
49 | - { |
|
50 | - return true; |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - protected function _set_admin_pages() |
|
55 | - { |
|
56 | - $this->admin_registered_pages = array( 'events_edit' => true ); |
|
57 | - } |
|
58 | - |
|
59 | - |
|
60 | - |
|
61 | - protected function _set_data_handler() |
|
62 | - { |
|
63 | - $this->_data_handler = 'Gateways'; |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - |
|
68 | - protected function _set_with_messengers() |
|
69 | - { |
|
70 | - $this->_with_messengers = array( |
|
71 | - 'html' => array( 'pdf' ) |
|
72 | - ); |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - |
|
77 | - protected function _get_data_for_context($context, EE_Registration $registration, $id) |
|
78 | - { |
|
79 | - // receipt message type data handler is 'Gateways' and it expects a transaction object. |
|
80 | - $transaction = $registration->transaction(); |
|
81 | - if ($transaction instanceof EE_Transaction) { |
|
82 | - return array( $transaction ); |
|
83 | - } |
|
84 | - return array(); |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - |
|
89 | - protected function _set_admin_settings_fields() |
|
90 | - { |
|
91 | - $this->_admin_settings_fields = array(); |
|
92 | - } |
|
93 | - |
|
94 | - |
|
95 | - |
|
96 | - protected function _set_contexts() |
|
97 | - { |
|
98 | - $this->_context_label = array( |
|
99 | - 'label' => __('recipient', 'event_espresso'), |
|
100 | - 'plural' => __('recipients', 'event_espresso'), |
|
101 | - 'description' => __('Recipient\'s are who will view the receipt.', 'event_espresso') |
|
102 | - ); |
|
103 | - |
|
104 | - $this->_contexts = array( |
|
105 | - 'purchaser' => array( |
|
106 | - 'label' => __('Purchaser', 'event_espresso'), |
|
107 | - 'description' => __('This template goes to the person who conducted the transaction.', 'event_espresso') |
|
108 | - ) |
|
109 | - ); |
|
110 | - } |
|
111 | - |
|
112 | - |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * used to set the valid shortcodes for the receipt message type |
|
117 | - * |
|
118 | - * @since 4.5.0 |
|
119 | - * |
|
120 | - * @return void |
|
121 | - */ |
|
122 | - protected function _set_valid_shortcodes() |
|
123 | - { |
|
124 | - $this->_valid_shortcodes['purchaser'] = array( |
|
125 | - 'attendee_list', |
|
126 | - 'attendee', |
|
127 | - 'datetime_list', |
|
128 | - 'datetime', |
|
129 | - 'event_list', |
|
130 | - 'event', |
|
131 | - 'event_meta', |
|
132 | - 'messenger', |
|
133 | - 'organization', |
|
134 | - 'primary_registration_list', |
|
135 | - 'primary_registration_details', |
|
136 | - 'ticket_list', |
|
137 | - 'ticket', |
|
138 | - 'transaction', |
|
139 | - 'venue', |
|
140 | - 'line_item_list', |
|
141 | - 'payment_list', |
|
142 | - 'line_item', |
|
143 | - 'payment' |
|
144 | - ); |
|
145 | - } |
|
146 | - |
|
30 | + /** |
|
31 | + * @see parent::get_priority() for documentation. |
|
32 | + * @return int |
|
33 | + */ |
|
34 | + public function get_priority() |
|
35 | + { |
|
36 | + return EEM_Message::priority_high; |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + |
|
41 | + /** |
|
42 | + * This method returns whether this message type should always generate a new copy |
|
43 | + * when requested, or if links can be to the already generated copy. |
|
44 | + * Note: this does NOT affect viewing/resending already generated messages in the EE_Message list table. |
|
45 | + * Receipts always generate |
|
46 | + * @return bool false means can link to generated EE_Message. true must regenerate. |
|
47 | + */ |
|
48 | + public function always_generate() |
|
49 | + { |
|
50 | + return true; |
|
51 | + } |
|
52 | + |
|
53 | + |
|
54 | + protected function _set_admin_pages() |
|
55 | + { |
|
56 | + $this->admin_registered_pages = array( 'events_edit' => true ); |
|
57 | + } |
|
58 | + |
|
59 | + |
|
60 | + |
|
61 | + protected function _set_data_handler() |
|
62 | + { |
|
63 | + $this->_data_handler = 'Gateways'; |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + |
|
68 | + protected function _set_with_messengers() |
|
69 | + { |
|
70 | + $this->_with_messengers = array( |
|
71 | + 'html' => array( 'pdf' ) |
|
72 | + ); |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + |
|
77 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) |
|
78 | + { |
|
79 | + // receipt message type data handler is 'Gateways' and it expects a transaction object. |
|
80 | + $transaction = $registration->transaction(); |
|
81 | + if ($transaction instanceof EE_Transaction) { |
|
82 | + return array( $transaction ); |
|
83 | + } |
|
84 | + return array(); |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + |
|
89 | + protected function _set_admin_settings_fields() |
|
90 | + { |
|
91 | + $this->_admin_settings_fields = array(); |
|
92 | + } |
|
93 | + |
|
94 | + |
|
95 | + |
|
96 | + protected function _set_contexts() |
|
97 | + { |
|
98 | + $this->_context_label = array( |
|
99 | + 'label' => __('recipient', 'event_espresso'), |
|
100 | + 'plural' => __('recipients', 'event_espresso'), |
|
101 | + 'description' => __('Recipient\'s are who will view the receipt.', 'event_espresso') |
|
102 | + ); |
|
103 | + |
|
104 | + $this->_contexts = array( |
|
105 | + 'purchaser' => array( |
|
106 | + 'label' => __('Purchaser', 'event_espresso'), |
|
107 | + 'description' => __('This template goes to the person who conducted the transaction.', 'event_espresso') |
|
108 | + ) |
|
109 | + ); |
|
110 | + } |
|
111 | + |
|
112 | + |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * used to set the valid shortcodes for the receipt message type |
|
117 | + * |
|
118 | + * @since 4.5.0 |
|
119 | + * |
|
120 | + * @return void |
|
121 | + */ |
|
122 | + protected function _set_valid_shortcodes() |
|
123 | + { |
|
124 | + $this->_valid_shortcodes['purchaser'] = array( |
|
125 | + 'attendee_list', |
|
126 | + 'attendee', |
|
127 | + 'datetime_list', |
|
128 | + 'datetime', |
|
129 | + 'event_list', |
|
130 | + 'event', |
|
131 | + 'event_meta', |
|
132 | + 'messenger', |
|
133 | + 'organization', |
|
134 | + 'primary_registration_list', |
|
135 | + 'primary_registration_details', |
|
136 | + 'ticket_list', |
|
137 | + 'ticket', |
|
138 | + 'transaction', |
|
139 | + 'venue', |
|
140 | + 'line_item_list', |
|
141 | + 'payment_list', |
|
142 | + 'line_item', |
|
143 | + 'payment' |
|
144 | + ); |
|
145 | + } |
|
146 | + |
|
147 | 147 | |
148 | 148 | |
149 | 149 | |
150 | - protected function _purchaser_addressees() |
|
151 | - { |
|
152 | - return parent::_primary_attendee_addressees(); |
|
153 | - } |
|
150 | + protected function _purchaser_addressees() |
|
151 | + { |
|
152 | + return parent::_primary_attendee_addressees(); |
|
153 | + } |
|
154 | 154 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | protected function _set_admin_pages() |
55 | 55 | { |
56 | - $this->admin_registered_pages = array( 'events_edit' => true ); |
|
56 | + $this->admin_registered_pages = array('events_edit' => true); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | protected function _set_with_messengers() |
69 | 69 | { |
70 | 70 | $this->_with_messengers = array( |
71 | - 'html' => array( 'pdf' ) |
|
71 | + 'html' => array('pdf') |
|
72 | 72 | ); |
73 | 73 | } |
74 | 74 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | // receipt message type data handler is 'Gateways' and it expects a transaction object. |
80 | 80 | $transaction = $registration->transaction(); |
81 | 81 | if ($transaction instanceof EE_Transaction) { |
82 | - return array( $transaction ); |
|
82 | + return array($transaction); |
|
83 | 83 | } |
84 | 84 | return array(); |
85 | 85 | } |
@@ -14,59 +14,59 @@ |
||
14 | 14 | class EE_Pending_Approval_message_type extends EE_Registration_Base_message_type |
15 | 15 | { |
16 | 16 | |
17 | - public function __construct() |
|
18 | - { |
|
19 | - $this->name = 'pending_approval'; |
|
20 | - $this->description = __('This message type is used for recipients who have Pending Payment registration status.', 'event_espresso'); |
|
21 | - $this->label = array( |
|
22 | - 'singular' => __('registration pending payment', 'event_espresso'), |
|
23 | - 'plural' => __('registrations pending payment', 'event_espresso') |
|
24 | - ); |
|
17 | + public function __construct() |
|
18 | + { |
|
19 | + $this->name = 'pending_approval'; |
|
20 | + $this->description = __('This message type is used for recipients who have Pending Payment registration status.', 'event_espresso'); |
|
21 | + $this->label = array( |
|
22 | + 'singular' => __('registration pending payment', 'event_espresso'), |
|
23 | + 'plural' => __('registrations pending payment', 'event_espresso') |
|
24 | + ); |
|
25 | 25 | |
26 | - $this->_master_templates = array( |
|
27 | - 'email' => 'registration' |
|
28 | - ); |
|
26 | + $this->_master_templates = array( |
|
27 | + 'email' => 'registration' |
|
28 | + ); |
|
29 | 29 | |
30 | - parent::__construct(); |
|
31 | - } |
|
30 | + parent::__construct(); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * _set_contexts |
|
37 | - * This sets up the contexts associated with the message_type |
|
38 | - * |
|
39 | - * @access protected |
|
40 | - * @return void |
|
41 | - */ |
|
42 | - protected function _set_contexts() |
|
43 | - { |
|
44 | - $this->_context_label = array( |
|
45 | - 'label' => __('recipient', 'event_espresso'), |
|
46 | - 'plural' => __('recipients', 'event_espresso'), |
|
47 | - 'description' => __('Recipient\'s are who will receive the template. You may want different pending approval details sent out depending on who the recipient is. To "turn off" a recipient from receiving message, simply remove any content from the "to" field in the template.', 'event_espresso') |
|
48 | - ); |
|
35 | + /** |
|
36 | + * _set_contexts |
|
37 | + * This sets up the contexts associated with the message_type |
|
38 | + * |
|
39 | + * @access protected |
|
40 | + * @return void |
|
41 | + */ |
|
42 | + protected function _set_contexts() |
|
43 | + { |
|
44 | + $this->_context_label = array( |
|
45 | + 'label' => __('recipient', 'event_espresso'), |
|
46 | + 'plural' => __('recipients', 'event_espresso'), |
|
47 | + 'description' => __('Recipient\'s are who will receive the template. You may want different pending approval details sent out depending on who the recipient is. To "turn off" a recipient from receiving message, simply remove any content from the "to" field in the template.', 'event_espresso') |
|
48 | + ); |
|
49 | 49 | |
50 | - $this->_contexts = array( |
|
51 | - 'admin' => array( |
|
52 | - 'label' => __('Event Admin', 'event_espresso'), |
|
53 | - 'description' => __('This template is what event administrators will receive when a message is sent to registrants with the pending payment registration status.', 'event_espresso') |
|
54 | - ), |
|
55 | - 'primary_attendee' => array( |
|
56 | - 'label' => __('Primary Registrant', 'event_espresso'), |
|
57 | - 'description' => __('This template is what the primary registrant (the person who completed the initial transaction) will receive on when their registration status is pending payment.', 'event_espresso') |
|
58 | - ) |
|
59 | - ); |
|
60 | - } |
|
50 | + $this->_contexts = array( |
|
51 | + 'admin' => array( |
|
52 | + 'label' => __('Event Admin', 'event_espresso'), |
|
53 | + 'description' => __('This template is what event administrators will receive when a message is sent to registrants with the pending payment registration status.', 'event_espresso') |
|
54 | + ), |
|
55 | + 'primary_attendee' => array( |
|
56 | + 'label' => __('Primary Registrant', 'event_espresso'), |
|
57 | + 'description' => __('This template is what the primary registrant (the person who completed the initial transaction) will receive on when their registration status is pending payment.', 'event_espresso') |
|
58 | + ) |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | 63 | |
64 | - protected function _primary_attendee_addressees() |
|
65 | - { |
|
66 | - $cached = $this->_single_message; |
|
67 | - $this->_single_message = false; |
|
68 | - $addressees = parent::_primary_attendee_addressees(); |
|
69 | - $this->_single_message = $cached; |
|
70 | - return $addressees; |
|
71 | - } |
|
64 | + protected function _primary_attendee_addressees() |
|
65 | + { |
|
66 | + $cached = $this->_single_message; |
|
67 | + $this->_single_message = false; |
|
68 | + $addressees = parent::_primary_attendee_addressees(); |
|
69 | + $this->_single_message = $cached; |
|
70 | + return $addressees; |
|
71 | + } |
|
72 | 72 | } |
@@ -13,75 +13,75 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * Will hold an EE_Messages_Queue object |
|
18 | - * @type EE_Messages_Queue |
|
19 | - */ |
|
20 | - public $queue = array(); |
|
16 | + /** |
|
17 | + * Will hold an EE_Messages_Queue object |
|
18 | + * @type EE_Messages_Queue |
|
19 | + */ |
|
20 | + public $queue = array(); |
|
21 | 21 | |
22 | - /** |
|
23 | - * @param string $messenger_name The messenger being used to send the message |
|
24 | - * @param string $message_type_name The message type being used to grab variations etc. |
|
25 | - * @param EE_Messages_Queue $queue |
|
26 | - * @param string $custom_subject Used if a custom subject is desired for the generated aggregate EE_Message object |
|
27 | - */ |
|
28 | - public function __construct($messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '') |
|
29 | - { |
|
30 | - $this->queue = $queue; |
|
31 | - parent::__construct($messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle); |
|
32 | - if ($this->valid()) { |
|
33 | - $this->_message->set_content($this->_get_content()); |
|
34 | - $this->_message->set_subject($this->_get_subject($custom_subject)); |
|
35 | - } |
|
36 | - } |
|
22 | + /** |
|
23 | + * @param string $messenger_name The messenger being used to send the message |
|
24 | + * @param string $message_type_name The message type being used to grab variations etc. |
|
25 | + * @param EE_Messages_Queue $queue |
|
26 | + * @param string $custom_subject Used if a custom subject is desired for the generated aggregate EE_Message object |
|
27 | + */ |
|
28 | + public function __construct($messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '') |
|
29 | + { |
|
30 | + $this->queue = $queue; |
|
31 | + parent::__construct($messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle); |
|
32 | + if ($this->valid()) { |
|
33 | + $this->_message->set_content($this->_get_content()); |
|
34 | + $this->_message->set_subject($this->_get_subject($custom_subject)); |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | 39 | |
40 | - /** |
|
41 | - * Uses the EE_Messages_Queue currently set on this object to generate the content |
|
42 | - * for the single EE_Message aggregate object returned by get_EE_Message |
|
43 | - * @return string; |
|
44 | - */ |
|
45 | - protected function _get_content() |
|
46 | - { |
|
47 | - $content = ''; |
|
48 | - $this->queue->get_message_repository()->rewind(); |
|
49 | - while ($this->queue->get_message_repository()->valid()) { |
|
50 | - $content .= $this->queue->get_message_repository()->current()->content(); |
|
51 | - $this->queue->get_message_repository()->next(); |
|
52 | - } |
|
53 | - return $content; |
|
54 | - } |
|
40 | + /** |
|
41 | + * Uses the EE_Messages_Queue currently set on this object to generate the content |
|
42 | + * for the single EE_Message aggregate object returned by get_EE_Message |
|
43 | + * @return string; |
|
44 | + */ |
|
45 | + protected function _get_content() |
|
46 | + { |
|
47 | + $content = ''; |
|
48 | + $this->queue->get_message_repository()->rewind(); |
|
49 | + while ($this->queue->get_message_repository()->valid()) { |
|
50 | + $content .= $this->queue->get_message_repository()->current()->content(); |
|
51 | + $this->queue->get_message_repository()->next(); |
|
52 | + } |
|
53 | + return $content; |
|
54 | + } |
|
55 | 55 | |
56 | 56 | |
57 | - /** |
|
58 | - * Return a subject string to use for `MSG_Subject` in the aggregate EE_Message object. |
|
59 | - * @param string $custom_subject |
|
60 | - * |
|
61 | - * @return string |
|
62 | - */ |
|
63 | - protected function _get_subject($custom_subject = '') |
|
64 | - { |
|
65 | - if (! empty($custom_subject)) { |
|
66 | - return $custom_subject; |
|
67 | - } |
|
68 | - $this->queue->get_message_repository()->rewind(); |
|
69 | - $count_of_items = $this->queue->get_message_repository()->count(); |
|
57 | + /** |
|
58 | + * Return a subject string to use for `MSG_Subject` in the aggregate EE_Message object. |
|
59 | + * @param string $custom_subject |
|
60 | + * |
|
61 | + * @return string |
|
62 | + */ |
|
63 | + protected function _get_subject($custom_subject = '') |
|
64 | + { |
|
65 | + if (! empty($custom_subject)) { |
|
66 | + return $custom_subject; |
|
67 | + } |
|
68 | + $this->queue->get_message_repository()->rewind(); |
|
69 | + $count_of_items = $this->queue->get_message_repository()->count(); |
|
70 | 70 | |
71 | - // if $count of items in queue == 1, then let's just return the subject for that item. |
|
72 | - if ($count_of_items === 1) { |
|
73 | - return $this->queue->get_message_repository()->current()->subject(); |
|
74 | - } |
|
75 | - // phpcs:disable WordPress.WP.I18n.MissingSingularPlaceholder |
|
76 | - return sprintf( |
|
77 | - _n( |
|
78 | - 'Showing Aggregate output for 1 result', |
|
79 | - 'Showing Aggregate output for %d items', |
|
80 | - $count_of_items, |
|
81 | - 'event_espresso' |
|
82 | - ), |
|
83 | - $count_of_items |
|
84 | - ); |
|
85 | - // phpcs:enable |
|
86 | - } |
|
71 | + // if $count of items in queue == 1, then let's just return the subject for that item. |
|
72 | + if ($count_of_items === 1) { |
|
73 | + return $this->queue->get_message_repository()->current()->subject(); |
|
74 | + } |
|
75 | + // phpcs:disable WordPress.WP.I18n.MissingSingularPlaceholder |
|
76 | + return sprintf( |
|
77 | + _n( |
|
78 | + 'Showing Aggregate output for 1 result', |
|
79 | + 'Showing Aggregate output for %d items', |
|
80 | + $count_of_items, |
|
81 | + 'event_espresso' |
|
82 | + ), |
|
83 | + $count_of_items |
|
84 | + ); |
|
85 | + // phpcs:enable |
|
86 | + } |
|
87 | 87 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | */ |
63 | 63 | protected function _get_subject($custom_subject = '') |
64 | 64 | { |
65 | - if (! empty($custom_subject)) { |
|
65 | + if ( ! empty($custom_subject)) { |
|
66 | 66 | return $custom_subject; |
67 | 67 | } |
68 | 68 | $this->queue->get_message_repository()->rewind(); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | <?php echo $eei18n; ?> |
33 | 33 | </script> |
34 | 34 | <?php foreach ($header_js as $key => $url) :?> |
35 | - <?php $header_attributes = isset($header_js_attributes[ $key ]) ? $header_js_attributes[ $key ] : ''; ?> |
|
35 | + <?php $header_attributes = isset($header_js_attributes[$key]) ? $header_js_attributes[$key] : ''; ?> |
|
36 | 36 | <script type="text/javascript" src="<?php echo $url; ?>"<?php echo $header_attributes; ?>></script> |
37 | 37 | <?php endforeach; ?> |
38 | 38 | <?php endif; ?> |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | <?php echo $content; ?> |
44 | 44 | </div> |
45 | 45 | <?php foreach ($footer_js as $key => $url) : ?> |
46 | - <?php $footer_attributes = isset($footer_js_attributes[ $key ]) ? $footer_js_attributes[ $key ] : ''; ?> |
|
46 | + <?php $footer_attributes = isset($footer_js_attributes[$key]) ? $footer_js_attributes[$key] : ''; ?> |
|
47 | 47 | <script type="text/javascript" src="<?php echo $url; ?>"<?php echo $footer_attributes; ?>></script> |
48 | 48 | <?php endforeach; ?> |
49 | 49 | <?php if ($enqueue_wp_assets) : ?> |
@@ -24,9 +24,12 @@ |
||
24 | 24 | <title><?php echo $title; ?></title> |
25 | 25 | <?php if ($enqueue_wp_assets) : ?> |
26 | 26 | <?php wp_head(); ?> |
27 | - <?php else : ?> |
|
27 | + <?php else { |
|
28 | + : ?> |
|
28 | 29 | <?php foreach ($css as $url) :?> |
29 | - <link rel="stylesheet" type="text/css" href="<?php echo $url; ?>"> |
|
30 | + <link rel="stylesheet" type="text/css" href="<?php echo $url; |
|
31 | +} |
|
32 | +?>"> |
|
30 | 33 | <?php endforeach; ?> |
31 | 34 | <script type="text/javascript"> |
32 | 35 | <?php echo $eei18n; ?> |
@@ -21,180 +21,180 @@ |
||
21 | 21 | class EE_Ticket_List_Shortcodes extends EE_Shortcodes |
22 | 22 | { |
23 | 23 | |
24 | - public function __construct() |
|
25 | - { |
|
26 | - parent::__construct(); |
|
27 | - } |
|
28 | - |
|
29 | - |
|
30 | - protected function _init_props() |
|
31 | - { |
|
32 | - $this->label = __('Ticket List Shortcodes', 'event_espresso'); |
|
33 | - $this->description = __('All shortcodes specific to ticket lists', 'event_espresso'); |
|
34 | - $this->_shortcodes = array( |
|
35 | - '[TICKET_LIST]' => __('Will output a list of tickets', 'event_espresso'), |
|
36 | - ); |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - protected function _parser($shortcode) |
|
41 | - { |
|
42 | - switch ($shortcode) { |
|
43 | - case '[TICKET_LIST]': |
|
44 | - return $this->_get_ticket_list(); |
|
45 | - break; |
|
46 | - } |
|
47 | - return ''; |
|
48 | - } |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * figure out what the incoming data is and then return the appropriate parsed value. |
|
53 | - * |
|
54 | - * @return string |
|
55 | - */ |
|
56 | - private function _get_ticket_list() |
|
57 | - { |
|
58 | - $this->_validate_list_requirements(); |
|
59 | - |
|
60 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
61 | - return $this->_get_ticket_list_for_main(); |
|
62 | - } elseif ($this->_data['data'] instanceof EE_Registration) { |
|
63 | - return $this->_get_ticket_list_for_attendee(); |
|
64 | - } elseif ($this->_data['data'] instanceof EE_Event) { |
|
65 | - return $this->_get_ticket_list_for_event(); |
|
66 | - } // prevent recursive loop |
|
67 | - else { |
|
68 | - return ''; |
|
69 | - } |
|
70 | - } |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * This returns the parsed ticket list for main template; |
|
75 | - */ |
|
76 | - private function _get_ticket_list_for_main() |
|
77 | - { |
|
78 | - $valid_shortcodes = array( |
|
79 | - 'ticket', |
|
80 | - 'event_list', |
|
81 | - 'attendee_list', |
|
82 | - 'datetime_list', |
|
83 | - 'attendee', |
|
84 | - 'line_item_list', |
|
85 | - 'primary_registration_details', |
|
86 | - 'recipient_details', |
|
87 | - ); |
|
88 | - $template = $this->_data['template']; |
|
89 | - $data = $this->_data['data']; |
|
90 | - $tktparsed = ''; |
|
91 | - |
|
92 | - |
|
93 | - // now we need to loop through the ticket list and send data to the EE_Parser helper. |
|
94 | - foreach ($data->tickets as $ticket) { |
|
95 | - $tktparsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
96 | - $template, |
|
97 | - $ticket['ticket'], |
|
98 | - $valid_shortcodes, |
|
99 | - $this->_extra_data |
|
100 | - ); |
|
101 | - } |
|
102 | - |
|
103 | - return $tktparsed; |
|
104 | - } |
|
105 | - |
|
106 | - |
|
107 | - /** |
|
108 | - * return parsed list of tickets for an event |
|
109 | - * |
|
110 | - * @return string |
|
111 | - */ |
|
112 | - private function _get_ticket_list_for_event() |
|
113 | - { |
|
114 | - $valid_shortcodes = array( |
|
115 | - 'ticket', |
|
116 | - 'attendee_list', |
|
117 | - 'datetime_list', |
|
118 | - 'attendee', |
|
119 | - 'venue', |
|
120 | - 'line_item_list', |
|
121 | - 'primary_registration_details', |
|
122 | - 'recipient_details', |
|
123 | - ); |
|
124 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
125 | - ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
126 | - $event = $this->_data['data']; |
|
127 | - |
|
128 | - // let's remove any existing [EVENT_LIST] shortcodes from the ticket list template so that we don't get recursion. |
|
129 | - $template = str_replace('[EVENT_LIST]', '', $template); |
|
130 | - |
|
131 | - // here we're setting up the tickets for the ticket list template for THIS event. |
|
132 | - $tkt_parsed = ''; |
|
133 | - $tickets = $this->_get_tickets_from_event($event); |
|
134 | - |
|
135 | - // each ticket in this case should be an ticket object. |
|
136 | - foreach ($tickets as $ticket) { |
|
137 | - $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
138 | - $template, |
|
139 | - $ticket, |
|
140 | - $valid_shortcodes, |
|
141 | - $this->_extra_data |
|
142 | - ); |
|
143 | - } |
|
144 | - |
|
145 | - return $tkt_parsed; |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - /** |
|
150 | - * return parsed list of tickets for an attendee |
|
151 | - * |
|
152 | - * @return string |
|
153 | - */ |
|
154 | - private function _get_ticket_list_for_attendee() |
|
155 | - { |
|
156 | - $valid_shortcodes = array( |
|
157 | - 'ticket', |
|
158 | - 'event_list', |
|
159 | - 'datetime_list', |
|
160 | - 'attendee', |
|
161 | - 'primary_registration_details', |
|
162 | - 'recipient_details', |
|
163 | - ); |
|
164 | - |
|
165 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
166 | - ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
167 | - $registration = $this->_data['data']; |
|
168 | - |
|
169 | - // let's remove any existing [ATTENDEE_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
170 | - $template = str_replace('[ATTENDEE_LIST]', '', $template); |
|
171 | - |
|
172 | - // here we're setting up the tickets for the ticket list template for THIS attendee. |
|
173 | - $tkt_parsed = ''; |
|
174 | - $tickets = $this->_get_ticket_list_from_registration($registration); |
|
175 | - |
|
176 | - // each ticket in this case should be an ticket object. |
|
177 | - foreach ($tickets as $ticket) { |
|
178 | - $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
179 | - $template, |
|
180 | - $ticket, |
|
181 | - $valid_shortcodes, |
|
182 | - $this->_extra_data |
|
183 | - ); |
|
184 | - } |
|
185 | - |
|
186 | - return $tkt_parsed; |
|
187 | - } |
|
188 | - |
|
189 | - private function _get_tickets_from_event(EE_Event $event) |
|
190 | - { |
|
191 | - return isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[ $event->ID( |
|
192 | - ) ]['tkt_objs'] : array(); |
|
193 | - } |
|
194 | - |
|
195 | - private function _get_ticket_list_from_registration(EE_Registration $registration, $att = null) |
|
196 | - { |
|
197 | - return isset($this->_extra_data['data']->registrations) |
|
198 | - ? array($this->_extra_data['data']->registrations[ $registration->ID() ]['tkt_obj']) : array(); |
|
199 | - } |
|
24 | + public function __construct() |
|
25 | + { |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | + |
|
29 | + |
|
30 | + protected function _init_props() |
|
31 | + { |
|
32 | + $this->label = __('Ticket List Shortcodes', 'event_espresso'); |
|
33 | + $this->description = __('All shortcodes specific to ticket lists', 'event_espresso'); |
|
34 | + $this->_shortcodes = array( |
|
35 | + '[TICKET_LIST]' => __('Will output a list of tickets', 'event_espresso'), |
|
36 | + ); |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + protected function _parser($shortcode) |
|
41 | + { |
|
42 | + switch ($shortcode) { |
|
43 | + case '[TICKET_LIST]': |
|
44 | + return $this->_get_ticket_list(); |
|
45 | + break; |
|
46 | + } |
|
47 | + return ''; |
|
48 | + } |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * figure out what the incoming data is and then return the appropriate parsed value. |
|
53 | + * |
|
54 | + * @return string |
|
55 | + */ |
|
56 | + private function _get_ticket_list() |
|
57 | + { |
|
58 | + $this->_validate_list_requirements(); |
|
59 | + |
|
60 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
61 | + return $this->_get_ticket_list_for_main(); |
|
62 | + } elseif ($this->_data['data'] instanceof EE_Registration) { |
|
63 | + return $this->_get_ticket_list_for_attendee(); |
|
64 | + } elseif ($this->_data['data'] instanceof EE_Event) { |
|
65 | + return $this->_get_ticket_list_for_event(); |
|
66 | + } // prevent recursive loop |
|
67 | + else { |
|
68 | + return ''; |
|
69 | + } |
|
70 | + } |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * This returns the parsed ticket list for main template; |
|
75 | + */ |
|
76 | + private function _get_ticket_list_for_main() |
|
77 | + { |
|
78 | + $valid_shortcodes = array( |
|
79 | + 'ticket', |
|
80 | + 'event_list', |
|
81 | + 'attendee_list', |
|
82 | + 'datetime_list', |
|
83 | + 'attendee', |
|
84 | + 'line_item_list', |
|
85 | + 'primary_registration_details', |
|
86 | + 'recipient_details', |
|
87 | + ); |
|
88 | + $template = $this->_data['template']; |
|
89 | + $data = $this->_data['data']; |
|
90 | + $tktparsed = ''; |
|
91 | + |
|
92 | + |
|
93 | + // now we need to loop through the ticket list and send data to the EE_Parser helper. |
|
94 | + foreach ($data->tickets as $ticket) { |
|
95 | + $tktparsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
96 | + $template, |
|
97 | + $ticket['ticket'], |
|
98 | + $valid_shortcodes, |
|
99 | + $this->_extra_data |
|
100 | + ); |
|
101 | + } |
|
102 | + |
|
103 | + return $tktparsed; |
|
104 | + } |
|
105 | + |
|
106 | + |
|
107 | + /** |
|
108 | + * return parsed list of tickets for an event |
|
109 | + * |
|
110 | + * @return string |
|
111 | + */ |
|
112 | + private function _get_ticket_list_for_event() |
|
113 | + { |
|
114 | + $valid_shortcodes = array( |
|
115 | + 'ticket', |
|
116 | + 'attendee_list', |
|
117 | + 'datetime_list', |
|
118 | + 'attendee', |
|
119 | + 'venue', |
|
120 | + 'line_item_list', |
|
121 | + 'primary_registration_details', |
|
122 | + 'recipient_details', |
|
123 | + ); |
|
124 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
125 | + ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
126 | + $event = $this->_data['data']; |
|
127 | + |
|
128 | + // let's remove any existing [EVENT_LIST] shortcodes from the ticket list template so that we don't get recursion. |
|
129 | + $template = str_replace('[EVENT_LIST]', '', $template); |
|
130 | + |
|
131 | + // here we're setting up the tickets for the ticket list template for THIS event. |
|
132 | + $tkt_parsed = ''; |
|
133 | + $tickets = $this->_get_tickets_from_event($event); |
|
134 | + |
|
135 | + // each ticket in this case should be an ticket object. |
|
136 | + foreach ($tickets as $ticket) { |
|
137 | + $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
138 | + $template, |
|
139 | + $ticket, |
|
140 | + $valid_shortcodes, |
|
141 | + $this->_extra_data |
|
142 | + ); |
|
143 | + } |
|
144 | + |
|
145 | + return $tkt_parsed; |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + /** |
|
150 | + * return parsed list of tickets for an attendee |
|
151 | + * |
|
152 | + * @return string |
|
153 | + */ |
|
154 | + private function _get_ticket_list_for_attendee() |
|
155 | + { |
|
156 | + $valid_shortcodes = array( |
|
157 | + 'ticket', |
|
158 | + 'event_list', |
|
159 | + 'datetime_list', |
|
160 | + 'attendee', |
|
161 | + 'primary_registration_details', |
|
162 | + 'recipient_details', |
|
163 | + ); |
|
164 | + |
|
165 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
166 | + ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
167 | + $registration = $this->_data['data']; |
|
168 | + |
|
169 | + // let's remove any existing [ATTENDEE_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
170 | + $template = str_replace('[ATTENDEE_LIST]', '', $template); |
|
171 | + |
|
172 | + // here we're setting up the tickets for the ticket list template for THIS attendee. |
|
173 | + $tkt_parsed = ''; |
|
174 | + $tickets = $this->_get_ticket_list_from_registration($registration); |
|
175 | + |
|
176 | + // each ticket in this case should be an ticket object. |
|
177 | + foreach ($tickets as $ticket) { |
|
178 | + $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
179 | + $template, |
|
180 | + $ticket, |
|
181 | + $valid_shortcodes, |
|
182 | + $this->_extra_data |
|
183 | + ); |
|
184 | + } |
|
185 | + |
|
186 | + return $tkt_parsed; |
|
187 | + } |
|
188 | + |
|
189 | + private function _get_tickets_from_event(EE_Event $event) |
|
190 | + { |
|
191 | + return isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[ $event->ID( |
|
192 | + ) ]['tkt_objs'] : array(); |
|
193 | + } |
|
194 | + |
|
195 | + private function _get_ticket_list_from_registration(EE_Registration $registration, $att = null) |
|
196 | + { |
|
197 | + return isset($this->_extra_data['data']->registrations) |
|
198 | + ? array($this->_extra_data['data']->registrations[ $registration->ID() ]['tkt_obj']) : array(); |
|
199 | + } |
|
200 | 200 | } |
@@ -188,13 +188,13 @@ |
||
188 | 188 | |
189 | 189 | private function _get_tickets_from_event(EE_Event $event) |
190 | 190 | { |
191 | - return isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[ $event->ID( |
|
192 | - ) ]['tkt_objs'] : array(); |
|
191 | + return isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[$event->ID( |
|
192 | + )]['tkt_objs'] : array(); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | private function _get_ticket_list_from_registration(EE_Registration $registration, $att = null) |
196 | 196 | { |
197 | 197 | return isset($this->_extra_data['data']->registrations) |
198 | - ? array($this->_extra_data['data']->registrations[ $registration->ID() ]['tkt_obj']) : array(); |
|
198 | + ? array($this->_extra_data['data']->registrations[$registration->ID()]['tkt_obj']) : array(); |
|
199 | 199 | } |
200 | 200 | } |
@@ -32,42 +32,42 @@ |
||
32 | 32 | { |
33 | 33 | |
34 | 34 | |
35 | - public function __construct() |
|
36 | - { |
|
37 | - parent::__construct(); |
|
38 | - } |
|
35 | + public function __construct() |
|
36 | + { |
|
37 | + parent::__construct(); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - protected function _init_props() |
|
42 | - { |
|
43 | - $this->label = __('Event Meta Shortcodes', 'event_espresso'); |
|
44 | - $this->description = __('All shortcodes related to Event Meta data', 'event_espresso'); |
|
45 | - $this->_shortcodes = array(); |
|
46 | - } |
|
41 | + protected function _init_props() |
|
42 | + { |
|
43 | + $this->label = __('Event Meta Shortcodes', 'event_espresso'); |
|
44 | + $this->description = __('All shortcodes related to Event Meta data', 'event_espresso'); |
|
45 | + $this->_shortcodes = array(); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * We have to overload the parent parser method because of the dynamic nature of custom event meta |
|
51 | - * |
|
52 | - * @param string $shortcode Incoming shortcode |
|
53 | - * @param mixed (array|object) $data incoming data object/array |
|
54 | - * @return string parsed code. |
|
55 | - */ |
|
56 | - public function parser($shortcode, $data, $extra_data = array()) |
|
57 | - { |
|
49 | + /** |
|
50 | + * We have to overload the parent parser method because of the dynamic nature of custom event meta |
|
51 | + * |
|
52 | + * @param string $shortcode Incoming shortcode |
|
53 | + * @param mixed (array|object) $data incoming data object/array |
|
54 | + * @return string parsed code. |
|
55 | + */ |
|
56 | + public function parser($shortcode, $data, $extra_data = array()) |
|
57 | + { |
|
58 | 58 | |
59 | - // all shortcodes will be checked in the post_meta table (assuming the shortcode matches the post_meta key); |
|
60 | - if (empty($this->_data['ID'])) { |
|
61 | - return ''; |
|
62 | - } // need the event id to do anything! |
|
59 | + // all shortcodes will be checked in the post_meta table (assuming the shortcode matches the post_meta key); |
|
60 | + if (empty($this->_data['ID'])) { |
|
61 | + return ''; |
|
62 | + } // need the event id to do anything! |
|
63 | 63 | |
64 | - $meta = get_post_meta($this->_data['ID'], $shortcode, true); |
|
64 | + $meta = get_post_meta($this->_data['ID'], $shortcode, true); |
|
65 | 65 | |
66 | - return ! empty($meta) ? $meta : ''; |
|
67 | - } |
|
66 | + return ! empty($meta) ? $meta : ''; |
|
67 | + } |
|
68 | 68 | |
69 | 69 | |
70 | - protected function _parser($shortcode) |
|
71 | - { |
|
72 | - } |
|
70 | + protected function _parser($shortcode) |
|
71 | + { |
|
72 | + } |
|
73 | 73 | } |
@@ -152,6 +152,6 @@ |
||
152 | 152 | private function _get_events_from_registration(EE_Registration $registration) |
153 | 153 | { |
154 | 154 | return isset($this->_extra_data['data']->registrations) |
155 | - ? array($this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']) : array(); |
|
155 | + ? array($this->_extra_data['data']->registrations[$registration->ID()]['evt_obj']) : array(); |
|
156 | 156 | } |
157 | 157 | } |
@@ -21,139 +21,139 @@ |
||
21 | 21 | class EE_Event_List_Shortcodes extends EE_Shortcodes |
22 | 22 | { |
23 | 23 | |
24 | - public function __construct() |
|
25 | - { |
|
26 | - parent::__construct(); |
|
27 | - } |
|
28 | - |
|
29 | - |
|
30 | - protected function _init_props() |
|
31 | - { |
|
32 | - $this->label = __('Event List Shortcodes', 'event_espresso'); |
|
33 | - $this->description = __('All shortcodes specific to event lists', 'event_espresso'); |
|
34 | - $this->_shortcodes = array( |
|
35 | - '[EVENT_LIST]' => __('Will output a list of events', 'event_espresso'), |
|
36 | - ); |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - protected function _parser($shortcode) |
|
41 | - { |
|
42 | - switch ($shortcode) { |
|
43 | - case '[EVENT_LIST]': |
|
44 | - return $this->_get_event_list(); |
|
45 | - break; |
|
46 | - } |
|
47 | - } |
|
48 | - |
|
49 | - |
|
50 | - /** |
|
51 | - * figure out what the incoming data is and then return the appropriate parsed value. |
|
52 | - * |
|
53 | - * @return string |
|
54 | - */ |
|
55 | - private function _get_event_list() |
|
56 | - { |
|
57 | - $this->_validate_list_requirements(); |
|
58 | - |
|
59 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
60 | - return $this->_get_event_list_for_main(); |
|
61 | - } elseif ($this->_data['data'] instanceof EE_Registration) { |
|
62 | - return $this->_get_event_list_for_registration(); |
|
63 | - } // prevent recursive loop |
|
64 | - else { |
|
65 | - return ''; |
|
66 | - } |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * This returns the parsed event list for main template |
|
72 | - * |
|
73 | - * @return string |
|
74 | - */ |
|
75 | - private function _get_event_list_for_main() |
|
76 | - { |
|
77 | - |
|
78 | - $valid_shortcodes = array( |
|
79 | - 'event', |
|
80 | - 'attendee_list', |
|
81 | - 'ticket_list', |
|
82 | - 'datetime_list', |
|
83 | - 'venue', |
|
84 | - 'attendee', |
|
85 | - 'recipient_list', |
|
86 | - 'recipient_details', |
|
87 | - 'primary_registration_list', |
|
88 | - 'primary_registration_details', |
|
89 | - 'event_author', |
|
90 | - 'organization', |
|
91 | - ); |
|
92 | - $template = $this->_data['template']; |
|
93 | - $data = $this->_data['data']; |
|
94 | - $events = ''; |
|
95 | - |
|
96 | - // now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper. |
|
97 | - foreach ($data->events as $event) { |
|
98 | - $events .= $this->_shortcode_helper->parse_event_list_template( |
|
99 | - $template, |
|
100 | - $event['event'], |
|
101 | - $valid_shortcodes, |
|
102 | - $this->_extra_data |
|
103 | - ); |
|
104 | - } |
|
105 | - return $events; |
|
106 | - } |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * This returns the parsed event list for an attendee |
|
111 | - * |
|
112 | - * @return string |
|
113 | - */ |
|
114 | - private function _get_event_list_for_registration() |
|
115 | - { |
|
116 | - $valid_shortcodes = array( |
|
117 | - 'event', |
|
118 | - 'ticket_list', |
|
119 | - 'datetime_list', |
|
120 | - 'attendee', |
|
121 | - 'event_author', |
|
122 | - 'recipient_details', |
|
123 | - 'recipient_list', |
|
124 | - 'venue', |
|
125 | - 'organization', |
|
126 | - ); |
|
127 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['event_list']) |
|
128 | - ? $this->_data['template']['event_list'] : $this->_extra_data['template']['event_list']; |
|
129 | - $registration = $this->_data['data']; |
|
130 | - |
|
131 | - // let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion. |
|
132 | - $template = str_replace('[ATTENDEE_LIST]', '', $template); |
|
133 | - |
|
134 | - // here we're setting up the events for the event_list template for THIS registration. |
|
135 | - $evt_result = ''; |
|
136 | - $all_events = $this->_get_events_from_registration($registration); |
|
137 | - |
|
138 | - // we're NOT going to prepare a list of attendees this time around |
|
139 | - $events = ''; |
|
140 | - |
|
141 | - foreach ((array) $all_events as $event) { |
|
142 | - $events .= $this->_shortcode_helper->parse_event_list_template( |
|
143 | - $template, |
|
144 | - $event, |
|
145 | - $valid_shortcodes, |
|
146 | - $this->_extra_data |
|
147 | - ); |
|
148 | - } |
|
149 | - |
|
150 | - return $events; |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - private function _get_events_from_registration(EE_Registration $registration) |
|
155 | - { |
|
156 | - return isset($this->_extra_data['data']->registrations) |
|
157 | - ? array($this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']) : array(); |
|
158 | - } |
|
24 | + public function __construct() |
|
25 | + { |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | + |
|
29 | + |
|
30 | + protected function _init_props() |
|
31 | + { |
|
32 | + $this->label = __('Event List Shortcodes', 'event_espresso'); |
|
33 | + $this->description = __('All shortcodes specific to event lists', 'event_espresso'); |
|
34 | + $this->_shortcodes = array( |
|
35 | + '[EVENT_LIST]' => __('Will output a list of events', 'event_espresso'), |
|
36 | + ); |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + protected function _parser($shortcode) |
|
41 | + { |
|
42 | + switch ($shortcode) { |
|
43 | + case '[EVENT_LIST]': |
|
44 | + return $this->_get_event_list(); |
|
45 | + break; |
|
46 | + } |
|
47 | + } |
|
48 | + |
|
49 | + |
|
50 | + /** |
|
51 | + * figure out what the incoming data is and then return the appropriate parsed value. |
|
52 | + * |
|
53 | + * @return string |
|
54 | + */ |
|
55 | + private function _get_event_list() |
|
56 | + { |
|
57 | + $this->_validate_list_requirements(); |
|
58 | + |
|
59 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
60 | + return $this->_get_event_list_for_main(); |
|
61 | + } elseif ($this->_data['data'] instanceof EE_Registration) { |
|
62 | + return $this->_get_event_list_for_registration(); |
|
63 | + } // prevent recursive loop |
|
64 | + else { |
|
65 | + return ''; |
|
66 | + } |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * This returns the parsed event list for main template |
|
72 | + * |
|
73 | + * @return string |
|
74 | + */ |
|
75 | + private function _get_event_list_for_main() |
|
76 | + { |
|
77 | + |
|
78 | + $valid_shortcodes = array( |
|
79 | + 'event', |
|
80 | + 'attendee_list', |
|
81 | + 'ticket_list', |
|
82 | + 'datetime_list', |
|
83 | + 'venue', |
|
84 | + 'attendee', |
|
85 | + 'recipient_list', |
|
86 | + 'recipient_details', |
|
87 | + 'primary_registration_list', |
|
88 | + 'primary_registration_details', |
|
89 | + 'event_author', |
|
90 | + 'organization', |
|
91 | + ); |
|
92 | + $template = $this->_data['template']; |
|
93 | + $data = $this->_data['data']; |
|
94 | + $events = ''; |
|
95 | + |
|
96 | + // now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper. |
|
97 | + foreach ($data->events as $event) { |
|
98 | + $events .= $this->_shortcode_helper->parse_event_list_template( |
|
99 | + $template, |
|
100 | + $event['event'], |
|
101 | + $valid_shortcodes, |
|
102 | + $this->_extra_data |
|
103 | + ); |
|
104 | + } |
|
105 | + return $events; |
|
106 | + } |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * This returns the parsed event list for an attendee |
|
111 | + * |
|
112 | + * @return string |
|
113 | + */ |
|
114 | + private function _get_event_list_for_registration() |
|
115 | + { |
|
116 | + $valid_shortcodes = array( |
|
117 | + 'event', |
|
118 | + 'ticket_list', |
|
119 | + 'datetime_list', |
|
120 | + 'attendee', |
|
121 | + 'event_author', |
|
122 | + 'recipient_details', |
|
123 | + 'recipient_list', |
|
124 | + 'venue', |
|
125 | + 'organization', |
|
126 | + ); |
|
127 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['event_list']) |
|
128 | + ? $this->_data['template']['event_list'] : $this->_extra_data['template']['event_list']; |
|
129 | + $registration = $this->_data['data']; |
|
130 | + |
|
131 | + // let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion. |
|
132 | + $template = str_replace('[ATTENDEE_LIST]', '', $template); |
|
133 | + |
|
134 | + // here we're setting up the events for the event_list template for THIS registration. |
|
135 | + $evt_result = ''; |
|
136 | + $all_events = $this->_get_events_from_registration($registration); |
|
137 | + |
|
138 | + // we're NOT going to prepare a list of attendees this time around |
|
139 | + $events = ''; |
|
140 | + |
|
141 | + foreach ((array) $all_events as $event) { |
|
142 | + $events .= $this->_shortcode_helper->parse_event_list_template( |
|
143 | + $template, |
|
144 | + $event, |
|
145 | + $valid_shortcodes, |
|
146 | + $this->_extra_data |
|
147 | + ); |
|
148 | + } |
|
149 | + |
|
150 | + return $events; |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + private function _get_events_from_registration(EE_Registration $registration) |
|
155 | + { |
|
156 | + return isset($this->_extra_data['data']->registrations) |
|
157 | + ? array($this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']) : array(); |
|
158 | + } |
|
159 | 159 | } |
@@ -22,137 +22,137 @@ |
||
22 | 22 | { |
23 | 23 | |
24 | 24 | |
25 | - protected function _init_props() |
|
26 | - { |
|
27 | - $this->label = __('Datetime List Shortcodes', 'event_espresso'); |
|
28 | - $this->description = __('All shortcodes specific to datetime lists', 'event_espresso'); |
|
29 | - $this->_shortcodes = array( |
|
30 | - '[DATETIME_LIST]' => __( |
|
31 | - 'Will output a list of datetimes according to the layout specified in the datetime list field.', |
|
32 | - 'event_espresso' |
|
33 | - ), |
|
34 | - ); |
|
35 | - } |
|
36 | - |
|
37 | - |
|
38 | - protected function _parser($shortcode) |
|
39 | - { |
|
40 | - switch ($shortcode) { |
|
41 | - case '[DATETIME_LIST]': |
|
42 | - return $this->_get_datetime_list(); |
|
43 | - break; |
|
44 | - } |
|
45 | - return ''; |
|
46 | - } |
|
47 | - |
|
48 | - |
|
49 | - /** |
|
50 | - * figure out what the incoming data is and then return the appropriate parsed value. |
|
51 | - * |
|
52 | - * @return string |
|
53 | - */ |
|
54 | - private function _get_datetime_list() |
|
55 | - { |
|
56 | - $this->_validate_list_requirements(); |
|
57 | - |
|
58 | - if ($this->_data['data'] instanceof EE_Ticket) { |
|
59 | - return $this->_get_datetime_list_for_ticket(); |
|
60 | - } elseif ($this->_data['data'] instanceof EE_Event) { |
|
61 | - return $this->_get_datetime_list_for_event(); |
|
62 | - } elseif ($this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration) { |
|
63 | - return $this->_get_datetime_list_for_registration(); |
|
64 | - } // prevent recursive loop |
|
65 | - else { |
|
66 | - return ''; |
|
67 | - } |
|
68 | - } |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * return parsed list of datetimes for an event |
|
73 | - * |
|
74 | - * @return string |
|
75 | - */ |
|
76 | - private function _get_datetime_list_for_event() |
|
77 | - { |
|
78 | - $valid_shortcodes = array('datetime', 'attendee'); |
|
79 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
80 | - ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
81 | - $event = $this->_data['data']; |
|
82 | - |
|
83 | - // here we're setting up the datetimes for the datetime list template for THIS event. |
|
84 | - $dtt_parsed = ''; |
|
85 | - $datetimes = $this->_get_datetimes_from_event($event); |
|
86 | - |
|
87 | - // each datetime in this case should be an datetime object. |
|
88 | - foreach ($datetimes as $datetime) { |
|
89 | - $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
90 | - $template, |
|
91 | - $datetime, |
|
92 | - $valid_shortcodes, |
|
93 | - $this->_extra_data |
|
94 | - ); |
|
95 | - } |
|
96 | - |
|
97 | - return $dtt_parsed; |
|
98 | - } |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * return parsed list of datetimes for an ticket |
|
103 | - * |
|
104 | - * @return string |
|
105 | - */ |
|
106 | - private function _get_datetime_list_for_ticket() |
|
107 | - { |
|
108 | - $valid_shortcodes = array('datetime', 'attendee'); |
|
109 | - |
|
110 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
111 | - ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
112 | - $ticket = $this->_data['data']; |
|
113 | - |
|
114 | - // here we're setting up the datetimes for the datetime list template for THIS ticket. |
|
115 | - $dtt_parsed = ''; |
|
116 | - $datetimes = $this->_get_datetimes_from_ticket($ticket); |
|
117 | - |
|
118 | - // each datetime in this case should be an datetime object. |
|
119 | - foreach ($datetimes as $datetime) { |
|
120 | - $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
121 | - $template, |
|
122 | - $datetime, |
|
123 | - $valid_shortcodes, |
|
124 | - $this->_extra_data |
|
125 | - ); |
|
126 | - } |
|
127 | - |
|
128 | - return $dtt_parsed; |
|
129 | - } |
|
130 | - |
|
131 | - |
|
132 | - /** |
|
133 | - * return parsed list of datetimes from a given registration. |
|
134 | - * |
|
135 | - * @return string |
|
136 | - */ |
|
137 | - private function _get_datetime_list_for_registration() |
|
138 | - { |
|
139 | - $registration = $this->_data['data']->reg_obj; |
|
140 | - |
|
141 | - // now let's just get the ticket, set $this->_data['data'] to the ticket and then call _get_datetime_list_for__ticket(); |
|
142 | - $this->_data['data'] = $registration->ticket(); |
|
143 | - return $this->_get_datetime_list_for_ticket(); |
|
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - private function _get_datetimes_from_event(EE_Event $event, $att = null) |
|
148 | - { |
|
149 | - return isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[ $event->ID( |
|
150 | - ) ]['dtt_objs'] : array(); |
|
151 | - } |
|
152 | - |
|
153 | - private function _get_datetimes_from_ticket(EE_Ticket $ticket, $att = null) |
|
154 | - { |
|
155 | - return isset($this->_extra_data['data']->tickets) ? $this->_extra_data['data']->tickets[ $ticket->ID( |
|
156 | - ) ]['dtt_objs'] : array(); |
|
157 | - } |
|
25 | + protected function _init_props() |
|
26 | + { |
|
27 | + $this->label = __('Datetime List Shortcodes', 'event_espresso'); |
|
28 | + $this->description = __('All shortcodes specific to datetime lists', 'event_espresso'); |
|
29 | + $this->_shortcodes = array( |
|
30 | + '[DATETIME_LIST]' => __( |
|
31 | + 'Will output a list of datetimes according to the layout specified in the datetime list field.', |
|
32 | + 'event_espresso' |
|
33 | + ), |
|
34 | + ); |
|
35 | + } |
|
36 | + |
|
37 | + |
|
38 | + protected function _parser($shortcode) |
|
39 | + { |
|
40 | + switch ($shortcode) { |
|
41 | + case '[DATETIME_LIST]': |
|
42 | + return $this->_get_datetime_list(); |
|
43 | + break; |
|
44 | + } |
|
45 | + return ''; |
|
46 | + } |
|
47 | + |
|
48 | + |
|
49 | + /** |
|
50 | + * figure out what the incoming data is and then return the appropriate parsed value. |
|
51 | + * |
|
52 | + * @return string |
|
53 | + */ |
|
54 | + private function _get_datetime_list() |
|
55 | + { |
|
56 | + $this->_validate_list_requirements(); |
|
57 | + |
|
58 | + if ($this->_data['data'] instanceof EE_Ticket) { |
|
59 | + return $this->_get_datetime_list_for_ticket(); |
|
60 | + } elseif ($this->_data['data'] instanceof EE_Event) { |
|
61 | + return $this->_get_datetime_list_for_event(); |
|
62 | + } elseif ($this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration) { |
|
63 | + return $this->_get_datetime_list_for_registration(); |
|
64 | + } // prevent recursive loop |
|
65 | + else { |
|
66 | + return ''; |
|
67 | + } |
|
68 | + } |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * return parsed list of datetimes for an event |
|
73 | + * |
|
74 | + * @return string |
|
75 | + */ |
|
76 | + private function _get_datetime_list_for_event() |
|
77 | + { |
|
78 | + $valid_shortcodes = array('datetime', 'attendee'); |
|
79 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
80 | + ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
81 | + $event = $this->_data['data']; |
|
82 | + |
|
83 | + // here we're setting up the datetimes for the datetime list template for THIS event. |
|
84 | + $dtt_parsed = ''; |
|
85 | + $datetimes = $this->_get_datetimes_from_event($event); |
|
86 | + |
|
87 | + // each datetime in this case should be an datetime object. |
|
88 | + foreach ($datetimes as $datetime) { |
|
89 | + $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
90 | + $template, |
|
91 | + $datetime, |
|
92 | + $valid_shortcodes, |
|
93 | + $this->_extra_data |
|
94 | + ); |
|
95 | + } |
|
96 | + |
|
97 | + return $dtt_parsed; |
|
98 | + } |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * return parsed list of datetimes for an ticket |
|
103 | + * |
|
104 | + * @return string |
|
105 | + */ |
|
106 | + private function _get_datetime_list_for_ticket() |
|
107 | + { |
|
108 | + $valid_shortcodes = array('datetime', 'attendee'); |
|
109 | + |
|
110 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
111 | + ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
112 | + $ticket = $this->_data['data']; |
|
113 | + |
|
114 | + // here we're setting up the datetimes for the datetime list template for THIS ticket. |
|
115 | + $dtt_parsed = ''; |
|
116 | + $datetimes = $this->_get_datetimes_from_ticket($ticket); |
|
117 | + |
|
118 | + // each datetime in this case should be an datetime object. |
|
119 | + foreach ($datetimes as $datetime) { |
|
120 | + $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
121 | + $template, |
|
122 | + $datetime, |
|
123 | + $valid_shortcodes, |
|
124 | + $this->_extra_data |
|
125 | + ); |
|
126 | + } |
|
127 | + |
|
128 | + return $dtt_parsed; |
|
129 | + } |
|
130 | + |
|
131 | + |
|
132 | + /** |
|
133 | + * return parsed list of datetimes from a given registration. |
|
134 | + * |
|
135 | + * @return string |
|
136 | + */ |
|
137 | + private function _get_datetime_list_for_registration() |
|
138 | + { |
|
139 | + $registration = $this->_data['data']->reg_obj; |
|
140 | + |
|
141 | + // now let's just get the ticket, set $this->_data['data'] to the ticket and then call _get_datetime_list_for__ticket(); |
|
142 | + $this->_data['data'] = $registration->ticket(); |
|
143 | + return $this->_get_datetime_list_for_ticket(); |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + private function _get_datetimes_from_event(EE_Event $event, $att = null) |
|
148 | + { |
|
149 | + return isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[ $event->ID( |
|
150 | + ) ]['dtt_objs'] : array(); |
|
151 | + } |
|
152 | + |
|
153 | + private function _get_datetimes_from_ticket(EE_Ticket $ticket, $att = null) |
|
154 | + { |
|
155 | + return isset($this->_extra_data['data']->tickets) ? $this->_extra_data['data']->tickets[ $ticket->ID( |
|
156 | + ) ]['dtt_objs'] : array(); |
|
157 | + } |
|
158 | 158 | } |
@@ -146,13 +146,13 @@ |
||
146 | 146 | |
147 | 147 | private function _get_datetimes_from_event(EE_Event $event, $att = null) |
148 | 148 | { |
149 | - return isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[ $event->ID( |
|
150 | - ) ]['dtt_objs'] : array(); |
|
149 | + return isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[$event->ID( |
|
150 | + )]['dtt_objs'] : array(); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | private function _get_datetimes_from_ticket(EE_Ticket $ticket, $att = null) |
154 | 154 | { |
155 | - return isset($this->_extra_data['data']->tickets) ? $this->_extra_data['data']->tickets[ $ticket->ID( |
|
156 | - ) ]['dtt_objs'] : array(); |
|
155 | + return isset($this->_extra_data['data']->tickets) ? $this->_extra_data['data']->tickets[$ticket->ID( |
|
156 | + )]['dtt_objs'] : array(); |
|
157 | 157 | } |
158 | 158 | } |
@@ -20,202 +20,202 @@ |
||
20 | 20 | { |
21 | 21 | |
22 | 22 | |
23 | - protected function _init_props() |
|
24 | - { |
|
25 | - $this->label = __('Line Item List Shortcodes', 'event_espresso'); |
|
26 | - $this->description = __('All shortcodes specific to line item lists', 'event_espresso'); |
|
27 | - $this->_shortcodes = array( |
|
28 | - '[TICKET_LINE_ITEM_LIST]' => __('Outputs a list of ticket line items.', 'event_espresso'), |
|
29 | - '[TAX_LINE_ITEM_LIST]' => __('Outputs a list of tax line items.', 'event_espresso'), |
|
30 | - '[ADDITIONAL_LINE_ITEM_LIST]' => __( |
|
31 | - 'Outputs a list of additional line items (other charges or discounts)', |
|
32 | - 'event_espresso' |
|
33 | - ), |
|
34 | - '[PRICE_MODIFIER_LINE_ITEM_LIST]' => __('Outputs a list of price modifier line items', 'event_espresso'), |
|
35 | - ); |
|
36 | - } |
|
37 | - |
|
38 | - |
|
39 | - protected function _parser($shortcode) |
|
40 | - { |
|
41 | - |
|
42 | - switch ($shortcode) { |
|
43 | - case '[TICKET_LINE_ITEM_LIST]': |
|
44 | - return $this->_get_ticket_line_item_list(); |
|
45 | - break; |
|
46 | - |
|
47 | - case '[TAX_LINE_ITEM_LIST]': |
|
48 | - return $this->_get_tax_line_item_list(); |
|
49 | - break; |
|
50 | - |
|
51 | - case '[PRICE_MODIFIER_LINE_ITEM_LIST]': |
|
52 | - return $this->_get_price_mod_line_item_list(); |
|
53 | - break; |
|
54 | - |
|
55 | - case '[ADDITIONAL_LINE_ITEM_LIST]': |
|
56 | - return $this->_get_additional_line_item_list(); |
|
57 | - break; |
|
58 | - |
|
59 | - default: |
|
60 | - return ''; |
|
61 | - break; |
|
62 | - } |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * verify incoming data contains what is needed for retrieving and parsing each ticket line item for an event. |
|
68 | - * |
|
69 | - * @since 4.5.0 |
|
70 | - * |
|
71 | - * @return string parsed ticket line item list. |
|
72 | - */ |
|
73 | - private function _get_ticket_line_item_list() |
|
74 | - { |
|
75 | - $this->_validate_list_requirements(); |
|
76 | - |
|
77 | - if (! $this->_data['data'] instanceof EE_Ticket) { |
|
78 | - return ''; |
|
79 | - } |
|
80 | - |
|
81 | - $valid_shortcodes = array('line_item', 'line_item_list', 'ticket'); |
|
82 | - |
|
83 | - $ticket = $this->_data['data']; |
|
84 | - $templates = $this->_extra_data['template']; |
|
85 | - $addressee_obj = $this->_extra_data['data']; |
|
86 | - |
|
87 | - // made it here so we have an EE_Ticket, so we should have what we need. |
|
88 | - $ticket_line_item = isset($addressee_obj->tickets[ $ticket->ID() ]['line_item']) |
|
89 | - ? $addressee_obj->tickets[ $ticket->ID() ]['line_item'] : null; |
|
90 | - $sub_line_items = isset($addressee_obj->tickets[ $ticket->ID() ]['sub_line_items']) |
|
91 | - ? $addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'] : array(); |
|
92 | - |
|
93 | - $template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms'] |
|
94 | - : $templates['ticket_line_item_pms']; |
|
95 | - |
|
96 | - if (empty($ticket_line_item) || empty($sub_line_items)) { |
|
97 | - return ''; |
|
98 | - } |
|
99 | - |
|
100 | - // now we just return the appropriate template parsed for each ticket. |
|
101 | - return $this->_shortcode_helper->parse_line_item_list_template( |
|
102 | - $template, |
|
103 | - $ticket_line_item, |
|
104 | - $valid_shortcodes, |
|
105 | - $this->_extra_data |
|
106 | - ); |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * Verify incoming data contains what is needed for retrieving and parsing each tax line item for a transaction. |
|
112 | - * |
|
113 | - * @since 4.5.0 |
|
114 | - * |
|
115 | - * @return string parsed tax line item list. |
|
116 | - */ |
|
117 | - private function _get_tax_line_item_list() |
|
118 | - { |
|
119 | - |
|
120 | - $this->_validate_list_requirements(); |
|
121 | - |
|
122 | - if (! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
123 | - return ''; |
|
124 | - } |
|
125 | - |
|
126 | - // made it here so we're good to go. |
|
127 | - $valid_shortcodes = array('line_item'); |
|
128 | - $templates = $this->_data['template']; |
|
129 | - |
|
130 | - $tax_line_items = $this->_data['data']->tax_line_items; |
|
131 | - $line_item_list = ''; |
|
132 | - foreach ($tax_line_items as $line_item) { |
|
133 | - $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( |
|
134 | - $templates['tax_line_item_list'], |
|
135 | - $line_item, |
|
136 | - $valid_shortcodes, |
|
137 | - $this->_extra_data |
|
138 | - ); |
|
139 | - } |
|
140 | - |
|
141 | - return $line_item_list; |
|
142 | - } |
|
143 | - |
|
144 | - /** |
|
145 | - * Verify incoming data contains what is needed for retrieving and parsing each other line item for a transaction. |
|
146 | - * |
|
147 | - * @since 4.5.0 |
|
148 | - * |
|
149 | - * @return string parsed other line item list. |
|
150 | - */ |
|
151 | - private function _get_additional_line_item_list() |
|
152 | - { |
|
153 | - |
|
154 | - $this->_validate_list_requirements(); |
|
155 | - |
|
156 | - if (! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
157 | - return ''; |
|
158 | - } |
|
159 | - |
|
160 | - // made it here so we're good to go. |
|
161 | - $valid_shortcodes = array('line_item'); |
|
162 | - $templates = $this->_data['template']; |
|
163 | - |
|
164 | - $additional_line_items = $this->_data['data']->additional_line_items; |
|
165 | - $line_item_list = ''; |
|
166 | - foreach ($additional_line_items as $line_item) { |
|
167 | - $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( |
|
168 | - $templates['additional_line_item_list'], |
|
169 | - $line_item, |
|
170 | - $valid_shortcodes, |
|
171 | - $this->_extra_data |
|
172 | - ); |
|
173 | - } |
|
174 | - |
|
175 | - |
|
176 | - return $line_item_list; |
|
177 | - } |
|
178 | - |
|
179 | - |
|
180 | - /** |
|
181 | - * Verify incoming data contains what is needed for retrieving and parsing each price modifier line item for a |
|
182 | - * parent ticket line item. |
|
183 | - * |
|
184 | - * @since 4.5.0 |
|
185 | - * |
|
186 | - * @return string parsed price modifier line item list. |
|
187 | - */ |
|
188 | - private function _get_price_mod_line_item_list() |
|
189 | - { |
|
190 | - $this->_validate_list_requirements(); |
|
191 | - |
|
192 | - if (! $this->_data['data'] instanceof EE_Line_Item) { |
|
193 | - return ''; |
|
194 | - } |
|
195 | - |
|
196 | - // made it here so we're good to go. |
|
197 | - $main_line_item = $this->_data['data']; |
|
198 | - $templates = $this->_extra_data['template']; |
|
199 | - $addressee_obj = $this->_extra_data['data']; |
|
200 | - |
|
201 | - $valid_shortcodes = array('line_item'); |
|
202 | - |
|
203 | - $main_line_item_id = $main_line_item->ID(); |
|
204 | - |
|
205 | - $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[ $main_line_item_id ]['children']) |
|
206 | - ? $addressee_obj->line_items_with_children[ $main_line_item_id ]['children'] : array(); |
|
207 | - |
|
208 | - $line_item_list = ''; |
|
209 | - |
|
210 | - foreach ($price_mod_line_items as $line_item) { |
|
211 | - $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( |
|
212 | - $templates['price_modifier_line_item_list'], |
|
213 | - $line_item, |
|
214 | - $valid_shortcodes, |
|
215 | - $this->_extra_data |
|
216 | - ); |
|
217 | - } |
|
218 | - |
|
219 | - return $line_item_list; |
|
220 | - } |
|
23 | + protected function _init_props() |
|
24 | + { |
|
25 | + $this->label = __('Line Item List Shortcodes', 'event_espresso'); |
|
26 | + $this->description = __('All shortcodes specific to line item lists', 'event_espresso'); |
|
27 | + $this->_shortcodes = array( |
|
28 | + '[TICKET_LINE_ITEM_LIST]' => __('Outputs a list of ticket line items.', 'event_espresso'), |
|
29 | + '[TAX_LINE_ITEM_LIST]' => __('Outputs a list of tax line items.', 'event_espresso'), |
|
30 | + '[ADDITIONAL_LINE_ITEM_LIST]' => __( |
|
31 | + 'Outputs a list of additional line items (other charges or discounts)', |
|
32 | + 'event_espresso' |
|
33 | + ), |
|
34 | + '[PRICE_MODIFIER_LINE_ITEM_LIST]' => __('Outputs a list of price modifier line items', 'event_espresso'), |
|
35 | + ); |
|
36 | + } |
|
37 | + |
|
38 | + |
|
39 | + protected function _parser($shortcode) |
|
40 | + { |
|
41 | + |
|
42 | + switch ($shortcode) { |
|
43 | + case '[TICKET_LINE_ITEM_LIST]': |
|
44 | + return $this->_get_ticket_line_item_list(); |
|
45 | + break; |
|
46 | + |
|
47 | + case '[TAX_LINE_ITEM_LIST]': |
|
48 | + return $this->_get_tax_line_item_list(); |
|
49 | + break; |
|
50 | + |
|
51 | + case '[PRICE_MODIFIER_LINE_ITEM_LIST]': |
|
52 | + return $this->_get_price_mod_line_item_list(); |
|
53 | + break; |
|
54 | + |
|
55 | + case '[ADDITIONAL_LINE_ITEM_LIST]': |
|
56 | + return $this->_get_additional_line_item_list(); |
|
57 | + break; |
|
58 | + |
|
59 | + default: |
|
60 | + return ''; |
|
61 | + break; |
|
62 | + } |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * verify incoming data contains what is needed for retrieving and parsing each ticket line item for an event. |
|
68 | + * |
|
69 | + * @since 4.5.0 |
|
70 | + * |
|
71 | + * @return string parsed ticket line item list. |
|
72 | + */ |
|
73 | + private function _get_ticket_line_item_list() |
|
74 | + { |
|
75 | + $this->_validate_list_requirements(); |
|
76 | + |
|
77 | + if (! $this->_data['data'] instanceof EE_Ticket) { |
|
78 | + return ''; |
|
79 | + } |
|
80 | + |
|
81 | + $valid_shortcodes = array('line_item', 'line_item_list', 'ticket'); |
|
82 | + |
|
83 | + $ticket = $this->_data['data']; |
|
84 | + $templates = $this->_extra_data['template']; |
|
85 | + $addressee_obj = $this->_extra_data['data']; |
|
86 | + |
|
87 | + // made it here so we have an EE_Ticket, so we should have what we need. |
|
88 | + $ticket_line_item = isset($addressee_obj->tickets[ $ticket->ID() ]['line_item']) |
|
89 | + ? $addressee_obj->tickets[ $ticket->ID() ]['line_item'] : null; |
|
90 | + $sub_line_items = isset($addressee_obj->tickets[ $ticket->ID() ]['sub_line_items']) |
|
91 | + ? $addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'] : array(); |
|
92 | + |
|
93 | + $template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms'] |
|
94 | + : $templates['ticket_line_item_pms']; |
|
95 | + |
|
96 | + if (empty($ticket_line_item) || empty($sub_line_items)) { |
|
97 | + return ''; |
|
98 | + } |
|
99 | + |
|
100 | + // now we just return the appropriate template parsed for each ticket. |
|
101 | + return $this->_shortcode_helper->parse_line_item_list_template( |
|
102 | + $template, |
|
103 | + $ticket_line_item, |
|
104 | + $valid_shortcodes, |
|
105 | + $this->_extra_data |
|
106 | + ); |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * Verify incoming data contains what is needed for retrieving and parsing each tax line item for a transaction. |
|
112 | + * |
|
113 | + * @since 4.5.0 |
|
114 | + * |
|
115 | + * @return string parsed tax line item list. |
|
116 | + */ |
|
117 | + private function _get_tax_line_item_list() |
|
118 | + { |
|
119 | + |
|
120 | + $this->_validate_list_requirements(); |
|
121 | + |
|
122 | + if (! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
123 | + return ''; |
|
124 | + } |
|
125 | + |
|
126 | + // made it here so we're good to go. |
|
127 | + $valid_shortcodes = array('line_item'); |
|
128 | + $templates = $this->_data['template']; |
|
129 | + |
|
130 | + $tax_line_items = $this->_data['data']->tax_line_items; |
|
131 | + $line_item_list = ''; |
|
132 | + foreach ($tax_line_items as $line_item) { |
|
133 | + $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( |
|
134 | + $templates['tax_line_item_list'], |
|
135 | + $line_item, |
|
136 | + $valid_shortcodes, |
|
137 | + $this->_extra_data |
|
138 | + ); |
|
139 | + } |
|
140 | + |
|
141 | + return $line_item_list; |
|
142 | + } |
|
143 | + |
|
144 | + /** |
|
145 | + * Verify incoming data contains what is needed for retrieving and parsing each other line item for a transaction. |
|
146 | + * |
|
147 | + * @since 4.5.0 |
|
148 | + * |
|
149 | + * @return string parsed other line item list. |
|
150 | + */ |
|
151 | + private function _get_additional_line_item_list() |
|
152 | + { |
|
153 | + |
|
154 | + $this->_validate_list_requirements(); |
|
155 | + |
|
156 | + if (! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
157 | + return ''; |
|
158 | + } |
|
159 | + |
|
160 | + // made it here so we're good to go. |
|
161 | + $valid_shortcodes = array('line_item'); |
|
162 | + $templates = $this->_data['template']; |
|
163 | + |
|
164 | + $additional_line_items = $this->_data['data']->additional_line_items; |
|
165 | + $line_item_list = ''; |
|
166 | + foreach ($additional_line_items as $line_item) { |
|
167 | + $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( |
|
168 | + $templates['additional_line_item_list'], |
|
169 | + $line_item, |
|
170 | + $valid_shortcodes, |
|
171 | + $this->_extra_data |
|
172 | + ); |
|
173 | + } |
|
174 | + |
|
175 | + |
|
176 | + return $line_item_list; |
|
177 | + } |
|
178 | + |
|
179 | + |
|
180 | + /** |
|
181 | + * Verify incoming data contains what is needed for retrieving and parsing each price modifier line item for a |
|
182 | + * parent ticket line item. |
|
183 | + * |
|
184 | + * @since 4.5.0 |
|
185 | + * |
|
186 | + * @return string parsed price modifier line item list. |
|
187 | + */ |
|
188 | + private function _get_price_mod_line_item_list() |
|
189 | + { |
|
190 | + $this->_validate_list_requirements(); |
|
191 | + |
|
192 | + if (! $this->_data['data'] instanceof EE_Line_Item) { |
|
193 | + return ''; |
|
194 | + } |
|
195 | + |
|
196 | + // made it here so we're good to go. |
|
197 | + $main_line_item = $this->_data['data']; |
|
198 | + $templates = $this->_extra_data['template']; |
|
199 | + $addressee_obj = $this->_extra_data['data']; |
|
200 | + |
|
201 | + $valid_shortcodes = array('line_item'); |
|
202 | + |
|
203 | + $main_line_item_id = $main_line_item->ID(); |
|
204 | + |
|
205 | + $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[ $main_line_item_id ]['children']) |
|
206 | + ? $addressee_obj->line_items_with_children[ $main_line_item_id ]['children'] : array(); |
|
207 | + |
|
208 | + $line_item_list = ''; |
|
209 | + |
|
210 | + foreach ($price_mod_line_items as $line_item) { |
|
211 | + $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( |
|
212 | + $templates['price_modifier_line_item_list'], |
|
213 | + $line_item, |
|
214 | + $valid_shortcodes, |
|
215 | + $this->_extra_data |
|
216 | + ); |
|
217 | + } |
|
218 | + |
|
219 | + return $line_item_list; |
|
220 | + } |
|
221 | 221 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | $this->_validate_list_requirements(); |
76 | 76 | |
77 | - if (! $this->_data['data'] instanceof EE_Ticket) { |
|
77 | + if ( ! $this->_data['data'] instanceof EE_Ticket) { |
|
78 | 78 | return ''; |
79 | 79 | } |
80 | 80 | |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | $addressee_obj = $this->_extra_data['data']; |
86 | 86 | |
87 | 87 | // made it here so we have an EE_Ticket, so we should have what we need. |
88 | - $ticket_line_item = isset($addressee_obj->tickets[ $ticket->ID() ]['line_item']) |
|
89 | - ? $addressee_obj->tickets[ $ticket->ID() ]['line_item'] : null; |
|
90 | - $sub_line_items = isset($addressee_obj->tickets[ $ticket->ID() ]['sub_line_items']) |
|
91 | - ? $addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'] : array(); |
|
88 | + $ticket_line_item = isset($addressee_obj->tickets[$ticket->ID()]['line_item']) |
|
89 | + ? $addressee_obj->tickets[$ticket->ID()]['line_item'] : null; |
|
90 | + $sub_line_items = isset($addressee_obj->tickets[$ticket->ID()]['sub_line_items']) |
|
91 | + ? $addressee_obj->tickets[$ticket->ID()]['sub_line_items'] : array(); |
|
92 | 92 | |
93 | 93 | $template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms'] |
94 | 94 | : $templates['ticket_line_item_pms']; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | $this->_validate_list_requirements(); |
121 | 121 | |
122 | - if (! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
122 | + if ( ! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
123 | 123 | return ''; |
124 | 124 | } |
125 | 125 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | $this->_validate_list_requirements(); |
155 | 155 | |
156 | - if (! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
156 | + if ( ! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
157 | 157 | return ''; |
158 | 158 | } |
159 | 159 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | { |
190 | 190 | $this->_validate_list_requirements(); |
191 | 191 | |
192 | - if (! $this->_data['data'] instanceof EE_Line_Item) { |
|
192 | + if ( ! $this->_data['data'] instanceof EE_Line_Item) { |
|
193 | 193 | return ''; |
194 | 194 | } |
195 | 195 | |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | |
203 | 203 | $main_line_item_id = $main_line_item->ID(); |
204 | 204 | |
205 | - $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[ $main_line_item_id ]['children']) |
|
206 | - ? $addressee_obj->line_items_with_children[ $main_line_item_id ]['children'] : array(); |
|
205 | + $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[$main_line_item_id]['children']) |
|
206 | + ? $addressee_obj->line_items_with_children[$main_line_item_id]['children'] : array(); |
|
207 | 207 | |
208 | 208 | $line_item_list = ''; |
209 | 209 |