@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | '', |
175 | 175 | 'tckt-slctr-tbl-td-qty cntr', |
176 | 176 | '', |
177 | - 'headers="quantity-' . $this->EVT_ID . '"' |
|
177 | + 'headers="quantity-'.$this->EVT_ID.'"' |
|
178 | 178 | ); |
179 | 179 | $this->setTicketStatusDisplay($remaining); |
180 | 180 | if (empty($this->ticket_status_display)) { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | '', |
241 | 241 | 'tckt-slctr-tbl-td-name', |
242 | 242 | '', |
243 | - 'headers="details-' . $this->EVT_ID . '"' |
|
243 | + 'headers="details-'.$this->EVT_ID.'"' |
|
244 | 244 | ); |
245 | 245 | $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
246 | 246 | $html .= $this->ticket_details->getShowHideLinks(); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | '', |
275 | 275 | 'tckt-slctr-tbl-td-price jst-rght', |
276 | 276 | '', |
277 | - 'headers="price-' . $this->EVT_ID . '"' |
|
277 | + 'headers="price-'.$this->EVT_ID.'"' |
|
278 | 278 | ); |
279 | 279 | $html .= \EEH_Template::format_currency($this->ticket_price); |
280 | 280 | $html .= $this->ticket->taxable() |
@@ -313,12 +313,12 @@ discard block |
||
313 | 313 | // display submit button since we have tickets available |
314 | 314 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
315 | 315 | $this->hidden_input_qty = false; |
316 | - $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
317 | - $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
318 | - $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>'; |
|
319 | - $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
320 | - $html .= ' id="' . $id . '"'; |
|
321 | - $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
316 | + $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row; |
|
317 | + $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">'; |
|
318 | + $html .= esc_html__('Select this ticket', 'event_espresso').'</label>'; |
|
319 | + $html .= '<input type="radio" name="tkt-slctr-qty-'.$this->EVT_ID.'"'; |
|
320 | + $html .= ' id="'.$id.'"'; |
|
321 | + $html .= ' class="ticket-selector-tbl-qty-slct" value="'.$this->row.'-1"'; |
|
322 | 322 | $html .= $this->total_tickets === 1 ? ' checked="checked"' : ''; |
323 | 323 | $html .= ' title=""/>'; |
324 | 324 | return $html; |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | // display submit button since we have tickets available |
337 | 337 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
338 | 338 | $this->hidden_input_qty = false; |
339 | - $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
340 | - $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
341 | - $html .= esc_html__('Quantity', 'event_espresso') . '</label>'; |
|
342 | - $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
343 | - $html .= ' id="' . $id . '"'; |
|
339 | + $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row; |
|
340 | + $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">'; |
|
341 | + $html .= esc_html__('Quantity', 'event_espresso').'</label>'; |
|
342 | + $html .= '<select name="tkt-slctr-qty-'.$this->EVT_ID.'[]"'; |
|
343 | + $html .= ' id="'.$id.'"'; |
|
344 | 344 | $html .= ' class="ticket-selector-tbl-qty-slct">'; |
345 | 345 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
346 | 346 | if ($this->min !== 0 && ! $this->ticket->required()) { |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | } |
349 | 349 | // offer ticket quantities from the min to the max |
350 | 350 | for ($i = $this->min; $i <= $this->max; $i++) { |
351 | - $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
351 | + $html .= '<option value="'.$i.'"> '.$i.' </option>'; |
|
352 | 352 | } |
353 | 353 | $html .= '</select>'; |
354 | 354 | return $html; |
@@ -366,10 +366,10 @@ discard block |
||
366 | 366 | $html = ''; |
367 | 367 | // depending on group reg we need to change the format for qty |
368 | 368 | if ($this->hidden_input_qty) { |
369 | - $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
369 | + $html .= '<input type="hidden" name="tkt-slctr-qty-'.$this->EVT_ID.'[]" value="0"/>'; |
|
370 | 370 | } |
371 | - $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
372 | - $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
371 | + $html .= '<input type="hidden" name="tkt-slctr-ticket-id-'.$this->EVT_ID.'[]"'; |
|
372 | + $html .= ' value="'.$this->ticket->ID().'"/>'; |
|
373 | 373 | return $html; |
374 | 374 | } |
375 | 375 | } |
@@ -17,356 +17,356 @@ |
||
17 | 17 | class TicketSelectorRowStandard extends TicketSelectorRow |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var TicketDetails $ticket_details |
|
22 | - */ |
|
23 | - protected $ticket_details; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var \EE_Ticket_Selector_Config $template_settings |
|
27 | - */ |
|
28 | - protected $template_settings; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var EE_Tax_Config $tax_settings |
|
32 | - */ |
|
33 | - protected $tax_settings; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var boolean $prices_displayed_including_taxes |
|
37 | - */ |
|
38 | - protected $prices_displayed_including_taxes; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var int $row |
|
42 | - */ |
|
43 | - protected $row; |
|
44 | - |
|
45 | - /** |
|
46 | - * @var int $cols |
|
47 | - */ |
|
48 | - protected $cols; |
|
49 | - |
|
50 | - /** |
|
51 | - * @var boolean $hidden_input_qty |
|
52 | - */ |
|
53 | - protected $hidden_input_qty; |
|
54 | - |
|
55 | - /** |
|
56 | - * @var string $ticket_datetime_classes |
|
57 | - */ |
|
58 | - protected $ticket_datetime_classes; |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * TicketDetails constructor. |
|
63 | - * |
|
64 | - * @param TicketDetails $ticket_details |
|
65 | - * @param EE_Tax_Config $tax_settings |
|
66 | - * @param int $total_tickets |
|
67 | - * @param int $max_attendees |
|
68 | - * @param int $row |
|
69 | - * @param int $cols |
|
70 | - * @param boolean $required_ticket_sold_out |
|
71 | - * @param string $event_status |
|
72 | - * @param string $ticket_datetime_classes |
|
73 | - * @throws EE_Error |
|
74 | - * @throws UnexpectedEntityException |
|
75 | - */ |
|
76 | - public function __construct( |
|
77 | - TicketDetails $ticket_details, |
|
78 | - EE_Tax_Config $tax_settings, |
|
79 | - $total_tickets, |
|
80 | - $max_attendees, |
|
81 | - $row, |
|
82 | - $cols, |
|
83 | - $required_ticket_sold_out, |
|
84 | - $event_status, |
|
85 | - $ticket_datetime_classes |
|
86 | - ) { |
|
87 | - $this->ticket_details = $ticket_details; |
|
88 | - $this->template_settings = $ticket_details->getTemplateSettings(); |
|
89 | - $this->tax_settings = $tax_settings; |
|
90 | - $this->row = $row; |
|
91 | - $this->cols = $cols; |
|
92 | - $this->ticket_datetime_classes = $ticket_datetime_classes; |
|
93 | - parent::__construct( |
|
94 | - $ticket_details->getTicket(), |
|
95 | - $max_attendees, |
|
96 | - $ticket_details->getDateFormat(), |
|
97 | - $event_status, |
|
98 | - $required_ticket_sold_out, |
|
99 | - $total_tickets |
|
100 | - ); |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - /** |
|
105 | - * other ticket rows will need to know if a required ticket is sold out, |
|
106 | - * so that they are not offered for sale |
|
107 | - * |
|
108 | - * @return boolean |
|
109 | - */ |
|
110 | - public function getRequiredTicketSoldOut() |
|
111 | - { |
|
112 | - return $this->required_ticket_sold_out; |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * @return int |
|
118 | - */ |
|
119 | - public function getCols() |
|
120 | - { |
|
121 | - return $this->cols; |
|
122 | - } |
|
123 | - |
|
124 | - |
|
125 | - /** |
|
126 | - * getHtml |
|
127 | - * |
|
128 | - * @return string |
|
129 | - * @throws EE_Error |
|
130 | - */ |
|
131 | - public function getHtml() |
|
132 | - { |
|
133 | - $this->min = 0; |
|
134 | - $this->max = $this->ticket->max(); |
|
135 | - $remaining = $this->ticket->remaining(); |
|
136 | - $this->setTicketMinAndMax($remaining); |
|
137 | - // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
|
138 | - $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining |
|
139 | - ? $this->ticket->start_date() |
|
140 | - : $this->required_ticket_sold_out; |
|
141 | - $this->setTicketPriceDetails(); |
|
142 | - $this->setTicketStatusClasses($remaining); |
|
143 | - $filtered_row_html = $this->getFilteredRowHtml(); |
|
144 | - if ($filtered_row_html !== false) { |
|
145 | - return $filtered_row_html; |
|
146 | - } |
|
147 | - $ticket_selector_row_html = EEH_HTML::tr( |
|
148 | - '', |
|
149 | - '', |
|
150 | - "tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} " |
|
151 | - . espresso_get_object_css_class($this->ticket) |
|
152 | - ); |
|
153 | - $filtered_row_content = $this->getFilteredRowContents(); |
|
154 | - if ($filtered_row_content !== false && $this->max_attendees === 1) { |
|
155 | - return $ticket_selector_row_html |
|
156 | - . $filtered_row_content |
|
157 | - . $this->ticketQtyAndIdHiddenInputs() |
|
158 | - . EEH_HTML::trx(); |
|
159 | - } |
|
160 | - if ($filtered_row_content !== false) { |
|
161 | - return $ticket_selector_row_html |
|
162 | - . $filtered_row_content |
|
163 | - . EEH_HTML::trx(); |
|
164 | - } |
|
165 | - $this->hidden_input_qty = $this->max_attendees > 1; |
|
166 | - |
|
167 | - $ticket_selector_row_html .= $this->ticketNameTableCell(); |
|
168 | - $ticket_selector_row_html .= $this->ticketPriceTableCell(); |
|
169 | - $ticket_selector_row_html .= EEH_HTML::td( |
|
170 | - '', |
|
171 | - '', |
|
172 | - 'tckt-slctr-tbl-td-qty cntr', |
|
173 | - '', |
|
174 | - 'headers="quantity-' . $this->EVT_ID . '"' |
|
175 | - ); |
|
176 | - $this->setTicketStatusDisplay($remaining); |
|
177 | - if (empty($this->ticket_status_display)) { |
|
178 | - if ($this->max_attendees === 1) { |
|
179 | - // only ONE attendee is allowed to register at a time |
|
180 | - $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister(); |
|
181 | - } elseif ($this->max > 0) { |
|
182 | - $ticket_selector_row_html .= $this->ticketQuantitySelector(); |
|
183 | - } |
|
184 | - } |
|
185 | - $ticket_selector_row_html .= $this->ticket_status_display; |
|
186 | - $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs(); |
|
187 | - $ticket_selector_row_html .= $this->ticket_details->display( |
|
188 | - $this->ticket_price, |
|
189 | - $remaining, |
|
190 | - $this->cols |
|
191 | - ); |
|
192 | - $ticket_selector_row_html .= EEH_HTML::tdx(); |
|
193 | - $ticket_selector_row_html .= EEH_HTML::trx(); |
|
194 | - |
|
195 | - |
|
196 | - $this->row++; |
|
197 | - return $ticket_selector_row_html; |
|
198 | - } |
|
199 | - |
|
200 | - |
|
201 | - /** |
|
202 | - * getTicketPriceDetails |
|
203 | - * |
|
204 | - * @return void |
|
205 | - * @throws EE_Error |
|
206 | - */ |
|
207 | - protected function setTicketPriceDetails() |
|
208 | - { |
|
209 | - $this->ticket_price = $this->tax_settings->prices_displayed_including_taxes |
|
210 | - ? $this->ticket->get_ticket_total_with_taxes() |
|
211 | - : $this->ticket->get_ticket_subtotal(); |
|
212 | - $this->ticket_bundle = false; |
|
213 | - $ticket_min = $this->ticket->min(); |
|
214 | - // for ticket bundles, set min and max qty the same |
|
215 | - if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) { |
|
216 | - $this->ticket_price *= $ticket_min; |
|
217 | - $this->ticket_bundle = true; |
|
218 | - } |
|
219 | - $this->ticket_price = apply_filters( |
|
220 | - 'FHEE__ticket_selector_chart_template__ticket_price', |
|
221 | - $this->ticket_price, |
|
222 | - $this->ticket |
|
223 | - ); |
|
224 | - } |
|
225 | - |
|
226 | - |
|
227 | - /** |
|
228 | - * ticketNameTableCell |
|
229 | - * |
|
230 | - * @return string |
|
231 | - * @throws EE_Error |
|
232 | - */ |
|
233 | - protected function ticketNameTableCell() |
|
234 | - { |
|
235 | - $html = EEH_HTML::td( |
|
236 | - '', |
|
237 | - '', |
|
238 | - 'tckt-slctr-tbl-td-name', |
|
239 | - '', |
|
240 | - 'headers="details-' . $this->EVT_ID . '"' |
|
241 | - ); |
|
242 | - $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
|
243 | - $html .= $this->ticket_details->getShowHideLinks(); |
|
244 | - if ($this->ticket->required()) { |
|
245 | - $html .= EEH_HTML::p( |
|
246 | - apply_filters( |
|
247 | - 'FHEE__ticket_selector_chart_template__ticket_required_message', |
|
248 | - esc_html__('This ticket is required and must be purchased.', 'event_espresso') |
|
249 | - ), |
|
250 | - '', |
|
251 | - 'ticket-required-pg' |
|
252 | - ); |
|
253 | - } |
|
254 | - $html .= EEH_HTML::tdx(); |
|
255 | - return $html; |
|
256 | - } |
|
257 | - |
|
258 | - |
|
259 | - /** |
|
260 | - * ticketPriceTableCell |
|
261 | - * |
|
262 | - * @return string |
|
263 | - * @throws EE_Error |
|
264 | - */ |
|
265 | - protected function ticketPriceTableCell() |
|
266 | - { |
|
267 | - $html = ''; |
|
268 | - if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
269 | - $html .= EEH_HTML::td( |
|
270 | - '', |
|
271 | - '', |
|
272 | - 'tckt-slctr-tbl-td-price jst-rght', |
|
273 | - '', |
|
274 | - 'headers="price-' . $this->EVT_ID . '"' |
|
275 | - ); |
|
276 | - $html .= \EEH_Template::format_currency($this->ticket_price); |
|
277 | - $html .= $this->ticket->taxable() |
|
278 | - ? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text') |
|
279 | - : ''; |
|
280 | - $html .= ' '; |
|
281 | - // phpcs:disable WordPress.WP.I18n.NoEmptyStrings |
|
282 | - $html .= EEH_HTML::span( |
|
283 | - $this->ticket_bundle |
|
284 | - ? apply_filters( |
|
285 | - 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', |
|
286 | - __(' / bundle', 'event_espresso') |
|
287 | - ) |
|
288 | - : apply_filters( |
|
289 | - 'FHEE__ticket_selector_chart_template__per_ticket_text', |
|
290 | - __('', 'event_espresso') |
|
291 | - ), |
|
292 | - '', |
|
293 | - 'smaller-text no-bold' |
|
294 | - ); |
|
295 | - $html .= ' '; |
|
296 | - $html .= EEH_HTML::tdx(); |
|
297 | - $this->cols++; |
|
298 | - } |
|
299 | - return $html; |
|
300 | - } |
|
301 | - |
|
302 | - |
|
303 | - /** |
|
304 | - * onlyOneAttendeeCanRegister |
|
305 | - * |
|
306 | - * @return string |
|
307 | - */ |
|
308 | - protected function onlyOneAttendeeCanRegister() |
|
309 | - { |
|
310 | - // display submit button since we have tickets available |
|
311 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
312 | - $this->hidden_input_qty = false; |
|
313 | - $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
314 | - $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
315 | - $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>'; |
|
316 | - $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
317 | - $html .= ' id="' . $id . '"'; |
|
318 | - $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
319 | - $html .= $this->total_tickets === 1 ? ' checked="checked"' : ''; |
|
320 | - $html .= ' title=""/>'; |
|
321 | - return $html; |
|
322 | - } |
|
323 | - |
|
324 | - |
|
325 | - /** |
|
326 | - * ticketQuantitySelector |
|
327 | - * |
|
328 | - * @return string |
|
329 | - * @throws EE_Error |
|
330 | - */ |
|
331 | - protected function ticketQuantitySelector() |
|
332 | - { |
|
333 | - // display submit button since we have tickets available |
|
334 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
335 | - $this->hidden_input_qty = false; |
|
336 | - $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
337 | - $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
338 | - $html .= esc_html__('Quantity', 'event_espresso') . '</label>'; |
|
339 | - $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
340 | - $html .= ' id="' . $id . '"'; |
|
341 | - $html .= ' class="ticket-selector-tbl-qty-slct">'; |
|
342 | - // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
|
343 | - if ($this->min !== 0 && ! $this->ticket->required()) { |
|
344 | - $html .= '<option value="0"> 0 </option>'; |
|
345 | - } |
|
346 | - // offer ticket quantities from the min to the max |
|
347 | - for ($i = $this->min; $i <= $this->max; $i++) { |
|
348 | - $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
349 | - } |
|
350 | - $html .= '</select>'; |
|
351 | - return $html; |
|
352 | - } |
|
353 | - |
|
354 | - |
|
355 | - /** |
|
356 | - * getHiddenInputs |
|
357 | - * |
|
358 | - * @return string |
|
359 | - * @throws EE_Error |
|
360 | - */ |
|
361 | - protected function ticketQtyAndIdHiddenInputs() |
|
362 | - { |
|
363 | - $html = ''; |
|
364 | - // depending on group reg we need to change the format for qty |
|
365 | - if ($this->hidden_input_qty) { |
|
366 | - $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
367 | - } |
|
368 | - $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
369 | - $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
370 | - return $html; |
|
371 | - } |
|
20 | + /** |
|
21 | + * @var TicketDetails $ticket_details |
|
22 | + */ |
|
23 | + protected $ticket_details; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var \EE_Ticket_Selector_Config $template_settings |
|
27 | + */ |
|
28 | + protected $template_settings; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var EE_Tax_Config $tax_settings |
|
32 | + */ |
|
33 | + protected $tax_settings; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var boolean $prices_displayed_including_taxes |
|
37 | + */ |
|
38 | + protected $prices_displayed_including_taxes; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var int $row |
|
42 | + */ |
|
43 | + protected $row; |
|
44 | + |
|
45 | + /** |
|
46 | + * @var int $cols |
|
47 | + */ |
|
48 | + protected $cols; |
|
49 | + |
|
50 | + /** |
|
51 | + * @var boolean $hidden_input_qty |
|
52 | + */ |
|
53 | + protected $hidden_input_qty; |
|
54 | + |
|
55 | + /** |
|
56 | + * @var string $ticket_datetime_classes |
|
57 | + */ |
|
58 | + protected $ticket_datetime_classes; |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * TicketDetails constructor. |
|
63 | + * |
|
64 | + * @param TicketDetails $ticket_details |
|
65 | + * @param EE_Tax_Config $tax_settings |
|
66 | + * @param int $total_tickets |
|
67 | + * @param int $max_attendees |
|
68 | + * @param int $row |
|
69 | + * @param int $cols |
|
70 | + * @param boolean $required_ticket_sold_out |
|
71 | + * @param string $event_status |
|
72 | + * @param string $ticket_datetime_classes |
|
73 | + * @throws EE_Error |
|
74 | + * @throws UnexpectedEntityException |
|
75 | + */ |
|
76 | + public function __construct( |
|
77 | + TicketDetails $ticket_details, |
|
78 | + EE_Tax_Config $tax_settings, |
|
79 | + $total_tickets, |
|
80 | + $max_attendees, |
|
81 | + $row, |
|
82 | + $cols, |
|
83 | + $required_ticket_sold_out, |
|
84 | + $event_status, |
|
85 | + $ticket_datetime_classes |
|
86 | + ) { |
|
87 | + $this->ticket_details = $ticket_details; |
|
88 | + $this->template_settings = $ticket_details->getTemplateSettings(); |
|
89 | + $this->tax_settings = $tax_settings; |
|
90 | + $this->row = $row; |
|
91 | + $this->cols = $cols; |
|
92 | + $this->ticket_datetime_classes = $ticket_datetime_classes; |
|
93 | + parent::__construct( |
|
94 | + $ticket_details->getTicket(), |
|
95 | + $max_attendees, |
|
96 | + $ticket_details->getDateFormat(), |
|
97 | + $event_status, |
|
98 | + $required_ticket_sold_out, |
|
99 | + $total_tickets |
|
100 | + ); |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + /** |
|
105 | + * other ticket rows will need to know if a required ticket is sold out, |
|
106 | + * so that they are not offered for sale |
|
107 | + * |
|
108 | + * @return boolean |
|
109 | + */ |
|
110 | + public function getRequiredTicketSoldOut() |
|
111 | + { |
|
112 | + return $this->required_ticket_sold_out; |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * @return int |
|
118 | + */ |
|
119 | + public function getCols() |
|
120 | + { |
|
121 | + return $this->cols; |
|
122 | + } |
|
123 | + |
|
124 | + |
|
125 | + /** |
|
126 | + * getHtml |
|
127 | + * |
|
128 | + * @return string |
|
129 | + * @throws EE_Error |
|
130 | + */ |
|
131 | + public function getHtml() |
|
132 | + { |
|
133 | + $this->min = 0; |
|
134 | + $this->max = $this->ticket->max(); |
|
135 | + $remaining = $this->ticket->remaining(); |
|
136 | + $this->setTicketMinAndMax($remaining); |
|
137 | + // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
|
138 | + $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining |
|
139 | + ? $this->ticket->start_date() |
|
140 | + : $this->required_ticket_sold_out; |
|
141 | + $this->setTicketPriceDetails(); |
|
142 | + $this->setTicketStatusClasses($remaining); |
|
143 | + $filtered_row_html = $this->getFilteredRowHtml(); |
|
144 | + if ($filtered_row_html !== false) { |
|
145 | + return $filtered_row_html; |
|
146 | + } |
|
147 | + $ticket_selector_row_html = EEH_HTML::tr( |
|
148 | + '', |
|
149 | + '', |
|
150 | + "tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} " |
|
151 | + . espresso_get_object_css_class($this->ticket) |
|
152 | + ); |
|
153 | + $filtered_row_content = $this->getFilteredRowContents(); |
|
154 | + if ($filtered_row_content !== false && $this->max_attendees === 1) { |
|
155 | + return $ticket_selector_row_html |
|
156 | + . $filtered_row_content |
|
157 | + . $this->ticketQtyAndIdHiddenInputs() |
|
158 | + . EEH_HTML::trx(); |
|
159 | + } |
|
160 | + if ($filtered_row_content !== false) { |
|
161 | + return $ticket_selector_row_html |
|
162 | + . $filtered_row_content |
|
163 | + . EEH_HTML::trx(); |
|
164 | + } |
|
165 | + $this->hidden_input_qty = $this->max_attendees > 1; |
|
166 | + |
|
167 | + $ticket_selector_row_html .= $this->ticketNameTableCell(); |
|
168 | + $ticket_selector_row_html .= $this->ticketPriceTableCell(); |
|
169 | + $ticket_selector_row_html .= EEH_HTML::td( |
|
170 | + '', |
|
171 | + '', |
|
172 | + 'tckt-slctr-tbl-td-qty cntr', |
|
173 | + '', |
|
174 | + 'headers="quantity-' . $this->EVT_ID . '"' |
|
175 | + ); |
|
176 | + $this->setTicketStatusDisplay($remaining); |
|
177 | + if (empty($this->ticket_status_display)) { |
|
178 | + if ($this->max_attendees === 1) { |
|
179 | + // only ONE attendee is allowed to register at a time |
|
180 | + $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister(); |
|
181 | + } elseif ($this->max > 0) { |
|
182 | + $ticket_selector_row_html .= $this->ticketQuantitySelector(); |
|
183 | + } |
|
184 | + } |
|
185 | + $ticket_selector_row_html .= $this->ticket_status_display; |
|
186 | + $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs(); |
|
187 | + $ticket_selector_row_html .= $this->ticket_details->display( |
|
188 | + $this->ticket_price, |
|
189 | + $remaining, |
|
190 | + $this->cols |
|
191 | + ); |
|
192 | + $ticket_selector_row_html .= EEH_HTML::tdx(); |
|
193 | + $ticket_selector_row_html .= EEH_HTML::trx(); |
|
194 | + |
|
195 | + |
|
196 | + $this->row++; |
|
197 | + return $ticket_selector_row_html; |
|
198 | + } |
|
199 | + |
|
200 | + |
|
201 | + /** |
|
202 | + * getTicketPriceDetails |
|
203 | + * |
|
204 | + * @return void |
|
205 | + * @throws EE_Error |
|
206 | + */ |
|
207 | + protected function setTicketPriceDetails() |
|
208 | + { |
|
209 | + $this->ticket_price = $this->tax_settings->prices_displayed_including_taxes |
|
210 | + ? $this->ticket->get_ticket_total_with_taxes() |
|
211 | + : $this->ticket->get_ticket_subtotal(); |
|
212 | + $this->ticket_bundle = false; |
|
213 | + $ticket_min = $this->ticket->min(); |
|
214 | + // for ticket bundles, set min and max qty the same |
|
215 | + if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) { |
|
216 | + $this->ticket_price *= $ticket_min; |
|
217 | + $this->ticket_bundle = true; |
|
218 | + } |
|
219 | + $this->ticket_price = apply_filters( |
|
220 | + 'FHEE__ticket_selector_chart_template__ticket_price', |
|
221 | + $this->ticket_price, |
|
222 | + $this->ticket |
|
223 | + ); |
|
224 | + } |
|
225 | + |
|
226 | + |
|
227 | + /** |
|
228 | + * ticketNameTableCell |
|
229 | + * |
|
230 | + * @return string |
|
231 | + * @throws EE_Error |
|
232 | + */ |
|
233 | + protected function ticketNameTableCell() |
|
234 | + { |
|
235 | + $html = EEH_HTML::td( |
|
236 | + '', |
|
237 | + '', |
|
238 | + 'tckt-slctr-tbl-td-name', |
|
239 | + '', |
|
240 | + 'headers="details-' . $this->EVT_ID . '"' |
|
241 | + ); |
|
242 | + $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
|
243 | + $html .= $this->ticket_details->getShowHideLinks(); |
|
244 | + if ($this->ticket->required()) { |
|
245 | + $html .= EEH_HTML::p( |
|
246 | + apply_filters( |
|
247 | + 'FHEE__ticket_selector_chart_template__ticket_required_message', |
|
248 | + esc_html__('This ticket is required and must be purchased.', 'event_espresso') |
|
249 | + ), |
|
250 | + '', |
|
251 | + 'ticket-required-pg' |
|
252 | + ); |
|
253 | + } |
|
254 | + $html .= EEH_HTML::tdx(); |
|
255 | + return $html; |
|
256 | + } |
|
257 | + |
|
258 | + |
|
259 | + /** |
|
260 | + * ticketPriceTableCell |
|
261 | + * |
|
262 | + * @return string |
|
263 | + * @throws EE_Error |
|
264 | + */ |
|
265 | + protected function ticketPriceTableCell() |
|
266 | + { |
|
267 | + $html = ''; |
|
268 | + if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
269 | + $html .= EEH_HTML::td( |
|
270 | + '', |
|
271 | + '', |
|
272 | + 'tckt-slctr-tbl-td-price jst-rght', |
|
273 | + '', |
|
274 | + 'headers="price-' . $this->EVT_ID . '"' |
|
275 | + ); |
|
276 | + $html .= \EEH_Template::format_currency($this->ticket_price); |
|
277 | + $html .= $this->ticket->taxable() |
|
278 | + ? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text') |
|
279 | + : ''; |
|
280 | + $html .= ' '; |
|
281 | + // phpcs:disable WordPress.WP.I18n.NoEmptyStrings |
|
282 | + $html .= EEH_HTML::span( |
|
283 | + $this->ticket_bundle |
|
284 | + ? apply_filters( |
|
285 | + 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', |
|
286 | + __(' / bundle', 'event_espresso') |
|
287 | + ) |
|
288 | + : apply_filters( |
|
289 | + 'FHEE__ticket_selector_chart_template__per_ticket_text', |
|
290 | + __('', 'event_espresso') |
|
291 | + ), |
|
292 | + '', |
|
293 | + 'smaller-text no-bold' |
|
294 | + ); |
|
295 | + $html .= ' '; |
|
296 | + $html .= EEH_HTML::tdx(); |
|
297 | + $this->cols++; |
|
298 | + } |
|
299 | + return $html; |
|
300 | + } |
|
301 | + |
|
302 | + |
|
303 | + /** |
|
304 | + * onlyOneAttendeeCanRegister |
|
305 | + * |
|
306 | + * @return string |
|
307 | + */ |
|
308 | + protected function onlyOneAttendeeCanRegister() |
|
309 | + { |
|
310 | + // display submit button since we have tickets available |
|
311 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
312 | + $this->hidden_input_qty = false; |
|
313 | + $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
314 | + $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
315 | + $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>'; |
|
316 | + $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
317 | + $html .= ' id="' . $id . '"'; |
|
318 | + $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
319 | + $html .= $this->total_tickets === 1 ? ' checked="checked"' : ''; |
|
320 | + $html .= ' title=""/>'; |
|
321 | + return $html; |
|
322 | + } |
|
323 | + |
|
324 | + |
|
325 | + /** |
|
326 | + * ticketQuantitySelector |
|
327 | + * |
|
328 | + * @return string |
|
329 | + * @throws EE_Error |
|
330 | + */ |
|
331 | + protected function ticketQuantitySelector() |
|
332 | + { |
|
333 | + // display submit button since we have tickets available |
|
334 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
335 | + $this->hidden_input_qty = false; |
|
336 | + $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
337 | + $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
338 | + $html .= esc_html__('Quantity', 'event_espresso') . '</label>'; |
|
339 | + $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
340 | + $html .= ' id="' . $id . '"'; |
|
341 | + $html .= ' class="ticket-selector-tbl-qty-slct">'; |
|
342 | + // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
|
343 | + if ($this->min !== 0 && ! $this->ticket->required()) { |
|
344 | + $html .= '<option value="0"> 0 </option>'; |
|
345 | + } |
|
346 | + // offer ticket quantities from the min to the max |
|
347 | + for ($i = $this->min; $i <= $this->max; $i++) { |
|
348 | + $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
349 | + } |
|
350 | + $html .= '</select>'; |
|
351 | + return $html; |
|
352 | + } |
|
353 | + |
|
354 | + |
|
355 | + /** |
|
356 | + * getHiddenInputs |
|
357 | + * |
|
358 | + * @return string |
|
359 | + * @throws EE_Error |
|
360 | + */ |
|
361 | + protected function ticketQtyAndIdHiddenInputs() |
|
362 | + { |
|
363 | + $html = ''; |
|
364 | + // depending on group reg we need to change the format for qty |
|
365 | + if ($this->hidden_input_qty) { |
|
366 | + $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
367 | + } |
|
368 | + $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
369 | + $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
370 | + return $html; |
|
371 | + } |
|
372 | 372 | } |
@@ -14,24 +14,24 @@ |
||
14 | 14 | class TicketSelectorIframeEmbedButton extends IframeEmbedButton |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * TicketSelectorIframeEmbedButton constructor. |
|
19 | - */ |
|
20 | - public function __construct() |
|
21 | - { |
|
22 | - parent::__construct( |
|
23 | - esc_html__('Ticket Selector', 'event_espresso'), |
|
24 | - 'ticket_selector' |
|
25 | - ); |
|
26 | - } |
|
17 | + /** |
|
18 | + * TicketSelectorIframeEmbedButton constructor. |
|
19 | + */ |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + parent::__construct( |
|
23 | + esc_html__('Ticket Selector', 'event_espresso'), |
|
24 | + 'ticket_selector' |
|
25 | + ); |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * Adds an iframe embed code button to the Event editor. |
|
31 | - */ |
|
32 | - public function addEventEditorIframeEmbedButton() |
|
33 | - { |
|
34 | - // add button for iframe code to event editor. |
|
35 | - $this->addEventEditorIframeEmbedButtonFilter(); |
|
36 | - } |
|
29 | + /** |
|
30 | + * Adds an iframe embed code button to the Event editor. |
|
31 | + */ |
|
32 | + public function addEventEditorIframeEmbedButton() |
|
33 | + { |
|
34 | + // add button for iframe code to event editor. |
|
35 | + $this->addEventEditorIframeEmbedButtonFilter(); |
|
36 | + } |
|
37 | 37 | } |
@@ -14,26 +14,26 @@ |
||
14 | 14 | class TicketSelectorRowSimple extends TicketSelectorRow |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @throws EE_Error |
|
19 | - */ |
|
20 | - public function setupTicketStatusDisplay() |
|
21 | - { |
|
22 | - $remaining = $this->ticket->remaining(); |
|
23 | - $this->setTicketMinAndMax($remaining); |
|
24 | - $this->setTicketStatusClasses($remaining); |
|
25 | - $this->setTicketStatusDisplay($remaining); |
|
26 | - } |
|
17 | + /** |
|
18 | + * @throws EE_Error |
|
19 | + */ |
|
20 | + public function setupTicketStatusDisplay() |
|
21 | + { |
|
22 | + $remaining = $this->ticket->remaining(); |
|
23 | + $this->setTicketMinAndMax($remaining); |
|
24 | + $this->setTicketStatusClasses($remaining); |
|
25 | + $this->setTicketStatusDisplay($remaining); |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | - public function getTicketDescription() |
|
30 | - { |
|
31 | - $filtered_row_content = $this->getFilteredRowContents(); |
|
32 | - if ($filtered_row_content !== false) { |
|
33 | - remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
34 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_false'); |
|
35 | - return $filtered_row_content; |
|
36 | - } |
|
37 | - return $this->ticket->description(); |
|
38 | - } |
|
29 | + public function getTicketDescription() |
|
30 | + { |
|
31 | + $filtered_row_content = $this->getFilteredRowContents(); |
|
32 | + if ($filtered_row_content !== false) { |
|
33 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
34 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_false'); |
|
35 | + return $filtered_row_content; |
|
36 | + } |
|
37 | + return $this->ticket->description(); |
|
38 | + } |
|
39 | 39 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $this |
61 | 61 | ) |
62 | 62 | ); |
63 | - if (! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
63 | + if ( ! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
64 | 64 | $this->addStylesheets(array('site_theme' => '')); |
65 | 65 | } |
66 | 66 | $this->addScripts( |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | array(), |
80 | 80 | $this |
81 | 81 | ); |
82 | - if (! empty($js_attributes)) { |
|
82 | + if ( ! empty($js_attributes)) { |
|
83 | 83 | $this->addScriptAttributes($js_attributes); |
84 | 84 | } |
85 | 85 | $this->addLocalizedVars( |
@@ -23,83 +23,83 @@ |
||
23 | 23 | class TicketSelectorIframe extends Iframe |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * TicketSelectorIframe constructor. |
|
28 | - * |
|
29 | - * @throws InvalidArgumentException |
|
30 | - * @throws InvalidInterfaceException |
|
31 | - * @throws InvalidDataTypeException |
|
32 | - * @throws DomainException |
|
33 | - * @throws EE_Error |
|
34 | - * @throws ReflectionException |
|
35 | - */ |
|
36 | - public function __construct() |
|
37 | - { |
|
38 | - EE_Registry::instance()->REQ->set_espresso_page(true); |
|
39 | - /** @type \EEM_Event $EEM_Event */ |
|
40 | - $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
41 | - $event = $EEM_Event->get_one_by_ID( |
|
42 | - EE_Registry::instance()->REQ->get('event', 0) |
|
43 | - ); |
|
44 | - $ticket_selector = LoaderFactory::getLoader()->getShared( |
|
45 | - DisplayTicketSelector::class, |
|
46 | - [null, true] |
|
47 | - ); |
|
48 | - parent::__construct( |
|
49 | - esc_html__('Ticket Selector', 'event_espresso'), |
|
50 | - $ticket_selector->display($event) |
|
51 | - ); |
|
52 | - $this->addStylesheets( |
|
53 | - apply_filters( |
|
54 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
55 | - array( |
|
56 | - 'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL |
|
57 | - . 'ticket_selector_embed.css?ver=' |
|
58 | - . EVENT_ESPRESSO_VERSION, |
|
59 | - 'ticket_selector' => TICKET_SELECTOR_ASSETS_URL |
|
60 | - . 'ticket_selector.css?ver=' |
|
61 | - . EVENT_ESPRESSO_VERSION, |
|
62 | - ), |
|
63 | - $this |
|
64 | - ) |
|
65 | - ); |
|
66 | - if (! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
67 | - $this->addStylesheets(array('site_theme' => '')); |
|
68 | - } |
|
69 | - $this->addScripts( |
|
70 | - apply_filters( |
|
71 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
72 | - array( |
|
73 | - 'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL |
|
74 | - . 'ticket_selector_iframe_embed.js?ver=' |
|
75 | - . EVENT_ESPRESSO_VERSION, |
|
76 | - ), |
|
77 | - $this |
|
78 | - ) |
|
79 | - ); |
|
80 | - $js_attributes = apply_filters( |
|
81 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__js_attributes', |
|
82 | - array(), |
|
83 | - $this |
|
84 | - ); |
|
85 | - if (! empty($js_attributes)) { |
|
86 | - $this->addScriptAttributes($js_attributes); |
|
87 | - } |
|
88 | - $this->addLocalizedVars( |
|
89 | - apply_filters( |
|
90 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__localized_vars', |
|
91 | - array( |
|
92 | - 'ticket_selector_iframe' => true, |
|
93 | - 'EEDTicketSelectorMsg' => __( |
|
94 | - 'Please choose at least one ticket before continuing.', |
|
95 | - 'event_espresso' |
|
96 | - ), |
|
97 | - ) |
|
98 | - ) |
|
99 | - ); |
|
100 | - do_action( |
|
101 | - 'AHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__complete', |
|
102 | - $this |
|
103 | - ); |
|
104 | - } |
|
26 | + /** |
|
27 | + * TicketSelectorIframe constructor. |
|
28 | + * |
|
29 | + * @throws InvalidArgumentException |
|
30 | + * @throws InvalidInterfaceException |
|
31 | + * @throws InvalidDataTypeException |
|
32 | + * @throws DomainException |
|
33 | + * @throws EE_Error |
|
34 | + * @throws ReflectionException |
|
35 | + */ |
|
36 | + public function __construct() |
|
37 | + { |
|
38 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
39 | + /** @type \EEM_Event $EEM_Event */ |
|
40 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
41 | + $event = $EEM_Event->get_one_by_ID( |
|
42 | + EE_Registry::instance()->REQ->get('event', 0) |
|
43 | + ); |
|
44 | + $ticket_selector = LoaderFactory::getLoader()->getShared( |
|
45 | + DisplayTicketSelector::class, |
|
46 | + [null, true] |
|
47 | + ); |
|
48 | + parent::__construct( |
|
49 | + esc_html__('Ticket Selector', 'event_espresso'), |
|
50 | + $ticket_selector->display($event) |
|
51 | + ); |
|
52 | + $this->addStylesheets( |
|
53 | + apply_filters( |
|
54 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
55 | + array( |
|
56 | + 'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL |
|
57 | + . 'ticket_selector_embed.css?ver=' |
|
58 | + . EVENT_ESPRESSO_VERSION, |
|
59 | + 'ticket_selector' => TICKET_SELECTOR_ASSETS_URL |
|
60 | + . 'ticket_selector.css?ver=' |
|
61 | + . EVENT_ESPRESSO_VERSION, |
|
62 | + ), |
|
63 | + $this |
|
64 | + ) |
|
65 | + ); |
|
66 | + if (! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
67 | + $this->addStylesheets(array('site_theme' => '')); |
|
68 | + } |
|
69 | + $this->addScripts( |
|
70 | + apply_filters( |
|
71 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
72 | + array( |
|
73 | + 'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL |
|
74 | + . 'ticket_selector_iframe_embed.js?ver=' |
|
75 | + . EVENT_ESPRESSO_VERSION, |
|
76 | + ), |
|
77 | + $this |
|
78 | + ) |
|
79 | + ); |
|
80 | + $js_attributes = apply_filters( |
|
81 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__js_attributes', |
|
82 | + array(), |
|
83 | + $this |
|
84 | + ); |
|
85 | + if (! empty($js_attributes)) { |
|
86 | + $this->addScriptAttributes($js_attributes); |
|
87 | + } |
|
88 | + $this->addLocalizedVars( |
|
89 | + apply_filters( |
|
90 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__localized_vars', |
|
91 | + array( |
|
92 | + 'ticket_selector_iframe' => true, |
|
93 | + 'EEDTicketSelectorMsg' => __( |
|
94 | + 'Please choose at least one ticket before continuing.', |
|
95 | + 'event_espresso' |
|
96 | + ), |
|
97 | + ) |
|
98 | + ) |
|
99 | + ); |
|
100 | + do_action( |
|
101 | + 'AHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__complete', |
|
102 | + $this |
|
103 | + ); |
|
104 | + } |
|
105 | 105 | } |
@@ -15,186 +15,186 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * @var \EE_Ticket $ticket |
|
20 | - */ |
|
21 | - protected $ticket; |
|
22 | - |
|
23 | - /** |
|
24 | - * @var \EE_Ticket_Selector_Config $template_settings |
|
25 | - */ |
|
26 | - protected $template_settings; |
|
27 | - |
|
28 | - /** |
|
29 | - * @var string $date_format |
|
30 | - */ |
|
31 | - protected $date_format; |
|
32 | - |
|
33 | - /** |
|
34 | - * @var string $time_format |
|
35 | - */ |
|
36 | - protected $time_format; |
|
37 | - |
|
38 | - /** |
|
39 | - * @var boolean $event_is_expired |
|
40 | - */ |
|
41 | - protected $event_is_expired; |
|
42 | - |
|
43 | - |
|
44 | - /** |
|
45 | - * TicketDetails constructor. |
|
46 | - * |
|
47 | - * @param \EE_Ticket $ticket |
|
48 | - * @param \EE_Ticket_Selector_Config $template_settings |
|
49 | - * @param array $template_args |
|
50 | - */ |
|
51 | - public function __construct( |
|
52 | - \EE_Ticket $ticket, |
|
53 | - \EE_Ticket_Selector_Config $template_settings, |
|
54 | - array $template_args |
|
55 | - ) { |
|
56 | - $this->ticket = $ticket; |
|
57 | - $this->template_settings = $template_settings; |
|
58 | - $this->date_format = $template_args['date_format']; |
|
59 | - $this->time_format = $template_args['time_format']; |
|
60 | - $this->event_is_expired = $template_args['event_is_expired']; |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * @return \EE_Ticket |
|
66 | - */ |
|
67 | - public function getTicket() |
|
68 | - { |
|
69 | - return $this->ticket; |
|
70 | - } |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * @return bool |
|
75 | - */ |
|
76 | - public function showTicketDetails() |
|
77 | - { |
|
78 | - return $this->template_settings->show_ticket_details; |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - /** |
|
83 | - * @return \EE_Ticket_Selector_Config |
|
84 | - */ |
|
85 | - public function getTemplateSettings() |
|
86 | - { |
|
87 | - return $this->template_settings; |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * @return string |
|
93 | - */ |
|
94 | - public function getDateFormat() |
|
95 | - { |
|
96 | - return $this->date_format; |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - public function getTimeFormat() |
|
104 | - { |
|
105 | - return $this->time_format; |
|
106 | - } |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * @return string |
|
111 | - */ |
|
112 | - public function getShowHideLinks() |
|
113 | - { |
|
114 | - if (! $this->showTicketDetails()) { |
|
115 | - return ''; |
|
116 | - } |
|
117 | - return \EEH_HTML::link( |
|
118 | - '', |
|
119 | - sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
120 | - esc_attr( |
|
121 | - apply_filters( |
|
122 | - 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
123 | - __('click to show additional ticket details', 'event_espresso') |
|
124 | - ) |
|
125 | - ), |
|
126 | - "display-{$this->cssId()}", |
|
127 | - 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
128 | - '', |
|
129 | - 'rel="' . $this->cssId() . '"' |
|
130 | - ) . \EEH_HTML::link( |
|
131 | - '', |
|
132 | - sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
133 | - esc_attr( |
|
134 | - apply_filters( |
|
135 | - 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
136 | - __('click to hide additional ticket details', 'event_espresso') |
|
137 | - ) |
|
138 | - ), |
|
139 | - "hide-{$this->cssId()}", |
|
140 | - 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
141 | - 'display:none;', |
|
142 | - 'rel="' . $this->cssId() . '"' |
|
143 | - ); |
|
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - /** |
|
148 | - * @return string |
|
149 | - */ |
|
150 | - public function cssId() |
|
151 | - { |
|
152 | - return apply_filters( |
|
153 | - 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
154 | - "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
155 | - ); |
|
156 | - } |
|
157 | - |
|
158 | - |
|
159 | - /** |
|
160 | - * @param float $ticket_price |
|
161 | - * @param int $remaining |
|
162 | - * @param int $cols |
|
163 | - * @return string |
|
164 | - */ |
|
165 | - public function display( |
|
166 | - $ticket_price = 0.00, |
|
167 | - $remaining, |
|
168 | - $cols = 2 |
|
169 | - ) { |
|
170 | - $template_args = array(); |
|
171 | - $template_args['ticket'] = $this->ticket; |
|
172 | - $template_args['ticket_price'] = $ticket_price; |
|
173 | - $template_args['remaining'] = $remaining; |
|
174 | - $template_args['cols'] = $cols; |
|
175 | - $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
176 | - $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
177 | - $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
178 | - $template_args['ticket_details_css_id'] = $this->cssId(); |
|
179 | - $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
180 | - 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
181 | - true |
|
182 | - ); |
|
183 | - $template_args['price_breakdown_heading'] = apply_filters( |
|
184 | - 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
185 | - esc_html__('Price', 'event_espresso') |
|
186 | - ); |
|
187 | - $template_args['date_format'] = $this->date_format; |
|
188 | - $template_args['time_format'] = $this->time_format; |
|
189 | - $template_args['event_is_expired'] = $this->event_is_expired; |
|
190 | - |
|
191 | - return \EEH_Template::locate_template( |
|
192 | - apply_filters( |
|
193 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
194 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
195 | - $this->ticket |
|
196 | - ), |
|
197 | - $template_args |
|
198 | - ); |
|
199 | - } |
|
18 | + /** |
|
19 | + * @var \EE_Ticket $ticket |
|
20 | + */ |
|
21 | + protected $ticket; |
|
22 | + |
|
23 | + /** |
|
24 | + * @var \EE_Ticket_Selector_Config $template_settings |
|
25 | + */ |
|
26 | + protected $template_settings; |
|
27 | + |
|
28 | + /** |
|
29 | + * @var string $date_format |
|
30 | + */ |
|
31 | + protected $date_format; |
|
32 | + |
|
33 | + /** |
|
34 | + * @var string $time_format |
|
35 | + */ |
|
36 | + protected $time_format; |
|
37 | + |
|
38 | + /** |
|
39 | + * @var boolean $event_is_expired |
|
40 | + */ |
|
41 | + protected $event_is_expired; |
|
42 | + |
|
43 | + |
|
44 | + /** |
|
45 | + * TicketDetails constructor. |
|
46 | + * |
|
47 | + * @param \EE_Ticket $ticket |
|
48 | + * @param \EE_Ticket_Selector_Config $template_settings |
|
49 | + * @param array $template_args |
|
50 | + */ |
|
51 | + public function __construct( |
|
52 | + \EE_Ticket $ticket, |
|
53 | + \EE_Ticket_Selector_Config $template_settings, |
|
54 | + array $template_args |
|
55 | + ) { |
|
56 | + $this->ticket = $ticket; |
|
57 | + $this->template_settings = $template_settings; |
|
58 | + $this->date_format = $template_args['date_format']; |
|
59 | + $this->time_format = $template_args['time_format']; |
|
60 | + $this->event_is_expired = $template_args['event_is_expired']; |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * @return \EE_Ticket |
|
66 | + */ |
|
67 | + public function getTicket() |
|
68 | + { |
|
69 | + return $this->ticket; |
|
70 | + } |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * @return bool |
|
75 | + */ |
|
76 | + public function showTicketDetails() |
|
77 | + { |
|
78 | + return $this->template_settings->show_ticket_details; |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + /** |
|
83 | + * @return \EE_Ticket_Selector_Config |
|
84 | + */ |
|
85 | + public function getTemplateSettings() |
|
86 | + { |
|
87 | + return $this->template_settings; |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * @return string |
|
93 | + */ |
|
94 | + public function getDateFormat() |
|
95 | + { |
|
96 | + return $this->date_format; |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + public function getTimeFormat() |
|
104 | + { |
|
105 | + return $this->time_format; |
|
106 | + } |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * @return string |
|
111 | + */ |
|
112 | + public function getShowHideLinks() |
|
113 | + { |
|
114 | + if (! $this->showTicketDetails()) { |
|
115 | + return ''; |
|
116 | + } |
|
117 | + return \EEH_HTML::link( |
|
118 | + '', |
|
119 | + sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
120 | + esc_attr( |
|
121 | + apply_filters( |
|
122 | + 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
123 | + __('click to show additional ticket details', 'event_espresso') |
|
124 | + ) |
|
125 | + ), |
|
126 | + "display-{$this->cssId()}", |
|
127 | + 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
128 | + '', |
|
129 | + 'rel="' . $this->cssId() . '"' |
|
130 | + ) . \EEH_HTML::link( |
|
131 | + '', |
|
132 | + sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
133 | + esc_attr( |
|
134 | + apply_filters( |
|
135 | + 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
136 | + __('click to hide additional ticket details', 'event_espresso') |
|
137 | + ) |
|
138 | + ), |
|
139 | + "hide-{$this->cssId()}", |
|
140 | + 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
141 | + 'display:none;', |
|
142 | + 'rel="' . $this->cssId() . '"' |
|
143 | + ); |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + /** |
|
148 | + * @return string |
|
149 | + */ |
|
150 | + public function cssId() |
|
151 | + { |
|
152 | + return apply_filters( |
|
153 | + 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
154 | + "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
155 | + ); |
|
156 | + } |
|
157 | + |
|
158 | + |
|
159 | + /** |
|
160 | + * @param float $ticket_price |
|
161 | + * @param int $remaining |
|
162 | + * @param int $cols |
|
163 | + * @return string |
|
164 | + */ |
|
165 | + public function display( |
|
166 | + $ticket_price = 0.00, |
|
167 | + $remaining, |
|
168 | + $cols = 2 |
|
169 | + ) { |
|
170 | + $template_args = array(); |
|
171 | + $template_args['ticket'] = $this->ticket; |
|
172 | + $template_args['ticket_price'] = $ticket_price; |
|
173 | + $template_args['remaining'] = $remaining; |
|
174 | + $template_args['cols'] = $cols; |
|
175 | + $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
176 | + $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
177 | + $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
178 | + $template_args['ticket_details_css_id'] = $this->cssId(); |
|
179 | + $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
180 | + 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
181 | + true |
|
182 | + ); |
|
183 | + $template_args['price_breakdown_heading'] = apply_filters( |
|
184 | + 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
185 | + esc_html__('Price', 'event_espresso') |
|
186 | + ); |
|
187 | + $template_args['date_format'] = $this->date_format; |
|
188 | + $template_args['time_format'] = $this->time_format; |
|
189 | + $template_args['event_is_expired'] = $this->event_is_expired; |
|
190 | + |
|
191 | + return \EEH_Template::locate_template( |
|
192 | + apply_filters( |
|
193 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
194 | + TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
195 | + $this->ticket |
|
196 | + ), |
|
197 | + $template_args |
|
198 | + ); |
|
199 | + } |
|
200 | 200 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function getShowHideLinks() |
113 | 113 | { |
114 | - if (! $this->showTicketDetails()) { |
|
114 | + if ( ! $this->showTicketDetails()) { |
|
115 | 115 | return ''; |
116 | 116 | } |
117 | 117 | return \EEH_HTML::link( |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | "display-{$this->cssId()}", |
127 | 127 | 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
128 | 128 | '', |
129 | - 'rel="' . $this->cssId() . '"' |
|
130 | - ) . \EEH_HTML::link( |
|
129 | + 'rel="'.$this->cssId().'"' |
|
130 | + ).\EEH_HTML::link( |
|
131 | 131 | '', |
132 | 132 | sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
133 | 133 | esc_attr( |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | "hide-{$this->cssId()}", |
140 | 140 | 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
141 | 141 | 'display:none;', |
142 | - 'rel="' . $this->cssId() . '"' |
|
142 | + 'rel="'.$this->cssId().'"' |
|
143 | 143 | ); |
144 | 144 | } |
145 | 145 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | return \EEH_Template::locate_template( |
192 | 192 | apply_filters( |
193 | 193 | 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
194 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
194 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_details.template.php', |
|
195 | 195 | $this->ticket |
196 | 196 | ), |
197 | 197 | $template_args |
@@ -19,57 +19,57 @@ |
||
19 | 19 | class TicketSelectorSimple extends TicketSelector |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * @var EE_Ticket $ticket |
|
24 | - */ |
|
25 | - protected $ticket; |
|
22 | + /** |
|
23 | + * @var EE_Ticket $ticket |
|
24 | + */ |
|
25 | + protected $ticket; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * TicketSelectorSimple constructor. |
|
30 | - * |
|
31 | - * @param EE_Event $event |
|
32 | - * @param EE_Ticket $ticket |
|
33 | - * @param int $max_attendees |
|
34 | - * @param array $template_args |
|
35 | - * @throws EE_Error |
|
36 | - */ |
|
37 | - public function __construct(EE_Event $event, EE_Ticket $ticket, $max_attendees, array $template_args) |
|
38 | - { |
|
39 | - $this->ticket = $ticket; |
|
40 | - parent::__construct( |
|
41 | - $event, |
|
42 | - array($this->ticket), |
|
43 | - $max_attendees, |
|
44 | - $template_args |
|
45 | - ); |
|
46 | - } |
|
28 | + /** |
|
29 | + * TicketSelectorSimple constructor. |
|
30 | + * |
|
31 | + * @param EE_Event $event |
|
32 | + * @param EE_Ticket $ticket |
|
33 | + * @param int $max_attendees |
|
34 | + * @param array $template_args |
|
35 | + * @throws EE_Error |
|
36 | + */ |
|
37 | + public function __construct(EE_Event $event, EE_Ticket $ticket, $max_attendees, array $template_args) |
|
38 | + { |
|
39 | + $this->ticket = $ticket; |
|
40 | + parent::__construct( |
|
41 | + $event, |
|
42 | + array($this->ticket), |
|
43 | + $max_attendees, |
|
44 | + $template_args |
|
45 | + ); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * sets any and all template args that are required for this Ticket Selector |
|
51 | - * |
|
52 | - * @return void |
|
53 | - * @throws \EventEspresso\core\exceptions\UnexpectedEntityException |
|
54 | - * @throws EE_Error |
|
55 | - */ |
|
56 | - protected function addTemplateArgs() |
|
57 | - { |
|
58 | - unset($this->template_args['tickets']); |
|
59 | - $this->template_args['ticket'] = $this->ticket; |
|
60 | - $ticket_selector_row = new TicketSelectorRowSimple( |
|
61 | - $this->ticket, |
|
62 | - $this->max_attendees, |
|
63 | - $this->template_args['date_format'], |
|
64 | - $this->template_args['event_status'] |
|
65 | - ); |
|
66 | - $this->template_args['TKT_ID'] = $this->ticket->ID(); |
|
67 | - $ticket_selector_row->setupTicketStatusDisplay(); |
|
68 | - $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
|
69 | - if (empty($this->template_args['ticket_status_display'])) { |
|
70 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
71 | - } |
|
72 | - $this->template_args['ticket_description'] = $ticket_selector_row->getTicketDescription(); |
|
73 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
74 | - } |
|
49 | + /** |
|
50 | + * sets any and all template args that are required for this Ticket Selector |
|
51 | + * |
|
52 | + * @return void |
|
53 | + * @throws \EventEspresso\core\exceptions\UnexpectedEntityException |
|
54 | + * @throws EE_Error |
|
55 | + */ |
|
56 | + protected function addTemplateArgs() |
|
57 | + { |
|
58 | + unset($this->template_args['tickets']); |
|
59 | + $this->template_args['ticket'] = $this->ticket; |
|
60 | + $ticket_selector_row = new TicketSelectorRowSimple( |
|
61 | + $this->ticket, |
|
62 | + $this->max_attendees, |
|
63 | + $this->template_args['date_format'], |
|
64 | + $this->template_args['event_status'] |
|
65 | + ); |
|
66 | + $this->template_args['TKT_ID'] = $this->ticket->ID(); |
|
67 | + $ticket_selector_row->setupTicketStatusDisplay(); |
|
68 | + $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
|
69 | + if (empty($this->template_args['ticket_status_display'])) { |
|
70 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
71 | + } |
|
72 | + $this->template_args['ticket_description'] = $ticket_selector_row->getTicketDescription(); |
|
73 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
74 | + } |
|
75 | 75 | } |
@@ -70,6 +70,6 @@ |
||
70 | 70 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
71 | 71 | } |
72 | 72 | $this->template_args['ticket_description'] = $ticket_selector_row->getTicketDescription(); |
73 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
73 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH.'simple_ticket_selector.template.php'; |
|
74 | 74 | } |
75 | 75 | } |
@@ -15,55 +15,55 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * EventsArchiveIframe constructor. |
|
20 | - * |
|
21 | - * @param \EED_Events_Archive $EED_Events_Archive |
|
22 | - * @throws \DomainException |
|
23 | - */ |
|
24 | - public function __construct($EED_Events_Archive) |
|
25 | - { |
|
26 | - \EE_Registry::instance()->REQ->set_espresso_page(true); |
|
27 | - add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true'); |
|
28 | - $EED_Events_Archive->event_list(); |
|
29 | - /** @var \EventEspresso\core\domain\entities\shortcodes\EspressoEvents $event_list */ |
|
30 | - $event_list = \EE_Registry::instance()->create('EventEspresso\core\domain\entities\shortcodes\EspressoEvents'); |
|
31 | - parent::__construct( |
|
32 | - esc_html__('Event List', 'event_espresso'), |
|
33 | - $event_list->processShortcode() |
|
34 | - ); |
|
35 | - $this->addStylesheets( |
|
36 | - apply_filters( |
|
37 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
38 | - array( |
|
39 | - 'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css') |
|
40 | - ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
41 | - : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
42 | - ), |
|
43 | - $this |
|
44 | - ) |
|
45 | - ); |
|
46 | - $this->addScripts( |
|
47 | - apply_filters( |
|
48 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
49 | - array( |
|
50 | - 'gmap_api' => sprintf( |
|
51 | - 'https://maps.googleapis.com/maps/api/js?key=%s', |
|
52 | - apply_filters( |
|
53 | - 'FHEE__EEH_Maps__espresso_google_maps_js__api_key', |
|
54 | - \EE_Registry::instance()->CFG->map_settings->google_map_api_key |
|
55 | - ) |
|
56 | - ), |
|
57 | - 'ee_gmap' => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0', |
|
58 | - ), |
|
59 | - $this |
|
60 | - ) |
|
61 | - ); |
|
62 | - $this->addLocalizedVars( |
|
63 | - array( |
|
64 | - 'ee_gmap' => \EEH_Maps::$gmap_vars, |
|
65 | - ), |
|
66 | - 'ee_gmap_vars' |
|
67 | - ); |
|
68 | - } |
|
18 | + /** |
|
19 | + * EventsArchiveIframe constructor. |
|
20 | + * |
|
21 | + * @param \EED_Events_Archive $EED_Events_Archive |
|
22 | + * @throws \DomainException |
|
23 | + */ |
|
24 | + public function __construct($EED_Events_Archive) |
|
25 | + { |
|
26 | + \EE_Registry::instance()->REQ->set_espresso_page(true); |
|
27 | + add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true'); |
|
28 | + $EED_Events_Archive->event_list(); |
|
29 | + /** @var \EventEspresso\core\domain\entities\shortcodes\EspressoEvents $event_list */ |
|
30 | + $event_list = \EE_Registry::instance()->create('EventEspresso\core\domain\entities\shortcodes\EspressoEvents'); |
|
31 | + parent::__construct( |
|
32 | + esc_html__('Event List', 'event_espresso'), |
|
33 | + $event_list->processShortcode() |
|
34 | + ); |
|
35 | + $this->addStylesheets( |
|
36 | + apply_filters( |
|
37 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
38 | + array( |
|
39 | + 'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css') |
|
40 | + ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
41 | + : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
42 | + ), |
|
43 | + $this |
|
44 | + ) |
|
45 | + ); |
|
46 | + $this->addScripts( |
|
47 | + apply_filters( |
|
48 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
49 | + array( |
|
50 | + 'gmap_api' => sprintf( |
|
51 | + 'https://maps.googleapis.com/maps/api/js?key=%s', |
|
52 | + apply_filters( |
|
53 | + 'FHEE__EEH_Maps__espresso_google_maps_js__api_key', |
|
54 | + \EE_Registry::instance()->CFG->map_settings->google_map_api_key |
|
55 | + ) |
|
56 | + ), |
|
57 | + 'ee_gmap' => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0', |
|
58 | + ), |
|
59 | + $this |
|
60 | + ) |
|
61 | + ); |
|
62 | + $this->addLocalizedVars( |
|
63 | + array( |
|
64 | + 'ee_gmap' => \EEH_Maps::$gmap_vars, |
|
65 | + ), |
|
66 | + 'ee_gmap_vars' |
|
67 | + ); |
|
68 | + } |
|
69 | 69 | } |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | apply_filters( |
37 | 37 | 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
38 | 38 | array( |
39 | - 'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css') |
|
40 | - ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
41 | - : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
39 | + 'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css') |
|
40 | + ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
41 | + : EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION, |
|
42 | 42 | ), |
43 | 43 | $this |
44 | 44 | ) |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | \EE_Registry::instance()->CFG->map_settings->google_map_api_key |
55 | 55 | ) |
56 | 56 | ), |
57 | - 'ee_gmap' => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0', |
|
57 | + 'ee_gmap' => EE_HELPERS_ASSETS.'ee_gmap.js?ver=1.0', |
|
58 | 58 | ), |
59 | 59 | $this |
60 | 60 | ) |
@@ -19,35 +19,35 @@ |
||
19 | 19 | class RecaptchaFactory implements FactoryInterface |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * @param array $arguments |
|
24 | - * @return InvisibleRecaptcha |
|
25 | - * @throws InvalidDataTypeException |
|
26 | - * @throws InvalidInterfaceException |
|
27 | - * @throws InvalidArgumentException |
|
28 | - */ |
|
29 | - public static function create($arguments = array()) |
|
30 | - { |
|
31 | - return LoaderFactory::getLoader()->getShared( |
|
32 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha', |
|
33 | - $arguments |
|
34 | - ); |
|
35 | - } |
|
22 | + /** |
|
23 | + * @param array $arguments |
|
24 | + * @return InvisibleRecaptcha |
|
25 | + * @throws InvalidDataTypeException |
|
26 | + * @throws InvalidInterfaceException |
|
27 | + * @throws InvalidArgumentException |
|
28 | + */ |
|
29 | + public static function create($arguments = array()) |
|
30 | + { |
|
31 | + return LoaderFactory::getLoader()->getShared( |
|
32 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha', |
|
33 | + $arguments |
|
34 | + ); |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * @param array $arguments |
|
41 | - * @return RecaptchaAdminSettings |
|
42 | - * @throws InvalidDataTypeException |
|
43 | - * @throws InvalidInterfaceException |
|
44 | - * @throws InvalidArgumentException |
|
45 | - */ |
|
46 | - public static function getAdminModule($arguments = array()) |
|
47 | - { |
|
48 | - return LoaderFactory::getLoader()->getShared( |
|
49 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings', |
|
50 | - $arguments |
|
51 | - ); |
|
52 | - } |
|
39 | + /** |
|
40 | + * @param array $arguments |
|
41 | + * @return RecaptchaAdminSettings |
|
42 | + * @throws InvalidDataTypeException |
|
43 | + * @throws InvalidInterfaceException |
|
44 | + * @throws InvalidArgumentException |
|
45 | + */ |
|
46 | + public static function getAdminModule($arguments = array()) |
|
47 | + { |
|
48 | + return LoaderFactory::getLoader()->getShared( |
|
49 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings', |
|
50 | + $arguments |
|
51 | + ); |
|
52 | + } |
|
53 | 53 | } |
@@ -33,87 +33,87 @@ |
||
33 | 33 | */ |
34 | 34 | class SocketPost implements RequestMethod |
35 | 35 | { |
36 | - /** |
|
37 | - * reCAPTCHA service host. |
|
38 | - * |
|
39 | - * @const string |
|
40 | - */ |
|
41 | - const RECAPTCHA_HOST = 'www.google.com'; |
|
42 | - |
|
43 | - /** |
|
44 | - * @const string reCAPTCHA service path |
|
45 | - */ |
|
46 | - const SITE_VERIFY_PATH = '/recaptcha/api/siteverify'; |
|
47 | - |
|
48 | - /** |
|
49 | - * @const string Bad request error |
|
50 | - */ |
|
51 | - const BAD_REQUEST = '{"success": false, "error-codes": ["invalid-request"]}'; |
|
52 | - |
|
53 | - /** |
|
54 | - * @const string Bad response error |
|
55 | - */ |
|
56 | - const BAD_RESPONSE = '{"success": false, "error-codes": ["invalid-response"]}'; |
|
57 | - |
|
58 | - /** |
|
59 | - * Socket to the reCAPTCHA service |
|
60 | - * |
|
61 | - * @var Socket |
|
62 | - */ |
|
63 | - private $socket; |
|
64 | - |
|
65 | - /** |
|
66 | - * Constructor |
|
67 | - * |
|
68 | - * @param \ReCaptcha\RequestMethod\Socket $socket optional socket, injectable for testing |
|
69 | - */ |
|
70 | - public function __construct(Socket $socket = null) |
|
71 | - { |
|
72 | - if (! is_null($socket)) { |
|
73 | - $this->socket = $socket; |
|
74 | - } else { |
|
75 | - $this->socket = new Socket(); |
|
76 | - } |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * Submit the POST request with the specified parameters. |
|
81 | - * |
|
82 | - * @param RequestParameters $params Request parameters |
|
83 | - * @return string Body of the reCAPTCHA response |
|
84 | - */ |
|
85 | - public function submit(RequestParameters $params) |
|
86 | - { |
|
87 | - $errno = 0; |
|
88 | - $errstr = ''; |
|
89 | - |
|
90 | - if ($this->socket->fsockopen('ssl://' . self::RECAPTCHA_HOST, 443, $errno, $errstr, 30) !== false) { |
|
91 | - $content = $params->toQueryString(); |
|
92 | - |
|
93 | - $request = "POST " . self::SITE_VERIFY_PATH . " HTTP/1.1\r\n"; |
|
94 | - $request .= "Host: " . self::RECAPTCHA_HOST . "\r\n"; |
|
95 | - $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
|
96 | - $request .= "Content-length: " . strlen($content) . "\r\n"; |
|
97 | - $request .= "Connection: close\r\n\r\n"; |
|
98 | - $request .= $content . "\r\n\r\n"; |
|
99 | - |
|
100 | - $this->socket->fwrite($request); |
|
101 | - $response = ''; |
|
102 | - |
|
103 | - while (! $this->socket->feof()) { |
|
104 | - $response .= $this->socket->fgets(4096); |
|
105 | - } |
|
106 | - |
|
107 | - $this->socket->fclose(); |
|
108 | - |
|
109 | - if (0 === strpos($response, 'HTTP/1.1 200 OK')) { |
|
110 | - $parts = preg_split("#\n\s*\n#Uis", $response); |
|
111 | - return $parts[1]; |
|
112 | - } |
|
113 | - |
|
114 | - return self::BAD_RESPONSE; |
|
115 | - } |
|
116 | - |
|
117 | - return self::BAD_REQUEST; |
|
118 | - } |
|
36 | + /** |
|
37 | + * reCAPTCHA service host. |
|
38 | + * |
|
39 | + * @const string |
|
40 | + */ |
|
41 | + const RECAPTCHA_HOST = 'www.google.com'; |
|
42 | + |
|
43 | + /** |
|
44 | + * @const string reCAPTCHA service path |
|
45 | + */ |
|
46 | + const SITE_VERIFY_PATH = '/recaptcha/api/siteverify'; |
|
47 | + |
|
48 | + /** |
|
49 | + * @const string Bad request error |
|
50 | + */ |
|
51 | + const BAD_REQUEST = '{"success": false, "error-codes": ["invalid-request"]}'; |
|
52 | + |
|
53 | + /** |
|
54 | + * @const string Bad response error |
|
55 | + */ |
|
56 | + const BAD_RESPONSE = '{"success": false, "error-codes": ["invalid-response"]}'; |
|
57 | + |
|
58 | + /** |
|
59 | + * Socket to the reCAPTCHA service |
|
60 | + * |
|
61 | + * @var Socket |
|
62 | + */ |
|
63 | + private $socket; |
|
64 | + |
|
65 | + /** |
|
66 | + * Constructor |
|
67 | + * |
|
68 | + * @param \ReCaptcha\RequestMethod\Socket $socket optional socket, injectable for testing |
|
69 | + */ |
|
70 | + public function __construct(Socket $socket = null) |
|
71 | + { |
|
72 | + if (! is_null($socket)) { |
|
73 | + $this->socket = $socket; |
|
74 | + } else { |
|
75 | + $this->socket = new Socket(); |
|
76 | + } |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * Submit the POST request with the specified parameters. |
|
81 | + * |
|
82 | + * @param RequestParameters $params Request parameters |
|
83 | + * @return string Body of the reCAPTCHA response |
|
84 | + */ |
|
85 | + public function submit(RequestParameters $params) |
|
86 | + { |
|
87 | + $errno = 0; |
|
88 | + $errstr = ''; |
|
89 | + |
|
90 | + if ($this->socket->fsockopen('ssl://' . self::RECAPTCHA_HOST, 443, $errno, $errstr, 30) !== false) { |
|
91 | + $content = $params->toQueryString(); |
|
92 | + |
|
93 | + $request = "POST " . self::SITE_VERIFY_PATH . " HTTP/1.1\r\n"; |
|
94 | + $request .= "Host: " . self::RECAPTCHA_HOST . "\r\n"; |
|
95 | + $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
|
96 | + $request .= "Content-length: " . strlen($content) . "\r\n"; |
|
97 | + $request .= "Connection: close\r\n\r\n"; |
|
98 | + $request .= $content . "\r\n\r\n"; |
|
99 | + |
|
100 | + $this->socket->fwrite($request); |
|
101 | + $response = ''; |
|
102 | + |
|
103 | + while (! $this->socket->feof()) { |
|
104 | + $response .= $this->socket->fgets(4096); |
|
105 | + } |
|
106 | + |
|
107 | + $this->socket->fclose(); |
|
108 | + |
|
109 | + if (0 === strpos($response, 'HTTP/1.1 200 OK')) { |
|
110 | + $parts = preg_split("#\n\s*\n#Uis", $response); |
|
111 | + return $parts[1]; |
|
112 | + } |
|
113 | + |
|
114 | + return self::BAD_RESPONSE; |
|
115 | + } |
|
116 | + |
|
117 | + return self::BAD_REQUEST; |
|
118 | + } |
|
119 | 119 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function __construct(Socket $socket = null) |
71 | 71 | { |
72 | - if (! is_null($socket)) { |
|
72 | + if ( ! is_null($socket)) { |
|
73 | 73 | $this->socket = $socket; |
74 | 74 | } else { |
75 | 75 | $this->socket = new Socket(); |
@@ -87,20 +87,20 @@ discard block |
||
87 | 87 | $errno = 0; |
88 | 88 | $errstr = ''; |
89 | 89 | |
90 | - if ($this->socket->fsockopen('ssl://' . self::RECAPTCHA_HOST, 443, $errno, $errstr, 30) !== false) { |
|
90 | + if ($this->socket->fsockopen('ssl://'.self::RECAPTCHA_HOST, 443, $errno, $errstr, 30) !== false) { |
|
91 | 91 | $content = $params->toQueryString(); |
92 | 92 | |
93 | - $request = "POST " . self::SITE_VERIFY_PATH . " HTTP/1.1\r\n"; |
|
94 | - $request .= "Host: " . self::RECAPTCHA_HOST . "\r\n"; |
|
93 | + $request = "POST ".self::SITE_VERIFY_PATH." HTTP/1.1\r\n"; |
|
94 | + $request .= "Host: ".self::RECAPTCHA_HOST."\r\n"; |
|
95 | 95 | $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
96 | - $request .= "Content-length: " . strlen($content) . "\r\n"; |
|
96 | + $request .= "Content-length: ".strlen($content)."\r\n"; |
|
97 | 97 | $request .= "Connection: close\r\n\r\n"; |
98 | - $request .= $content . "\r\n\r\n"; |
|
98 | + $request .= $content."\r\n\r\n"; |
|
99 | 99 | |
100 | 100 | $this->socket->fwrite($request); |
101 | 101 | $response = ''; |
102 | 102 | |
103 | - while (! $this->socket->feof()) { |
|
103 | + while ( ! $this->socket->feof()) { |
|
104 | 104 | $response .= $this->socket->fgets(4096); |
105 | 105 | } |
106 | 106 |