Completed
Branch BUG/3607-max-attendeezzz (33de71)
by
unknown
07:58 queued 05:26
created
modules/ticket_selector/ProcessTicketSelector.php 2 patches
Indentation   +494 added lines, -494 removed lines patch added patch discarded remove patch
@@ -33,523 +33,523 @@
 block discarded – undo
33 33
 class ProcessTicketSelector
34 34
 {
35 35
 
36
-    /**
37
-     * @var EE_Cart $cart
38
-     */
39
-    private $cart;
36
+	/**
37
+	 * @var EE_Cart $cart
38
+	 */
39
+	private $cart;
40 40
 
41
-    /**
42
-     * @var EE_Core_Config $core_config
43
-     */
44
-    private $core_config;
41
+	/**
42
+	 * @var EE_Core_Config $core_config
43
+	 */
44
+	private $core_config;
45 45
 
46
-    /**
47
-     * @var RequestInterface $request
48
-     */
49
-    private $request;
46
+	/**
47
+	 * @var RequestInterface $request
48
+	 */
49
+	private $request;
50 50
 
51
-    /**
52
-     * @var EE_Session $session
53
-     */
54
-    private $session;
51
+	/**
52
+	 * @var EE_Session $session
53
+	 */
54
+	private $session;
55 55
 
56
-    /**
57
-     * @var EEM_Ticket $ticket_model
58
-     */
59
-    private $ticket_model;
56
+	/**
57
+	 * @var EEM_Ticket $ticket_model
58
+	 */
59
+	private $ticket_model;
60 60
 
61
-    /**
62
-     * @var TicketDatetimeAvailabilityTracker $tracker
63
-     */
64
-    private $tracker;
61
+	/**
62
+	 * @var TicketDatetimeAvailabilityTracker $tracker
63
+	 */
64
+	private $tracker;
65 65
 
66 66
 
67
-    /**
68
-     * ProcessTicketSelector constructor.
69
-     * NOTE: PLZ use the Loader to instantiate this class if need be
70
-     * so that all dependencies get injected correctly (which will happen automatically)
71
-     * Null values for parameters are only for backwards compatibility but will be removed later on.
72
-     *
73
-     * @param EE_Core_Config                    $core_config
74
-     * @param RequestInterface                           $request
75
-     * @param EE_Session                        $session
76
-     * @param EEM_Ticket                        $ticket_model
77
-     * @param TicketDatetimeAvailabilityTracker $tracker
78
-     * @throws InvalidArgumentException
79
-     * @throws InvalidDataTypeException
80
-     * @throws InvalidInterfaceException
81
-     */
82
-    public function __construct(
83
-        EE_Core_Config $core_config = null,
84
-        RequestInterface $request = null,
85
-        EE_Session $session = null,
86
-        EEM_Ticket $ticket_model = null,
87
-        TicketDatetimeAvailabilityTracker $tracker = null
88
-    ) {
89
-        $loader = LoaderFactory::getLoader();
90
-        $this->core_config = $core_config instanceof EE_Core_Config
91
-            ? $core_config
92
-            : $loader->getShared('EE_Core_Config');
93
-        $this->request = $request instanceof RequestInterface
94
-            ? $request
95
-            : $loader->getShared('EventEspresso\core\services\request\Request');
96
-        $this->session = $session instanceof EE_Session
97
-            ? $session
98
-            : $loader->getShared('EE_Session');
99
-        $this->ticket_model = $ticket_model instanceof EEM_Ticket
100
-            ? $ticket_model
101
-            : $loader->getShared('EEM_Ticket');
102
-        $this->tracker = $tracker instanceof TicketDatetimeAvailabilityTracker
103
-            ? $tracker
104
-            : $loader->getShared('EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker');
105
-    }
67
+	/**
68
+	 * ProcessTicketSelector constructor.
69
+	 * NOTE: PLZ use the Loader to instantiate this class if need be
70
+	 * so that all dependencies get injected correctly (which will happen automatically)
71
+	 * Null values for parameters are only for backwards compatibility but will be removed later on.
72
+	 *
73
+	 * @param EE_Core_Config                    $core_config
74
+	 * @param RequestInterface                           $request
75
+	 * @param EE_Session                        $session
76
+	 * @param EEM_Ticket                        $ticket_model
77
+	 * @param TicketDatetimeAvailabilityTracker $tracker
78
+	 * @throws InvalidArgumentException
79
+	 * @throws InvalidDataTypeException
80
+	 * @throws InvalidInterfaceException
81
+	 */
82
+	public function __construct(
83
+		EE_Core_Config $core_config = null,
84
+		RequestInterface $request = null,
85
+		EE_Session $session = null,
86
+		EEM_Ticket $ticket_model = null,
87
+		TicketDatetimeAvailabilityTracker $tracker = null
88
+	) {
89
+		$loader = LoaderFactory::getLoader();
90
+		$this->core_config = $core_config instanceof EE_Core_Config
91
+			? $core_config
92
+			: $loader->getShared('EE_Core_Config');
93
+		$this->request = $request instanceof RequestInterface
94
+			? $request
95
+			: $loader->getShared('EventEspresso\core\services\request\Request');
96
+		$this->session = $session instanceof EE_Session
97
+			? $session
98
+			: $loader->getShared('EE_Session');
99
+		$this->ticket_model = $ticket_model instanceof EEM_Ticket
100
+			? $ticket_model
101
+			: $loader->getShared('EEM_Ticket');
102
+		$this->tracker = $tracker instanceof TicketDatetimeAvailabilityTracker
103
+			? $tracker
104
+			: $loader->getShared('EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker');
105
+	}
106 106
 
107 107
 
108
-    /**
109
-     * cancelTicketSelections
110
-     *
111
-     * @return bool
112
-     * @throws EE_Error
113
-     * @throws InvalidArgumentException
114
-     * @throws InvalidInterfaceException
115
-     * @throws InvalidDataTypeException
116
-     * @throws ReflectionException
117
-     */
118
-    public function cancelTicketSelections()
119
-    {
120
-        // check nonce
121
-        if (! $this->processTicketSelectorNonce('cancel_ticket_selections')) {
122
-            return false;
123
-        }
124
-        $this->session->clear_session(__CLASS__, __FUNCTION__);
125
-        if ($this->request->requestParamIsSet('event_id')) {
126
-            EEH_URL::safeRedirectAndExit(
127
-                EEH_Event_View::event_link_url(
128
-                    $this->request->getRequestParam('event_id', 0, 'int')
129
-                )
130
-            );
131
-        }
132
-        EEH_URL::safeRedirectAndExit(
133
-            site_url('/' . $this->core_config->event_cpt_slug . '/')
134
-        );
135
-        return true;
136
-    }
108
+	/**
109
+	 * cancelTicketSelections
110
+	 *
111
+	 * @return bool
112
+	 * @throws EE_Error
113
+	 * @throws InvalidArgumentException
114
+	 * @throws InvalidInterfaceException
115
+	 * @throws InvalidDataTypeException
116
+	 * @throws ReflectionException
117
+	 */
118
+	public function cancelTicketSelections()
119
+	{
120
+		// check nonce
121
+		if (! $this->processTicketSelectorNonce('cancel_ticket_selections')) {
122
+			return false;
123
+		}
124
+		$this->session->clear_session(__CLASS__, __FUNCTION__);
125
+		if ($this->request->requestParamIsSet('event_id')) {
126
+			EEH_URL::safeRedirectAndExit(
127
+				EEH_Event_View::event_link_url(
128
+					$this->request->getRequestParam('event_id', 0, 'int')
129
+				)
130
+			);
131
+		}
132
+		EEH_URL::safeRedirectAndExit(
133
+			site_url('/' . $this->core_config->event_cpt_slug . '/')
134
+		);
135
+		return true;
136
+	}
137 137
 
138 138
 
139
-    /**
140
-     * processTicketSelectorNonce
141
-     *
142
-     * @param  string $nonce_name
143
-     * @param string  $id
144
-     * @return bool
145
-     */
146
-    private function processTicketSelectorNonce($nonce_name, $id = '')
147
-    {
148
-        $nonce_name_with_id = ! empty($id) ? "{$nonce_name}_nonce_{$id}" : "{$nonce_name}_nonce";
149
-        if (
150
-            ! $this->request->isAdmin()
151
-            && (
152
-                ! $this->request->requestParamIsSet($nonce_name_with_id)
153
-                || ! wp_verify_nonce(
154
-                    $this->request->getRequestParam($nonce_name_with_id),
155
-                    $nonce_name
156
-                )
157
-            )
158
-        ) {
159
-            EE_Error::add_error(
160
-                sprintf(
161
-                    esc_html__(
162
-                        'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.',
163
-                        'event_espresso'
164
-                    ),
165
-                    '<br/>'
166
-                ),
167
-                __FILE__,
168
-                __FUNCTION__,
169
-                __LINE__
170
-            );
171
-            return false;
172
-        }
173
-        return true;
174
-    }
139
+	/**
140
+	 * processTicketSelectorNonce
141
+	 *
142
+	 * @param  string $nonce_name
143
+	 * @param string  $id
144
+	 * @return bool
145
+	 */
146
+	private function processTicketSelectorNonce($nonce_name, $id = '')
147
+	{
148
+		$nonce_name_with_id = ! empty($id) ? "{$nonce_name}_nonce_{$id}" : "{$nonce_name}_nonce";
149
+		if (
150
+			! $this->request->isAdmin()
151
+			&& (
152
+				! $this->request->requestParamIsSet($nonce_name_with_id)
153
+				|| ! wp_verify_nonce(
154
+					$this->request->getRequestParam($nonce_name_with_id),
155
+					$nonce_name
156
+				)
157
+			)
158
+		) {
159
+			EE_Error::add_error(
160
+				sprintf(
161
+					esc_html__(
162
+						'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.',
163
+						'event_espresso'
164
+					),
165
+					'<br/>'
166
+				),
167
+				__FILE__,
168
+				__FUNCTION__,
169
+				__LINE__
170
+			);
171
+			return false;
172
+		}
173
+		return true;
174
+	}
175 175
 
176 176
 
177
-    /**
178
-     * process_ticket_selections
179
-     *
180
-     * @return bool
181
-     * @throws EE_Error
182
-     * @throws InvalidArgumentException
183
-     * @throws InvalidDataTypeException
184
-     * @throws InvalidInterfaceException
185
-     * @throws ReflectionException
186
-     */
187
-    public function processTicketSelections()
188
-    {
189
-        do_action('EED_Ticket_Selector__process_ticket_selections__before');
190
-        if ($this->request->isBot()) {
191
-            EEH_URL::safeRedirectAndExit(
192
-                apply_filters(
193
-                    'FHEE__EE_Ticket_Selector__process_ticket_selections__bot_redirect_url',
194
-                    site_url()
195
-                )
196
-            );
197
-        }
198
-        // do we have an event id?
199
-        $id = $this->getEventId();
200
-        // we should really only have 1 registration in the works now
201
-        // (ie, no MER) so unless otherwise requested, clear the session
202
-        if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', true)) {
203
-            $this->session->clear_session(__CLASS__, __FUNCTION__);
204
-        }
205
-        // validate/sanitize/filter data
206
-        $valid = apply_filters(
207
-            'FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data',
208
-            $this->validatePostData($id)
209
-        );
210
-        // check total tickets ordered vs max number of attendees that can register
211
-        if (! empty($valid) && $valid['total_tickets'] > $valid['max_atndz']) {
212
-            $this->maxAttendeesViolation($valid);
213
-        } else {
214
-            // all data appears to be valid
215
-            if ($this->processSuccessfulCart($this->addTicketsToCart($valid))) {
216
-                return true;
217
-            }
218
-        }
219
-        // die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
220
-        // at this point, just return if registration is being made from admin
221
-        if ($this->request->isAdmin() || $this->request->isFrontAjax()) {
222
-            return false;
223
-        }
224
-        if ($valid['return_url']) {
225
-            EEH_URL::safeRedirectAndExit($valid['return_url']);
226
-        }
227
-        if ($id) {
228
-            EEH_URL::safeRedirectAndExit(get_permalink($id));
229
-        }
230
-        echo EE_Error::get_notices(); // already escaped
231
-        return false;
232
-    }
177
+	/**
178
+	 * process_ticket_selections
179
+	 *
180
+	 * @return bool
181
+	 * @throws EE_Error
182
+	 * @throws InvalidArgumentException
183
+	 * @throws InvalidDataTypeException
184
+	 * @throws InvalidInterfaceException
185
+	 * @throws ReflectionException
186
+	 */
187
+	public function processTicketSelections()
188
+	{
189
+		do_action('EED_Ticket_Selector__process_ticket_selections__before');
190
+		if ($this->request->isBot()) {
191
+			EEH_URL::safeRedirectAndExit(
192
+				apply_filters(
193
+					'FHEE__EE_Ticket_Selector__process_ticket_selections__bot_redirect_url',
194
+					site_url()
195
+				)
196
+			);
197
+		}
198
+		// do we have an event id?
199
+		$id = $this->getEventId();
200
+		// we should really only have 1 registration in the works now
201
+		// (ie, no MER) so unless otherwise requested, clear the session
202
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', true)) {
203
+			$this->session->clear_session(__CLASS__, __FUNCTION__);
204
+		}
205
+		// validate/sanitize/filter data
206
+		$valid = apply_filters(
207
+			'FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data',
208
+			$this->validatePostData($id)
209
+		);
210
+		// check total tickets ordered vs max number of attendees that can register
211
+		if (! empty($valid) && $valid['total_tickets'] > $valid['max_atndz']) {
212
+			$this->maxAttendeesViolation($valid);
213
+		} else {
214
+			// all data appears to be valid
215
+			if ($this->processSuccessfulCart($this->addTicketsToCart($valid))) {
216
+				return true;
217
+			}
218
+		}
219
+		// die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
220
+		// at this point, just return if registration is being made from admin
221
+		if ($this->request->isAdmin() || $this->request->isFrontAjax()) {
222
+			return false;
223
+		}
224
+		if ($valid['return_url']) {
225
+			EEH_URL::safeRedirectAndExit($valid['return_url']);
226
+		}
227
+		if ($id) {
228
+			EEH_URL::safeRedirectAndExit(get_permalink($id));
229
+		}
230
+		echo EE_Error::get_notices(); // already escaped
231
+		return false;
232
+	}
233 233
 
