Completed
Branch BUG/3647-son-of-count-ticket-s... (875b84)
by
unknown
02:32 queued 24s
created
modules/ticket_selector/TicketSelectorStandard.php 2 patches
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -21,127 +21,127 @@
 block discarded – undo
21 21
 class TicketSelectorStandard extends TicketSelector
22 22
 {
23 23
 
24
-    /**
25
-     * @var string $date_format
26
-     */
27
-    protected $date_format;
24
+	/**
25
+	 * @var string $date_format
26
+	 */
27
+	protected $date_format;
28 28
 
29
-    /**
30
-     * @var string $time_format
31
-     */
32
-    protected $time_format;
29
+	/**
30
+	 * @var string $time_format
31
+	 */
32
+	protected $time_format;
33 33
 
34
-    /**
35
-     * @var EE_Ticket_Selector_Config $ticket_selector_config
36
-     */
37
-    protected $ticket_selector_config;
34
+	/**
35
+	 * @var EE_Ticket_Selector_Config $ticket_selector_config
36
+	 */
37
+	protected $ticket_selector_config;
38 38
 
39
-    /**
40
-     * @var EE_Tax_Config $tax_config
41
-     */
42
-    protected $tax_config;
39
+	/**
40
+	 * @var EE_Tax_Config $tax_config
41
+	 */
42
+	protected $tax_config;
43 43
 
44 44
 
45
-    /**
46
-     * TicketSelectorSimple constructor.
47
-     *
48
-     * @param EE_Ticket_Selector_Config $ticket_selector_config
49
-     * @param EE_Tax_Config             $tax_config
50
-     * @param EE_Event                  $event
51
-     * @param EE_Ticket[]               $tickets
52
-     * @param int                       $max_attendees
53
-     * @param array                     $template_args
54
-     * @param string                    $date_format
55
-     * @param string                    $time_format
56
-     */
57
-    public function __construct(
58
-        EE_Ticket_Selector_Config $ticket_selector_config,
59
-        EE_Tax_Config $tax_config,
60
-        EE_Event $event,
61
-        array $tickets,
62
-        $max_attendees,
63
-        array $template_args,
64
-        $date_format = 'Y-m-d',
65
-        $time_format = 'g:i a'
66
-    ) {
67
-        $this->ticket_selector_config = $ticket_selector_config;
68
-        $this->tax_config             = $tax_config;
69
-        $this->date_format            = $date_format;
70
-        $this->time_format            = $time_format;
71
-        parent::__construct($event, $tickets, $max_attendees, $template_args);
72
-    }
45
+	/**
46
+	 * TicketSelectorSimple constructor.
47
+	 *
48
+	 * @param EE_Ticket_Selector_Config $ticket_selector_config
49
+	 * @param EE_Tax_Config             $tax_config
50
+	 * @param EE_Event                  $event
51
+	 * @param EE_Ticket[]               $tickets
52
+	 * @param int                       $max_attendees
53
+	 * @param array                     $template_args
54
+	 * @param string                    $date_format
55
+	 * @param string                    $time_format
56
+	 */
57
+	public function __construct(
58
+		EE_Ticket_Selector_Config $ticket_selector_config,
59
+		EE_Tax_Config $tax_config,
60
+		EE_Event $event,
61
+		array $tickets,
62
+		$max_attendees,
63
+		array $template_args,
64
+		$date_format = 'Y-m-d',
65
+		$time_format = 'g:i a'
66
+	) {
67
+		$this->ticket_selector_config = $ticket_selector_config;
68
+		$this->tax_config             = $tax_config;
69
+		$this->date_format            = $date_format;
70
+		$this->time_format            = $time_format;
71
+		parent::__construct($event, $tickets, $max_attendees, $template_args);
72
+	}
73 73
 
74 74
 
75
-    /**
76
-     * sets any and all template args that are required for this Ticket Selector
77
-     *
78
-     * @return void
79
-     * @throws EE_Error
80
-     * @throws ReflectionException
81
-     */
82
-    protected function addTemplateArgs()
83
-    {
84
-        $this->ticket_rows        = 0;
85
-        $all_ticket_rows_html     = '';
86
-        $required_ticket_sold_out = false;
87
-        // flag to indicate that at least one taxable ticket has been encountered
88
-        $taxable_tickets                          = false;
89
-        $datetime_selector                        = null;
90
-        $this->template_args['datetime_selector'] = '';
91
-        if (
92
-            $this->ticket_selector_config->getShowDatetimeSelector()
93
-            !== EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
94
-        ) {
95
-            $datetime_selector                        = new DatetimeSelector(
96
-                $this->event,
97
-                $this->tickets,
98
-                $this->ticket_selector_config,
99
-                $this->date_format,
100
-                $this->time_format
101
-            );
102
-            $this->template_args['datetime_selector'] = $datetime_selector->getDatetimeSelector();
103
-        }
104
-        $total_tickets = count($this->tickets);
105
-        // loop through tickets
106
-        foreach ($this->tickets as $ticket) {
107
-            if ($ticket instanceof EE_Ticket) {
108
-                $this->ticket_rows++;
109
-                $cols                = 2;
110
-                $taxable_tickets     = $ticket->taxable() ? true : $taxable_tickets;
111
-                $ticket_selector_row = new TicketSelectorRowStandard(
112
-                    new TicketDetails($ticket, $this->ticket_selector_config, $this->template_args),
113
-                    $this->tax_config,
114
-                    $total_tickets,
115
-                    $this->max_attendees,
116
-                    $this->ticket_rows,
117
-                    $cols,
118
-                    $required_ticket_sold_out,
119
-                    $this->template_args['event_status'],
120
-                    $datetime_selector instanceof DatetimeSelector
121
-                        ? $datetime_selector->getTicketDatetimeClasses($ticket)
122
-                        : ''
123
-                );
124
-                $ticket_row_html     = $ticket_selector_row->getHtml();
125
-                // check if something was actually returned
126
-                if (! empty($ticket_row_html)) {
127
-                    // add any output to the cumulative HTML
128
-                    $all_ticket_rows_html .= $ticket_row_html;
129
-                }
130
-                if (empty($ticket_row_html) || ! $ticket_selector_row->isOnSale()) {
131
-                    // decrement the ticket row count since it looks like one has been removed
132
-                    $this->ticket_rows--;
133
-                }
75
+	/**
76
+	 * sets any and all template args that are required for this Ticket Selector
77
+	 *
78
+	 * @return void
79
+	 * @throws EE_Error
80
+	 * @throws ReflectionException
81
+	 */
82
+	protected function addTemplateArgs()
83
+	{
84
+		$this->ticket_rows        = 0;
85
+		$all_ticket_rows_html     = '';
86
+		$required_ticket_sold_out = false;
87
+		// flag to indicate that at least one taxable ticket has been encountered
88
+		$taxable_tickets                          = false;
89
+		$datetime_selector                        = null;
90
+		$this->template_args['datetime_selector'] = '';
91
+		if (
92
+			$this->ticket_selector_config->getShowDatetimeSelector()
93
+			!== EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
94
+		) {
95
+			$datetime_selector                        = new DatetimeSelector(
96
+				$this->event,
97
+				$this->tickets,
98
+				$this->ticket_selector_config,
99
+				$this->date_format,
100
+				$this->time_format
101
+			);
102
+			$this->template_args['datetime_selector'] = $datetime_selector->getDatetimeSelector();
103
+		}
104
+		$total_tickets = count($this->tickets);
105
+		// loop through tickets
106
+		foreach ($this->tickets as $ticket) {
107
+			if ($ticket instanceof EE_Ticket) {
108
+				$this->ticket_rows++;
109
+				$cols                = 2;
110
+				$taxable_tickets     = $ticket->taxable() ? true : $taxable_tickets;
111
+				$ticket_selector_row = new TicketSelectorRowStandard(
112
+					new TicketDetails($ticket, $this->ticket_selector_config, $this->template_args),
113
+					$this->tax_config,
114
+					$total_tickets,
115
+					$this->max_attendees,
116
+					$this->ticket_rows,
117
+					$cols,
118
+					$required_ticket_sold_out,
119
+					$this->template_args['event_status'],
120
+					$datetime_selector instanceof DatetimeSelector
121
+						? $datetime_selector->getTicketDatetimeClasses($ticket)
122
+						: ''
123
+				);
124
+				$ticket_row_html     = $ticket_selector_row->getHtml();
125
+				// check if something was actually returned
126
+				if (! empty($ticket_row_html)) {
127
+					// add any output to the cumulative HTML
128
+					$all_ticket_rows_html .= $ticket_row_html;
129
+				}
130
+				if (empty($ticket_row_html) || ! $ticket_selector_row->isOnSale()) {
131
+					// decrement the ticket row count since it looks like one has been removed
132
+					$this->ticket_rows--;
133
+				}
134 134
 
135
-                $required_ticket_sold_out = $ticket_selector_row->getRequiredTicketSoldOut();
136
-            }
137
-        }
138
-        $this->template_args['row']                              = $this->ticket_rows;
139
-        $this->template_args['ticket_row_html']                  = $all_ticket_rows_html;
140
-        $this->template_args['taxable_tickets']                  = $taxable_tickets;
141
-        $this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes;
142
-        // now load template
143
-        $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH
144
-                                                . 'standard_ticket_selector.template.php';
145
-        remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector');
146
-    }
135
+				$required_ticket_sold_out = $ticket_selector_row->getRequiredTicketSoldOut();
136
+			}
137
+		}
138
+		$this->template_args['row']                              = $this->ticket_rows;
139
+		$this->template_args['ticket_row_html']                  = $all_ticket_rows_html;
140
+		$this->template_args['taxable_tickets']                  = $taxable_tickets;
141
+		$this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes;
142
+		// now load template
143
+		$this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH
144
+												. 'standard_ticket_selector.template.php';
145
+		remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector');
146
+	}
147 147
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             $this->ticket_selector_config->getShowDatetimeSelector()
93 93
             !== EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
94 94
         ) {
95
-            $datetime_selector                        = new DatetimeSelector(
95
+            $datetime_selector = new DatetimeSelector(
96 96
                 $this->event,
97 97
                 $this->tickets,
98 98
                 $this->ticket_selector_config,
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
                         ? $datetime_selector->getTicketDatetimeClasses($ticket)
122 122
                         : ''
123 123
                 );
124
-                $ticket_row_html     = $ticket_selector_row->getHtml();
124
+                $ticket_row_html = $ticket_selector_row->getHtml();
125 125
                 // check if something was actually returned
126
-                if (! empty($ticket_row_html)) {
126
+                if ( ! empty($ticket_row_html)) {
127 127
                     // add any output to the cumulative HTML
128 128
                     $all_ticket_rows_html .= $ticket_row_html;
129 129
                 }
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorRowSimple.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -15,27 +15,27 @@
 block discarded – undo
15 15
 class TicketSelectorRowSimple extends TicketSelectorRow
16 16
 {
17 17
 
18
-    /**
19
-     * @throws EE_Error
20
-     * @throws ReflectionException
21
-     */
22
-    public function setupTicketStatusDisplay()
23
-    {
24
-        $remaining = $this->ticket->remaining();
25
-        $this->setTicketMinAndMax($remaining);
26
-        $this->setTicketStatusClasses($remaining);
27
-        $this->setTicketStatusDisplay($remaining);
28
-    }
18
+	/**
19
+	 * @throws EE_Error
20
+	 * @throws ReflectionException
21
+	 */
22
+	public function setupTicketStatusDisplay()
23
+	{
24
+		$remaining = $this->ticket->remaining();
25
+		$this->setTicketMinAndMax($remaining);
26
+		$this->setTicketStatusClasses($remaining);
27
+		$this->setTicketStatusDisplay($remaining);
28
+	}
29 29
 
30 30
 
31
-    public function getTicketDescription()
32
-    {
33
-        $filtered_row_content = $this->getFilteredRowContents();
34
-        if ($filtered_row_content !== false) {
35
-            remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
36
-            add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_false');
37
-            return $filtered_row_content;
38
-        }
39
-        return $this->ticket->description();
40
-    }
31
+	public function getTicketDescription()
32
+	{
33
+		$filtered_row_content = $this->getFilteredRowContents();
34
+		if ($filtered_row_content !== false) {
35
+			remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
36
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_false');
37
+			return $filtered_row_content;
38
+		}
39
+		return $this->ticket->description();
40
+	}
41 41
 }
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorRow.php 1 patch
Indentation   +416 added lines, -416 removed lines patch added patch discarded remove patch
@@ -19,420 +19,420 @@
 block discarded – undo
19 19
 abstract class TicketSelectorRow
20 20
 {
21 21
 
22
-    /**
23
-     * @var EE_Ticket
24
-     */
25
-    protected $ticket;
26
-
27
-    /**
28
-     * @var int
29
-     */
30
-    protected $total_tickets;
31
-
32
-    /**
33
-     * @var int
34
-     */
35
-    protected $max_attendees;
36
-
37
-    /**
38
-     * @var string
39
-     */
40
-    protected $date_format;
41
-
42
-    /**
43
-     * @var int
44
-     */
45
-    protected $EVT_ID;
46
-
47
-    /**
48
-     * @var string
49
-     */
50
-    protected $event_status;
51
-
52
-    /**
53
-     * @var boolean|string
54
-     */
55
-    protected $required_ticket_sold_out;
56
-
57
-    /**
58
-     * @var string
59
-     */
60
-    protected $ticket_status_display;
61
-
62
-    /**
63
-     * @var int
64
-     */
65
-    protected $max = 0;
66
-
67
-    /**
68
-     * @var int
69
-     */
70
-    protected $min = 0;
71
-
72
-    /**
73
-     * @var float
74
-     */
75
-    protected $ticket_price = 0.00;
76
-
77
-    /**
78
-     * @var bool
79
-     */
80
-    protected $ticket_bundle = false;
81
-
82
-    /**
83
-     * @var string
84
-     */
85
-    protected $ticket_status_id = EE_Ticket::sold_out;
86
-
87
-    /**
88
-     * @var string
89
-     */
90
-    protected $ticket_status_html = 'ticket-sales-sold-out';
91
-
92
-    /**
93
-     * @var string
94
-     */
95
-    protected $status_class = 'ticket-sales-sold-out lt-grey-text';
96
-
97
-    /**
98
-     * @var bool
99
-     */
100
-    protected $is_on_sale = true;
101
-
102
-
103
-    /**
104
-     * @param EE_Ticket      $ticket
105
-     * @param int            $max_attendees
106
-     * @param string         $date_format
107
-     * @param string         $event_status
108
-     * @param boolean|string $required_ticket_sold_out
109
-     * @param int            $total_tickets
110
-     * @throws EE_Error
111
-     * @throws UnexpectedEntityException
112
-     */
113
-    public function __construct(
114
-        EE_Ticket $ticket,
115
-        $max_attendees,
116
-        $date_format,
117
-        $event_status,
118
-        $required_ticket_sold_out = false,
119
-        $total_tickets = 1
120
-    ) {
121
-        $this->ticket = $ticket;
122
-        $this->max_attendees = $max_attendees;
123
-        $this->date_format = $date_format;
124
-        $this->EVT_ID = $this->ticket->get_event_ID();
125
-        $this->event_status = $event_status;
126
-        $this->required_ticket_sold_out = $required_ticket_sold_out;
127
-        $this->total_tickets = $total_tickets;
128
-    }
129
-
130
-
131
-    /**
132
-     * getTicketStatusClasses
133
-     *
134
-     * @param int $remaining
135
-     * @return void
136
-     * @throws EE_Error
137
-     */
138
-    protected function setTicketStatusClasses($remaining = 0)
139
-    {
140
-        // if a previous required ticket with the same sale start date is sold out,
141
-        // then mark this ticket as sold out as well.
142
-        // tickets that go on sale at a later date than the required ticket  will NOT be affected
143
-        $this->ticket_status_id = $this->required_ticket_sold_out !== false
144
-                                  && $this->required_ticket_sold_out === $this->ticket->start_date()
145
-            ? EE_Ticket::sold_out
146
-            : $this->ticket->ticket_status();
147
-        $this->ticket_status_id = $this->event_status === EE_Datetime::sold_out
148
-            ? EE_Ticket::sold_out
149
-            : $this->ticket_status_id;
150
-        // If at admin area, display expired tickets as on sale.
151
-        $this->ticket_status_id = is_admin() && $this->ticket_status_id === EE_Ticket::expired
152
-            ? EE_Ticket::onsale
153
-            : $this->ticket_status_id;
154
-        // check ticket status
155
-        switch ($this->ticket_status_id) {
156
-            // sold_out
157
-            case EE_Ticket::sold_out:
158
-                $ticket_status_class = 'ticket-sales-sold-out';
159
-                $this->status_class = 'ticket-sales-sold-out lt-grey-text';
160
-                $this->setIsOnSale(false);
161
-                break;
162
-            // expired
163
-            case EE_Ticket::expired:
164
-                $ticket_status_class = 'ticket-sales-expired';
165
-                $this->status_class = 'ticket-sales-expired lt-grey-text';
166
-                $this->setIsOnSale(false);
167
-                break;
168
-            // archived
169
-            case EE_Ticket::archived:
170
-                $ticket_status_class = 'archived-ticket';
171
-                $this->status_class = 'archived-ticket hidden';
172
-                $this->setIsOnSale(false);
173
-                break;
174
-            // pending
175
-            case EE_Ticket::pending:
176
-                $ticket_status_class = 'ticket-pending';
177
-                $this->status_class = 'ticket-pending';
178
-                $this->setIsOnSale(false);
179
-                break;
180
-            // on sale
181
-            case EE_Ticket::onsale:
182
-            default:
183
-                $ticket_status_class = 'ticket-on-sale';
184
-                $this->status_class = 'ticket-on-sale';
185
-                $this->setIsOnSale();
186
-                break;
187
-        }
188
-        $this->ticket_status_html = EEH_HTML::span(
189
-            $this->ticket->ticket_status(true, ($remaining > 0)),
190
-            "{$ticket_status_class}-{$this->ticket->ID()}",
191
-            $ticket_status_class
192
-        );
193
-    }
194
-
195
-
196
-    /**
197
-     * @return string
198
-     */
199
-    public function getTicketStatusDisplay()
200
-    {
201
-        return $this->ticket_status_display;
202
-    }
203
-
204
-
205
-    /**
206
-     * setTicketStatusDisplay
207
-     *
208
-     * @param int $remaining
209
-     * @throws EE_Error
210
-     * @throws ReflectionException
211
-     */
212
-    protected function setTicketStatusDisplay($remaining)
213
-    {
214
-        $this->ticket_status_display = '';
215
-
216
-        // now depending on the ticket and other circumstances...
217
-        if ($this->max_attendees === 0) {
218
-            // registration is CLOSED because admin set max attendees to ZERO
219
-            $this->ticket_status_display = $this->registrationClosed();
220
-            $this->setIsOnSale(false);
221
-        } elseif ($this->ticket_status_id === EE_Ticket::sold_out || $remaining === 0) {
222
-            // SOLD OUT - no tickets remaining
223
-            $this->ticket_status_display = $this->ticketsSoldOut();
224
-            $this->setIsOnSale(false);
225
-        } elseif ($this->ticket_status_id === EE_Ticket::expired || $this->ticket_status_id === EE_Ticket::archived) {
226
-            // expired or archived ticket
227
-            $this->ticket_status_display = $this->ticket_status_html;
228
-            $this->setIsOnSale(false);
229
-        } elseif ($this->ticket_status_id === EE_Ticket::pending) {
230
-            // ticket not on sale yet
231
-            $this->ticket_status_display = $this->ticketsSalesPending();
232
-            $this->setIsOnSale(false);
233
-        } elseif ($this->ticket->min() > $remaining) {
234
-            // min qty purchasable is less than tickets available
235
-            $this->ticket_status_display = $this->notEnoughTicketsAvailable();
236
-            $this->setIsOnSale(false);
237
-        }
238
-    }
239
-
240
-
241
-    /**
242
-     * registrationClosed
243
-     */
244
-    protected function registrationClosed()
245
-    {
246
-        return EEH_HTML::span(
247
-            apply_filters(
248
-                'FHEE__ticket_selector_chart_template__ticket_closed_msg',
249
-                esc_html__('Closed', 'event_espresso')
250
-            ),
251
-            '',
252
-            'sold-out'
253
-        );
254
-    }
255
-
256
-
257
-    /**
258
-     * ticketsSoldOut
259
-     */
260
-    protected function ticketsSoldOut()
261
-    {
262
-        return EEH_HTML::span(
263
-            apply_filters(
264
-                'FHEE__ticket_selector_chart_template__ticket_sold_out_msg',
265
-                esc_html__('Sold Out', 'event_espresso')
266
-            ),
267
-            '',
268
-            'sold-out'
269
-        );
270
-    }
271
-
272
-
273
-    /**
274
-     * ticketsSalesPending
275
-     *
276
-     * @throws EE_Error
277
-     * @throws ReflectionException
278
-     */
279
-    protected function ticketsSalesPending()
280
-    {
281
-        return EEH_HTML::span(
282
-            EEH_HTML::span(
283
-                apply_filters(
284
-                    'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg',
285
-                    esc_html__('Goes On Sale', 'event_espresso')
286
-                ),
287
-                '',
288
-                'ticket-pending'
289
-            )
290
-            . EEH_HTML::br()
291
-            . EEH_HTML::span(
292
-                $this->ticket->get_i18n_datetime(
293
-                    'TKT_start_date',
294
-                    apply_filters(
295
-                        'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format',
296
-                        $this->date_format
297
-                    )
298
-                ),
299
-                '',
300
-                'small-text'
301
-            ),
302
-            '',
303
-            'ticket-pending-pg'
304
-        );
305
-    }
306
-
307
-
308
-    /**
309
-     * notEnoughTicketsAvailable
310
-     */
311
-    protected function notEnoughTicketsAvailable()
312
-    {
313
-        return EEH_HTML::div(
314
-            EEH_HTML::span(
315
-                apply_filters(
316
-                    'FHEE__ticket_selector_chart_template__ticket_not_available_msg',
317
-                    esc_html__('Not Available', 'event_espresso')
318
-                ),
319
-                '',
320
-                'archived-ticket small-text'
321
-            )
322
-            . EEH_HTML::br(),
323
-            '',
324
-            'archived-ticket-pg'
325
-        );
326
-    }
327
-
328
-
329
-    /**
330
-     * setTicketMinAndMax
331
-     *
332
-     * @param int $remaining
333
-     * @return void
334
-     * @throws EE_Error
335
-     */
336
-    protected function setTicketMinAndMax($remaining)
337
-    {
338
-        // offer the number of $tickets_remaining or $this->max_attendees, whichever is smaller
339
-        $this->max = min($remaining, $this->max_attendees);
340
-        // but... we also want to restrict the number of tickets by the ticket max setting,
341
-        // however, the max still can't be higher than what was just set above
342
-        $this->max = $this->ticket->max() > 0
343
-            ? min($this->ticket->max(), $this->max)
344
-            : $this->max;
345
-        // and we also want to restrict the minimum number of tickets by the ticket min setting
346
-        $this->min = $this->ticket->min() > 0
347
-            ? $this->ticket->min()
348
-            : 0;
349
-        // and if the ticket is required, then make sure that min qty is at least 1
350
-        $this->min = $this->ticket->required()
351
-            ? max($this->min, 1)
352
-            : $this->min;
353
-    }
354
-
355
-
356
-    /**
357
-     * Allow plugins to hook in and abort the generation and display of this row to do
358
-     * something elseif they want.
359
-     * For an addon to abort things, all they have to do is register a filter with this hook, and
360
-     * return a value that is NOT false.  Whatever is returned gets echoed instead of the
361
-     * current row.
362
-     *
363
-     * @return string|bool
364
-     */
365
-    protected function getFilteredRowHtml()
366
-    {
367
-        return apply_filters(
368
-            'FHEE__ticket_selector_chart_template__do_ticket_entire_row',
369
-            false,
370
-            $this->ticket,
371
-            $this->max,
372
-            $this->min,
373
-            $this->required_ticket_sold_out,
374
-            $this->ticket_price,
375
-            $this->ticket_bundle,
376
-            $this->ticket_status_html,
377
-            $this->status_class,
378
-            $this
379
-        );
380
-    }
381
-
382
-
383
-    /**
384
-     * Allow plugins to hook in and abort the generation and display of the contents of this
385
-     * row to do something elseif they want.
386
-     * For an addon to abort things, all they have to do is register a filter with this hook, and
387
-     * return a value that is NOT false.  Whatever is returned gets echoed instead of the
388
-     * current row.
389
-     *
390
-     * @return string|bool
391
-     */
392
-    protected function getFilteredRowContents()
393
-    {
394
-        $filtered_row_content = apply_filters(
395
-            'FHEE__ticket_selector_chart_template__do_ticket_inside_row',
396
-            false,
397
-            $this->ticket,
398
-            $this->max,
399
-            $this->min,
400
-            $this->required_ticket_sold_out,
401
-            $this->ticket_price,
402
-            $this->ticket_bundle,
403
-            $this->ticket_status_html,
404
-            $this->status_class,
405
-            $this
406
-        );
407
-        // if the ticket row html is overridden but does NOT contain some kind of input...
408
-        if (
409
-            $filtered_row_content !== false
410
-            && strpos($filtered_row_content, '<input') === false
411
-            && strpos($filtered_row_content, '<select') === false
412
-        ) {
413
-            // then mark the ticket as not on sale
414
-            $this->setIsOnSale(false);
415
-        }
416
-        return $filtered_row_content;
417
-    }
418
-
419
-
420
-    /**
421
-     * @return bool
422
-     * @since $VID:$
423
-     */
424
-    public function isOnSale()
425
-    {
426
-        return $this->is_on_sale;
427
-    }
428
-
429
-
430
-    /**
431
-     * @param bool $is_on_sale
432
-     * @since $VID:$
433
-     */
434
-    public function setIsOnSale($is_on_sale = true)
435
-    {
436
-        $this->is_on_sale = filter_var($is_on_sale, FILTER_VALIDATE_BOOLEAN);
437
-    }
22
+	/**
23
+	 * @var EE_Ticket
24
+	 */
25
+	protected $ticket;
26
+
27
+	/**
28
+	 * @var int
29
+	 */
30
+	protected $total_tickets;
31
+
32
+	/**
33
+	 * @var int
34
+	 */
35
+	protected $max_attendees;
36
+
37
+	/**
38
+	 * @var string
39
+	 */
40
+	protected $date_format;
41
+
42
+	/**
43
+	 * @var int
44
+	 */
45
+	protected $EVT_ID;
46
+
47
+	/**
48
+	 * @var string
49
+	 */
50
+	protected $event_status;
51
+
52
+	/**
53
+	 * @var boolean|string
54
+	 */
55
+	protected $required_ticket_sold_out;
56
+
57
+	/**
58
+	 * @var string
59
+	 */
60
+	protected $ticket_status_display;
61
+
62
+	/**
63
+	 * @var int
64
+	 */
65
+	protected $max = 0;
66
+
67
+	/**
68
+	 * @var int
69
+	 */
70
+	protected $min = 0;
71
+
72
+	/**
73
+	 * @var float
74
+	 */
75
+	protected $ticket_price = 0.00;
76
+
77
+	/**
78
+	 * @var bool
79
+	 */
80
+	protected $ticket_bundle = false;
81
+
82
+	/**
83
+	 * @var string
84
+	 */
85
+	protected $ticket_status_id = EE_Ticket::sold_out;
86
+
87
+	/**
88
+	 * @var string
89
+	 */
90
+	protected $ticket_status_html = 'ticket-sales-sold-out';
91
+
92
+	/**
93
+	 * @var string
94
+	 */
95
+	protected $status_class = 'ticket-sales-sold-out lt-grey-text';
96
+
97
+	/**
98
+	 * @var bool
99
+	 */
100
+	protected $is_on_sale = true;
101
+
102
+
103
+	/**
104
+	 * @param EE_Ticket      $ticket
105
+	 * @param int            $max_attendees
106
+	 * @param string         $date_format
107
+	 * @param string         $event_status
108
+	 * @param boolean|string $required_ticket_sold_out
109
+	 * @param int            $total_tickets
110
+	 * @throws EE_Error
111
+	 * @throws UnexpectedEntityException
112
+	 */
113
+	public function __construct(
114
+		EE_Ticket $ticket,
115
+		$max_attendees,
116
+		$date_format,
117
+		$event_status,
118
+		$required_ticket_sold_out = false,
119
+		$total_tickets = 1
120
+	) {
121
+		$this->ticket = $ticket;
122
+		$this->max_attendees = $max_attendees;
123
+		$this->date_format = $date_format;
124
+		$this->EVT_ID = $this->ticket->get_event_ID();
125
+		$this->event_status = $event_status;
126
+		$this->required_ticket_sold_out = $required_ticket_sold_out;
127
+		$this->total_tickets = $total_tickets;
128
+	}
129
+
130
+
131
+	/**
132
+	 * getTicketStatusClasses
133
+	 *
134
+	 * @param int $remaining
135
+	 * @return void
136
+	 * @throws EE_Error
137
+	 */
138
+	protected function setTicketStatusClasses($remaining = 0)
139
+	{
140
+		// if a previous required ticket with the same sale start date is sold out,
141
+		// then mark this ticket as sold out as well.
142
+		// tickets that go on sale at a later date than the required ticket  will NOT be affected
143
+		$this->ticket_status_id = $this->required_ticket_sold_out !== false
144
+								  && $this->required_ticket_sold_out === $this->ticket->start_date()
145
+			? EE_Ticket::sold_out
146
+			: $this->ticket->ticket_status();
147
+		$this->ticket_status_id = $this->event_status === EE_Datetime::sold_out
148
+			? EE_Ticket::sold_out
149
+			: $this->ticket_status_id;
150
+		// If at admin area, display expired tickets as on sale.
151
+		$this->ticket_status_id = is_admin() && $this->ticket_status_id === EE_Ticket::expired
152
+			? EE_Ticket::onsale
153
+			: $this->ticket_status_id;
154
+		// check ticket status
155
+		switch ($this->ticket_status_id) {
156
+			// sold_out
157
+			case EE_Ticket::sold_out:
158
+				$ticket_status_class = 'ticket-sales-sold-out';
159
+				$this->status_class = 'ticket-sales-sold-out lt-grey-text';
160
+				$this->setIsOnSale(false);
161
+				break;
162
+			// expired
163
+			case EE_Ticket::expired:
164
+				$ticket_status_class = 'ticket-sales-expired';
165
+				$this->status_class = 'ticket-sales-expired lt-grey-text';
166
+				$this->setIsOnSale(false);
167
+				break;
168
+			// archived
169
+			case EE_Ticket::archived:
170
+				$ticket_status_class = 'archived-ticket';
171
+				$this->status_class = 'archived-ticket hidden';
172
+				$this->setIsOnSale(false);
173
+				break;
174
+			// pending
175
+			case EE_Ticket::pending:
176
+				$ticket_status_class = 'ticket-pending';
177
+				$this->status_class = 'ticket-pending';
178
+				$this->setIsOnSale(false);
179
+				break;
180
+			// on sale
181
+			case EE_Ticket::onsale:
182
+			default:
183
+				$ticket_status_class = 'ticket-on-sale';
184
+				$this->status_class = 'ticket-on-sale';
185
+				$this->setIsOnSale();
186
+				break;
187
+		}
188
+		$this->ticket_status_html = EEH_HTML::span(
189
+			$this->ticket->ticket_status(true, ($remaining > 0)),
190
+			"{$ticket_status_class}-{$this->ticket->ID()}",
191
+			$ticket_status_class
192
+		);
193
+	}
194
+
195
+
196
+	/**
197
+	 * @return string
198
+	 */
199
+	public function getTicketStatusDisplay()
200
+	{
201
+		return $this->ticket_status_display;
202
+	}
203
+
204
+
205
+	/**
206
+	 * setTicketStatusDisplay
207
+	 *
208
+	 * @param int $remaining
209
+	 * @throws EE_Error
210
+	 * @throws ReflectionException
211
+	 */
212
+	protected function setTicketStatusDisplay($remaining)
213
+	{
214
+		$this->ticket_status_display = '';
215
+
216
+		// now depending on the ticket and other circumstances...
217
+		if ($this->max_attendees === 0) {
218
+			// registration is CLOSED because admin set max attendees to ZERO
219
+			$this->ticket_status_display = $this->registrationClosed();
220
+			$this->setIsOnSale(false);
221
+		} elseif ($this->ticket_status_id === EE_Ticket::sold_out || $remaining === 0) {
222
+			// SOLD OUT - no tickets remaining
223
+			$this->ticket_status_display = $this->ticketsSoldOut();
224
+			$this->setIsOnSale(false);
225
+		} elseif ($this->ticket_status_id === EE_Ticket::expired || $this->ticket_status_id === EE_Ticket::archived) {
226
+			// expired or archived ticket
227
+			$this->ticket_status_display = $this->ticket_status_html;
228
+			$this->setIsOnSale(false);
229
+		} elseif ($this->ticket_status_id === EE_Ticket::pending) {
230
+			// ticket not on sale yet
231
+			$this->ticket_status_display = $this->ticketsSalesPending();
232
+			$this->setIsOnSale(false);
233
+		} elseif ($this->ticket->min() > $remaining) {
234
+			// min qty purchasable is less than tickets available
235
+			$this->ticket_status_display = $this->notEnoughTicketsAvailable();
236
+			$this->setIsOnSale(false);
237
+		}
238
+	}
239
+
240
+
241
+	/**
242
+	 * registrationClosed
243
+	 */
244
+	protected function registrationClosed()
245
+	{
246
+		return EEH_HTML::span(
247
+			apply_filters(
248
+				'FHEE__ticket_selector_chart_template__ticket_closed_msg',
249
+				esc_html__('Closed', 'event_espresso')
250
+			),
251
+			'',
252
+			'sold-out'
253
+		);
254
+	}
255
+
256
+
257
+	/**
258
+	 * ticketsSoldOut
259
+	 */
260
+	protected function ticketsSoldOut()
261
+	{
262
+		return EEH_HTML::span(
263
+			apply_filters(
264
+				'FHEE__ticket_selector_chart_template__ticket_sold_out_msg',
265
+				esc_html__('Sold&nbsp;Out', 'event_espresso')
266
+			),
267
+			'',
268
+			'sold-out'
269
+		);
270
+	}
271
+
272
+
273
+	/**
274
+	 * ticketsSalesPending
275
+	 *
276
+	 * @throws EE_Error
277
+	 * @throws ReflectionException
278
+	 */
279
+	protected function ticketsSalesPending()
280
+	{
281
+		return EEH_HTML::span(
282
+			EEH_HTML::span(
283
+				apply_filters(
284
+					'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg',
285
+					esc_html__('Goes&nbsp;On&nbsp;Sale', 'event_espresso')
286
+				),
287
+				'',
288
+				'ticket-pending'
289
+			)
290
+			. EEH_HTML::br()
291
+			. EEH_HTML::span(
292
+				$this->ticket->get_i18n_datetime(
293
+					'TKT_start_date',
294
+					apply_filters(
295
+						'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format',
296
+						$this->date_format
297
+					)
298
+				),
299
+				'',
300
+				'small-text'
301
+			),
302
+			'',
303
+			'ticket-pending-pg'
304
+		);
305
+	}
306
+
307
+
308
+	/**
309
+	 * notEnoughTicketsAvailable
310
+	 */
311
+	protected function notEnoughTicketsAvailable()
312
+	{
313
+		return EEH_HTML::div(
314
+			EEH_HTML::span(
315
+				apply_filters(
316
+					'FHEE__ticket_selector_chart_template__ticket_not_available_msg',
317
+					esc_html__('Not Available', 'event_espresso')
318
+				),
319
+				'',
320
+				'archived-ticket small-text'
321
+			)
322
+			. EEH_HTML::br(),
323
+			'',
324
+			'archived-ticket-pg'
325
+		);
326
+	}
327
+
328
+
329
+	/**
330
+	 * setTicketMinAndMax
331
+	 *
332
+	 * @param int $remaining
333
+	 * @return void
334
+	 * @throws EE_Error
335
+	 */
336
+	protected function setTicketMinAndMax($remaining)
337
+	{
338
+		// offer the number of $tickets_remaining or $this->max_attendees, whichever is smaller
339
+		$this->max = min($remaining, $this->max_attendees);
340
+		// but... we also want to restrict the number of tickets by the ticket max setting,
341
+		// however, the max still can't be higher than what was just set above
342
+		$this->max = $this->ticket->max() > 0
343
+			? min($this->ticket->max(), $this->max)
344
+			: $this->max;
345
+		// and we also want to restrict the minimum number of tickets by the ticket min setting
346
+		$this->min = $this->ticket->min() > 0
347
+			? $this->ticket->min()
348
+			: 0;
349
+		// and if the ticket is required, then make sure that min qty is at least 1
350
+		$this->min = $this->ticket->required()
351
+			? max($this->min, 1)
352
+			: $this->min;
353
+	}
354
+
355
+
356
+	/**
357
+	 * Allow plugins to hook in and abort the generation and display of this row to do
358
+	 * something elseif they want.
359
+	 * For an addon to abort things, all they have to do is register a filter with this hook, and
360
+	 * return a value that is NOT false.  Whatever is returned gets echoed instead of the
361
+	 * current row.
362
+	 *
363
+	 * @return string|bool
364
+	 */
365
+	protected function getFilteredRowHtml()
366
+	{
367
+		return apply_filters(
368
+			'FHEE__ticket_selector_chart_template__do_ticket_entire_row',
369
+			false,
370
+			$this->ticket,
371
+			$this->max,
372
+			$this->min,
373
+			$this->required_ticket_sold_out,
374
+			$this->ticket_price,
375
+			$this->ticket_bundle,
376
+			$this->ticket_status_html,
377
+			$this->status_class,
378
+			$this
379
+		);
380
+	}
381
+
382
+
383
+	/**
384
+	 * Allow plugins to hook in and abort the generation and display of the contents of this
385
+	 * row to do something elseif they want.
386
+	 * For an addon to abort things, all they have to do is register a filter with this hook, and
387
+	 * return a value that is NOT false.  Whatever is returned gets echoed instead of the
388
+	 * current row.
389
+	 *
390
+	 * @return string|bool
391
+	 */
392
+	protected function getFilteredRowContents()
393
+	{
394
+		$filtered_row_content = apply_filters(
395
+			'FHEE__ticket_selector_chart_template__do_ticket_inside_row',
396
+			false,
397
+			$this->ticket,
398
+			$this->max,
399
+			$this->min,
400
+			$this->required_ticket_sold_out,
401
+			$this->ticket_price,
402
+			$this->ticket_bundle,
403
+			$this->ticket_status_html,
404
+			$this->status_class,
405
+			$this
406
+		);
407
+		// if the ticket row html is overridden but does NOT contain some kind of input...
408
+		if (
409
+			$filtered_row_content !== false
410
+			&& strpos($filtered_row_content, '<input') === false
411
+			&& strpos($filtered_row_content, '<select') === false
412
+		) {
413
+			// then mark the ticket as not on sale
414
+			$this->setIsOnSale(false);
415
+		}
416
+		return $filtered_row_content;
417
+	}
418
+
419
+
420
+	/**
421
+	 * @return bool
422
+	 * @since $VID:$
423
+	 */
424
+	public function isOnSale()
425
+	{
426
+		return $this->is_on_sale;
427
+	}
428
+
429
+
430
+	/**
431
+	 * @param bool $is_on_sale
432
+	 * @since $VID:$
433
+	 */
434
+	public function setIsOnSale($is_on_sale = true)
435
+	{
436
+		$this->is_on_sale = filter_var($is_on_sale, FILTER_VALIDATE_BOOLEAN);
437
+	}
438 438
 }
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorRowStandard.php 2 patches
Indentation   +354 added lines, -354 removed lines patch added patch discarded remove patch
@@ -20,358 +20,358 @@
 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;
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 && $this->max_attendees === 1) {
159
-            return $ticket_selector_row_html
160
-                   . $filtered_row_content
161
-                   . $this->ticketQtyAndIdHiddenInputs()
162
-                   . EEH_HTML::trx();
163
-        }
164
-        if ($filtered_row_content !== false) {
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
-     */
313
-    protected function onlyOneAttendeeCanRegister()
314
-    {
315
-        // display submit button since we have tickets available
316
-        add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
317
-        $this->hidden_input_qty = false;
318
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
319
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
320
-        $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>';
321
-        $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"';
322
-        $html .= ' id="' . $id . '"';
323
-        $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"';
324
-        $html .= $this->total_tickets === 1 ? ' checked="checked"' : '';
325
-        $html .= ' title=""/>';
326
-        return $html;
327
-    }
328
-
329
-
330
-    /**
331
-     * ticketQuantitySelector
332
-     *
333
-     * @return string
334
-     * @throws EE_Error
335
-     */
336
-    protected function ticketQuantitySelector()
337
-    {
338
-        // display submit button since we have tickets available
339
-        add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
340
-        $this->hidden_input_qty = false;
341
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
342
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
343
-        $html .= esc_html__('Quantity', 'event_espresso') . '</label>';
344
-        $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"';
345
-        $html .= ' id="' . $id . '"';
346
-        $html .= ' class="ticket-selector-tbl-qty-slct">';
347
-        // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
348
-        if ($this->min !== 0 && ! $this->ticket->required()) {
349
-            $html .= '<option value="0">&nbsp;0&nbsp;</option>';
350
-        }
351
-        // offer ticket quantities from the min to the max
352
-        for ($i = $this->min; $i <= $this->max; $i++) {
353
-            $html .= '<option value="' . $i . '">&nbsp;' . $i . '&nbsp;</option>';
354
-        }
355
-        $html .= '</select>';
356
-        return $html;
357
-    }
358
-
359
-
360
-    /**
361
-     * getHiddenInputs
362
-     *
363
-     * @return string
364
-     * @throws EE_Error
365
-     */
366
-    protected function ticketQtyAndIdHiddenInputs()
367
-    {
368
-        $html = '';
369
-        // depending on group reg we need to change the format for qty
370
-        if ($this->hidden_input_qty) {
371
-            $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>';
372
-        }
373
-        $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"';
374
-        $html .= ' value="' . $this->ticket->ID() . '"/>';
375
-        return $html;
376
-    }
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;
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 && $this->max_attendees === 1) {
159
+			return $ticket_selector_row_html
160
+				   . $filtered_row_content
161
+				   . $this->ticketQtyAndIdHiddenInputs()
162
+				   . EEH_HTML::trx();
163
+		}
164
+		if ($filtered_row_content !== false) {
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
+	 */
313
+	protected function onlyOneAttendeeCanRegister()
314
+	{
315
+		// display submit button since we have tickets available
316
+		add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
317
+		$this->hidden_input_qty = false;
318
+		$id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
319
+		$html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
320
+		$html .= esc_html__('Select this ticket', 'event_espresso') . '</label>';
321
+		$html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"';
322
+		$html .= ' id="' . $id . '"';
323
+		$html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"';
324
+		$html .= $this->total_tickets === 1 ? ' checked="checked"' : '';
325
+		$html .= ' title=""/>';
326
+		return $html;
327
+	}
328
+
329
+
330
+	/**
331
+	 * ticketQuantitySelector
332
+	 *
333
+	 * @return string
334
+	 * @throws EE_Error
335
+	 */
336
+	protected function ticketQuantitySelector()
337
+	{
338
+		// display submit button since we have tickets available
339
+		add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
340
+		$this->hidden_input_qty = false;
341
+		$id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
342
+		$html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
343
+		$html .= esc_html__('Quantity', 'event_espresso') . '</label>';
344
+		$html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"';
345
+		$html .= ' id="' . $id . '"';
346
+		$html .= ' class="ticket-selector-tbl-qty-slct">';
347
+		// this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
348
+		if ($this->min !== 0 && ! $this->ticket->required()) {
349
+			$html .= '<option value="0">&nbsp;0&nbsp;</option>';
350
+		}
351
+		// offer ticket quantities from the min to the max
352
+		for ($i = $this->min; $i <= $this->max; $i++) {
353
+			$html .= '<option value="' . $i . '">&nbsp;' . $i . '&nbsp;</option>';
354
+		}
355
+		$html .= '</select>';
356
+		return $html;
357
+	}
358
+
359
+
360
+	/**
361
+	 * getHiddenInputs
362
+	 *
363
+	 * @return string
364
+	 * @throws EE_Error
365
+	 */
366
+	protected function ticketQtyAndIdHiddenInputs()
367
+	{
368
+		$html = '';
369
+		// depending on group reg we need to change the format for qty
370
+		if ($this->hidden_input_qty) {
371
+			$html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>';
372
+		}
373
+		$html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"';
374
+		$html .= ' value="' . $this->ticket->ID() . '"/>';
375
+		return $html;
376
+	}
377 377
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             '',
176 176
             'tckt-slctr-tbl-td-qty cntr',
177 177
             '',
178
-            'headers="quantity-' . $this->EVT_ID . '"'
178
+            'headers="quantity-'.$this->EVT_ID.'"'
179 179
         );
180 180
         $this->setTicketStatusDisplay($remaining);
181 181
         if (empty($this->ticket_status_display)) {
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             '',
243 243
             'tckt-slctr-tbl-td-name',
244 244
             '',
245
-            'headers="details-' . $this->EVT_ID . '"'
245
+            'headers="details-'.$this->EVT_ID.'"'
246 246
         );
247 247
         $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name'));
248 248
         $html .= $this->ticket_details->getShowHideLinks();
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
                 '',
277 277
                 'tckt-slctr-tbl-td-price jst-rght',
278 278
                 '',
279
-                'headers="price-' . $this->EVT_ID . '"'
279
+                'headers="price-'.$this->EVT_ID.'"'
280 280
             );
281 281
             $html .= EEH_Template::format_currency($this->ticket_price);
282 282
             $html .= $this->ticket->taxable()
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
         // display submit button since we have tickets available
316 316
         add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
317 317
         $this->hidden_input_qty = false;
318
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
319
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
320
-        $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>';
321
-        $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"';
322
-        $html .= ' id="' . $id . '"';
323
-        $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"';
318
+        $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row;
319
+        $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">';
320
+        $html .= esc_html__('Select this ticket', 'event_espresso').'</label>';
321
+        $html .= '<input type="radio" name="tkt-slctr-qty-'.$this->EVT_ID.'"';
322
+        $html .= ' id="'.$id.'"';
323
+        $html .= ' class="ticket-selector-tbl-qty-slct" value="'.$this->row.'-1"';
324 324
         $html .= $this->total_tickets === 1 ? ' checked="checked"' : '';
325 325
         $html .= ' title=""/>';
326 326
         return $html;
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
         // display submit button since we have tickets available
339 339
         add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
340 340
         $this->hidden_input_qty = false;
341
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
342
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
343
-        $html .= esc_html__('Quantity', 'event_espresso') . '</label>';
344
-        $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"';
345
-        $html .= ' id="' . $id . '"';
341
+        $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row;
342
+        $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">';
343
+        $html .= esc_html__('Quantity', 'event_espresso').'</label>';
344
+        $html .= '<select name="tkt-slctr-qty-'.$this->EVT_ID.'[]"';
345
+        $html .= ' id="'.$id.'"';
346 346
         $html .= ' class="ticket-selector-tbl-qty-slct">';
347 347
         // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
348 348
         if ($this->min !== 0 && ! $this->ticket->required()) {
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         }
351 351
         // offer ticket quantities from the min to the max
352 352
         for ($i = $this->min; $i <= $this->max; $i++) {
353
-            $html .= '<option value="' . $i . '">&nbsp;' . $i . '&nbsp;</option>';
353
+            $html .= '<option value="'.$i.'">&nbsp;'.$i.'&nbsp;</option>';
354 354
         }
355 355
         $html .= '</select>';
356 356
         return $html;
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
         $html = '';
369 369
         // depending on group reg we need to change the format for qty
370 370
         if ($this->hidden_input_qty) {
371
-            $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>';
371
+            $html .= '<input type="hidden" name="tkt-slctr-qty-'.$this->EVT_ID.'[]" value="0"/>';
372 372
         }
373
-        $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"';
374
-        $html .= ' value="' . $this->ticket->ID() . '"/>';
373
+        $html .= '<input type="hidden" name="tkt-slctr-ticket-id-'.$this->EVT_ID.'[]"';
374
+        $html .= ' value="'.$this->ticket->ID().'"/>';
375 375
         return $html;
376 376
     }
377 377
 }
Please login to merge, or discard this patch.