Completed
Branch fix/kses-6 (dd7b82)
by
unknown
09:41 queued 07:30
created
admin_pages/messages/help_tabs/messages_settings_messengers.help_tab.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -3,79 +3,79 @@
 block discarded – undo
3 3
 </p>
4 4
 <p>
5 5
     <?php esc_html_e(
6
-        'You can select Messengers via the tabs across the top of the settings page. The available messengers you see depends on what version of Event Espresso you have and what addons are installed. Every install include an "Email" messenger tab.  When you click one of those tabs it will display that messenger.',
7
-        'event_espresso'
8
-    ); ?>
6
+		'You can select Messengers via the tabs across the top of the settings page. The available messengers you see depends on what version of Event Espresso you have and what addons are installed. Every install include an "Email" messenger tab.  When you click one of those tabs it will display that messenger.',
7
+		'event_espresso'
8
+	); ?>
9 9
 </p>
10 10
 <p>
11 11
     <?php esc_html_e(
12
-        'There are two ways to determine whether a messenger is active or not.  The first way is via the messenger tab itself.',
13
-        'event_espresso'
14
-    ); ?>
12
+		'There are two ways to determine whether a messenger is active or not.  The first way is via the messenger tab itself.',
13
+		'event_espresso'
14
+	); ?>
15 15
 </p>
16 16
 <p>
17 17
     <?php printf(
18
-        esc_html__(
19
-            'The green colored gear %s indicates that this messenger is currently active.',
20
-            'event_espresso'
21
-        ),
22
-        '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '"'
23
-        . ' alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />'
24
-    );
25
-    printf(
26
-        esc_html__(
27
-            ' The white colored gear %s indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.',
28
-            'event_espresso'
29
-        ),
30
-        '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png'
31
-        . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />'
32
-    ); ?>
18
+		esc_html__(
19
+			'The green colored gear %s indicates that this messenger is currently active.',
20
+			'event_espresso'
21
+		),
22
+		'<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '"'
23
+		. ' alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />'
24
+	);
25
+	printf(
26
+		esc_html__(
27
+			' The white colored gear %s indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.',
28
+			'event_espresso'
29
+		),
30
+		'<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png'
31
+		. '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />'
32
+	); ?>
33 33
 </p>
34 34
 <p>
35 35
     <?php esc_html_e(
36
-        'The second way to determine whether a messenger is active or not is via the "on/off" button in the top right corner of the active messenger displayed content:',
37
-        'event_espresso'
38
-    ); ?>
36
+		'The second way to determine whether a messenger is active or not is via the "on/off" button in the top right corner of the active messenger displayed content:',
37
+		'event_espresso'
38
+	); ?>
39 39
 </p>
40 40
 <p>
41 41
     <?php printf(
42
-        esc_html__(
43
-            '%1$s means of course that the messenger is active and %2$s means the messenger is inactive.',
44
-            'event_espresso'
45
-        ),
46
-        '<div class="switch">'
47
-        . '<input class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked disabled>'
48
-        . '<label for="ee-on-off-toggle-on"></label>'
49
-        . '</div>',
50
-        '<div class="switch">'
51
-        . '<input class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" disabled>'
52
-        . '<label for="ee-on-off-toggle-on"></label>'
53
-        . '</div>'
54
-    ); ?>
42
+		esc_html__(
43
+			'%1$s means of course that the messenger is active and %2$s means the messenger is inactive.',
44
+			'event_espresso'
45
+		),
46
+		'<div class="switch">'
47
+		. '<input class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked disabled>'
48
+		. '<label for="ee-on-off-toggle-on"></label>'
49
+		. '</div>',
50
+		'<div class="switch">'
51
+		. '<input class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" disabled>'
52
+		. '<label for="ee-on-off-toggle-on"></label>'
53
+		. '</div>'
54
+	); ?>
55 55
 </p>
56 56
 <p>
57 57
     <?php
58
-    esc_html_e(
59
-        'The on/off toggle is also what you use to activate or deactivate a messenger.',
60
-        'event_espresso'
61
-    ); ?>
58
+	esc_html_e(
59
+		'The on/off toggle is also what you use to activate or deactivate a messenger.',
60
+		'event_espresso'
61
+	); ?>
62 62
 </p>
63 63
 <p>
64 64
     <?php esc_html_e(
65
-        'What happens when you click the toggle to activate is the messenger is activated and the system determines what default message types are activated with the messenger.  Then, if there are any default settings for either the messenger or message types those settings are saved.  Next, the system will generate any default templates (if none have been generated before, if there are previously generated templates then they are reactivated).  Finally, you will see the display change to reflect that the messenger is active. If the messenger has settings you can modify them then. Any message types that have settings will also automatically expand so you can see the default settings and make any changes as necessary to fit your needs. Usually the defaults are sufficient however.',
66
-        'event_espresso'
67
-    ); ?>
65
+		'What happens when you click the toggle to activate is the messenger is activated and the system determines what default message types are activated with the messenger.  Then, if there are any default settings for either the messenger or message types those settings are saved.  Next, the system will generate any default templates (if none have been generated before, if there are previously generated templates then they are reactivated).  Finally, you will see the display change to reflect that the messenger is active. If the messenger has settings you can modify them then. Any message types that have settings will also automatically expand so you can see the default settings and make any changes as necessary to fit your needs. Usually the defaults are sufficient however.',
66
+		'event_espresso'
67
+	); ?>
68 68
 </p>
69 69
 <p>
70 70
     <?php esc_html_e(
71
-        'When you deactivate a messenger, the system will first check if there are any custom event templates for that messenger. If there are you will be unable to deactivate the messenger. This is a fail safe to make sure you know that no messages will go out for those specific events so you don\'t accidentally deactivate.  If this check passes, then the system will deactivate any global templates for that messenger (note the templates are not erased, they just become inactive, so if you decide to reactivate the messenger later all your customizations are preserved). Then the display will change to reflect the deactivation.',
72
-        'event_espresso'
73
-    ); ?>
71
+		'When you deactivate a messenger, the system will first check if there are any custom event templates for that messenger. If there are you will be unable to deactivate the messenger. This is a fail safe to make sure you know that no messages will go out for those specific events so you don\'t accidentally deactivate.  If this check passes, then the system will deactivate any global templates for that messenger (note the templates are not erased, they just become inactive, so if you decide to reactivate the messenger later all your customizations are preserved). Then the display will change to reflect the deactivation.',
72
+		'event_espresso'
73
+	); ?>
74 74
 </p>
75 75
 <p>
76 76
     <strong><?php esc_html_e('Important', 'event_espresso'); ?></strong><br />
77 77
     <?php esc_html_e(
78
-        'Although customizations made to global templates are preserved when a messenger is deactivated, any settings for that messenger (or the message types that were attached to it) are lost on deactivation.  Also, once you deactivate a messenger, no more messages will be delivered using that messenger for any of your events.',
79
-        'event_espresso'
80
-    ); ?>
78
+		'Although customizations made to global templates are preserved when a messenger is deactivated, any settings for that messenger (or the message types that were attached to it) are lost on deactivation.  Also, once you deactivate a messenger, no more messages will be delivered using that messenger for any of your events.',
79
+		'event_espresso'
80
+	); ?>
81 81
 </p>
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
 ?>
59 59
                 </td>
60 60
             </tr>
Please login to merge, or discard this patch.
modules/gateways/Invoice/lib/invoice_functions.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -13,36 +13,36 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function espresso_invoice_template_files($class_file)
15 15
 {
16
-    $files = [];
17
-    // read our template dir and build an array of files
18
-    $directory_handle = opendir(dirname($class_file) . '/lib/templates/css/');
19
-    //if we managed to open the directory
20
-    if ($directory_handle) {
21
-        /** @var RequestInterface $request */
22
-        $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
23
-        $skip = [
24
-            '.',
25
-            '..',
26
-            '.DS_Store',
27
-            '.svn',
28
-            'images',
29
-            'index.php',
30
-            'print',
31
-            basename($request->getServerParam('PHP_SELF')),
32
-        ];
33
-        // loop through all of the files
34
-        while (false !== ($fname = readdir($directory_handle))) {
35
-            // if the file is not this file, and does not start with a '.' or '..',
36
-            // then store it for later display
37
-            if (! in_array($fname, $skip, true)) {
38
-                $files[] = $fname;
39
-            }
40
-        }
41
-        // close the directory
42
-        closedir($directory_handle);
43
-    }
16
+	$files = [];
17
+	// read our template dir and build an array of files
18
+	$directory_handle = opendir(dirname($class_file) . '/lib/templates/css/');
19
+	//if we managed to open the directory
20
+	if ($directory_handle) {
21
+		/** @var RequestInterface $request */
22
+		$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
23
+		$skip = [
24
+			'.',
25
+			'..',
26
+			'.DS_Store',
27
+			'.svn',
28
+			'images',
29
+			'index.php',
30
+			'print',
31
+			basename($request->getServerParam('PHP_SELF')),
32
+		];
33
+		// loop through all of the files
34
+		while (false !== ($fname = readdir($directory_handle))) {
35
+			// if the file is not this file, and does not start with a '.' or '..',
36
+			// then store it for later display
37
+			if (! in_array($fname, $skip, true)) {
38
+				$files[] = $fname;
39
+			}
40
+		}
41
+		// close the directory
42
+		closedir($directory_handle);
43
+	}
44 44
 
45
-    return $files;
45
+	return $files;
46 46
 }
47 47
 
48 48
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
  */
57 57
 function espresso_invoice_is_selected($input_item, $selected = '')
58 58
 {
59
-    if ($input_item === $selected) {
60
-        return 'selected';
61
-    }
62
-    return '';
59
+	if ($input_item === $selected) {
60
+		return 'selected';
61
+	}
62
+	return '';
63 63
 }
64 64
\ No newline at end of file
Please login to merge, or discard this patch.
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 .= '&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
-    }
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.