234 234
 
235
-    /**
236
-     * @return int
237
-     */
238
-    private function getEventId()
239
-    {
240
-        // do we have an event id?
241
-        if (! $this->request->requestParamIsSet('tkt-slctr-event-id')) {
242
-            // $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
243
-            EE_Error::add_error(
244
-                sprintf(
245
-                    esc_html__(
246
-                        'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.',
247
-                        'event_espresso'
248
-                    ),
249
-                    '<br/>'
250
-                ),
251
-                __FILE__,
252
-                __FUNCTION__,
253
-                __LINE__
254
-            );
255
-        }
256
-        // if event id is valid
257
-        return $this->request->getRequestParam('tkt-slctr-event-id', 0, 'int');
258
-    }
235
+	/**
236
+	 * @return int
237
+	 */
238
+	private function getEventId()
239
+	{
240
+		// do we have an event id?
241
+		if (! $this->request->requestParamIsSet('tkt-slctr-event-id')) {
242
+			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
243
+			EE_Error::add_error(
244
+				sprintf(
245
+					esc_html__(
246
+						'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.',
247
+						'event_espresso'
248
+					),
249
+					'<br/>'
250
+				),
251
+				__FILE__,
252
+				__FUNCTION__,
253
+				__LINE__
254
+			);
255
+		}
256
+		// if event id is valid
257
+		return $this->request->getRequestParam('tkt-slctr-event-id', 0, 'int');
258
+	}
259 259
 
