@@ -18,225 +18,225 @@ |
||
18 | 18 | class EE_Recipient_List_Shortcodes extends EE_Shortcodes |
19 | 19 | { |
20 | 20 | |
21 | - public function __construct() |
|
22 | - { |
|
23 | - parent::__construct(); |
|
24 | - } |
|
25 | - |
|
26 | - |
|
27 | - protected function _init_props() |
|
28 | - { |
|
29 | - $this->label = __('Recipient List Shortcodes', 'event_espresso'); |
|
30 | - $this->description = __('All shortcodes specific to registrant recipients list type data.', 'event_espresso'); |
|
31 | - $this->_shortcodes = array( |
|
32 | - '[RECIPIENT_TICKET_LIST]' => __( |
|
33 | - 'Will output a list of tickets for the recipient of the email. Note, if the recipient is the Event Author, then this is blank.', |
|
34 | - 'event_espresso' |
|
35 | - ), |
|
36 | - '[RECIPIENT_DATETIME_LIST]' => __( |
|
37 | - 'Will output a list of datetimes that the person receiving this message has been registered for.', |
|
38 | - 'event_espresso' |
|
39 | - ), |
|
40 | - ); |
|
41 | - } |
|
42 | - |
|
43 | - |
|
44 | - protected function _parser($shortcode) |
|
45 | - { |
|
46 | - switch ($shortcode) { |
|
47 | - case '[RECIPIENT_TICKET_LIST]': |
|
48 | - return $this->_get_recipient_ticket_list(); |
|
49 | - break; |
|
50 | - |
|
51 | - case '[RECIPIENT_DATETIME_LIST]': |
|
52 | - return $this->_get_recipient_datetime_list(); |
|
53 | - break; |
|
54 | - } |
|
55 | - return ''; |
|
56 | - } |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * figure out what the incoming data is and then return the appropriate parsed value |
|
61 | - * |
|
62 | - * @return string |
|
63 | - */ |
|
64 | - private function _get_recipient_ticket_list() |
|
65 | - { |
|
66 | - $this->_validate_list_requirements(); |
|
67 | - |
|
68 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
69 | - return $this->_get_recipient_ticket_list_parsed($this->_data['data']); |
|
70 | - } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
71 | - return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data']); |
|
72 | - } else { |
|
73 | - return ''; |
|
74 | - } |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data) |
|
79 | - { |
|
80 | - // first get registrations just for this attendee. |
|
81 | - $att = $data->att_obj; |
|
82 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
83 | - $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
84 | - ? array($data->reg_obj) : $registrations_on_attendee; |
|
85 | - $tkts = array(); |
|
86 | - |
|
87 | - // if we're coming in from the main content then $this->_data['data'] is instanceof EE_Messages_Addressee. |
|
88 | - // which means we want to get tickets for all events this addressee is a part of. |
|
89 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
90 | - $valid_shortcodes = array( |
|
91 | - 'ticket', |
|
92 | - 'event_list', |
|
93 | - 'attendee_list', |
|
94 | - 'datetime_list', |
|
95 | - 'registration_details', |
|
96 | - 'attendee', |
|
97 | - 'recipient_details', |
|
98 | - ); |
|
99 | - $template = $this->_data['template']; |
|
100 | - |
|
101 | - // tickets will be tickets for all registrations on this attendee. |
|
102 | - foreach ($registrations_on_attendee as $reg) { |
|
103 | - if ($reg instanceof EE_Registration) { |
|
104 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
105 | - $data->registrations[ $reg->ID() ] |
|
106 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
107 | - ) ]['tkt_obj'] : null; |
|
108 | - if ($ticket instanceof EE_Ticket) { |
|
109 | - $tkts[ $ticket->ID() ] = $ticket; |
|
110 | - } |
|
111 | - } |
|
112 | - } |
|
113 | - } |
|
114 | - |
|
115 | - // if coming from the context of the event list parser, then let's return just the tickets for that event. |
|
116 | - $event = $this->_data['data']; |
|
117 | - if ($event instanceof EE_Event) { |
|
118 | - $valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee', 'recipient_details'); |
|
119 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
120 | - ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
121 | - // let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
122 | - $template = str_replace('[EVENT_LIST]', '', $template); |
|
123 | - // data will be tickets for this event for this recipient. |
|
124 | - foreach ($registrations_on_attendee as $reg) { |
|
125 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
126 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
127 | - $data->registrations[ $reg->ID() ] |
|
128 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
129 | - ) ]['tkt_obj'] : null; |
|
130 | - if ($ticket instanceof EE_Ticket) { |
|
131 | - $tkts[ $ticket->ID() ] = $ticket; |
|
132 | - } |
|
133 | - } |
|
134 | - } |
|
135 | - } |
|
136 | - |
|
137 | - $tkt_parsed = ''; |
|
138 | - foreach ($tkts as $ticket) { |
|
139 | - $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
140 | - $template, |
|
141 | - $ticket, |
|
142 | - $valid_shortcodes, |
|
143 | - $this->_extra_data |
|
144 | - ); |
|
145 | - } |
|
146 | - return $tkt_parsed; |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * figure out what the incoming data is and then return the appropriate parsed value |
|
152 | - * |
|
153 | - * @return string |
|
154 | - */ |
|
155 | - private function _get_recipient_datetime_list() |
|
156 | - { |
|
157 | - $this->_validate_list_requirements(); |
|
158 | - |
|
159 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
160 | - return $this->_get_recipient_datetime_list_parsed($this->_data['data']); |
|
161 | - } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
162 | - return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data']); |
|
163 | - } else { |
|
164 | - return ''; |
|
165 | - } |
|
166 | - } |
|
167 | - |
|
168 | - |
|
169 | - private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data) |
|
170 | - { |
|
171 | - // first get registrations just for this attendee. |
|
172 | - $att = $data->att_obj; |
|
173 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
174 | - $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
175 | - ? array($data->reg_obj) |
|
176 | - : $registrations_on_attendee; |
|
177 | - $valid_shortcodes = array('datetime', 'attendee', 'recipient_details'); |
|
178 | - $template = ''; |
|
179 | - $dtts = array(); |
|
180 | - |
|
181 | - // setup valid shortcodes depending on what the status of the $this->_data property is |
|
182 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
183 | - $template = $this->_data['template']; |
|
184 | - |
|
185 | - // dtts will be datetimes for all registrations on this attendee |
|
186 | - foreach ($registrations_on_attendee as $reg) { |
|
187 | - if ($reg instanceof EE_Registration) { |
|
188 | - $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
189 | - $data->registrations[ $reg->ID() ] |
|
190 | - ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
191 | - ) ]['dtt_objs'] : array(); |
|
192 | - $dtt_objs = (array) $dtt_objs; |
|
193 | - foreach ($dtt_objs as $dtt_obj) { |
|
194 | - if ($dtt_obj instanceof EE_Datetime) { |
|
195 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
196 | - } |
|
197 | - } |
|
198 | - } |
|
199 | - } |
|
200 | - } |
|
201 | - |
|
202 | - // if coming from the context of the event list parser, then let's just return the datetimes for the specific event. |
|
203 | - $event = $this->_data['data']; |
|
204 | - if ($event instanceof EE_Event) { |
|
205 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
206 | - ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
207 | - |
|
208 | - // data will be datetimes for this event for this recipient |
|
209 | - foreach ($registrations_on_attendee as $reg) { |
|
210 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
211 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
212 | - $data->registrations[ $reg->ID() ] |
|
213 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
214 | - ) ]['tkt_obj'] : null; |
|
215 | - if ($ticket instanceof EE_Ticket) { |
|
216 | - $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
217 | - $data->tickets[ $ticket->ID() ] |
|
218 | - ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
219 | - ) ]['dtt_objs'] : array(); |
|
220 | - $dtt_objs = (array) $dtt_objs; |
|
221 | - foreach ($dtt_objs as $dtt_obj) { |
|
222 | - if ($dtt_obj instanceof EE_Datetime) { |
|
223 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
224 | - } |
|
225 | - } |
|
226 | - } |
|
227 | - } |
|
228 | - } |
|
229 | - } |
|
230 | - |
|
231 | - $dtt_parsed = ''; |
|
232 | - foreach ($dtts as $datetime) { |
|
233 | - $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
234 | - $template, |
|
235 | - $datetime, |
|
236 | - $valid_shortcodes, |
|
237 | - $this->_extra_data |
|
238 | - ); |
|
239 | - } |
|
240 | - return $dtt_parsed; |
|
241 | - } |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + parent::__construct(); |
|
24 | + } |
|
25 | + |
|
26 | + |
|
27 | + protected function _init_props() |
|
28 | + { |
|
29 | + $this->label = __('Recipient List Shortcodes', 'event_espresso'); |
|
30 | + $this->description = __('All shortcodes specific to registrant recipients list type data.', 'event_espresso'); |
|
31 | + $this->_shortcodes = array( |
|
32 | + '[RECIPIENT_TICKET_LIST]' => __( |
|
33 | + 'Will output a list of tickets for the recipient of the email. Note, if the recipient is the Event Author, then this is blank.', |
|
34 | + 'event_espresso' |
|
35 | + ), |
|
36 | + '[RECIPIENT_DATETIME_LIST]' => __( |
|
37 | + 'Will output a list of datetimes that the person receiving this message has been registered for.', |
|
38 | + 'event_espresso' |
|
39 | + ), |
|
40 | + ); |
|
41 | + } |
|
42 | + |
|
43 | + |
|
44 | + protected function _parser($shortcode) |
|
45 | + { |
|
46 | + switch ($shortcode) { |
|
47 | + case '[RECIPIENT_TICKET_LIST]': |
|
48 | + return $this->_get_recipient_ticket_list(); |
|
49 | + break; |
|
50 | + |
|
51 | + case '[RECIPIENT_DATETIME_LIST]': |
|
52 | + return $this->_get_recipient_datetime_list(); |
|
53 | + break; |
|
54 | + } |
|
55 | + return ''; |
|
56 | + } |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * figure out what the incoming data is and then return the appropriate parsed value |
|
61 | + * |
|
62 | + * @return string |
|
63 | + */ |
|
64 | + private function _get_recipient_ticket_list() |
|
65 | + { |
|
66 | + $this->_validate_list_requirements(); |
|
67 | + |
|
68 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
69 | + return $this->_get_recipient_ticket_list_parsed($this->_data['data']); |
|
70 | + } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
71 | + return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data']); |
|
72 | + } else { |
|
73 | + return ''; |
|
74 | + } |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data) |
|
79 | + { |
|
80 | + // first get registrations just for this attendee. |
|
81 | + $att = $data->att_obj; |
|
82 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
83 | + $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
84 | + ? array($data->reg_obj) : $registrations_on_attendee; |
|
85 | + $tkts = array(); |
|
86 | + |
|
87 | + // if we're coming in from the main content then $this->_data['data'] is instanceof EE_Messages_Addressee. |
|
88 | + // which means we want to get tickets for all events this addressee is a part of. |
|
89 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
90 | + $valid_shortcodes = array( |
|
91 | + 'ticket', |
|
92 | + 'event_list', |
|
93 | + 'attendee_list', |
|
94 | + 'datetime_list', |
|
95 | + 'registration_details', |
|
96 | + 'attendee', |
|
97 | + 'recipient_details', |
|
98 | + ); |
|
99 | + $template = $this->_data['template']; |
|
100 | + |
|
101 | + // tickets will be tickets for all registrations on this attendee. |
|
102 | + foreach ($registrations_on_attendee as $reg) { |
|
103 | + if ($reg instanceof EE_Registration) { |
|
104 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
105 | + $data->registrations[ $reg->ID() ] |
|
106 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
107 | + ) ]['tkt_obj'] : null; |
|
108 | + if ($ticket instanceof EE_Ticket) { |
|
109 | + $tkts[ $ticket->ID() ] = $ticket; |
|
110 | + } |
|
111 | + } |
|
112 | + } |
|
113 | + } |
|
114 | + |
|
115 | + // if coming from the context of the event list parser, then let's return just the tickets for that event. |
|
116 | + $event = $this->_data['data']; |
|
117 | + if ($event instanceof EE_Event) { |
|
118 | + $valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee', 'recipient_details'); |
|
119 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
120 | + ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
121 | + // let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
122 | + $template = str_replace('[EVENT_LIST]', '', $template); |
|
123 | + // data will be tickets for this event for this recipient. |
|
124 | + foreach ($registrations_on_attendee as $reg) { |
|
125 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
126 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
127 | + $data->registrations[ $reg->ID() ] |
|
128 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
129 | + ) ]['tkt_obj'] : null; |
|
130 | + if ($ticket instanceof EE_Ticket) { |
|
131 | + $tkts[ $ticket->ID() ] = $ticket; |
|
132 | + } |
|
133 | + } |
|
134 | + } |
|
135 | + } |
|
136 | + |
|
137 | + $tkt_parsed = ''; |
|
138 | + foreach ($tkts as $ticket) { |
|
139 | + $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
140 | + $template, |
|
141 | + $ticket, |
|
142 | + $valid_shortcodes, |
|
143 | + $this->_extra_data |
|
144 | + ); |
|
145 | + } |
|
146 | + return $tkt_parsed; |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * figure out what the incoming data is and then return the appropriate parsed value |
|
152 | + * |
|
153 | + * @return string |
|
154 | + */ |
|
155 | + private function _get_recipient_datetime_list() |
|
156 | + { |
|
157 | + $this->_validate_list_requirements(); |
|
158 | + |
|
159 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
160 | + return $this->_get_recipient_datetime_list_parsed($this->_data['data']); |
|
161 | + } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
162 | + return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data']); |
|
163 | + } else { |
|
164 | + return ''; |
|
165 | + } |
|
166 | + } |
|
167 | + |
|
168 | + |
|
169 | + private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data) |
|
170 | + { |
|
171 | + // first get registrations just for this attendee. |
|
172 | + $att = $data->att_obj; |
|
173 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
174 | + $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
175 | + ? array($data->reg_obj) |
|
176 | + : $registrations_on_attendee; |
|
177 | + $valid_shortcodes = array('datetime', 'attendee', 'recipient_details'); |
|
178 | + $template = ''; |
|
179 | + $dtts = array(); |
|
180 | + |
|
181 | + // setup valid shortcodes depending on what the status of the $this->_data property is |
|
182 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
183 | + $template = $this->_data['template']; |
|
184 | + |
|
185 | + // dtts will be datetimes for all registrations on this attendee |
|
186 | + foreach ($registrations_on_attendee as $reg) { |
|
187 | + if ($reg instanceof EE_Registration) { |
|
188 | + $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
189 | + $data->registrations[ $reg->ID() ] |
|
190 | + ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
191 | + ) ]['dtt_objs'] : array(); |
|
192 | + $dtt_objs = (array) $dtt_objs; |
|
193 | + foreach ($dtt_objs as $dtt_obj) { |
|
194 | + if ($dtt_obj instanceof EE_Datetime) { |
|
195 | + $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
196 | + } |
|
197 | + } |
|
198 | + } |
|
199 | + } |
|
200 | + } |
|
201 | + |
|
202 | + // if coming from the context of the event list parser, then let's just return the datetimes for the specific event. |
|
203 | + $event = $this->_data['data']; |
|
204 | + if ($event instanceof EE_Event) { |
|
205 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
206 | + ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
207 | + |
|
208 | + // data will be datetimes for this event for this recipient |
|
209 | + foreach ($registrations_on_attendee as $reg) { |
|
210 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
211 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
212 | + $data->registrations[ $reg->ID() ] |
|
213 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
214 | + ) ]['tkt_obj'] : null; |
|
215 | + if ($ticket instanceof EE_Ticket) { |
|
216 | + $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
217 | + $data->tickets[ $ticket->ID() ] |
|
218 | + ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
219 | + ) ]['dtt_objs'] : array(); |
|
220 | + $dtt_objs = (array) $dtt_objs; |
|
221 | + foreach ($dtt_objs as $dtt_obj) { |
|
222 | + if ($dtt_obj instanceof EE_Datetime) { |
|
223 | + $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
224 | + } |
|
225 | + } |
|
226 | + } |
|
227 | + } |
|
228 | + } |
|
229 | + } |
|
230 | + |
|
231 | + $dtt_parsed = ''; |
|
232 | + foreach ($dtts as $datetime) { |
|
233 | + $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
234 | + $template, |
|
235 | + $datetime, |
|
236 | + $valid_shortcodes, |
|
237 | + $this->_extra_data |
|
238 | + ); |
|
239 | + } |
|
240 | + return $dtt_parsed; |
|
241 | + } |
|
242 | 242 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | // first get registrations just for this attendee. |
81 | 81 | $att = $data->att_obj; |
82 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
82 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : array(); |
|
83 | 83 | $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
84 | 84 | ? array($data->reg_obj) : $registrations_on_attendee; |
85 | 85 | $tkts = array(); |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | // tickets will be tickets for all registrations on this attendee. |
102 | 102 | foreach ($registrations_on_attendee as $reg) { |
103 | 103 | if ($reg instanceof EE_Registration) { |
104 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
105 | - $data->registrations[ $reg->ID() ] |
|
106 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
107 | - ) ]['tkt_obj'] : null; |
|
104 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
105 | + $data->registrations[$reg->ID()] |
|
106 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
107 | + )]['tkt_obj'] : null; |
|
108 | 108 | if ($ticket instanceof EE_Ticket) { |
109 | - $tkts[ $ticket->ID() ] = $ticket; |
|
109 | + $tkts[$ticket->ID()] = $ticket; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | // data will be tickets for this event for this recipient. |
124 | 124 | foreach ($registrations_on_attendee as $reg) { |
125 | 125 | if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
126 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
127 | - $data->registrations[ $reg->ID() ] |
|
128 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
129 | - ) ]['tkt_obj'] : null; |
|
126 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
127 | + $data->registrations[$reg->ID()] |
|
128 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
129 | + )]['tkt_obj'] : null; |
|
130 | 130 | if ($ticket instanceof EE_Ticket) { |
131 | - $tkts[ $ticket->ID() ] = $ticket; |
|
131 | + $tkts[$ticket->ID()] = $ticket; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | // first get registrations just for this attendee. |
172 | 172 | $att = $data->att_obj; |
173 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
173 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : array(); |
|
174 | 174 | $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
175 | 175 | ? array($data->reg_obj) |
176 | 176 | : $registrations_on_attendee; |
@@ -185,14 +185,14 @@ discard block |
||
185 | 185 | // dtts will be datetimes for all registrations on this attendee |
186 | 186 | foreach ($registrations_on_attendee as $reg) { |
187 | 187 | if ($reg instanceof EE_Registration) { |
188 | - $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
189 | - $data->registrations[ $reg->ID() ] |
|
190 | - ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
191 | - ) ]['dtt_objs'] : array(); |
|
188 | + $dtt_objs = isset($data->registrations[$reg->ID()]) && is_array( |
|
189 | + $data->registrations[$reg->ID()] |
|
190 | + ) && isset($data->registrations[$reg->ID()]['dtt_objs']) ? $data->registrations[$reg->ID( |
|
191 | + )]['dtt_objs'] : array(); |
|
192 | 192 | $dtt_objs = (array) $dtt_objs; |
193 | 193 | foreach ($dtt_objs as $dtt_obj) { |
194 | 194 | if ($dtt_obj instanceof EE_Datetime) { |
195 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
195 | + $dtts[$dtt_obj->ID()] = $dtt_obj; |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | } |
@@ -208,19 +208,19 @@ discard block |
||
208 | 208 | // data will be datetimes for this event for this recipient |
209 | 209 | foreach ($registrations_on_attendee as $reg) { |
210 | 210 | if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
211 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
212 | - $data->registrations[ $reg->ID() ] |
|
213 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
214 | - ) ]['tkt_obj'] : null; |
|
211 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
212 | + $data->registrations[$reg->ID()] |
|
213 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
214 | + )]['tkt_obj'] : null; |
|
215 | 215 | if ($ticket instanceof EE_Ticket) { |
216 | - $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
217 | - $data->tickets[ $ticket->ID() ] |
|
218 | - ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
219 | - ) ]['dtt_objs'] : array(); |
|
216 | + $dtt_objs = isset($data->tickets[$ticket->ID()]) && is_array( |
|
217 | + $data->tickets[$ticket->ID()] |
|
218 | + ) && isset($data->tickets[$ticket->ID()]['dtt_objs']) ? $data->tickets[$ticket->ID( |
|
219 | + )]['dtt_objs'] : array(); |
|
220 | 220 | $dtt_objs = (array) $dtt_objs; |
221 | 221 | foreach ($dtt_objs as $dtt_obj) { |
222 | 222 | if ($dtt_obj instanceof EE_Datetime) { |
223 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
223 | + $dtts[$dtt_obj->ID()] = $dtt_obj; |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | } |
@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.10.2.rc.027'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.10.2.rc.027'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |