Completed
Branch master (5979d3)
by
unknown
26:18 queued 23:58
created
modules/ticket_selector/TicketSelectorRowStandard.php 1 patch
Indentation   +360 added lines, -360 removed lines patch added patch discarded remove patch
@@ -20,364 +20,364 @@
 block discarded – undo
20 20
 class TicketSelectorRowStandard extends TicketSelectorRow
21 21
 {
22 22
 
23
-    /**
24
-     * @var TicketDetails
25
-     */
26
-    protected $ticket_details;
27
-
28
-    /**
29
-     * @var EE_Ticket_Selector_Config
30
-     */
31
-    protected $template_settings;
32
-
33
-    /**
34
-     * @var EE_Tax_Config
35
-     */
36
-    protected $tax_settings;
37
-
38
-    /**
39
-     * @var boolean
40
-     */
41
-    protected $prices_displayed_including_taxes;
42
-
43
-    /**
44
-     * @var int
45
-     */
46
-    protected $row;
47
-
48
-    /**
49
-     * @var int
50
-     */
51
-    protected $cols;
52
-
53
-    /**
54
-     * @var boolean
55
-     */
56
-    protected $hidden_input_qty = false;
57
-
58
-    /**
59
-     * @var string
60
-     */
61
-    protected $ticket_datetime_classes;
62
-
63
-
64
-    /**
65
-     * TicketDetails constructor.
66
-     *
67
-     * @param TicketDetails $ticket_details
68
-     * @param EE_Tax_Config $tax_settings
69
-     * @param int           $total_tickets
70
-     * @param int           $max_attendees
71
-     * @param int           $row
72
-     * @param int           $cols
73
-     * @param boolean       $required_ticket_sold_out
74
-     * @param string        $event_status
75
-     * @param string        $ticket_datetime_classes
76
-     * @throws EE_Error
77
-     * @throws UnexpectedEntityException
78
-     */
79
-    public function __construct(
80
-        TicketDetails $ticket_details,
81
-        EE_Tax_Config $tax_settings,
82
-        $total_tickets,
83
-        $max_attendees,
84
-        $row,
85
-        $cols,
86
-        $required_ticket_sold_out,
87
-        $event_status,
88
-        $ticket_datetime_classes
89
-    ) {
90
-        $this->ticket_details = $ticket_details;
91
-        $this->template_settings = $ticket_details->getTemplateSettings();
92
-        $this->tax_settings = $tax_settings;
93
-        $this->row = $row;
94
-        $this->cols = $cols;
95
-        $this->ticket_datetime_classes = $ticket_datetime_classes;
96
-        parent::__construct(
97
-            $ticket_details->getTicket(),
98
-            $max_attendees,
99
-            $ticket_details->getDateFormat(),
100
-            $event_status,
101
-            $required_ticket_sold_out,
102
-            $total_tickets
103
-        );
104
-    }
105
-
106
-
107
-    /**
108
-     * other ticket rows will need to know if a required ticket is sold out,
109
-     * so that they are not offered for sale
110
-     *
111
-     * @return boolean
112
-     */
113
-    public function getRequiredTicketSoldOut()
114
-    {
115
-        return $this->required_ticket_sold_out;
116
-    }
117
-
118
-
119
-    /**
120
-     * @return int
121
-     */
122
-    public function getCols()
123
-    {
124
-        return $this->cols;
125
-    }
126
-
127
-
128
-    /**
129
-     * getHtml
130
-     *
131
-     * @return string
132
-     * @throws EE_Error
133
-     * @throws ReflectionException
134
-     */
135
-    public function getHtml()
136
-    {
137
-        $this->min = 0;
138
-        $this->max = $this->ticket->max();
139
-        $remaining = $this->ticket->remaining();
140
-        $this->setTicketMinAndMax($remaining);
141
-        // set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
142
-        $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining
143
-            ? $this->ticket->start_date()
144
-            : $this->required_ticket_sold_out;
145
-        $this->setTicketPriceDetails();
146
-        $this->setTicketStatusClasses($remaining);
147
-        $filtered_row_html = $this->getFilteredRowHtml();
148
-        if ($filtered_row_html !== false) {
149
-            return $filtered_row_html;
150
-        }
151
-        $ticket_selector_row_html = EEH_HTML::tr(
152
-            '',
153
-            '',
154
-            "tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} "
155
-            . espresso_get_object_css_class($this->ticket)
156
-        );
157
-        $filtered_row_content = $this->getFilteredRowContents();
158
-        if ($filtered_row_content !== false) {
159
-            if ($this->max_attendees === 1) {
160
-                return $ticket_selector_row_html
161
-                       . $filtered_row_content
162
-                       . $this->ticketQtyAndIdHiddenInputs()
163
-                       . EEH_HTML::trx();
164
-            }
165
-            return $ticket_selector_row_html
166
-                   . $filtered_row_content
167
-                   . EEH_HTML::trx();
168
-        }
169
-        $this->hidden_input_qty = $this->max_attendees > 1;
170
-
171
-        $ticket_selector_row_html .= $this->ticketNameTableCell();
172
-        $ticket_selector_row_html .= $this->ticketPriceTableCell();
173
-        $ticket_selector_row_html .= EEH_HTML::td(
174
-            '',
175
-            '',
176
-            'tckt-slctr-tbl-td-qty cntr',
177
-            '',
178
-            'headers="quantity-' . $this->EVT_ID . '"'
179
-        );
180
-        $this->setTicketStatusDisplay($remaining);
181
-        if (empty($this->ticket_status_display)) {
182
-            if ($this->max_attendees === 1) {
183
-                // only ONE attendee is allowed to register at a time
184
-                $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister();
185
-            } elseif ($this->max > 0) {
186
-                $ticket_selector_row_html .= $this->ticketQuantitySelector();
187
-            }
188
-        }
189
-        $ticket_selector_row_html .= $this->ticket_status_display;
190
-        $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs();
191
-        $ticket_selector_row_html .= $this->ticket_details->display(
192
-            $this->ticket_price,
193
-            $remaining,
194
-            $this->cols
195
-        );
196
-        $ticket_selector_row_html .= EEH_HTML::tdx();
197
-        $ticket_selector_row_html .= EEH_HTML::trx();
198
-
199
-
200
-        $this->row++;
201
-        return $ticket_selector_row_html;
202
-    }
203
-
204
-
205
-    /**
206
-     * getTicketPriceDetails
207
-     *
208
-     * @return void
209
-     * @throws EE_Error
210
-     */
211
-    protected function setTicketPriceDetails()
212
-    {
213
-        $this->ticket_price = $this->tax_settings->prices_displayed_including_taxes
214
-            ? $this->ticket->get_ticket_total_with_taxes()
215
-            : $this->ticket->get_ticket_subtotal();
216
-        $this->ticket_bundle = false;
217
-        $ticket_min = $this->ticket->min();
218
-        // for ticket bundles, set min and max qty the same
219
-        if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) {
220
-            $this->ticket_price *= $ticket_min;
221
-            $this->ticket_bundle = true;
222
-        }
223
-        $this->ticket_price = apply_filters(
224
-            'FHEE__ticket_selector_chart_template__ticket_price',
225
-            $this->ticket_price,
226
-            $this->ticket
227
-        );
228
-    }
229
-
230
-
231
-    /**
232
-     * ticketNameTableCell
233
-     *
234
-     * @return string
235
-     * @throws EE_Error
236
-     * @throws ReflectionException
237
-     */
238
-    protected function ticketNameTableCell()
239
-    {
240
-        $html = EEH_HTML::td(
241
-            '',
242
-            '',
243
-            'tckt-slctr-tbl-td-name',
244
-            '',
245
-            'headers="details-' . $this->EVT_ID . '"'
246
-        );
247
-        $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name'));
248
-        $html .= $this->ticket_details->getShowHideLinks();
249
-        if ($this->ticket->required()) {
250
-            $html .= EEH_HTML::p(
251
-                apply_filters(
252
-                    'FHEE__ticket_selector_chart_template__ticket_required_message',
253
-                    esc_html__('This ticket is required and must be purchased.', 'event_espresso')
254
-                ),
255
-                '',
256
-                'ticket-required-pg'
257
-            );
258
-        }
259
-        $html .= EEH_HTML::tdx();
260
-        return $html;
261
-    }
262
-
263
-
264
-    /**
265
-     * ticketPriceTableCell
266
-     *
267
-     * @return string
268
-     * @throws EE_Error
269
-     */
270
-    protected function ticketPriceTableCell()
271
-    {
272
-        $html = '';
273
-        if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) {
274
-            $html .= EEH_HTML::td(
275
-                '',
276
-                '',
277
-                'tckt-slctr-tbl-td-price jst-rght',
278
-                '',
279
-                'headers="price-' . $this->EVT_ID . '"'
280
-            );
281
-            $html .= EEH_Template::format_currency($this->ticket_price);
282
-            $html .= $this->ticket->taxable()
283
-                ? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text')
284
-                : '';
285
-            $html .= ' ';
286
-            // phpcs:disable WordPress.WP.I18n.NoEmptyStrings
287
-            $html .= EEH_HTML::span(
288
-                $this->ticket_bundle
289
-                    ? apply_filters(
290
-                        'FHEE__ticket_selector_chart_template__per_ticket_bundle_text',
291
-                        esc_html__(' / bundle', 'event_espresso')
292
-                    )
293
-                    : apply_filters(
294
-                        'FHEE__ticket_selector_chart_template__per_ticket_text',
295
-                        esc_html__('', 'event_espresso')
296
-                    ),
297
-                '',
298
-                'smaller-text no-bold'
299
-            );
300
-            $html .= ' ';
301
-            $html .= EEH_HTML::tdx();
302
-            $this->cols++;
303
-        }
304
-        return $html;
305
-    }
306
-
307
-
308
-    /**
309
-     * onlyOneAttendeeCanRegister
310
-     *
311
-     * @return string
312
-     * @throws EE_Error
313
-     */
314
-    protected function onlyOneAttendeeCanRegister()
315
-    {
316
-        $this->hidden_input_qty = false;
317
-        // display submit button since we have tickets available
318
-        add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
319
-
320
-        $TKT   = $this->ticket->ID();
321
-        $label = esc_html__('Select this ticket', 'event_espresso');
322
-        $name  = "tkt-slctr-qty-{$this->EVT_ID}";
323
-        $class = "ticket-selector-tbl-qty-slct";
324
-        $id    = "{$class}-{$this->EVT_ID}-{$this->row}";
325
-        $checked = $this->total_tickets === 1 ? ' checked' : '';
326
-
327
-        $html = "<label class='ee-a11y-screen-reader-text' for='{$id}' >{$label}</label>";
328
-        $html .= "<input type='radio'{$checked} name='{$name}' id='{$id}' class='{$class}' value='{$TKT}-1' title='' />";
329
-        return $html;
330
-    }
331
-
332
-
333
-    /**
334
-     * ticketQuantitySelector
335
-     *
336
-     * @return string
337
-     * @throws EE_Error
338
-     */
339
-    protected function ticketQuantitySelector()
340
-    {
341
-        $this->hidden_input_qty = false;
342
-        // display submit button since we have tickets available
343
-        add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
344
-
345
-        $TKT = $this->ticket->ID();
346
-        $label = esc_html__('Quantity', 'event_espresso');
347
-        $class = 'ticket-selector-tbl-qty-slct';
348
-        $id = "{$class}-{$this->EVT_ID}-{$this->row}";
349
-
350
-        $html = "<label class='ee-a11y-screen-reader-text' for='{$id}' >{$label}</label>";
351
-        $html .= "<select name='tkt-slctr-qty-{$this->EVT_ID}[{$TKT}]' id='{$id}' class='{$class}'>";
352
-        // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
353
-        if ($this->min !== 0 && ! $this->ticket->required()) {
354
-            $html .= "<option value='0'>&nbsp;0&nbsp;</option>";
355
-        }
356
-        // offer ticket quantities from the min to the max
357
-        for ($i = $this->min; $i <= $this->max; $i++) {
358
-            $html .= "<option value='{$i}'>&nbsp;{$i}&nbsp;</option>";
359
-        }
360
-        $html .= "</select>";
361
-        return $html;
362
-    }
363
-
364
-
365
-    /**
366
-     * getHiddenInputs
367
-     *
368
-     * @return string
369
-     * @throws EE_Error
370
-     */
371
-    protected function ticketQtyAndIdHiddenInputs()
372
-    {
373
-        $html = '';
374
-        $EVT = $this->EVT_ID;
375
-        $TKT = $this->ticket->ID();
376
-        // depending on group reg we need to change the format for qty
377
-        if ($this->hidden_input_qty) {
378
-            $html .= "<input type='hidden' name='tkt-slctr-qty-{$EVT}[]' value='0' />";
379
-        }
380
-        $html .= "<input type='hidden' name='tkt-slctr-ticket-id-{$EVT}[]' value='{$TKT}' />";
381
-        return $html;
382
-    }
23
+	/**
24
+	 * @var TicketDetails
25
+	 */
26
+	protected $ticket_details;
27
+
28
+	/**
29
+	 * @var EE_Ticket_Selector_Config
30
+	 */
31
+	protected $template_settings;
32
+
33
+	/**
34
+	 * @var EE_Tax_Config
35
+	 */
36
+	protected $tax_settings;
37
+
38
+	/**
39
+	 * @var boolean
40
+	 */
41
+	protected $prices_displayed_including_taxes;
42
+
43
+	/**
44
+	 * @var int
45
+	 */
46
+	protected $row;
47
+
48
+	/**
49
+	 * @var int
50
+	 */
51
+	protected $cols;
52
+
53
+	/**
54
+	 * @var boolean
55
+	 */
56
+	protected $hidden_input_qty = false;
57
+
58
+	/**
59
+	 * @var string
60
+	 */
61
+	protected $ticket_datetime_classes;
62
+
63
+
64
+	/**
65
+	 * TicketDetails constructor.
66
+	 *
67
+	 * @param TicketDetails $ticket_details
68
+	 * @param EE_Tax_Config $tax_settings
69
+	 * @param int           $total_tickets
70
+	 * @param int           $max_attendees
71
+	 * @param int           $row
72
+	 * @param int           $cols
73
+	 * @param boolean       $required_ticket_sold_out
74
+	 * @param string        $event_status
75
+	 * @param string        $ticket_datetime_classes
76
+	 * @throws EE_Error
77
+	 * @throws UnexpectedEntityException
78
+	 */
79
+	public function __construct(
80
+		TicketDetails $ticket_details,
81
+		EE_Tax_Config $tax_settings,
82
+		$total_tickets,
83
+		$max_attendees,
84
+		$row,
85
+		$cols,
86
+		$required_ticket_sold_out,
87
+		$event_status,
88
+		$ticket_datetime_classes
89
+	) {
90
+		$this->ticket_details = $ticket_details;
91
+		$this->template_settings = $ticket_details->getTemplateSettings();
92
+		$this->tax_settings = $tax_settings;
93
+		$this->row = $row;
94
+		$this->cols = $cols;
95
+		$this->ticket_datetime_classes = $ticket_datetime_classes;
96
+		parent::__construct(
97
+			$ticket_details->getTicket(),
98
+			$max_attendees,
99
+			$ticket_details->getDateFormat(),
100
+			$event_status,
101
+			$required_ticket_sold_out,
102
+			$total_tickets
103
+		);
104
+	}
105
+
106
+
107
+	/**
108
+	 * other ticket rows will need to know if a required ticket is sold out,
109
+	 * so that they are not offered for sale
110
+	 *
111
+	 * @return boolean
112
+	 */
113
+	public function getRequiredTicketSoldOut()
114
+	{
115
+		return $this->required_ticket_sold_out;
116
+	}
117
+
118
+
119
+	/**
120
+	 * @return int
121
+	 */
122
+	public function getCols()
123
+	{
124
+		return $this->cols;
125
+	}
126
+
127
+
128
+	/**
129
+	 * getHtml
130
+	 *
131
+	 * @return string
132
+	 * @throws EE_Error
133
+	 * @throws ReflectionException
134
+	 */
135
+	public function getHtml()
136
+	{
137
+		$this->min = 0;
138
+		$this->max = $this->ticket->max();
139
+		$remaining = $this->ticket->remaining();
140
+		$this->setTicketMinAndMax($remaining);
141
+		// set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
142
+		$this->required_ticket_sold_out = $this->ticket->required() && ! $remaining
143
+			? $this->ticket->start_date()
144
+			: $this->required_ticket_sold_out;
145
+		$this->setTicketPriceDetails();
146
+		$this->setTicketStatusClasses($remaining);
147
+		$filtered_row_html = $this->getFilteredRowHtml();
148
+		if ($filtered_row_html !== false) {
149
+			return $filtered_row_html;
150
+		}
151
+		$ticket_selector_row_html = EEH_HTML::tr(
152
+			'',
153
+			'',
154
+			"tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} "
155
+			. espresso_get_object_css_class($this->ticket)
156
+		);
157
+		$filtered_row_content = $this->getFilteredRowContents();
158
+		if ($filtered_row_content !== false) {
159
+			if ($this->max_attendees === 1) {
160
+				return $ticket_selector_row_html
161
+					   . $filtered_row_content
162
+					   . $this->ticketQtyAndIdHiddenInputs()
163
+					   . EEH_HTML::trx();
164
+			}
165
+			return $ticket_selector_row_html
166
+				   . $filtered_row_content
167
+				   . EEH_HTML::trx();
168
+		}
169
+		$this->hidden_input_qty = $this->max_attendees > 1;
170
+
171
+		$ticket_selector_row_html .= $this->ticketNameTableCell();
172
+		$ticket_selector_row_html .= $this->ticketPriceTableCell();
173
+		$ticket_selector_row_html .= EEH_HTML::td(
174
+			'',
175
+			'',
176
+			'tckt-slctr-tbl-td-qty cntr',
177
+			'',
178
+			'headers="quantity-' . $this->EVT_ID . '"'
179
+		);
180
+		$this->setTicketStatusDisplay($remaining);
181
+		if (empty($this->ticket_status_display)) {
182
+			if ($this->max_attendees === 1) {
183
+				// only ONE attendee is allowed to register at a time
184
+				$ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister();
185
+			} elseif ($this->max > 0) {
186
+				$ticket_selector_row_html .= $this->ticketQuantitySelector();
187
+			}
188
+		}
189
+		$ticket_selector_row_html .= $this->ticket_status_display;
190
+		$ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs();
191
+		$ticket_selector_row_html .= $this->ticket_details->display(
192
+			$this->ticket_price,
193
+			$remaining,
194
+			$this->cols
195
+		);
196
+		$ticket_selector_row_html .= EEH_HTML::tdx();
197
+		$ticket_selector_row_html .= EEH_HTML::trx();
198
+
199
+
200
+		$this->row++;
201
+		return $ticket_selector_row_html;
202
+	}
203
+
204
+
205
+	/**
206
+	 * getTicketPriceDetails
207
+	 *
208
+	 * @return void
209
+	 * @throws EE_Error
210
+	 */
211
+	protected function setTicketPriceDetails()
212
+	{
213
+		$this->ticket_price = $this->tax_settings->prices_displayed_including_taxes
214
+			? $this->ticket->get_ticket_total_with_taxes()
215
+			: $this->ticket->get_ticket_subtotal();
216
+		$this->ticket_bundle = false;
217
+		$ticket_min = $this->ticket->min();
218
+		// for ticket bundles, set min and max qty the same
219
+		if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) {
220
+			$this->ticket_price *= $ticket_min;
221
+			$this->ticket_bundle = true;
222
+		}
223
+		$this->ticket_price = apply_filters(
224
+			'FHEE__ticket_selector_chart_template__ticket_price',
225
+			$this->ticket_price,
226
+			$this->ticket
227
+		);
228
+	}
229
+
230
+
231
+	/**
232
+	 * ticketNameTableCell
233
+	 *
234
+	 * @return string
235
+	 * @throws EE_Error
236
+	 * @throws ReflectionException
237
+	 */
238
+	protected function ticketNameTableCell()
239
+	{
240
+		$html = EEH_HTML::td(
241
+			'',
242
+			'',
243
+			'tckt-slctr-tbl-td-name',
244
+			'',
245
+			'headers="details-' . $this->EVT_ID . '"'
246
+		);
247
+		$html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name'));
248
+		$html .= $this->ticket_details->getShowHideLinks();
249
+		if ($this->ticket->required()) {
250
+			$html .= EEH_HTML::p(
251
+				apply_filters(
252
+					'FHEE__ticket_selector_chart_template__ticket_required_message',
253
+					esc_html__('This ticket is required and must be purchased.', 'event_espresso')
254
+				),
255
+				'',
256
+				'ticket-required-pg'
257
+			);
258
+		}
259
+		$html .= EEH_HTML::tdx();
260
+		return $html;
261
+	}
262
+
263
+
264
+	/**
265
+	 * ticketPriceTableCell
266
+	 *
267
+	 * @return string
268
+	 * @throws EE_Error
269
+	 */
270
+	protected function ticketPriceTableCell()
271
+	{
272
+		$html = '';
273
+		if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) {
274
+			$html .= EEH_HTML::td(
275
+				'',
276
+				'',
277
+				'tckt-slctr-tbl-td-price jst-rght',
278
+				'',
279
+				'headers="price-' . $this->EVT_ID . '"'
280
+			);
281
+			$html .= EEH_Template::format_currency($this->ticket_price);
282
+			$html .= $this->ticket->taxable()
283
+				? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text')
284
+				: '';
285
+			$html .= '&nbsp;';
286
+			// phpcs:disable WordPress.WP.I18n.NoEmptyStrings
287
+			$html .= EEH_HTML::span(
288
+				$this->ticket_bundle
289
+					? apply_filters(
290
+						'FHEE__ticket_selector_chart_template__per_ticket_bundle_text',
291
+						esc_html__(' / bundle', 'event_espresso')
292
+					)
293
+					: apply_filters(
294
+						'FHEE__ticket_selector_chart_template__per_ticket_text',
295
+						esc_html__('', 'event_espresso')
296
+					),
297
+				'',
298
+				'smaller-text no-bold'
299
+			);
300
+			$html .= '&nbsp;';
301
+			$html .= EEH_HTML::tdx();
302
+			$this->cols++;
303
+		}
304
+		return $html;
305
+	}
306
+
307
+
308
+	/**
309
+	 * onlyOneAttendeeCanRegister
310
+	 *
311
+	 * @return string
312
+	 * @throws EE_Error
313
+	 */
314
+	protected function onlyOneAttendeeCanRegister()
315
+	{
316
+		$this->hidden_input_qty = false;
317
+		// display submit button since we have tickets available
318
+		add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
319
+
320
+		$TKT   = $this->ticket->ID();
321
+		$label = esc_html__('Select this ticket', 'event_espresso');
322
+		$name  = "tkt-slctr-qty-{$this->EVT_ID}";
323
+		$class = "ticket-selector-tbl-qty-slct";
324
+		$id    = "{$class}-{$this->EVT_ID}-{$this->row}";
325
+		$checked = $this->total_tickets === 1 ? ' checked' : '';
326
+
327
+		$html = "<label class='ee-a11y-screen-reader-text' for='{$id}' >{$label}</label>";
328
+		$html .= "<input type='radio'{$checked} name='{$name}' id='{$id}' class='{$class}' value='{$TKT}-1' title='' />";
329
+		return $html;
330
+	}
331
+
332
+
333
+	/**
334
+	 * ticketQuantitySelector
335
+	 *
336
+	 * @return string
337
+	 * @throws EE_Error
338
+	 */
339
+	protected function ticketQuantitySelector()
340
+	{
341
+		$this->hidden_input_qty = false;
342
+		// display submit button since we have tickets available
343
+		add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
344
+
345
+		$TKT = $this->ticket->ID();
346
+		$label = esc_html__('Quantity', 'event_espresso');
347
+		$class = 'ticket-selector-tbl-qty-slct';
348
+		$id = "{$class}-{$this->EVT_ID}-{$this->row}";
349
+
350
+		$html = "<label class='ee-a11y-screen-reader-text' for='{$id}' >{$label}</label>";
351
+		$html .= "<select name='tkt-slctr-qty-{$this->EVT_ID}[{$TKT}]' id='{$id}' class='{$class}'>";
352
+		// this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
353
+		if ($this->min !== 0 && ! $this->ticket->required()) {
354
+			$html .= "<option value='0'>&nbsp;0&nbsp;</option>";
355
+		}
356
+		// offer ticket quantities from the min to the max
357
+		for ($i = $this->min; $i <= $this->max; $i++) {
358
+			$html .= "<option value='{$i}'>&nbsp;{$i}&nbsp;</option>";
359
+		}
360
+		$html .= "</select>";
361
+		return $html;
362
+	}
363
+
364
+
365
+	/**
366
+	 * getHiddenInputs
367
+	 *
368
+	 * @return string
369
+	 * @throws EE_Error
370
+	 */
371
+	protected function ticketQtyAndIdHiddenInputs()
372
+	{
373
+		$html = '';
374
+		$EVT = $this->EVT_ID;
375
+		$TKT = $this->ticket->ID();
376
+		// depending on group reg we need to change the format for qty
377
+		if ($this->hidden_input_qty) {
378
+			$html .= "<input type='hidden' name='tkt-slctr-qty-{$EVT}[]' value='0' />";
379
+		}
380
+		$html .= "<input type='hidden' name='tkt-slctr-ticket-id-{$EVT}[]' value='{$TKT}' />";
381
+		return $html;
382
+	}
383 383
 }