260 260
 
261
-    /**
262
-     * validate_post_data
263
-     *
264
-     * @param int $id
265
-     * @return array
266
-     */
267
-    private function validatePostData($id = 0)
268
-    {
269
-        if (! $id) {
270
-            EE_Error::add_error(
271
-                esc_html__('The event id provided was not valid.', 'event_espresso'),
272
-                __FILE__,
273
-                __FUNCTION__,
274
-                __LINE__
275
-            );
276
-            return array();
277
-        }
278
-        // start with an empty array()
279
-        $valid_data = array();
280
-        // grab valid id
281
-        $valid_data['id'] = $id;
282
-        // array of other form names
283
-        $inputs_to_clean = array(
284
-            'max_atndz'  => 'tkt-slctr-max-atndz-',
285
-            'rows'       => 'tkt-slctr-rows-',
286
-            'qty'        => 'tkt-slctr-qty-',
287
-            'ticket_id'  => 'tkt-slctr-ticket-id-',
288
-            'return_url' => 'tkt-slctr-return-url-',
289
-        );
290
-        // let's track the total number of tickets ordered.'
291
-        $valid_data['total_tickets'] = 0;
292
-        // cycle through $inputs_to_clean array
293
-        foreach ($inputs_to_clean as $what => $input_to_clean) {
294
-            $input_key = "{$input_to_clean}{$id}";
295
-            // check for POST data
296
-            if ($this->request->requestParamIsSet($input_key)) {
297
-                switch ($what) {
298
-                    // integers
299
-                    case 'event_id':
300
-                    case 'rows':
301
-                    case 'max_atndz':
302
-                        $valid_data[ $what ] = $this->request->getRequestParam($input_key, 0, 'int');
303
-                        break;
304
-                    // arrays of integers
305
-                    case 'qty':
306
-                        $max_atndz = $valid_data['max_atndz'] ?? $this->request->getRequestParam($input_key, 0, 'int');
307
-                        // explode integers by the dash if qty is a string
308
-                        $delimiter = $max_atndz === 1 ? '-' : '';
309
-                        /** @var array $row_qty */
310
-                        $row_qty = $this->request->getRequestParam($input_key, [], 'int', true, $delimiter);
311
-                        // if qty is coming from a radio button input, then we need to assemble an array of rows
312
-                        if ($max_atndz === 1) {
313
-                            // get number of rows
314
-                            $rows = $this->request->getRequestParam('tkt-slctr-rows-' . $id, 1, 'int');
315
-                            $row = isset($row_qty[0]) ? absint($row_qty[0]) : 1;
316
-                            $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
317
-                            // restructure the row qty array so that $row is now the key instead of the first value
318
-                            $row_qty = array($row => $qty);
319
-                            for ($x = 1; $x <= $rows; $x++) {
320
-                                if (! isset($row_qty[ $x ])) {
321
-                                    $row_qty[ $x ] = 0;
322
-                                }
323
-                            }
324
-                        }
325
-                        ksort($row_qty);
326
-                        // cycle thru values
327
-                        foreach ($row_qty as $qty) {
328
-                            $qty = absint($qty);
329
-                            // sanitize as integers
330
-                            $valid_data[ $what ][] = $qty;
331
-                            $valid_data['total_tickets'] += $qty;
332
-                        }
333
-                        break;
334
-                    // array of integers
335
-                    case 'ticket_id':
336
-                        $ticket_ids = (array) $this->request->getRequestParam($input_key, [], 'int', true);
337
-                        // cycle thru values
338
-                        foreach ($ticket_ids as $key => $value) {
339
-                            // allow only integers
340
-                            $valid_data[ $what ][ $key ] = absint($value);
341
-                        }
342
-                        break;
343
-                    case 'return_url':
344
-                        // grab and sanitize return-url
345
-                        $input_value = $this->request->getRequestParam($input_key, '', 'url');
346
-                        // was the request coming from an iframe ? if so, then:
347
-                        if (strpos($input_value, 'event_list=iframe')) {
348
-                            // get anchor fragment
349
-                            $input_value = explode('#', $input_value);
350
-                            $input_value = end($input_value);
351
-                            // use event list url instead, but append anchor
352
-                            $input_value = EEH_Event_View::event_archive_url() . '#' . $input_value;
353
-                        }
354
-                        $valid_data[ $what ] = $input_value;
355
-                        break;
356
-                }    // end switch $what
357
-            }
358
-        }    // end foreach $inputs_to_clean
359
-        return $valid_data;
360
-    }
261
+	/**
262
+	 * validate_post_data
263
+	 *
264
+	 * @param int $id
265
+	 * @return array
266
+	 */
267
+	private function validatePostData($id = 0)
268
+	{
269
+		if (! $id) {
270
+			EE_Error::add_error(
271
+				esc_html__('The event id provided was not valid.', 'event_espresso'),
272
+				__FILE__,
273
+				__FUNCTION__,
274
+				__LINE__
275
+			);
276
+			return array();
277
+		}
278
+		// start with an empty array()
279
+		$valid_data = array();
280
+		// grab valid id
281
+		$valid_data['id'] = $id;
282
+		// array of other form names
283
+		$inputs_to_clean = array(
284
+			'max_atndz'  => 'tkt-slctr-max-atndz-',
285
+			'rows'       => 'tkt-slctr-rows-',
286
+			'qty'        => 'tkt-slctr-qty-',
287
+			'ticket_id'  => 'tkt-slctr-ticket-id-',
288
+			'return_url' => 'tkt-slctr-return-url-',
289
+		);
290
+		// let's track the total number of tickets ordered.'
291
+		$valid_data['total_tickets'] = 0;
292
+		// cycle through $inputs_to_clean array
293
+		foreach ($inputs_to_clean as $what => $input_to_clean) {
294
+			$input_key = "{$input_to_clean}{$id}";
295
+			// check for POST data
296
+			if ($this->request->requestParamIsSet($input_key)) {
297
+				switch ($what) {
298
+					// integers
299
+					case 'event_id':
300
+					case 'rows':
301
+					case 'max_atndz':
302
+						$valid_data[ $what ] = $this->request->getRequestParam($input_key, 0, 'int');
303
+						break;
304
+					// arrays of integers
305
+					case 'qty':
306
+						$max_atndz = $valid_data['max_atndz'] ?? $this->request->getRequestParam($input_key, 0, 'int');
307
+						// explode integers by the dash if qty is a string
308
+						$delimiter = $max_atndz === 1 ? '-' : '';
309
+						/** @var array $row_qty */
310
+						$row_qty = $this->request->getRequestParam($input_key, [], 'int', true, $delimiter);
311
+						// if qty is coming from a radio button input, then we need to assemble an array of rows
312
+						if ($max_atndz === 1) {
313
+							// get number of rows
314
+							$rows = $this->request->getRequestParam('tkt-slctr-rows-' . $id, 1, 'int');
315
+							$row = isset($row_qty[0]) ? absint($row_qty[0]) : 1;
316
+							$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
317
+							// restructure the row qty array so that $row is now the key instead of the first value
318
+							$row_qty = array($row => $qty);
319
+							for ($x = 1; $x <= $rows; $x++) {
320
+								if (! isset($row_qty[ $x ])) {
321
+									$row_qty[ $x ] = 0;
322
+								}
323
+							}
324
+						}
325
+						ksort($row_qty);
326
+						// cycle thru values
327
+						foreach ($row_qty as $qty) {
328
+							$qty = absint($qty);
329
+							// sanitize as integers
330
+							$valid_data[ $what ][] = $qty;
331
+							$valid_data['total_tickets'] += $qty;
332
+						}
333
+						break;
334
+					// array of integers
335
+					case 'ticket_id':
336
+						$ticket_ids = (array) $this->request->getRequestParam($input_key, [], 'int', true);
337
+						// cycle thru values
338
+						foreach ($ticket_ids as $key => $value) {
339
+							// allow only integers
340
+							$valid_data[ $what ][ $key ] = absint($value);
341
+						}
342
+						break;
343
+					case 'return_url':
344
+						// grab and sanitize return-url
345
+						$input_value = $this->request->getRequestParam($input_key, '', 'url');
346
+						// was the request coming from an iframe ? if so, then:
347
+						if (strpos($input_value, 'event_list=iframe')) {
348
+							// get anchor fragment
349
+							$input_value = explode('#', $input_value);
350
+							$input_value = end($input_value);
351
+							// use event list url instead, but append anchor
352
+							$input_value = EEH_Event_View::event_archive_url() . '#' . $input_value;
353
+						}
354
+						$valid_data[ $what ] = $input_value;
355
+						break;
356
+				}    // end switch $what
357
+			}
358
+		}    // end foreach $inputs_to_clean
359
+		return $valid_data;
360
+	}
361 361
 
362 362
 
363
-    /**
364
-     * @param array $valid
365
-     */
366
-    private function maxAttendeesViolation(array $valid)
367
-    {
368
-        // ordering too many tickets !!!
369
-        $total_tickets_string = esc_html(
370
-            _n(
371
-                'You have attempted to purchase %s ticket.',
372
-                'You have attempted to purchase %s tickets.',
373
-                $valid['total_tickets'],
374
-                'event_espresso'
375
-            )
376
-        );
377
-        $limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
378
-        // dev only message
379
-        $max_attendees_string = esc_html(
380
-            _n(
381
-                'The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.',
382
-                'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.',
383
-                $valid['max_atndz'],
384
-                'event_espresso'
385
-            )
386
-        );
387
-        $limit_error_2 = sprintf($max_attendees_string, $valid['max_atndz'], $valid['max_atndz']);
388
-        EE_Error::add_error($limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__);
389
-    }
363
+	/**
364
+	 * @param array $valid
365
+	 */
366
+	private function maxAttendeesViolation(array $valid)
367
+	{
368
+		// ordering too many tickets !!!
369
+		$total_tickets_string = esc_html(
370
+			_n(
371
+				'You have attempted to purchase %s ticket.',
372
+				'You have attempted to purchase %s tickets.',
373
+				$valid['total_tickets'],
374
+				'event_espresso'
375
+			)
376
+		);
377
+		$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
378
+		// dev only message
379
+		$max_attendees_string = esc_html(
380
+			_n(
381
+				'The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.',
382
+				'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.',
383
+				$valid['max_atndz'],
384
+				'event_espresso'
385
+			)
386
+		);
387
+		$limit_error_2 = sprintf($max_attendees_string, $valid['max_atndz'], $valid['max_atndz']);
388
+		EE_Error::add_error($limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__);
389
+	}
390 390
 