Please login to merge, or discard this patch.
admin_pages/payments/templates/payment_log_details.template.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
                 </th>
36 36
                 <td>
37 37
                     <?php
38
-                    if ($payment_log->object() instanceof EE_Transaction) {
39
-                        esc_html_e('Unknown', 'event_espresso');
40
-                    } else {
41
-                        echo ($payment_method
42
-                            ? esc_html($payment_method->admin_name())
43
-                            : esc_html__("No Longer Exists", 'event_espresso'));
44
-                    }
45
-                    ?>
38
+					if ($payment_log->object() instanceof EE_Transaction) {
39
+						esc_html_e('Unknown', 'event_espresso');
40
+					} else {
41
+						echo ($payment_method
42
+							? esc_html($payment_method->admin_name())
43
+							: esc_html__("No Longer Exists", 'event_espresso'));
44
+					}
45
+					?>
46 46
                 </td>
47 47
             </tr>
48 48
             <tr>
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
                 </th>
54 54
                 <td>
55 55
                     <?php echo ($transaction
56
-                        ? absint($transaction->ID())
57
-                        : esc_html__('Could not be determined', 'event_espresso')); ?>
56
+						? absint($transaction->ID())
57
+						: esc_html__('Could not be determined', 'event_espresso')); ?>
58 58
                 </td>
59 59
             </tr>
60 60
             <tr>
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -38,103 +38,103 @@
 block discarded – undo
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.6.2');
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.6.2');
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.30.rc.013');
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.30.rc.013');
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
 }
141 141
\ No newline at end of file
Please login to merge, or discard this patch.