391 391
 
392
-    /**
393
-     * @param array $valid
394
-     * @return int
395
-     * @throws EE_Error
396
-     * @throws InvalidArgumentException
397
-     * @throws InvalidDataTypeException
398
-     * @throws InvalidInterfaceException
399
-     */
400
-    private function addTicketsToCart(array $valid)
401
-    {
402
-        $tickets_added = 0;
403
-        $tickets_selected = false;
404
-        if (! empty($valid) && $valid['total_tickets'] > 0) {
405
-            // load cart using factory because we don't want to do so until actually needed
406
-            $this->cart = CartFactory::getCart();
407
-            // if the user is an admin that can edit registrations,
408
-            // then we'll also allow them to add any tickets, even if they are expired
409
-            $current_user_is_admin = current_user_can('ee_edit_registrations');
410
-            // cycle thru the number of data rows sent from the event listing
411
-            for ($x = 0; $x < $valid['rows']; $x++) {
412
-                // does this row actually contain a ticket quantity?
413
-                if (isset($valid['qty'][ $x ]) && $valid['qty'][ $x ] > 0) {
414
-                    // YES we have a ticket quantity
415
-                    $tickets_selected = true;
416
-                    $valid_ticket = false;
417
-                    if (isset($valid['ticket_id'][ $x ])) {
418
-                        // get ticket via the ticket id we put in the form
419
-                        $ticket = $this->ticket_model->get_one_by_ID($valid['ticket_id'][ $x ]);
420
-                        if ($ticket instanceof EE_Ticket && ($ticket->is_on_sale() || $current_user_is_admin)) {
421
-                            $valid_ticket = true;
422
-                            $tickets_added += $this->addTicketToCart(
423
-                                $ticket,
424
-                                $valid['qty'][ $x ]
425
-                            );
426
-                        }
427
-                    }
428
-                    if ($valid_ticket !== true) {
429
-                        // nothing added to cart retrieved
430
-                        EE_Error::add_error(
431
-                            sprintf(
432
-                                esc_html__(
433
-                                    'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.',
434
-                                    'event_espresso'
435
-                                ),
436
-                                '<br/>'
437
-                            ),
438
-                            __FILE__,
439
-                            __FUNCTION__,
440
-                            __LINE__
441
-                        );
442
-                    }
443
-                    if (EE_Error::has_error()) {
444
-                        break;
445
-                    }
446
-                }
447
-            }
448
-        }
449
-        do_action(
450
-            'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart',
451
-            $this->cart,
452
-            $this
453
-        );
454
-        if (! apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tickets_selected)) {
455
-            // no ticket quantities were selected
456
-            EE_Error::add_error(
457
-                esc_html__('You need to select a ticket quantity before you can proceed.', 'event_espresso'),
458
-                __FILE__,
459
-                __FUNCTION__,
460
-                __LINE__
461
-            );
462
-        }
463
-        return $tickets_added;
464
-    }
392
+	/**
393
+	 * @param array $valid
394
+	 * @return int
395
+	 * @throws EE_Error
396
+	 * @throws InvalidArgumentException
397
+	 * @throws InvalidDataTypeException
398
+	 * @throws InvalidInterfaceException
399
+	 */
400
+	private function addTicketsToCart(array $valid)
401
+	{
402
+		$tickets_added = 0;
403
+		$tickets_selected = false;
404
+		if (! empty($valid) && $valid['total_tickets'] > 0) {
405
+			// load cart using factory because we don't want to do so until actually needed
406
+			$this->cart = CartFactory::getCart();
407
+			// if the user is an admin that can edit registrations,
408
+			// then we'll also allow them to add any tickets, even if they are expired
409
+			$current_user_is_admin = current_user_can('ee_edit_registrations');
410
+			// cycle thru the number of data rows sent from the event listing
411
+			for ($x = 0; $x < $valid['rows']; $x++) {
412
+				// does this row actually contain a ticket quantity?
413
+				if (isset($valid['qty'][ $x ]) && $valid['qty'][ $x ] > 0) {
414
+					// YES we have a ticket quantity
415
+					$tickets_selected = true;
416
+					$valid_ticket = false;
417
+					if (isset($valid['ticket_id'][ $x ])) {
418
+						// get ticket via the ticket id we put in the form
419
+						$ticket = $this->ticket_model->get_one_by_ID($valid['ticket_id'][ $x ]);
420
+						if ($ticket instanceof EE_Ticket && ($ticket->is_on_sale() || $current_user_is_admin)) {
421
+							$valid_ticket = true;
422
+							$tickets_added += $this->addTicketToCart(
423
+								$ticket,
424
+								$valid['qty'][ $x ]
425
+							);
426
+						}
427
+					}
428
+					if ($valid_ticket !== true) {
429
+						// nothing added to cart retrieved
430
+						EE_Error::add_error(
431
+							sprintf(
432
+								esc_html__(
433
+									'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.',
434
+									'event_espresso'
435
+								),
436
+								'<br/>'
437
+							),
438
+							__FILE__,
439
+							__FUNCTION__,
440
+							__LINE__
441
+						);
442
+					}
443
+					if (EE_Error::has_error()) {
444
+						break;
445
+					}
446
+				}
447
+			}
448
+		}
449
+		do_action(
450
+			'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart',
451
+			$this->cart,
452
+			$this
453
+		);
454
+		if (! apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tickets_selected)) {
455
+			// no ticket quantities were selected
456
+			EE_Error::add_error(
457
+				esc_html__('You need to select a ticket quantity before you can proceed.', 'event_espresso'),
458
+				__FILE__,
459
+				__FUNCTION__,
460
+				__LINE__
461
+			);
462
+		}
463
+		return $tickets_added;
464
+	}
465 465
 
466 466
 
467
-    /**
468
-     * adds a ticket to the cart
469
-     *
470
-     * @param EE_Ticket $ticket
471
-     * @param int       $qty
472
-     * @return bool TRUE on success, FALSE on fail
473
-     * @throws InvalidArgumentException
474
-     * @throws InvalidInterfaceException
475
-     * @throws InvalidDataTypeException
476
-     * @throws EE_Error
477
-     */
478
-    private function addTicketToCart(EE_Ticket $ticket, $qty = 1)
479
-    {
480
-        // get the number of spaces left for this datetime ticket
481
-        $available_spaces = $this->tracker->ticketDatetimeAvailability($ticket);
482
-        // compare available spaces against the number of tickets being purchased
483
-        if ($available_spaces >= $qty) {
484
-            // allow addons to prevent a ticket from being added to cart
485
-            if (
486
-                ! apply_filters(
487
-                    'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart',
488
-                    true,
489
-                    $ticket,
490
-                    $qty,
491
-                    $available_spaces
492
-                )
493
-            ) {
494
-                return false;
495
-            }
496
-            $qty = absint(apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket));
497
-            // add event to cart
498
-            if ($this->cart->add_ticket_to_cart($ticket, $qty)) {
499
-                $this->tracker->recalculateTicketDatetimeAvailability($ticket, $qty);
500
-                return true;
501
-            }
502
-            return false;
503
-        }
504
-        $this->tracker->processAvailabilityError($ticket, $qty, $this->cart->all_ticket_quantity_count());
505
-        return false;
506
-    }
467
+	/**
468
+	 * adds a ticket to the cart
469
+	 *
470
+	 * @param EE_Ticket $ticket
471
+	 * @param int       $qty
472
+	 * @return bool TRUE on success, FALSE on fail
473
+	 * @throws InvalidArgumentException
474
+	 * @throws InvalidInterfaceException
475
+	 * @throws InvalidDataTypeException
476
+	 * @throws EE_Error
477
+	 */
478
+	private function addTicketToCart(EE_Ticket $ticket, $qty = 1)
479
+	{
480
+		// get the number of spaces left for this datetime ticket
481
+		$available_spaces = $this->tracker->ticketDatetimeAvailability($ticket);
482
+		// compare available spaces against the number of tickets being purchased
483
+		if ($available_spaces >= $qty) {
484
+			// allow addons to prevent a ticket from being added to cart
485
+			if (
486
+				! apply_filters(
487
+					'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart',
488
+					true,
489
+					$ticket,
490
+					$qty,
491
+					$available_spaces
492
+				)
493
+			) {
494
+				return false;
495
+			}
496
+			$qty = absint(apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket));
497
+			// add event to cart
498
+			if ($this->cart->add_ticket_to_cart($ticket, $qty)) {
499
+				$this->tracker->recalculateTicketDatetimeAvailability($ticket, $qty);
500
+				return true;
501
+			}
502
+			return false;
503
+		}
504
+		$this->tracker->processAvailabilityError($ticket, $qty, $this->cart->all_ticket_quantity_count());
505
+		return false;
506
+	}
507 507
 
508 508
 
509
-    /**
510
-     * @param $tickets_added
511
-     * @return bool
512
-     * @throws InvalidInterfaceException
513
-     * @throws InvalidDataTypeException
514
-     * @throws EE_Error
515
-     * @throws InvalidArgumentException
516
-     */
517
-    private function processSuccessfulCart($tickets_added)
518
-    {
519
-        // exit('KILL REDIRECT BEFORE CART UPDATE'); // <<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
520
-        if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added)) {
521
-            // make sure cart is loaded
522
-            if (! $this->cart instanceof EE_Cart) {
523
-                $this->cart = CartFactory::getCart();
524
-            }
525
-            do_action(
526
-                'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout',
527
-                $this->cart,
528
-                $this
529
-            );
530
-            $this->cart->recalculate_all_cart_totals();
531
-            $this->cart->save_cart(false);
532
-            // exit('KILL REDIRECT AFTER CART UPDATE'); // <<<<<<<<  OR HERE TO KILL REDIRECT AFTER CART UPDATE
533
-            // just return TRUE for registrations being made from admin
534
-            if ($this->request->isAdmin() || $this->request->isFrontAjax()) {
535
-                return true;
536
-            }
537
-            EEH_URL::safeRedirectAndExit(
538
-                apply_filters(
539
-                    'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url',
540
-                    $this->core_config->reg_page_url()
541
-                )
542
-            );
543
-        }
544
-        if (! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention')) {
545
-            // nothing added to cart
546
-            EE_Error::add_attention(
547
-                esc_html__('No tickets were added for the event', 'event_espresso'),
548
-                __FILE__,
549
-                __FUNCTION__,
550
-                __LINE__
551
-            );
552
-        }
553
-        return false;
554
-    }
509
+	/**
510
+	 * @param $tickets_added
511
+	 * @return bool
512
+	 * @throws InvalidInterfaceException
513
+	 * @throws InvalidDataTypeException
514
+	 * @throws EE_Error
515
+	 * @throws InvalidArgumentException
516
+	 */
517
+	private function processSuccessfulCart($tickets_added)
518
+	{
519
+		// exit('KILL REDIRECT BEFORE CART UPDATE'); // <<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
520
+		if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added)) {
521
+			// make sure cart is loaded
522
+			if (! $this->cart instanceof EE_Cart) {
523
+				$this->cart = CartFactory::getCart();
524
+			}
525
+			do_action(
526
+				'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout',
527
+				$this->cart,
528
+				$this
529
+			);
530
+			$this->cart->recalculate_all_cart_totals();
531
+			$this->cart->save_cart(false);
532
+			// exit('KILL REDIRECT AFTER CART UPDATE'); // <<<<<<<<  OR HERE TO KILL REDIRECT AFTER CART UPDATE
533
+			// just return TRUE for registrations being made from admin
534
+			if ($this->request->isAdmin() || $this->request->isFrontAjax()) {
535
+				return true;
536
+			}
537
+			EEH_URL::safeRedirectAndExit(
538
+				apply_filters(
539
+					'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url',
540
+					$this->core_config->reg_page_url()
541
+				)
542
+			);
543
+		}
544
+		if (! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention')) {
545
+			// nothing added to cart
546
+			EE_Error::add_attention(
547
+				esc_html__('No tickets were added for the event', 'event_espresso'),
548
+				__FILE__,
549
+				__FUNCTION__,
550
+				__LINE__
551
+			);
552
+		}
553
+		return false;
554
+	}
555 555
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     public function cancelTicketSelections()
119 119
     {
120 120
         // check nonce
121
-        if (! $this->processTicketSelectorNonce('cancel_ticket_selections')) {
121
+        if ( ! $this->processTicketSelectorNonce('cancel_ticket_selections')) {
122 122
             return false;
123 123
         }
124 124
         $this->session->clear_session(__CLASS__, __FUNCTION__);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             );
131 131
         }
132 132
         EEH_URL::safeRedirectAndExit(
133
-            site_url('/' . $this->core_config->event_cpt_slug . '/')
133
+            site_url('/'.$this->core_config->event_cpt_slug.'/')
134 134
         );
135 135
         return true;
136 136
     }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             $this->validatePostData($id)
209 209
         );
210 210
         // check total tickets ordered vs max number of attendees that can register
211
-        if (! empty($valid) && $valid['total_tickets'] > $valid['max_atndz']) {
211
+        if ( ! empty($valid) && $valid['total_tickets'] > $valid['max_atndz']) {
212 212
             $this->maxAttendeesViolation($valid);
213 213
         } else {
214 214
             // all data appears to be valid
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     private function getEventId()
239 239
     {
240 240
         // do we have an event id?
241
-        if (! $this->request->requestParamIsSet('tkt-slctr-event-id')) {
241
+        if ( ! $this->request->requestParamIsSet('tkt-slctr-event-id')) {
242 242
             // $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
243 243
             EE_Error::add_error(
244 244
                 sprintf(
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
      */
267 267
     private function validatePostData($id = 0)
268 268
     {
269
-        if (! $id) {
269
+        if ( ! $id) {
270 270
             EE_Error::add_error(
271 271
                 esc_html__('The event id provided was not valid.', 'event_espresso'),
272 272
                 __FILE__,
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
                     case 'event_id':
300 300
                     case 'rows':
301 301
                     case 'max_atndz':
302
-                        $valid_data[ $what ] = $this->request->getRequestParam($input_key, 0, 'int');
302
+                        $valid_data[$what] = $this->request->getRequestParam($input_key, 0, 'int');
303 303
                         break;
304 304
                     // arrays of integers
305 305
                     case 'qty':
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
                         // if qty is coming from a radio button input, then we need to assemble an array of rows
312 312
                         if ($max_atndz === 1) {
313 313
                             // get number of rows
314
-                            $rows = $this->request->getRequestParam('tkt-slctr-rows-' . $id, 1, 'int');
314
+                            $rows = $this->request->getRequestParam('tkt-slctr-rows-'.$id, 1, 'int');
315 315
                             $row = isset($row_qty[0]) ? absint($row_qty[0]) : 1;
316 316
                             $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
317 317
                             // restructure the row qty array so that $row is now the key instead of the first value
318 318
                             $row_qty = array($row => $qty);
319 319
                             for ($x = 1; $x <= $rows; $x++) {
320
-                                if (! isset($row_qty[ $x ])) {
321
-                                    $row_qty[ $x ] = 0;
320
+                                if ( ! isset($row_qty[$x])) {
321
+                                    $row_qty[$x] = 0;
322 322
                                 }
323 323
                             }
324 324
                         }
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
                         foreach ($row_qty as $qty) {
328 328
                             $qty = absint($qty);
329 329
                             // sanitize as integers
330
-                            $valid_data[ $what ][] = $qty;
330
+                            $valid_data[$what][] = $qty;
331 331
                             $valid_data['total_tickets'] += $qty;
332 332
                         }
333 333
                         break;
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
                         // cycle thru values
338 338
                         foreach ($ticket_ids as $key => $value) {
339 339
                             // allow only integers
340
-                            $valid_data[ $what ][ $key ] = absint($value);
340
+                            $valid_data[$what][$key] = absint($value);
341 341
                         }
342 342
                         break;
343 343
                     case 'return_url':
@@ -349,9 +349,9 @@  discard block
 block discarded – undo
349 349
                             $input_value = explode('#', $input_value);
350 350
                             $input_value = end($input_value);
351 351
                             // use event list url instead, but append anchor
352
-                            $input_value = EEH_Event_View::event_archive_url() . '#' . $input_value;
352
+                            $input_value = EEH_Event_View::event_archive_url().'#'.$input_value;
353 353
                         }
354
-                        $valid_data[ $what ] = $input_value;
354
+                        $valid_data[$what] = $input_value;
355 355
                         break;
356 356
                 }    // end switch $what
357 357
             }
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
             )
386 386
         );
387 387
         $limit_error_2 = sprintf($max_attendees_string, $valid['max_atndz'], $valid['max_atndz']);
388
-        EE_Error::add_error($limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__);
388
+        EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
389 389
     }
390 390
 
391 391
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
     {
402 402
         $tickets_added = 0;
403 403
         $tickets_selected = false;
404
-        if (! empty($valid) && $valid['total_tickets'] > 0) {
404
+        if ( ! empty($valid) && $valid['total_tickets'] > 0) {
405 405
             // load cart using factory because we don't want to do so until actually needed
406 406
             $this->cart = CartFactory::getCart();
407 407
             // if the user is an admin that can edit registrations,
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
             // cycle thru the number of data rows sent from the event listing
411 411
             for ($x = 0; $x < $valid['rows']; $x++) {
412 412
                 // does this row actually contain a ticket quantity?
413
-                if (isset($valid['qty'][ $x ]) && $valid['qty'][ $x ] > 0) {
413
+                if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
414 414
                     // YES we have a ticket quantity
415 415
                     $tickets_selected = true;
416 416
                     $valid_ticket = false;
417
-                    if (isset($valid['ticket_id'][ $x ])) {
417
+                    if (isset($valid['ticket_id'][$x])) {
418 418
                         // get ticket via the ticket id we put in the form
419
-                        $ticket = $this->ticket_model->get_one_by_ID($valid['ticket_id'][ $x ]);
419
+                        $ticket = $this->ticket_model->get_one_by_ID($valid['ticket_id'][$x]);
420 420
                         if ($ticket instanceof EE_Ticket && ($ticket->is_on_sale() || $current_user_is_admin)) {
421 421
                             $valid_ticket = true;
422 422
                             $tickets_added += $this->addTicketToCart(
423 423
                                 $ticket,
424
-                                $valid['qty'][ $x ]
424
+                                $valid['qty'][$x]
425 425
                             );
426 426
                         }
427 427
                     }
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
             $this->cart,
452 452
             $this
453 453
         );
454
-        if (! apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tickets_selected)) {
454
+        if ( ! apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tickets_selected)) {
455 455
             // no ticket quantities were selected
456 456
             EE_Error::add_error(
457 457
                 esc_html__('You need to select a ticket quantity before you can proceed.', 'event_espresso'),
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
         // exit('KILL REDIRECT BEFORE CART UPDATE'); // <<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
520 520
         if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added)) {
521 521
             // make sure cart is loaded
522
-            if (! $this->cart instanceof EE_Cart) {
522
+            if ( ! $this->cart instanceof EE_Cart) {
523 523
                 $this->cart = CartFactory::getCart();
524 524
             }
525 525
             do_action(
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
                 )
542 542
             );
543 543
         }
544
-        if (! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention')) {
544
+        if ( ! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention')) {
545 545
             // nothing added to cart
546 546
             EE_Error::add_attention(
547 547
                 esc_html__('No tickets were added for the event', 'event_espresso'),
Please login to merge, or discard this patch.