Completed
Branch FET-9576-iframes (9d3203)
by
unknown
255:15 queued 240:15
created
modules/ticket_selector/ProcessTicketSelector.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @access        public
36 36
      * @access        public
37
-     * @return        array  or FALSE
37
+     * @return        boolean|null  or FALSE
38 38
      * @throws \EE_Error
39 39
      */
40 40
     public function process_ticket_selections()
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
      * @access   private
352 352
      * @param \EE_Ticket $ticket
353 353
      * @param int        $qty
354
-     * @return TRUE on success, FALSE on fail
354
+     * @return boolean on success, FALSE on fail
355 355
      * @throws \EE_Error
356 356
      */
357 357
     private static function _add_ticket_to_cart(\EE_Ticket $ticket = null, $qty = 1)
Please login to merge, or discard this patch.
Indentation   +485 added lines, -485 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\modules\ticket_selector;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -19,509 +19,509 @@  discard block
 block discarded – undo
19 19
 class ProcessTicketSelector
20 20
 {
21 21
 
22
-    /**
23
-     * array of datetimes and the spaces available for them
24
-     *
25
-     * @access private
26
-     * @var array
27
-     */
28
-    private static $_available_spaces = array();
22
+	/**
23
+	 * array of datetimes and the spaces available for them
24
+	 *
25
+	 * @access private
26
+	 * @var array
27
+	 */
28
+	private static $_available_spaces = array();
29 29
 
30 30
 
31 31
 
32
-    /**
33
-     *    process_ticket_selections
34
-     *
35
-     * @access        public
36
-     * @access        public
37
-     * @return        array  or FALSE
38
-     * @throws \EE_Error
39
-     */
40
-    public function process_ticket_selections()
41
-    {
42
-        do_action('EED_Ticket_Selector__process_ticket_selections__before');
43
-        // check nonce
44
-        if ( ! is_admin()
45
-             && ( ! \EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce')
46
-                  || ! wp_verify_nonce(
47
-                    \EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'),
48
-                    'process_ticket_selections'
49
-                ))
50
-        ) {
51
-            \EE_Error::add_error(
52
-                sprintf(
53
-                    __(
54
-                        'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.',
55
-                        'event_espresso'
56
-                    ),
57
-                    '<br/>'
58
-                ),
59
-                __FILE__,
60
-                __FUNCTION__,
61
-                __LINE__
62
-            );
63
-            return false;
64
-        }
32
+	/**
33
+	 *    process_ticket_selections
34
+	 *
35
+	 * @access        public
36
+	 * @access        public
37
+	 * @return        array  or FALSE
38
+	 * @throws \EE_Error
39
+	 */
40
+	public function process_ticket_selections()
41
+	{
42
+		do_action('EED_Ticket_Selector__process_ticket_selections__before');
43
+		// check nonce
44
+		if ( ! is_admin()
45
+			 && ( ! \EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce')
46
+				  || ! wp_verify_nonce(
47
+					\EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'),
48
+					'process_ticket_selections'
49
+				))
50
+		) {
51
+			\EE_Error::add_error(
52
+				sprintf(
53
+					__(
54
+						'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.',
55
+						'event_espresso'
56
+					),
57
+					'<br/>'
58
+				),
59
+				__FILE__,
60
+				__FUNCTION__,
61
+				__LINE__
62
+			);
63
+			return false;
64
+		}
65 65
 //		d( \EE_Registry::instance()->REQ );
66
-        self::$_available_spaces = array(
67
-            'tickets'   => array(),
68
-            'datetimes' => array(),
69
-        );
70
-        //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
71
-        // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
72
-        \EE_Registry::instance()->load_core('Session');
73
-        // unless otherwise requested, clear the session
74
-        if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', true)) {
75
-            \EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
76
-        }
77
-        //d( \EE_Registry::instance()->SSN );
78
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
79
-        // do we have an event id?
80
-        if (\EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
81
-            // validate/sanitize data
82
-            $valid = self::_validate_post_data();
83
-            //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
84
-            //EEH_Debug_Tools::printr( $valid, '$valid', __FILE__, __LINE__ );
85
-            //EEH_Debug_Tools::printr( $valid[ 'total_tickets' ], 'total_tickets', __FILE__, __LINE__ );
86
-            //EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
87
-            //check total tickets ordered vs max number of attendees that can register
88
-            if ($valid['total_tickets'] > $valid['max_atndz']) {
89
-                // ordering too many tickets !!!
90
-                $singular = 'You have attempted to purchase %s ticket.';
91
-                $plural = 'You have attempted to purchase %s tickets.';
92
-                $limit_error_1 = sprintf(
93
-                    _n($singular, $plural, $valid['total_tickets'], 'event_espresso'),
94
-                    $valid['total_tickets'],
95
-                    $valid['total_tickets']
96
-                );
97
-                // dev only message
98
-                $singular = '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.';
99
-                $plural = '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.';
100
-                $limit_error_2 = sprintf(
101
-                    _n($singular, $plural, $valid['max_atndz'], 'event_espresso'),
102
-                    $valid['max_atndz'],
103
-                    $valid['max_atndz']
104
-                );
105
-                \EE_Error::add_error($limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__);
106
-            } else {
107
-                // all data appears to be valid
108
-                $tckts_slctd = false;
109
-                $success = true;
110
-                // load cart
111
-                \EE_Registry::instance()->load_core('Cart');
112
-                // cycle thru the number of data rows sent from the event listing
113
-                for ($x = 0; $x < $valid['rows']; $x++) {
114
-                    // does this row actually contain a ticket quantity?
115
-                    if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
116
-                        // YES we have a ticket quantity
117
-                        $tckts_slctd = true;
118
-                        //						d( $valid['ticket_obj'][$x] );
119
-                        if ($valid['ticket_obj'][$x] instanceof \EE_Ticket) {
120
-                            // then add ticket to cart
121
-                            $ticket_added = self::_add_ticket_to_cart(
122
-                                $valid['ticket_obj'][$x],
123
-                                $valid['qty'][$x]
124
-                            );
125
-                            $success = ! $ticket_added ? false : $success;
126
-                            if (\EE_Error::has_error()) {
127
-                                break;
128
-                            }
129
-                        } else {
130
-                            // nothing added to cart retrieved
131
-                            \EE_Error::add_error(
132
-                                sprintf(
133
-                                    __(
134
-                                        'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.',
135
-                                        'event_espresso'
136
-                                    ),
137
-                                    '<br/>'
138
-                                ),
139
-                                __FILE__,
140
-                                __FUNCTION__,
141
-                                __LINE__
142
-                            );
143
-                        }
144
-                    }
145
-                }
146
-                //d( \EE_Registry::instance()->CART );
147
-                //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
148
-                if ($tckts_slctd) {
149
-                    if ($success) {
150
-                        do_action(
151
-                            'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout',
152
-                            \EE_Registry::instance()->CART,
153
-                            $this
154
-                        );
155
-                        \EE_Registry::instance()->CART->recalculate_all_cart_totals();
156
-                        \EE_Registry::instance()->CART->save_cart(false);
157
-                        \EE_Registry::instance()->SSN->update();
158
-                        //d( \EE_Registry::instance()->CART );
159
-                        //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
160
-                        // just return TRUE for registrations being made from admin
161
-                        if (is_admin()) {
162
-                            return true;
163
-                        }
164
-                        wp_safe_redirect(
165
-                            apply_filters(
166
-                                'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url',
167
-                                \EE_Registry::instance()->CFG->core->reg_page_url()
168
-                            )
169
-                        );
170
-                        exit();
171
-                    } else {
172
-                        if ( ! \EE_Error::has_error()) {
173
-                            // nothing added to cart
174
-                            \EE_Error::add_attention(
175
-                                __('No tickets were added for the event', 'event_espresso'),
176
-                                __FILE__,
177
-                                __FUNCTION__,
178
-                                __LINE__
179
-                            );
180
-                        }
181
-                    }
182
-                } else {
183
-                    // no ticket quantities were selected
184
-                    \EE_Error::add_error(
185
-                        __('You need to select a ticket quantity before you can proceed.', 'event_espresso'),
186
-                        __FILE__,
187
-                        __FUNCTION__,
188
-                        __LINE__
189
-                    );
190
-                }
191
-            }
192
-            //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
193
-            // at this point, just return if registration is being made from admin
194
-            if (is_admin()) {
195
-                return false;
196
-            }
197
-            if ($valid['return_url']) {
198
-                \EE_Error::get_notices(false, true);
199
-                wp_safe_redirect($valid['return_url']);
200
-                exit();
201
-            } elseif (isset($event_to_add['id'])) {
202
-                \EE_Error::get_notices(false, true);
203
-                wp_safe_redirect(get_permalink($event_to_add['id']));
204
-                exit();
205
-            } else {
206
-                echo \EE_Error::get_notices();
207
-            }
208
-        } else {
209
-            // $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
210
-            \EE_Error::add_error(
211
-                sprintf(
212
-                    __(
213
-                        'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.',
214
-                        'event_espresso'
215
-                    ),
216
-                    '<br/>'
217
-                ),
218
-                __FILE__,
219
-                __FUNCTION__,
220
-                __LINE__
221
-            );
222
-        }
223
-        return false;
224
-    }
66
+		self::$_available_spaces = array(
67
+			'tickets'   => array(),
68
+			'datetimes' => array(),
69
+		);
70
+		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
71
+		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
72
+		\EE_Registry::instance()->load_core('Session');
73
+		// unless otherwise requested, clear the session
74
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', true)) {
75
+			\EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
76
+		}
77
+		//d( \EE_Registry::instance()->SSN );
78
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
79
+		// do we have an event id?
80
+		if (\EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
81
+			// validate/sanitize data
82
+			$valid = self::_validate_post_data();
83
+			//EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
84
+			//EEH_Debug_Tools::printr( $valid, '$valid', __FILE__, __LINE__ );
85
+			//EEH_Debug_Tools::printr( $valid[ 'total_tickets' ], 'total_tickets', __FILE__, __LINE__ );
86
+			//EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
87
+			//check total tickets ordered vs max number of attendees that can register
88
+			if ($valid['total_tickets'] > $valid['max_atndz']) {
89
+				// ordering too many tickets !!!
90
+				$singular = 'You have attempted to purchase %s ticket.';
91
+				$plural = 'You have attempted to purchase %s tickets.';
92
+				$limit_error_1 = sprintf(
93
+					_n($singular, $plural, $valid['total_tickets'], 'event_espresso'),
94
+					$valid['total_tickets'],
95
+					$valid['total_tickets']
96
+				);
97
+				// dev only message
98
+				$singular = '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.';
99
+				$plural = '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.';
100
+				$limit_error_2 = sprintf(
101
+					_n($singular, $plural, $valid['max_atndz'], 'event_espresso'),
102
+					$valid['max_atndz'],
103
+					$valid['max_atndz']
104
+				);
105
+				\EE_Error::add_error($limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__);
106
+			} else {
107
+				// all data appears to be valid
108
+				$tckts_slctd = false;
109
+				$success = true;
110
+				// load cart
111
+				\EE_Registry::instance()->load_core('Cart');
112
+				// cycle thru the number of data rows sent from the event listing
113
+				for ($x = 0; $x < $valid['rows']; $x++) {
114
+					// does this row actually contain a ticket quantity?
115
+					if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
116
+						// YES we have a ticket quantity
117
+						$tckts_slctd = true;
118
+						//						d( $valid['ticket_obj'][$x] );
119
+						if ($valid['ticket_obj'][$x] instanceof \EE_Ticket) {
120
+							// then add ticket to cart
121
+							$ticket_added = self::_add_ticket_to_cart(
122
+								$valid['ticket_obj'][$x],
123
+								$valid['qty'][$x]
124
+							);
125
+							$success = ! $ticket_added ? false : $success;
126
+							if (\EE_Error::has_error()) {
127
+								break;
128
+							}
129
+						} else {
130
+							// nothing added to cart retrieved
131
+							\EE_Error::add_error(
132
+								sprintf(
133
+									__(
134
+										'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.',
135
+										'event_espresso'
136
+									),
137
+									'<br/>'
138
+								),
139
+								__FILE__,
140
+								__FUNCTION__,
141
+								__LINE__
142
+							);
143
+						}
144
+					}
145
+				}
146
+				//d( \EE_Registry::instance()->CART );
147
+				//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
148
+				if ($tckts_slctd) {
149
+					if ($success) {
150
+						do_action(
151
+							'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout',
152
+							\EE_Registry::instance()->CART,
153
+							$this
154
+						);
155
+						\EE_Registry::instance()->CART->recalculate_all_cart_totals();
156
+						\EE_Registry::instance()->CART->save_cart(false);
157
+						\EE_Registry::instance()->SSN->update();
158
+						//d( \EE_Registry::instance()->CART );
159
+						//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
160
+						// just return TRUE for registrations being made from admin
161
+						if (is_admin()) {
162
+							return true;
163
+						}
164
+						wp_safe_redirect(
165
+							apply_filters(
166
+								'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url',
167
+								\EE_Registry::instance()->CFG->core->reg_page_url()
168
+							)
169
+						);
170
+						exit();
171
+					} else {
172
+						if ( ! \EE_Error::has_error()) {
173
+							// nothing added to cart
174
+							\EE_Error::add_attention(
175
+								__('No tickets were added for the event', 'event_espresso'),
176
+								__FILE__,
177
+								__FUNCTION__,
178
+								__LINE__
179
+							);
180
+						}
181
+					}
182
+				} else {
183
+					// no ticket quantities were selected
184
+					\EE_Error::add_error(
185
+						__('You need to select a ticket quantity before you can proceed.', 'event_espresso'),
186
+						__FILE__,
187
+						__FUNCTION__,
188
+						__LINE__
189
+					);
190
+				}
191
+			}
192
+			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
193
+			// at this point, just return if registration is being made from admin
194
+			if (is_admin()) {
195
+				return false;
196
+			}
197
+			if ($valid['return_url']) {
198
+				\EE_Error::get_notices(false, true);
199
+				wp_safe_redirect($valid['return_url']);
200
+				exit();
201
+			} elseif (isset($event_to_add['id'])) {
202
+				\EE_Error::get_notices(false, true);
203
+				wp_safe_redirect(get_permalink($event_to_add['id']));
204
+				exit();
205
+			} else {
206
+				echo \EE_Error::get_notices();
207
+			}
208
+		} else {
209
+			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
210
+			\EE_Error::add_error(
211
+				sprintf(
212
+					__(
213
+						'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.',
214
+						'event_espresso'
215
+					),
216
+					'<br/>'
217
+				),
218
+				__FILE__,
219
+				__FUNCTION__,
220
+				__LINE__
221
+			);
222
+		}
223
+		return false;
224
+	}
225 225
 
226 226
 
227 227
 
228
-    /**
229
-     *    validate_post_data
230
-     *
231
-     * @access        private
232
-     * @return        array  or FALSE
233
-     */
234
-    private static function _validate_post_data()
235
-    {
236
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
237
-        // start with an empty array()
238
-        $valid_data = array();
239
-        //		d( $_POST );
240
-        //if event id is valid
241
-        $id = absint(\EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
242
-        if ($id) {
243
-            // grab valid id
244
-            $valid_data['id'] = $id;
245
-            // grab and sanitize return-url
246
-            $valid_data['return_url'] = esc_url_raw(
247
-                \EE_Registry::instance()->REQ->get('tkt-slctr-return-url-' . $id)
248
-            );
249
-            // array of other form names
250
-            $inputs_to_clean = array(
251
-                'event_id'   => 'tkt-slctr-event-id',
252
-                'max_atndz'  => 'tkt-slctr-max-atndz-',
253
-                'rows'       => 'tkt-slctr-rows-',
254
-                'qty'        => 'tkt-slctr-qty-',
255
-                'ticket_id'  => 'tkt-slctr-ticket-id-',
256
-                'return_url' => 'tkt-slctr-return-url-',
257
-            );
258
-            // let's track the total number of tickets ordered.'
259
-            $valid_data['total_tickets'] = 0;
260
-            // cycle through $inputs_to_clean array
261
-            foreach ($inputs_to_clean as $what => $input_to_clean) {
262
-                // check for POST data
263
-                if (\EE_Registry::instance()->REQ->is_set($input_to_clean . $id)) {
264
-                    // grab value
265
-                    $input_value = \EE_Registry::instance()->REQ->get($input_to_clean . $id);
266
-                    switch ($what) {
267
-                        // integers
268
-                        case 'event_id':
269
-                            $valid_data[$what] = absint($input_value);
270
-                            // get event via the event id we put in the form
271
-                            $valid_data['event'] = \EE_Registry::instance()->load_model('Event')->get_one_by_ID(
272
-                                $valid_data['event_id']
273
-                            );
274
-                            break;
275
-                        case 'rows':
276
-                        case 'max_atndz':
277
-                            $valid_data[$what] = absint($input_value);
278
-                            break;
279
-                        // arrays of integers
280
-                        case 'qty':
281
-                            //							d( $input_value );
282
-                            $row_qty = $input_value;
283
-                            // if qty is coming from a radio button input, then we need to assemble an array of rows
284
-                            if ( ! is_array($row_qty)) {
285
-                                // get number of rows
286
-                                $rows = \EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-' . $id) ? absint(
287
-                                    \EE_Registry::instance()->REQ->get('tkt-slctr-rows-' . $id)
288
-                                ) : 1;
289
-                                //								d( $rows );
290
-                                // explode ints by the dash
291
-                                $row_qty = explode('-', $row_qty);
292
-                                $row = isset($row_qty[0]) ? absint($row_qty[0]) : 1;
293
-                                $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
294
-                                $row_qty = array($row => $qty);
295
-                                //								 d( $row_qty );
296
-                                for ($x = 1; $x <= $rows; $x++) {
297
-                                    if ( ! isset($row_qty[$x])) {
298
-                                        $row_qty[$x] = 0;
299
-                                    }
300
-                                }
301
-                            }
302
-                            ksort($row_qty);
303
-                            //							 d( $row_qty );
304
-                            // cycle thru values
305
-                            foreach ($row_qty as $qty) {
306
-                                $qty = absint($qty);
307
-                                // sanitize as integers
308
-                                $valid_data[$what][] = $qty;
309
-                                $valid_data['total_tickets'] += $qty;
310
-                            }
311
-                            break;
312
-                        // array of integers
313
-                        case 'ticket_id':
314
-                            $value_array = array();
315
-                            // cycle thru values
316
-                            foreach ($input_value as $key => $value) {
317
-                                // allow only numbers, letters,  spaces, commas and dashes
318
-                                $value_array[$key] = wp_strip_all_tags($value);
319
-                                // get ticket via the ticket id we put in the form
320
-                                $ticket_obj = \EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
321
-                                $valid_data['ticket_obj'][$key] = $ticket_obj;
322
-                            }
323
-                            $valid_data[$what] = $value_array;
324
-                            break;
325
-                        case 'return_url' :
326
-                            // grab and sanitize return-url
327
-                            $valid_data[$what] = esc_url_raw($input_value);
328
-                            break;
329
-                    }    // end switch $what
330
-                }
331
-            }    // end foreach $inputs_to_clean
332
-        } else {
333
-            \EE_Error::add_error(
334
-                __('The event id provided was not valid.', 'event_espresso'),
335
-                __FILE__,
336
-                __FUNCTION__,
337
-                __LINE__
338
-            );
339
-            return false;
340
-        }
341
-        //		d( $valid_data );
342
-        //		die();
343
-        return $valid_data;
344
-    }
228
+	/**
229
+	 *    validate_post_data
230
+	 *
231
+	 * @access        private
232
+	 * @return        array  or FALSE
233
+	 */
234
+	private static function _validate_post_data()
235
+	{
236
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
237
+		// start with an empty array()
238
+		$valid_data = array();
239
+		//		d( $_POST );
240
+		//if event id is valid
241
+		$id = absint(\EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
242
+		if ($id) {
243
+			// grab valid id
244
+			$valid_data['id'] = $id;
245
+			// grab and sanitize return-url
246
+			$valid_data['return_url'] = esc_url_raw(
247
+				\EE_Registry::instance()->REQ->get('tkt-slctr-return-url-' . $id)
248
+			);
249
+			// array of other form names
250
+			$inputs_to_clean = array(
251
+				'event_id'   => 'tkt-slctr-event-id',
252
+				'max_atndz'  => 'tkt-slctr-max-atndz-',
253
+				'rows'       => 'tkt-slctr-rows-',
254
+				'qty'        => 'tkt-slctr-qty-',
255
+				'ticket_id'  => 'tkt-slctr-ticket-id-',
256
+				'return_url' => 'tkt-slctr-return-url-',
257
+			);
258
+			// let's track the total number of tickets ordered.'
259
+			$valid_data['total_tickets'] = 0;
260
+			// cycle through $inputs_to_clean array
261
+			foreach ($inputs_to_clean as $what => $input_to_clean) {
262
+				// check for POST data
263
+				if (\EE_Registry::instance()->REQ->is_set($input_to_clean . $id)) {
264
+					// grab value
265
+					$input_value = \EE_Registry::instance()->REQ->get($input_to_clean . $id);
266
+					switch ($what) {
267
+						// integers
268
+						case 'event_id':
269
+							$valid_data[$what] = absint($input_value);
270
+							// get event via the event id we put in the form
271
+							$valid_data['event'] = \EE_Registry::instance()->load_model('Event')->get_one_by_ID(
272
+								$valid_data['event_id']
273
+							);
274
+							break;
275
+						case 'rows':
276
+						case 'max_atndz':
277
+							$valid_data[$what] = absint($input_value);
278
+							break;
279
+						// arrays of integers
280
+						case 'qty':
281
+							//							d( $input_value );
282
+							$row_qty = $input_value;
283
+							// if qty is coming from a radio button input, then we need to assemble an array of rows
284
+							if ( ! is_array($row_qty)) {
285
+								// get number of rows
286
+								$rows = \EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-' . $id) ? absint(
287
+									\EE_Registry::instance()->REQ->get('tkt-slctr-rows-' . $id)
288
+								) : 1;
289
+								//								d( $rows );
290
+								// explode ints by the dash
291
+								$row_qty = explode('-', $row_qty);
292
+								$row = isset($row_qty[0]) ? absint($row_qty[0]) : 1;
293
+								$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
294
+								$row_qty = array($row => $qty);
295
+								//								 d( $row_qty );
296
+								for ($x = 1; $x <= $rows; $x++) {
297
+									if ( ! isset($row_qty[$x])) {
298
+										$row_qty[$x] = 0;
299
+									}
300
+								}
301
+							}
302
+							ksort($row_qty);
303
+							//							 d( $row_qty );
304
+							// cycle thru values
305
+							foreach ($row_qty as $qty) {
306
+								$qty = absint($qty);
307
+								// sanitize as integers
308
+								$valid_data[$what][] = $qty;
309
+								$valid_data['total_tickets'] += $qty;
310
+							}
311
+							break;
312
+						// array of integers
313
+						case 'ticket_id':
314
+							$value_array = array();
315
+							// cycle thru values
316
+							foreach ($input_value as $key => $value) {
317
+								// allow only numbers, letters,  spaces, commas and dashes
318
+								$value_array[$key] = wp_strip_all_tags($value);
319
+								// get ticket via the ticket id we put in the form
320
+								$ticket_obj = \EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
321
+								$valid_data['ticket_obj'][$key] = $ticket_obj;
322
+							}
323
+							$valid_data[$what] = $value_array;
324
+							break;
325
+						case 'return_url' :
326
+							// grab and sanitize return-url
327
+							$valid_data[$what] = esc_url_raw($input_value);
328
+							break;
329
+					}    // end switch $what
330
+				}
331
+			}    // end foreach $inputs_to_clean
332
+		} else {
333
+			\EE_Error::add_error(
334
+				__('The event id provided was not valid.', 'event_espresso'),
335
+				__FILE__,
336
+				__FUNCTION__,
337
+				__LINE__
338
+			);
339
+			return false;
340
+		}
341
+		//		d( $valid_data );
342
+		//		die();
343
+		return $valid_data;
344
+	}
345 345
 
346 346
 
347 347
 
348
-    /**
349
-     *    adds a ticket to the cart
350
-     *
351
-     * @access   private
352
-     * @param \EE_Ticket $ticket
353
-     * @param int        $qty
354
-     * @return TRUE on success, FALSE on fail
355
-     * @throws \EE_Error
356
-     */
357
-    private static function _add_ticket_to_cart(\EE_Ticket $ticket = null, $qty = 1)
358
-    {
359
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
360
-        // get the number of spaces left for this datetime ticket
361
-        $available_spaces = self::_ticket_datetime_availability($ticket);
362
-        // compare available spaces against the number of tickets being purchased
363
-        if ($available_spaces >= $qty) {
364
-            // allow addons to prevent a ticket from being added to cart
365
-            if ( ! apply_filters(
366
-                'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart',
367
-                true,
368
-                $ticket,
369
-                $qty,
370
-                $available_spaces
371
-            )
372
-            ) {
373
-                return false;
374
-            }
375
-            // add event to cart
376
-            if (\EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
377
-                self::_recalculate_ticket_datetime_availability($ticket, $qty);
378
-                return true;
379
-            } else {
380
-                return false;
381
-            }
382
-        } else {
383
-            // tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
384
-            $available_spaces = self::_ticket_datetime_availability($ticket, true);
385
-            // greedy greedy greedy eh?
386
-            if ($available_spaces > 0) {
387
-                // add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces
388
-                \EE_Error::add_error(
389
-                    sprintf(
390
-                        _n(
391
-                            'We\'re sorry, but there is only %s available space left for this event at this particular date and time.%sPlease select a different number (or different combination) of tickets.',
392
-                            'We\'re sorry, but there are only %s available spaces left for this event at this particular date and time.%sPlease select a different number (or different combination) of tickets.',
393
-                            $available_spaces,
394
-                            'event_espresso'
395
-                        ),
396
-                        $available_spaces,
397
-                        '<br />'
398
-                    ),
399
-                    __FILE__,
400
-                    __FUNCTION__,
401
-                    __LINE__
402
-                );
403
-            } else {
404
-                \EE_Error::add_error(
405
-                    __(
406
-                        'We\'re sorry, but there are no available spaces left for this event at this particular date and time.',
407
-                        'event_espresso'
408
-                    ),
409
-                    __FILE__,
410
-                    __FUNCTION__,
411
-                    __LINE__
412
-                );
413
-            }
414
-            return false;
415
-        }
416
-    }
348
+	/**
349
+	 *    adds a ticket to the cart
350
+	 *
351
+	 * @access   private
352
+	 * @param \EE_Ticket $ticket
353
+	 * @param int        $qty
354
+	 * @return TRUE on success, FALSE on fail
355
+	 * @throws \EE_Error
356
+	 */
357
+	private static function _add_ticket_to_cart(\EE_Ticket $ticket = null, $qty = 1)
358
+	{
359
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
360
+		// get the number of spaces left for this datetime ticket
361
+		$available_spaces = self::_ticket_datetime_availability($ticket);
362
+		// compare available spaces against the number of tickets being purchased
363
+		if ($available_spaces >= $qty) {
364
+			// allow addons to prevent a ticket from being added to cart
365
+			if ( ! apply_filters(
366
+				'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart',
367
+				true,
368
+				$ticket,
369
+				$qty,
370
+				$available_spaces
371
+			)
372
+			) {
373
+				return false;
374
+			}
375
+			// add event to cart
376
+			if (\EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
377
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
378
+				return true;
379
+			} else {
380
+				return false;
381
+			}
382
+		} else {
383
+			// tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
384
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
385
+			// greedy greedy greedy eh?
386
+			if ($available_spaces > 0) {
387
+				// add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces
388
+				\EE_Error::add_error(
389
+					sprintf(
390
+						_n(
391
+							'We\'re sorry, but there is only %s available space left for this event at this particular date and time.%sPlease select a different number (or different combination) of tickets.',
392
+							'We\'re sorry, but there are only %s available spaces left for this event at this particular date and time.%sPlease select a different number (or different combination) of tickets.',
393
+							$available_spaces,
394
+							'event_espresso'
395
+						),
396
+						$available_spaces,
397
+						'<br />'
398
+					),
399
+					__FILE__,
400
+					__FUNCTION__,
401
+					__LINE__
402
+				);
403
+			} else {
404
+				\EE_Error::add_error(
405
+					__(
406
+						'We\'re sorry, but there are no available spaces left for this event at this particular date and time.',
407
+						'event_espresso'
408
+					),
409
+					__FILE__,
410
+					__FUNCTION__,
411
+					__LINE__
412
+				);
413
+			}
414
+			return false;
415
+		}
416
+	}
417 417
 
418 418
 
419 419
 
420
-    /**
421
-     *        _ticket_datetime_availability
422
-     *        creates an array of tickets plus all of the datetimes available to each ticket
423
-     *        and tracks the spaces remaining for each of those datetimes
424
-     *
425
-     * @access    private
426
-     * @param    \EE_Ticket $ticket - selected ticket
427
-     * @param    bool       $get_original_ticket_spaces
428
-     * @return    int
429
-     * @throws \EE_Error
430
-     */
431
-    private static function _ticket_datetime_availability(\EE_Ticket $ticket, $get_original_ticket_spaces = false)
432
-    {
433
-        // if the $_available_spaces array has not been set up yet...
434
-        if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
435
-            self::_set_initial_ticket_datetime_availability($ticket);
436
-        }
437
-        $available_spaces = $ticket->qty() - $ticket->sold();
438
-        if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
439
-            // loop thru tickets, which will ALSO include individual ticket records AND a total
440
-            foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
441
-                // if we want the original datetime availability BEFORE we started subtracting tickets ?
442
-                if ($get_original_ticket_spaces) {
443
-                    // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
444
-                    $available_spaces = min(
445
-                        $available_spaces,
446
-                        self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]
447
-                    );
448
-                } else {
449
-                    // we want the updated ticket availability as stored in the "datetimes" array
450
-                    $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
451
-                }
452
-            }
453
-        }
454
-        return $available_spaces;
455
-    }
420
+	/**
421
+	 *        _ticket_datetime_availability
422
+	 *        creates an array of tickets plus all of the datetimes available to each ticket
423
+	 *        and tracks the spaces remaining for each of those datetimes
424
+	 *
425
+	 * @access    private
426
+	 * @param    \EE_Ticket $ticket - selected ticket
427
+	 * @param    bool       $get_original_ticket_spaces
428
+	 * @return    int
429
+	 * @throws \EE_Error
430
+	 */
431
+	private static function _ticket_datetime_availability(\EE_Ticket $ticket, $get_original_ticket_spaces = false)
432
+	{
433
+		// if the $_available_spaces array has not been set up yet...
434
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
435
+			self::_set_initial_ticket_datetime_availability($ticket);
436
+		}
437
+		$available_spaces = $ticket->qty() - $ticket->sold();
438
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
439
+			// loop thru tickets, which will ALSO include individual ticket records AND a total
440
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
441
+				// if we want the original datetime availability BEFORE we started subtracting tickets ?
442
+				if ($get_original_ticket_spaces) {
443
+					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
444
+					$available_spaces = min(
445
+						$available_spaces,
446
+						self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]
447
+					);
448
+				} else {
449
+					// we want the updated ticket availability as stored in the "datetimes" array
450
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
451
+				}
452
+			}
453
+		}
454
+		return $available_spaces;
455
+	}
456 456
 
457 457
 
458 458
 
459
-    /**
460
-     *    _set_initial_ticket_datetime_availability
461
-     *
462
-     * @access    private
463
-     * @param    \EE_Ticket $ticket
464
-     * @return    int
465
-     * @throws \EE_Error
466
-     */
467
-    private static function _set_initial_ticket_datetime_availability(\EE_Ticket $ticket)
468
-    {
469
-        // first, get all of the datetimes that are available to this ticket
470
-        $datetimes = $ticket->get_many_related(
471
-            'Datetime',
472
-            array(
473
-                array(
474
-                    'DTT_EVT_end' => array(
475
-                        '>=',
476
-                        \EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'),
477
-                    ),
478
-                ),
479
-                'order_by' => array('DTT_EVT_start' => 'ASC'),
480
-            )
481
-        );
482
-        if ( ! empty($datetimes)) {
483
-            // now loop thru all of the datetimes
484
-            foreach ($datetimes as $datetime) {
485
-                if ($datetime instanceof \EE_Datetime) {
486
-                    // the number of spaces available for the datetime without considering individual ticket quantities
487
-                    $spaces_remaining = $datetime->spaces_remaining();
488
-                    // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key
489
-                    self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(
490
-                        $ticket->qty() - $ticket->sold(),
491
-                        $spaces_remaining
492
-                    );
493
-                    // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
494
-                    // else just take the datetime spaces remaining, and assign to the datetimes array
495
-                    self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()])
496
-                        ? min(
497
-                            self::$_available_spaces['datetimes'][$datetime->ID()],
498
-                            $spaces_remaining
499
-                        ) : $spaces_remaining;
500
-                }
501
-            }
502
-        }
503
-    }
459
+	/**
460
+	 *    _set_initial_ticket_datetime_availability
461
+	 *
462
+	 * @access    private
463
+	 * @param    \EE_Ticket $ticket
464
+	 * @return    int
465
+	 * @throws \EE_Error
466
+	 */
467
+	private static function _set_initial_ticket_datetime_availability(\EE_Ticket $ticket)
468
+	{
469
+		// first, get all of the datetimes that are available to this ticket
470
+		$datetimes = $ticket->get_many_related(
471
+			'Datetime',
472
+			array(
473
+				array(
474
+					'DTT_EVT_end' => array(
475
+						'>=',
476
+						\EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'),
477
+					),
478
+				),
479
+				'order_by' => array('DTT_EVT_start' => 'ASC'),
480
+			)
481
+		);
482
+		if ( ! empty($datetimes)) {
483
+			// now loop thru all of the datetimes
484
+			foreach ($datetimes as $datetime) {
485
+				if ($datetime instanceof \EE_Datetime) {
486
+					// the number of spaces available for the datetime without considering individual ticket quantities
487
+					$spaces_remaining = $datetime->spaces_remaining();
488
+					// save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key
489
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(
490
+						$ticket->qty() - $ticket->sold(),
491
+						$spaces_remaining
492
+					);
493
+					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
494
+					// else just take the datetime spaces remaining, and assign to the datetimes array
495
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()])
496
+						? min(
497
+							self::$_available_spaces['datetimes'][$datetime->ID()],
498
+							$spaces_remaining
499
+						) : $spaces_remaining;
500
+				}
501
+			}
502
+		}
503
+	}
504 504
 
505 505
 
506 506
 
507
-    /**
508
-     *    _recalculate_ticket_datetime_availability
509
-     *
510
-     * @access    private
511
-     * @param    \EE_Ticket $ticket
512
-     * @param    int        $qty
513
-     * @return    int
514
-     */
515
-    private static function _recalculate_ticket_datetime_availability(\EE_Ticket $ticket, $qty = 0)
516
-    {
517
-        if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
518
-            // loop thru tickets, which will ALSO include individual ticket records AND a total
519
-            foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
520
-                // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
521
-                self::$_available_spaces['datetimes'][$DTD_ID] -= $qty;
522
-            }
523
-        }
524
-    }
507
+	/**
508
+	 *    _recalculate_ticket_datetime_availability
509
+	 *
510
+	 * @access    private
511
+	 * @param    \EE_Ticket $ticket
512
+	 * @param    int        $qty
513
+	 * @return    int
514
+	 */
515
+	private static function _recalculate_ticket_datetime_availability(\EE_Ticket $ticket, $qty = 0)
516
+	{
517
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
518
+			// loop thru tickets, which will ALSO include individual ticket records AND a total
519
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
520
+				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
521
+				self::$_available_spaces['datetimes'][$DTD_ID] -= $qty;
522
+			}
523
+		}
524
+	}
525 525
 
526 526
 }
527 527
 // End of file ProcessTicketSelector.php
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                     $valid['max_atndz'],
103 103
                     $valid['max_atndz']
104 104
                 );
105
-                \EE_Error::add_error($limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__);
105
+                \EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
106 106
             } else {
107 107
                 // all data appears to be valid
108 108
                 $tckts_slctd = false;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
             $valid_data['id'] = $id;
245 245
             // grab and sanitize return-url
246 246
             $valid_data['return_url'] = esc_url_raw(
247
-                \EE_Registry::instance()->REQ->get('tkt-slctr-return-url-' . $id)
247
+                \EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)
248 248
             );
249 249
             // array of other form names
250 250
             $inputs_to_clean = array(
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
             // cycle through $inputs_to_clean array
261 261
             foreach ($inputs_to_clean as $what => $input_to_clean) {
262 262
                 // check for POST data
263
-                if (\EE_Registry::instance()->REQ->is_set($input_to_clean . $id)) {
263
+                if (\EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
264 264
                     // grab value
265
-                    $input_value = \EE_Registry::instance()->REQ->get($input_to_clean . $id);
265
+                    $input_value = \EE_Registry::instance()->REQ->get($input_to_clean.$id);
266 266
                     switch ($what) {
267 267
                         // integers
268 268
                         case 'event_id':
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
                             // if qty is coming from a radio button input, then we need to assemble an array of rows
284 284
                             if ( ! is_array($row_qty)) {
285 285
                                 // get number of rows
286
-                                $rows = \EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-' . $id) ? absint(
287
-                                    \EE_Registry::instance()->REQ->get('tkt-slctr-rows-' . $id)
286
+                                $rows = \EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(
287
+                                    \EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)
288 288
                                 ) : 1;
289 289
                                 //								d( $rows );
290 290
                                 // explode ints by the dash
Please login to merge, or discard this patch.
core/libraries/iframe_display/Iframe.php 2 patches
Indentation   +442 added lines, -442 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\libraries\iframe_display;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -18,474 +18,474 @@  discard block
 block discarded – undo
18 18
 class Iframe
19 19
 {
20 20
 
21
-    /*
21
+	/*
22 22
     * HTML for notices and ajax gif
23 23
     * @var string $title
24 24
     */
25
-    protected $title = '';
25
+	protected $title = '';
26 26
 
27
-    /*
27
+	/*
28 28
     * HTML for the content being displayed
29 29
     * @var string $content
30 30
     */
31
-    protected $content = '';
31
+	protected $content = '';
32 32
 
33
-    /*
33
+	/*
34 34
     * whether or not to call wp_head() and wp_footer()
35 35
     * @var boolean $enqueue_wp_assets
36 36
     */
37
-    protected $enqueue_wp_assets = false;
37
+	protected $enqueue_wp_assets = false;
38 38
 
39
-    /*
39
+	/*
40 40
     * an array of CSS URLs
41 41
     * @var array $css
42 42
     */
43
-    protected $css = array();
43
+	protected $css = array();
44 44
 
45
-    /*
45
+	/*
46 46
     * an array of JS URLs to be set in the HTML header.
47 47
     * @var array $header_js
48 48
     */
49
-    protected $header_js = array();
49
+	protected $header_js = array();
50 50
 
51
-    /*
51
+	/*
52 52
     * an array of JS URLs to be displayed before the HTML </body> tag
53 53
     * @var array $footer_js
54 54
     */
55
-    protected $footer_js = array();
55
+	protected $footer_js = array();
56 56
 
57
-    /*
57
+	/*
58 58
     * an array of JSON vars to be set in the HTML header.
59 59
     * @var array $localized_vars
60 60
     */
61
-    protected $localized_vars = array();
62
-
63
-
64
-
65
-    /**
66
-     * Iframe constructor
67
-     *
68
-     * @param string $title
69
-     * @param string $content
70
-     * @throws \EE_Error
71
-     */
72
-    public function __construct($title, $content)
73
-    {
74
-        global $wp_version;
75
-        if ( ! defined('EE_IFRAME_DIR_URL')) {
76
-            define('EE_IFRAME_DIR_URL', plugin_dir_url(__FILE__));
77
-        }
78
-        $this->setContent($content);
79
-        $this->setTitle($title);
80
-        $this->addStylesheets(
81
-            apply_filters(
82
-                'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__construct__default_css',
83
-                array(
84
-                    'dashicons'        => includes_url('css/dashicons.min.css?ver=' . $wp_version),
85
-                    'espresso_default' => EE_GLOBAL_ASSETS_URL
86
-                                          . 'css/espresso_default.css?ver='
87
-                                          . EVENT_ESPRESSO_VERSION,
88
-                )
89
-            )
90
-        );
91
-        $this->addScripts(
92
-            apply_filters(
93
-                'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__construct__default_js',
94
-                array(
95
-                    'jquery'        => includes_url('js/jquery/jquery.js?ver=' . $wp_version),
96
-                    'espresso_core' => EE_GLOBAL_ASSETS_URL
97
-                                       . 'scripts/espresso_core.js?ver='
98
-                                       . EVENT_ESPRESSO_VERSION,
99
-                )
100
-            )
101
-        );
102
-    }
103
-
104
-
105
-
106
-    /**
107
-     * @param string $title
108
-     * @throws \EE_Error
109
-     */
110
-    public function setTitle($title)
111
-    {
112
-        if (empty($title)) {
113
-            throw new \EE_Error(
114
-                __('You must provide a page title in order to create an iframe.', 'event_espresso')
115
-            );
116
-        }
117
-        $this->title = $title;
118
-    }
119
-
120
-
121
-
122
-    /**
123
-     * @param string $content
124
-     * @throws \EE_Error
125
-     */
126
-    public function setContent($content)
127
-    {
128
-        if (empty($content)) {
129
-            throw new \EE_Error(
130
-                __('You must provide content in order to create an iframe.', 'event_espresso')
131
-            );
132
-        }
133
-        $this->content = $content;
134
-    }
135
-
136
-
137
-
138
-    /**
139
-     * @param boolean $enqueue_wp_assets
140
-     */
141
-    public function setEnqueueWpAssets($enqueue_wp_assets)
142
-    {
143
-        $this->enqueue_wp_assets = filter_var($enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN);
144
-    }
145
-
146
-
147
-
148
-    /**
149
-     * @param array $stylesheets
150
-     * @throws \EE_Error
151
-     */
152
-    public function addStylesheets(array $stylesheets)
153
-    {
154
-        if (empty($stylesheets)) {
155
-            throw new \EE_Error(
156
-                __('A non-empty array of URLs, is required to add a CSS stylesheet to an iframe.', 'event_espresso')
157
-            );
158
-        }
159
-        foreach ($stylesheets as $handle => $stylesheet) {
160
-            $this->css[$handle] = $stylesheet;
161
-        }
162
-    }
163
-
164
-
165
-
166
-    /**
167
-     * @param array $scripts
168
-     * @param bool  $add_to_header
169
-     * @throws \EE_Error
170
-     */
171
-    public function addScripts(array $scripts, $add_to_header = false)
172
-    {
173
-        if (empty($scripts)) {
174
-            throw new \EE_Error(
175
-                __('A non-empty array of URLs, is required to add Javascript to an iframe.', 'event_espresso')
176
-            );
177
-        }
178
-        foreach ($scripts as $handle => $script) {
179
-            if ($add_to_header) {
180
-                $this->header_js[$handle] = $script;
181
-            } else {
182
-                $this->footer_js[$handle] = $script;
183
-            }
184
-        }
185
-    }
186
-
187
-
188
-
189
-    /**
190
-     * @param array  $vars
191
-     * @param string $var_name
192
-     * @throws \EE_Error
193
-     */
194
-    public function addLocalizedVars(array $vars, $var_name = 'eei18n')
195
-    {
196
-        if (empty($vars)) {
197
-            throw new \EE_Error(
198
-                __('A non-empty array of vars, is required to add localized Javascript vars to an iframe.',
199
-                    'event_espresso')
200
-            );
201
-        }
202
-        foreach ($vars as $handle => $var) {
203
-            if ($var_name === 'eei18n') {
204
-                \EE_Registry::$i18n_js_strings[$handle] = $var;
205
-            } else {
206
-                if ( ! isset($this->localized_vars[$var_name])) {
207
-                    $this->localized_vars[$var_name] = array();
208
-                }
209
-                $this->localized_vars[$var_name][$handle] = $var;
210
-            }
211
-        }
212
-    }
213
-
214
-
215
-
216
-    /**
217
-     * @return void
218
-     */
219
-    public function display()
220
-    {
221
-        echo $this->getTemplate();
222
-        exit;
223
-    }
224
-
225
-
226
-
227
-    /**
228
-     * @return string
229
-     */
230
-    public function getTemplate()
231
-    {
232
-        return \EEH_Template::display_template(
233
-            __DIR__ . '\iframe_wrapper.template.php',
234
-            array(
235
-                'title'             => apply_filters(
236
-                    'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__title',
237
-                    $this->title
238
-                ),
239
-                'content'           => apply_filters(
240
-                    'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__content',
241
-                    $this->content
242
-                ),
243
-                'enqueue_wp_assets' => apply_filters(
244
-                    'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__enqueue_wp_assets',
245
-                    $this->enqueue_wp_assets
246
-                ),
247
-                'css'               => (array)apply_filters(
248
-                    'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__css_urls',
249
-                    $this->css
250
-                ),
251
-                'header_js'         => (array)apply_filters(
252
-                    'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__header_js_urls',
253
-                    $this->header_js
254
-                ),
255
-                'footer_js'         => (array)apply_filters(
256
-                    'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__footer_js_urls',
257
-                    $this->footer_js
258
-                ),
259
-                'eei18n'            => apply_filters(
260
-                    'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__eei18n_js_strings',
261
-                    \EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars()
262
-                ),
263
-                'notices'           => \EEH_Template::display_template(
264
-                    EE_TEMPLATES . 'espresso-ajax-notices.template.php',
265
-                    array(),
266
-                    true
267
-                ),
268
-            ),
269
-            true
270
-        );
271
-    }
272
-
273
-
274
-
275
-    /**
276
-     * localizeJsonVars
277
-     *
278
-     * @return string
279
-     */
280
-    public function localizeJsonVars()
281
-    {
282
-        $JSON = '';
283
-        $localized_vars = (array)$this->localized_vars;
284
-        foreach ($localized_vars as $var_name => $vars) {
285
-            foreach ($vars as $key => $value) {
286
-                if (is_scalar($value)) {
287
-                    $localized_vars[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
288
-                }
289
-            }
290
-            $JSON .= "/* <![CDATA[ */ var $var_name = " . wp_json_encode($localized_vars) . '; /* ]]> */';
291
-        }
292
-        return $JSON;
293
-    }
294
-
295
-
296
-
297
-    /**
298
-     * Adds an iframe embed code button to the Event editor.
299
-     *
300
-     * @param string $route_name the named module route that generates the iframe
301
-     */
302
-    public static function addEventEditorIframeEmbedButton($route_name)
303
-    {
304
-        // add button for iframe code to event editor.
305
-        add_filter(
306
-            'get_sample_permalink_html',
307
-            function ($permalink_string, $id, $new_title, $new_slug) use ($route_name) {
308
-                return Iframe::eventListIframeEmbedButton($permalink_string, $id, $new_title, $new_slug, $route_name);
309
-            },
310
-            10, 2
311
-        );
312
-        add_action(
313
-            'admin_enqueue_scripts',
314
-            array('\EventEspresso\core\libraries\iframe_display\Iframe', 'EventsAdminEmbedButtonAssets'),
315
-            10
316
-        );
317
-    }
318
-
319
-
320
-
321
-    /**
322
-     * iframe embed code button to the Event editor.
323
-     *
324
-     * @param string $permalink_string
325
-     * @param int    $id
326
-     * @param string $new_title  (unused)
327
-     * @param string $new_slug   (unused)
328
-     * @param string $route_name the named module route that generates the iframe
329
-     * @return string
330
-     */
331
-    public static function eventListIframeEmbedButton(
332
-        $permalink_string,
333
-        $id,
334
-        $new_title = '',
335
-        $new_slug = '',
336
-        $route_name = ''
337
-    ) {
338
-        //make sure this is ONLY when editing and the event id has been set.
339
-        if ( ! empty($id)) {
340
-            $post = get_post($id);
341
-            //if NOT event then let's get out.
342
-            if ($post->post_type !== 'espresso_events') {
343
-                return $permalink_string;
344
-            }
345
-            $permalink_string .= Iframe::embedButtonHtml(
346
-                'Event',
347
-                $route_name,
348
-                array('event' => $id),
349
-                'button-small'
350
-            );
351
-        }
352
-        return $permalink_string;
353
-    }
354
-
355
-
356
-
357
-    /**
358
-     * Adds an iframe embed code button to the Event editor.
359
-     *
360
-     * @param string $route_name the named module route that generates the iframe
361
-     */
362
-    public static function addEventListIframeEmbedButton($route_name)
363
-    {
364
-        // add button for iframe code to event editor.
365
-        add_action(
366
-            'AHEE__admin_list_wrapper_template__after_list_table',
367
-            function ($page_slug) use ($route_name) {
368
-                //make sure this is ONLY when editing and the event id has been set.
369
-                if ($page_slug === 'espresso_events') {
370
-                    echo \EEH_HTML::h3(__('iFrame Embed Code', 'event_espresso'));
371
-                    echo \EEH_HTML::p(__('Click the following buttons to generate iframe HTML that will allow you to embed your event content within the content of other websites.',
372
-                        'event_espresso'));
373
-                    echo Iframe::embedButtonHtml(
374
-                        'Events List',
375
-                        $route_name
376
-                    );
377
-                }
378
-            },
379
-            10, 1
380
-        );
381
-        add_action(
382
-            'admin_enqueue_scripts',
383
-            array('\EventEspresso\core\libraries\iframe_display\Iframe', 'EventsAdminEmbedButtonAssets'),
384
-            10
385
-        );
386
-    }
387
-
388
-
389
-
390
-    /**
391
-     * Adds an iframe embed code button via a WP do_action() as determined by the first parameter
392
-     *
393
-     * @param string $iframe_name
394
-     * @param string $route_name the named module route that generates the iframe
395
-     * @param string $action     name of the WP do_action() to hook into
396
-     */
397
-    public static function addActionIframeEmbedButton($iframe_name, $route_name, $action)
398
-    {
399
-        // add button for iframe code to event editor.
400
-        add_action(
401
-            $action,
402
-            function () use ($iframe_name, $route_name) {
403
-                echo Iframe::embedButtonHtml($iframe_name, $route_name);
404
-            },
405
-            10
406
-        );
407
-    }
408
-
409
-
410
-
411
-    /**
412
-     * iframe_embed_html
413
-     *
414
-     * @param string $iframe_name
415
-     * @param string $route_name the named module route that generates the iframe
416
-     * @param array  $query_args
417
-     * @param string $button_class
418
-     * @return string
419
-     */
420
-    public static function embedButtonHtml($iframe_name, $route_name, $query_args = array(), $button_class = '')
421
-    {
422
-        $query_args = ! empty($query_args) ? $query_args : array($route_name => 'iframe');
423
-        // add this route to our localized vars
424
-        $iframe_module_routes = isset(\EE_Registry::$i18n_js_strings['iframe_module_routes'])
425
-            ? \EE_Registry::$i18n_js_strings['iframe_module_routes']
426
-            : array();
427
-        $iframe_module_routes[$route_name] = $route_name;
428
-        \EE_Registry::$i18n_js_strings['iframe_module_routes'] = $iframe_module_routes;
429
-        $iframe_embed_html = \EEH_HTML::link(
430
-            '#',
431
-            sprintf(__('Embed %1$s', 'event_espresso'), $iframe_name),
432
-            sprintf(
433
-                __(
434
-                    'click here to generate code for embedding an %1$s iframe into another site.',
435
-                    'event_espresso'
436
-                ),
437
-                $iframe_name
438
-            ),
439
-            "$route_name-iframe-embed-trigger-js",
440
-            'iframe-embed-trigger-js button ' . $button_class,
441
-            '',
442
-            ' data-iframe_embed_button="#' . $route_name . '-iframe-js" tabindex="-1"'
443
-        );
444
-        $iframe_embed_html .= \EEH_HTML::div('', "$route_name-iframe-js", 'iframe-embed-wrapper-js', 'display:none;');
445
-        $iframe_embed_html .= \EEH_HTML::div(
446
-            '<iframe src="' . add_query_arg($query_args, site_url()) . '" width="100%" height="100%"></iframe>',
447
-            '', '', 'width:100%; height: 500px;'
448
-        );
449
-        $iframe_embed_html .= \EEH_HTML::divx();
450
-        return $iframe_embed_html;
451
-    }
452
-
453
-
454
-
455
-    /**
456
-     * iframe button js on admin events list or event editor page
457
-     */
458
-    public static function EventsAdminEmbedButtonAssets()
459
-    {
460
-        if (\EE_Registry::instance()->REQ->get('page') === 'espresso_events') {
461
-            Iframe::embedButtonAssets();
462
-            \EE_Registry::$i18n_js_strings['iframe_embed_title'] = __(
463
-                'copy and paste the following into any other site\'s content to display this event:',
464
-                'event_espresso'
465
-            );
466
-        }
467
-    }
468
-
469
-
470
-
471
-    /**
472
-     * enqueue iframe button js
473
-     */
474
-    public static function embedButtonAssets()
475
-    {
476
-        \EE_Registry::$i18n_js_strings['iframe_embed_close_msg'] = __(
477
-            'click anywhere outside of this window to close it.',
478
-            'event_espresso'
479
-        );
480
-        wp_register_script(
481
-            'iframe_embed_button',
482
-            plugin_dir_url(__FILE__) . 'iframe-embed-button.js',
483
-            array('ee-dialog'),
484
-            EVENT_ESPRESSO_VERSION,
485
-            true
486
-        );
487
-        wp_enqueue_script('iframe_embed_button');
488
-    }
61
+	protected $localized_vars = array();
62
+
63
+
64
+
65
+	/**
66
+	 * Iframe constructor
67
+	 *
68
+	 * @param string $title
69
+	 * @param string $content
70
+	 * @throws \EE_Error
71
+	 */
72
+	public function __construct($title, $content)
73
+	{
74
+		global $wp_version;
75
+		if ( ! defined('EE_IFRAME_DIR_URL')) {
76
+			define('EE_IFRAME_DIR_URL', plugin_dir_url(__FILE__));
77
+		}
78
+		$this->setContent($content);
79
+		$this->setTitle($title);
80
+		$this->addStylesheets(
81
+			apply_filters(
82
+				'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__construct__default_css',
83
+				array(
84
+					'dashicons'        => includes_url('css/dashicons.min.css?ver=' . $wp_version),
85
+					'espresso_default' => EE_GLOBAL_ASSETS_URL
86
+										  . 'css/espresso_default.css?ver='
87
+										  . EVENT_ESPRESSO_VERSION,
88
+				)
89
+			)
90
+		);
91
+		$this->addScripts(
92
+			apply_filters(
93
+				'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__construct__default_js',
94
+				array(
95
+					'jquery'        => includes_url('js/jquery/jquery.js?ver=' . $wp_version),
96
+					'espresso_core' => EE_GLOBAL_ASSETS_URL
97
+									   . 'scripts/espresso_core.js?ver='
98
+									   . EVENT_ESPRESSO_VERSION,
99
+				)
100
+			)
101
+		);
102
+	}
103
+
104
+
105
+
106
+	/**
107
+	 * @param string $title
108
+	 * @throws \EE_Error
109
+	 */
110
+	public function setTitle($title)
111
+	{
112
+		if (empty($title)) {
113
+			throw new \EE_Error(
114
+				__('You must provide a page title in order to create an iframe.', 'event_espresso')
115
+			);
116
+		}
117
+		$this->title = $title;
118
+	}
119
+
120
+
121
+
122
+	/**
123
+	 * @param string $content
124
+	 * @throws \EE_Error
125
+	 */
126
+	public function setContent($content)
127
+	{
128
+		if (empty($content)) {
129
+			throw new \EE_Error(
130
+				__('You must provide content in order to create an iframe.', 'event_espresso')
131
+			);
132
+		}
133
+		$this->content = $content;
134
+	}
135
+
136
+
137
+
138
+	/**
139
+	 * @param boolean $enqueue_wp_assets
140
+	 */
141
+	public function setEnqueueWpAssets($enqueue_wp_assets)
142
+	{
143
+		$this->enqueue_wp_assets = filter_var($enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN);
144
+	}
145
+
146
+
147
+
148
+	/**
149
+	 * @param array $stylesheets
150
+	 * @throws \EE_Error
151
+	 */
152
+	public function addStylesheets(array $stylesheets)
153
+	{
154
+		if (empty($stylesheets)) {
155
+			throw new \EE_Error(
156
+				__('A non-empty array of URLs, is required to add a CSS stylesheet to an iframe.', 'event_espresso')
157
+			);
158
+		}
159
+		foreach ($stylesheets as $handle => $stylesheet) {
160
+			$this->css[$handle] = $stylesheet;
161
+		}
162
+	}
163
+
164
+
165
+
166
+	/**
167
+	 * @param array $scripts
168
+	 * @param bool  $add_to_header
169
+	 * @throws \EE_Error
170
+	 */
171
+	public function addScripts(array $scripts, $add_to_header = false)
172
+	{
173
+		if (empty($scripts)) {
174
+			throw new \EE_Error(
175
+				__('A non-empty array of URLs, is required to add Javascript to an iframe.', 'event_espresso')
176
+			);
177
+		}
178
+		foreach ($scripts as $handle => $script) {
179
+			if ($add_to_header) {
180
+				$this->header_js[$handle] = $script;
181
+			} else {
182
+				$this->footer_js[$handle] = $script;
183
+			}
184
+		}
185
+	}
186
+
187
+
188
+
189
+	/**
190
+	 * @param array  $vars
191
+	 * @param string $var_name
192
+	 * @throws \EE_Error
193
+	 */
194
+	public function addLocalizedVars(array $vars, $var_name = 'eei18n')
195
+	{
196
+		if (empty($vars)) {
197
+			throw new \EE_Error(
198
+				__('A non-empty array of vars, is required to add localized Javascript vars to an iframe.',
199
+					'event_espresso')
200
+			);
201
+		}
202
+		foreach ($vars as $handle => $var) {
203
+			if ($var_name === 'eei18n') {
204
+				\EE_Registry::$i18n_js_strings[$handle] = $var;
205
+			} else {
206
+				if ( ! isset($this->localized_vars[$var_name])) {
207
+					$this->localized_vars[$var_name] = array();
208
+				}
209
+				$this->localized_vars[$var_name][$handle] = $var;
210
+			}
211
+		}
212
+	}
213
+
214
+
215
+
216
+	/**
217
+	 * @return void
218
+	 */
219
+	public function display()
220
+	{
221
+		echo $this->getTemplate();
222
+		exit;
223
+	}
224
+
225
+
226
+
227
+	/**
228
+	 * @return string
229
+	 */
230
+	public function getTemplate()
231
+	{
232
+		return \EEH_Template::display_template(
233
+			__DIR__ . '\iframe_wrapper.template.php',
234
+			array(
235
+				'title'             => apply_filters(
236
+					'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__title',
237
+					$this->title
238
+				),
239
+				'content'           => apply_filters(
240
+					'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__content',
241
+					$this->content
242
+				),
243
+				'enqueue_wp_assets' => apply_filters(
244
+					'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__enqueue_wp_assets',
245
+					$this->enqueue_wp_assets
246
+				),
247
+				'css'               => (array)apply_filters(
248
+					'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__css_urls',
249
+					$this->css
250
+				),
251
+				'header_js'         => (array)apply_filters(
252
+					'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__header_js_urls',
253
+					$this->header_js
254
+				),
255
+				'footer_js'         => (array)apply_filters(
256
+					'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__footer_js_urls',
257
+					$this->footer_js
258
+				),
259
+				'eei18n'            => apply_filters(
260
+					'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__eei18n_js_strings',
261
+					\EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars()
262
+				),
263
+				'notices'           => \EEH_Template::display_template(
264
+					EE_TEMPLATES . 'espresso-ajax-notices.template.php',
265
+					array(),
266
+					true
267
+				),
268
+			),
269
+			true
270
+		);
271
+	}
272
+
273
+
274
+
275
+	/**
276
+	 * localizeJsonVars
277
+	 *
278
+	 * @return string
279
+	 */
280
+	public function localizeJsonVars()
281
+	{
282
+		$JSON = '';
283
+		$localized_vars = (array)$this->localized_vars;
284
+		foreach ($localized_vars as $var_name => $vars) {
285
+			foreach ($vars as $key => $value) {
286
+				if (is_scalar($value)) {
287
+					$localized_vars[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
288
+				}
289
+			}
290
+			$JSON .= "/* <![CDATA[ */ var $var_name = " . wp_json_encode($localized_vars) . '; /* ]]> */';
291
+		}
292
+		return $JSON;
293
+	}
294
+
295
+
296
+
297
+	/**
298
+	 * Adds an iframe embed code button to the Event editor.
299
+	 *
300
+	 * @param string $route_name the named module route that generates the iframe
301
+	 */
302
+	public static function addEventEditorIframeEmbedButton($route_name)
303
+	{
304
+		// add button for iframe code to event editor.
305
+		add_filter(
306
+			'get_sample_permalink_html',
307
+			function ($permalink_string, $id, $new_title, $new_slug) use ($route_name) {
308
+				return Iframe::eventListIframeEmbedButton($permalink_string, $id, $new_title, $new_slug, $route_name);
309
+			},
310
+			10, 2
311
+		);
312
+		add_action(
313
+			'admin_enqueue_scripts',
314
+			array('\EventEspresso\core\libraries\iframe_display\Iframe', 'EventsAdminEmbedButtonAssets'),
315
+			10
316
+		);
317
+	}
318
+
319
+
320
+
321
+	/**
322
+	 * iframe embed code button to the Event editor.
323
+	 *
324
+	 * @param string $permalink_string
325
+	 * @param int    $id
326
+	 * @param string $new_title  (unused)
327
+	 * @param string $new_slug   (unused)
328
+	 * @param string $route_name the named module route that generates the iframe
329
+	 * @return string
330
+	 */
331
+	public static function eventListIframeEmbedButton(
332
+		$permalink_string,
333
+		$id,
334
+		$new_title = '',
335
+		$new_slug = '',
336
+		$route_name = ''
337
+	) {
338
+		//make sure this is ONLY when editing and the event id has been set.
339
+		if ( ! empty($id)) {
340
+			$post = get_post($id);
341
+			//if NOT event then let's get out.
342
+			if ($post->post_type !== 'espresso_events') {
343
+				return $permalink_string;
344
+			}
345
+			$permalink_string .= Iframe::embedButtonHtml(
346
+				'Event',
347
+				$route_name,
348
+				array('event' => $id),
349
+				'button-small'
350
+			);
351
+		}
352
+		return $permalink_string;
353
+	}
354
+
355
+
356
+
357
+	/**
358
+	 * Adds an iframe embed code button to the Event editor.
359
+	 *
360
+	 * @param string $route_name the named module route that generates the iframe
361
+	 */
362
+	public static function addEventListIframeEmbedButton($route_name)
363
+	{
364
+		// add button for iframe code to event editor.
365
+		add_action(
366
+			'AHEE__admin_list_wrapper_template__after_list_table',
367
+			function ($page_slug) use ($route_name) {
368
+				//make sure this is ONLY when editing and the event id has been set.
369
+				if ($page_slug === 'espresso_events') {
370
+					echo \EEH_HTML::h3(__('iFrame Embed Code', 'event_espresso'));
371
+					echo \EEH_HTML::p(__('Click the following buttons to generate iframe HTML that will allow you to embed your event content within the content of other websites.',
372
+						'event_espresso'));
373
+					echo Iframe::embedButtonHtml(
374
+						'Events List',
375
+						$route_name
376
+					);
377
+				}
378
+			},
379
+			10, 1
380
+		);
381
+		add_action(
382
+			'admin_enqueue_scripts',
383
+			array('\EventEspresso\core\libraries\iframe_display\Iframe', 'EventsAdminEmbedButtonAssets'),
384
+			10
385
+		);
386
+	}
387
+
388
+
389
+
390
+	/**
391
+	 * Adds an iframe embed code button via a WP do_action() as determined by the first parameter
392
+	 *
393
+	 * @param string $iframe_name
394
+	 * @param string $route_name the named module route that generates the iframe
395
+	 * @param string $action     name of the WP do_action() to hook into
396
+	 */
397
+	public static function addActionIframeEmbedButton($iframe_name, $route_name, $action)
398
+	{
399
+		// add button for iframe code to event editor.
400
+		add_action(
401
+			$action,
402
+			function () use ($iframe_name, $route_name) {
403
+				echo Iframe::embedButtonHtml($iframe_name, $route_name);
404
+			},
405
+			10
406
+		);
407
+	}
408
+
409
+
410
+
411
+	/**
412
+	 * iframe_embed_html
413
+	 *
414
+	 * @param string $iframe_name
415
+	 * @param string $route_name the named module route that generates the iframe
416
+	 * @param array  $query_args
417
+	 * @param string $button_class
418
+	 * @return string
419
+	 */
420
+	public static function embedButtonHtml($iframe_name, $route_name, $query_args = array(), $button_class = '')
421
+	{
422
+		$query_args = ! empty($query_args) ? $query_args : array($route_name => 'iframe');
423
+		// add this route to our localized vars
424
+		$iframe_module_routes = isset(\EE_Registry::$i18n_js_strings['iframe_module_routes'])
425
+			? \EE_Registry::$i18n_js_strings['iframe_module_routes']
426
+			: array();
427
+		$iframe_module_routes[$route_name] = $route_name;
428
+		\EE_Registry::$i18n_js_strings['iframe_module_routes'] = $iframe_module_routes;
429
+		$iframe_embed_html = \EEH_HTML::link(
430
+			'#',
431
+			sprintf(__('Embed %1$s', 'event_espresso'), $iframe_name),
432
+			sprintf(
433
+				__(
434
+					'click here to generate code for embedding an %1$s iframe into another site.',
435
+					'event_espresso'
436
+				),
437
+				$iframe_name
438
+			),
439
+			"$route_name-iframe-embed-trigger-js",
440
+			'iframe-embed-trigger-js button ' . $button_class,
441
+			'',
442
+			' data-iframe_embed_button="#' . $route_name . '-iframe-js" tabindex="-1"'
443
+		);
444
+		$iframe_embed_html .= \EEH_HTML::div('', "$route_name-iframe-js", 'iframe-embed-wrapper-js', 'display:none;');
445
+		$iframe_embed_html .= \EEH_HTML::div(
446
+			'<iframe src="' . add_query_arg($query_args, site_url()) . '" width="100%" height="100%"></iframe>',
447
+			'', '', 'width:100%; height: 500px;'
448
+		);
449
+		$iframe_embed_html .= \EEH_HTML::divx();
450
+		return $iframe_embed_html;
451
+	}
452
+
453
+
454
+
455
+	/**
456
+	 * iframe button js on admin events list or event editor page
457
+	 */
458
+	public static function EventsAdminEmbedButtonAssets()
459
+	{
460
+		if (\EE_Registry::instance()->REQ->get('page') === 'espresso_events') {
461
+			Iframe::embedButtonAssets();
462
+			\EE_Registry::$i18n_js_strings['iframe_embed_title'] = __(
463
+				'copy and paste the following into any other site\'s content to display this event:',
464
+				'event_espresso'
465
+			);
466
+		}
467
+	}
468
+
469
+
470
+
471
+	/**
472
+	 * enqueue iframe button js
473
+	 */
474
+	public static function embedButtonAssets()
475
+	{
476
+		\EE_Registry::$i18n_js_strings['iframe_embed_close_msg'] = __(
477
+			'click anywhere outside of this window to close it.',
478
+			'event_espresso'
479
+		);
480
+		wp_register_script(
481
+			'iframe_embed_button',
482
+			plugin_dir_url(__FILE__) . 'iframe-embed-button.js',
483
+			array('ee-dialog'),
484
+			EVENT_ESPRESSO_VERSION,
485
+			true
486
+		);
487
+		wp_enqueue_script('iframe_embed_button');
488
+	}
489 489
 
490 490
 
491 491
 
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             apply_filters(
82 82
                 'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__construct__default_css',
83 83
                 array(
84
-                    'dashicons'        => includes_url('css/dashicons.min.css?ver=' . $wp_version),
84
+                    'dashicons'        => includes_url('css/dashicons.min.css?ver='.$wp_version),
85 85
                     'espresso_default' => EE_GLOBAL_ASSETS_URL
86 86
                                           . 'css/espresso_default.css?ver='
87 87
                                           . EVENT_ESPRESSO_VERSION,
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             apply_filters(
93 93
                 'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__construct__default_js',
94 94
                 array(
95
-                    'jquery'        => includes_url('js/jquery/jquery.js?ver=' . $wp_version),
95
+                    'jquery'        => includes_url('js/jquery/jquery.js?ver='.$wp_version),
96 96
                     'espresso_core' => EE_GLOBAL_ASSETS_URL
97 97
                                        . 'scripts/espresso_core.js?ver='
98 98
                                        . EVENT_ESPRESSO_VERSION,
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     public function getTemplate()
231 231
     {
232 232
         return \EEH_Template::display_template(
233
-            __DIR__ . '\iframe_wrapper.template.php',
233
+            __DIR__.'\iframe_wrapper.template.php',
234 234
             array(
235 235
                 'title'             => apply_filters(
236 236
                     'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__title',
@@ -244,24 +244,24 @@  discard block
 block discarded – undo
244 244
                     'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__enqueue_wp_assets',
245 245
                     $this->enqueue_wp_assets
246 246
                 ),
247
-                'css'               => (array)apply_filters(
247
+                'css'               => (array) apply_filters(
248 248
                     'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__css_urls',
249 249
                     $this->css
250 250
                 ),
251
-                'header_js'         => (array)apply_filters(
251
+                'header_js'         => (array) apply_filters(
252 252
                     'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__header_js_urls',
253 253
                     $this->header_js
254 254
                 ),
255
-                'footer_js'         => (array)apply_filters(
255
+                'footer_js'         => (array) apply_filters(
256 256
                     'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__footer_js_urls',
257 257
                     $this->footer_js
258 258
                 ),
259 259
                 'eei18n'            => apply_filters(
260 260
                     'FHEE__\EventEspresso\core\libraries\iframe_display\Iframe__getTemplate__eei18n_js_strings',
261
-                    \EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars()
261
+                    \EE_Registry::localize_i18n_js_strings().$this->localizeJsonVars()
262 262
                 ),
263 263
                 'notices'           => \EEH_Template::display_template(
264
-                    EE_TEMPLATES . 'espresso-ajax-notices.template.php',
264
+                    EE_TEMPLATES.'espresso-ajax-notices.template.php',
265 265
                     array(),
266 266
                     true
267 267
                 ),
@@ -280,14 +280,14 @@  discard block
 block discarded – undo
280 280
     public function localizeJsonVars()
281 281
     {
282 282
         $JSON = '';
283
-        $localized_vars = (array)$this->localized_vars;
283
+        $localized_vars = (array) $this->localized_vars;
284 284
         foreach ($localized_vars as $var_name => $vars) {
285 285
             foreach ($vars as $key => $value) {
286 286
                 if (is_scalar($value)) {
287
-                    $localized_vars[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
287
+                    $localized_vars[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
288 288
                 }
289 289
             }
290
-            $JSON .= "/* <![CDATA[ */ var $var_name = " . wp_json_encode($localized_vars) . '; /* ]]> */';
290
+            $JSON .= "/* <![CDATA[ */ var $var_name = ".wp_json_encode($localized_vars).'; /* ]]> */';
291 291
         }
292 292
         return $JSON;
293 293
     }
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
         // add button for iframe code to event editor.
305 305
         add_filter(
306 306
             'get_sample_permalink_html',
307
-            function ($permalink_string, $id, $new_title, $new_slug) use ($route_name) {
307
+            function($permalink_string, $id, $new_title, $new_slug) use ($route_name) {
308 308
                 return Iframe::eventListIframeEmbedButton($permalink_string, $id, $new_title, $new_slug, $route_name);
309 309
             },
310 310
             10, 2
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
         // add button for iframe code to event editor.
365 365
         add_action(
366 366
             'AHEE__admin_list_wrapper_template__after_list_table',
367
-            function ($page_slug) use ($route_name) {
367
+            function($page_slug) use ($route_name) {
368 368
                 //make sure this is ONLY when editing and the event id has been set.
369 369
                 if ($page_slug === 'espresso_events') {
370 370
                     echo \EEH_HTML::h3(__('iFrame Embed Code', 'event_espresso'));
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
         // add button for iframe code to event editor.
400 400
         add_action(
401 401
             $action,
402
-            function () use ($iframe_name, $route_name) {
402
+            function() use ($iframe_name, $route_name) {
403 403
                 echo Iframe::embedButtonHtml($iframe_name, $route_name);
404 404
             },
405 405
             10
@@ -437,13 +437,13 @@  discard block
 block discarded – undo
437 437
                 $iframe_name
438 438
             ),
439 439
             "$route_name-iframe-embed-trigger-js",
440
-            'iframe-embed-trigger-js button ' . $button_class,
440
+            'iframe-embed-trigger-js button '.$button_class,
441 441
             '',
442
-            ' data-iframe_embed_button="#' . $route_name . '-iframe-js" tabindex="-1"'
442
+            ' data-iframe_embed_button="#'.$route_name.'-iframe-js" tabindex="-1"'
443 443
         );
444 444
         $iframe_embed_html .= \EEH_HTML::div('', "$route_name-iframe-js", 'iframe-embed-wrapper-js', 'display:none;');
445 445
         $iframe_embed_html .= \EEH_HTML::div(
446
-            '<iframe src="' . add_query_arg($query_args, site_url()) . '" width="100%" height="100%"></iframe>',
446
+            '<iframe src="'.add_query_arg($query_args, site_url()).'" width="100%" height="100%"></iframe>',
447 447
             '', '', 'width:100%; height: 500px;'
448 448
         );
449 449
         $iframe_embed_html .= \EEH_HTML::divx();
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         );
480 480
         wp_register_script(
481 481
             'iframe_embed_button',
482
-            plugin_dir_url(__FILE__) . 'iframe-embed-button.js',
482
+            plugin_dir_url(__FILE__).'iframe-embed-button.js',
483 483
             array('ee-dialog'),
484 484
             EVENT_ESPRESSO_VERSION,
485 485
             true
Please login to merge, or discard this patch.
modules/ticket_selector/DisplayTicketSelector.php 2 patches
Indentation   +346 added lines, -346 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\modules\ticket_selector;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -19,351 +19,351 @@  discard block
 block discarded – undo
19 19
 class DisplayTicketSelector
20 20
 {
21 21
 
22
-    /**
23
-     * event that ticket selector is being generated for
24
-     *
25
-     * @access protected
26
-     * @var \EE_Event $event
27
-     */
28
-    protected $event;
29
-
30
-    /**
31
-     * Used to flag when the ticket selector is being called from an external iframe.
32
-     *
33
-     * @var bool $iframe
34
-     */
35
-    protected $iframe = false;
36
-
37
-
38
-
39
-    /**
40
-     * @param boolean $iframe
41
-     */
42
-    public function setIframe($iframe = true)
43
-    {
44
-        $this->iframe = filter_var($iframe, FILTER_VALIDATE_BOOLEAN);
45
-    }
46
-
47
-
48
-
49
-    /**
50
-     *    finds and sets the \EE_Event object for use throughout class
51
-     *
52
-     * @access    public
53
-     * @param    mixed $event
54
-     * @return    bool
55
-     */
56
-    protected function setEvent($event = null)
57
-    {
58
-        if ($event === null) {
59
-            global $post;
60
-            $event = $post;
61
-        }
62
-        if ($event instanceof \EE_Event) {
63
-            $this->event = $event;
64
-        } else if ($event instanceof \WP_Post) {
65
-            if (isset($event->EE_Event) && $event->EE_Event instanceof \EE_Event) {
66
-                $this->event = $event->EE_Event;
67
-            } else if ($event->post_type === 'espresso_events') {
68
-                $event->EE_Event = \EEM_Event::instance()->instantiate_class_from_post_object($event);
69
-                $this->event = $event->EE_Event;
70
-            }
71
-        } else {
72
-            $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
73
-            $dev_msg = $user_msg . __(
74
-                    'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.',
75
-                    'event_espresso'
76
-                );
77
-            \EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
78
-            return false;
79
-        }
80
-        return true;
81
-    }
82
-
83
-
84
-
85
-    /**
86
-     *    creates buttons for selecting number of attendees for an event
87
-     *
88
-     * @access    public
89
-     * @param    \WP_Post|int $event
90
-     * @param    bool         $view_details
91
-     * @return    string
92
-     */
93
-    public function display($event = null, $view_details = false)
94
-    {
95
-        // reset filter for displaying submit button
96
-        remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
97
-        // poke and prod incoming event till it tells us what it is
98
-        if ( ! $this->setEvent($event)) {
99
-            return false;
100
-        }
101
-        $event_post = $this->event instanceof \EE_Event ? $this->event->ID() : $event;
102
-        // grab event status
103
-        $_event_active_status = $this->event->get_active_status();
104
-        if (
105
-            ! is_admin()
106
-            && (
107
-                ! $this->event->display_ticket_selector()
108
-                || $view_details
109
-                || post_password_required($event_post)
110
-                || (
111
-                    $_event_active_status !== \EE_Datetime::active
112
-                    && $_event_active_status !== \EE_Datetime::upcoming
113
-                    && $_event_active_status !== \EE_Datetime::sold_out
114
-                    && ! (
115
-                        $_event_active_status === \EE_Datetime::inactive
116
-                        && is_user_logged_in()
117
-                    )
118
-                )
119
-            )
120
-        ) {
121
-            return ! is_single() ? $this->displayViewDetailsButton() : '';
122
-        }
123
-        $template_args = array();
124
-        $template_args['event_status'] = $_event_active_status;
125
-        $template_args['date_format'] = apply_filters(
126
-            'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format',
127
-            get_option('date_format')
128
-        );
129
-        $template_args['time_format'] = apply_filters(
130
-            'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format',
131
-            get_option('time_format')
132
-        );
133
-        $template_args['EVT_ID'] = $this->event->ID();
134
-        $template_args['event'] = $this->event;
135
-        // is the event expired ?
136
-        $template_args['event_is_expired'] = $this->event->is_expired();
137
-        if ($template_args['event_is_expired']) {
138
-            return '<div class="ee-event-expired-notice"><span class="important-notice">' . __(
139
-                'We\'re sorry, but all tickets sales have ended because the event is expired.',
140
-                'event_espresso'
141
-            ) . '</span></div>';
142
-        }
143
-        $ticket_query_args = array(
144
-            array('Datetime.EVT_ID' => $this->event->ID()),
145
-            'order_by' => array(
146
-                'TKT_order'              => 'ASC',
147
-                'TKT_required'           => 'DESC',
148
-                'TKT_start_date'         => 'ASC',
149
-                'TKT_end_date'           => 'ASC',
150
-                'Datetime.DTT_EVT_start' => 'DESC',
151
-            ),
152
-        );
153
-        if ( ! \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
154
-            //use the correct applicable time query depending on what version of core is being run.
155
-            $current_time = method_exists('EEM_Datetime', 'current_time_for_query')
156
-                ? time()
157
-                : current_time(
158
-                    'timestamp'
159
-                );
160
-            $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
161
-        }
162
-        // get all tickets for this event ordered by the datetime
163
-        $template_args['tickets'] = \EEM_Ticket::instance()->get_all($ticket_query_args);
164
-        if (count($template_args['tickets']) < 1) {
165
-            return '<div class="ee-event-expired-notice"><span class="important-notice">' . __(
166
-                'We\'re sorry, but all ticket sales have ended.',
167
-                'event_espresso'
168
-            ) . '</span></div>';
169
-        }
170
-        // filter the maximum qty that can appear in the Ticket Selector qty dropdowns
171
-        $template_args['max_atndz'] = apply_filters(
172
-            'FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets',
173
-            $this->event->additional_limit()
174
-        );
175
-        if ($template_args['max_atndz'] < 1) {
176
-            $sales_closed_msg = __(
177
-                'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.',
178
-                'event_espresso'
179
-            );
180
-            if (current_user_can('edit_post', $this->event->ID())) {
181
-                $sales_closed_msg .= sprintf(
182
-                    __(
183
-                        '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s',
184
-                        'event_espresso'
185
-                    ),
186
-                    '<div class="ee-attention" style="text-align: left;"><b>',
187
-                    '</b><br />',
188
-                    $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link(
189
-                            $this->event->ID()
190
-                        ) . '">',
191
-                    '</a></span></div>'
192
-                );
193
-            }
194
-            return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
195
-        }
196
-        $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
197
-        $templates['ticket_selector'] = apply_filters(
198
-            'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path',
199
-            $templates['ticket_selector'],
200
-            $this->event
201
-        );
202
-        // redirecting to another site for registration ??
203
-        $external_url = $this->event->external_url() !== null || $this->event->external_url() !== ''
204
-            ? $this->event->external_url() : false;
205
-        // set up the form (but not for the admin)
206
-        $ticket_selector = ! is_admin() ? $this->formOpen(
207
-            $this->event->ID(),
208
-            $external_url
209
-        ) : '';
210
-        // if not redirecting to another site for registration
211
-        if ( ! $external_url) {
212
-            \EE_Registry::instance()->load_helper('Template');
213
-            \EE_Registry::instance()->load_helper('URL');
214
-            // then display the ticket selector
215
-            $ticket_selector .= \EEH_Template::locate_template($templates['ticket_selector'], $template_args);
216
-        } else {
217
-            // if not we still need to trigger the display of the submit button
218
-            add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
219
-            //display notice to admin that registration is external
220
-            $ticket_selector .= ! is_admin()
221
-                ? ''
222
-                : __(
223
-                    'Registration is at an external URL for this event.',
224
-                    'event_espresso'
225
-                );
226
-        }
227
-        // submit button and form close tag
228
-        $ticket_selector .= ! is_admin() ? $this->displaySubmitButton() : '';
229
-        // set no cache headers and constants
230
-        \EE_System::do_not_cache();
231
-        return $ticket_selector;
232
-    }
233
-
234
-
235
-
236
-    /**
237
-     *    formOpen
238
-     *
239
-     * @access        public
240
-     * @param        int    $ID
241
-     * @param        string $external_url
242
-     * @return        string
243
-     */
244
-    public function formOpen($ID = 0, $external_url = '')
245
-    {
246
-        // if redirecting, we don't need any anything else
247
-        if ($external_url) {
248
-            \EE_Registry::instance()->load_helper('URL');
249
-            $html = '<form method="GET" action="' . \EEH_URL::refactor_url($external_url) . '">';
250
-            $query_args = \EEH_URL::get_query_string($external_url);
251
-            foreach ($query_args as $query_arg => $value) {
252
-                $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
253
-            }
254
-            return $html;
255
-        }
256
-        \EE_Registry::instance()->load_helper('Event_View');
257
-        $checkout_url = \EEH_Event_View::event_link_url($ID);
258
-        if ( ! $checkout_url) {
259
-            \EE_Error::add_error(
260
-                __('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
261
-                __FILE__,
262
-                __FUNCTION__,
263
-                __LINE__
264
-            );
265
-        }
266
-        $extra_params = $this->iframe ? ' target="_blank"' : '';
267
-        $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
268
-        $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', true, false);
269
-        $html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
270
-        $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, $this->event);
271
-        return $html;
272
-    }
273
-
274
-
275
-
276
-    /**
277
-     *    displaySubmitButton
278
-     *
279
-     * @access        public
280
-     * @access        public
281
-     * @return        string
282
-     */
283
-    public function displaySubmitButton()
284
-    {
285
-        if ( ! is_admin()) {
286
-            if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
287
-                $btn_text = apply_filters(
288
-                    'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
289
-                    __('Register Now', 'event_espresso'),
290
-                    $this->event
291
-                );
292
-                $external_url = $this->event->external_url();
293
-                $html = '<input id="ticket-selector-submit-' . $this->event->ID() . '-btn"';
294
-                $html .= ' class="ticket-selector-submit-btn ';
295
-                $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
296
-                $html .= ' type="submit" value="' . $btn_text . '" />';
297
-                $html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', $this->event);
298
-                $html .= '<div class="clear"><br/></div></form>';
299
-                return $html;
300
-            } else if (is_archive()) {
301
-                return $this->formClose()
302
-                       . $this->displayViewDetailsButton();
303
-            }
304
-        }
305
-        return '';
306
-    }
307
-
308
-
309
-
310
-    /**
311
-     *    formClose
312
-     *
313
-     * @access        public
314
-     * @access        public
315
-     * @return        string
316
-     */
317
-    public function formClose()
318
-    {
319
-        return '</form>';
320
-    }
321
-
322
-
323
-
324
-    /**
325
-     *    displayViewDetailsButton
326
-     *
327
-     * @access        public
328
-     * @access        public
329
-     * @return        string
330
-     */
331
-    public function displayViewDetailsButton()
332
-    {
333
-        if ( ! $this->event->get_permalink()) {
334
-            \EE_Error::add_error(
335
-                __('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
336
-                __FILE__,
337
-                __FUNCTION__,
338
-                __LINE__
339
-            );
340
-        }
341
-        $view_details_btn = '<form method="POST" action="' . $this->event->get_permalink() . '">';
342
-        $btn_text = apply_filters(
343
-            'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
344
-            __('View Details', 'event_espresso'),
345
-            $this->event
346
-        );
347
-        $view_details_btn .= '<input id="ticket-selector-submit-'
348
-                             . $this->event->ID()
349
-                             . '-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'
350
-                             . $btn_text
351
-                             . '" />';
352
-        $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', $this->event);
353
-        $view_details_btn .= '<div class="clear"><br/></div>';
354
-        $view_details_btn .= '</form>';
355
-        return $view_details_btn;
356
-    }
357
-
358
-
359
-
360
-    /**
361
-     * @return string
362
-     */
363
-    public static function noTicketSelectorEndDiv()
364
-    {
365
-        return '<div class="clear"></div></div>';
366
-    }
22
+	/**
23
+	 * event that ticket selector is being generated for
24
+	 *
25
+	 * @access protected
26
+	 * @var \EE_Event $event
27
+	 */
28
+	protected $event;
29
+
30
+	/**
31
+	 * Used to flag when the ticket selector is being called from an external iframe.
32
+	 *
33
+	 * @var bool $iframe
34
+	 */
35
+	protected $iframe = false;
36
+
37
+
38
+
39
+	/**
40
+	 * @param boolean $iframe
41
+	 */
42
+	public function setIframe($iframe = true)
43
+	{
44
+		$this->iframe = filter_var($iframe, FILTER_VALIDATE_BOOLEAN);
45
+	}
46
+
47
+
48
+
49
+	/**
50
+	 *    finds and sets the \EE_Event object for use throughout class
51
+	 *
52
+	 * @access    public
53
+	 * @param    mixed $event
54
+	 * @return    bool
55
+	 */
56
+	protected function setEvent($event = null)
57
+	{
58
+		if ($event === null) {
59
+			global $post;
60
+			$event = $post;
61
+		}
62
+		if ($event instanceof \EE_Event) {
63
+			$this->event = $event;
64
+		} else if ($event instanceof \WP_Post) {
65
+			if (isset($event->EE_Event) && $event->EE_Event instanceof \EE_Event) {
66
+				$this->event = $event->EE_Event;
67
+			} else if ($event->post_type === 'espresso_events') {
68
+				$event->EE_Event = \EEM_Event::instance()->instantiate_class_from_post_object($event);
69
+				$this->event = $event->EE_Event;
70
+			}
71
+		} else {
72
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
73
+			$dev_msg = $user_msg . __(
74
+					'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.',
75
+					'event_espresso'
76
+				);
77
+			\EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
78
+			return false;
79
+		}
80
+		return true;
81
+	}
82
+
83
+
84
+
85
+	/**
86
+	 *    creates buttons for selecting number of attendees for an event
87
+	 *
88
+	 * @access    public
89
+	 * @param    \WP_Post|int $event
90
+	 * @param    bool         $view_details
91
+	 * @return    string
92
+	 */
93
+	public function display($event = null, $view_details = false)
94
+	{
95
+		// reset filter for displaying submit button
96
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
97
+		// poke and prod incoming event till it tells us what it is
98
+		if ( ! $this->setEvent($event)) {
99
+			return false;
100
+		}
101
+		$event_post = $this->event instanceof \EE_Event ? $this->event->ID() : $event;
102
+		// grab event status
103
+		$_event_active_status = $this->event->get_active_status();
104
+		if (
105
+			! is_admin()
106
+			&& (
107
+				! $this->event->display_ticket_selector()
108
+				|| $view_details
109
+				|| post_password_required($event_post)
110
+				|| (
111
+					$_event_active_status !== \EE_Datetime::active
112
+					&& $_event_active_status !== \EE_Datetime::upcoming
113
+					&& $_event_active_status !== \EE_Datetime::sold_out
114
+					&& ! (
115
+						$_event_active_status === \EE_Datetime::inactive
116
+						&& is_user_logged_in()
117
+					)
118
+				)
119
+			)
120
+		) {
121
+			return ! is_single() ? $this->displayViewDetailsButton() : '';
122
+		}
123
+		$template_args = array();
124
+		$template_args['event_status'] = $_event_active_status;
125
+		$template_args['date_format'] = apply_filters(
126
+			'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format',
127
+			get_option('date_format')
128
+		);
129
+		$template_args['time_format'] = apply_filters(
130
+			'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format',
131
+			get_option('time_format')
132
+		);
133
+		$template_args['EVT_ID'] = $this->event->ID();
134
+		$template_args['event'] = $this->event;
135
+		// is the event expired ?
136
+		$template_args['event_is_expired'] = $this->event->is_expired();
137
+		if ($template_args['event_is_expired']) {
138
+			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __(
139
+				'We\'re sorry, but all tickets sales have ended because the event is expired.',
140
+				'event_espresso'
141
+			) . '</span></div>';
142
+		}
143
+		$ticket_query_args = array(
144
+			array('Datetime.EVT_ID' => $this->event->ID()),
145
+			'order_by' => array(
146
+				'TKT_order'              => 'ASC',
147
+				'TKT_required'           => 'DESC',
148
+				'TKT_start_date'         => 'ASC',
149
+				'TKT_end_date'           => 'ASC',
150
+				'Datetime.DTT_EVT_start' => 'DESC',
151
+			),
152
+		);
153
+		if ( ! \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
154
+			//use the correct applicable time query depending on what version of core is being run.
155
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query')
156
+				? time()
157
+				: current_time(
158
+					'timestamp'
159
+				);
160
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
161
+		}
162
+		// get all tickets for this event ordered by the datetime
163
+		$template_args['tickets'] = \EEM_Ticket::instance()->get_all($ticket_query_args);
164
+		if (count($template_args['tickets']) < 1) {
165
+			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __(
166
+				'We\'re sorry, but all ticket sales have ended.',
167
+				'event_espresso'
168
+			) . '</span></div>';
169
+		}
170
+		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
171
+		$template_args['max_atndz'] = apply_filters(
172
+			'FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets',
173
+			$this->event->additional_limit()
174
+		);
175
+		if ($template_args['max_atndz'] < 1) {
176
+			$sales_closed_msg = __(
177
+				'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.',
178
+				'event_espresso'
179
+			);
180
+			if (current_user_can('edit_post', $this->event->ID())) {
181
+				$sales_closed_msg .= sprintf(
182
+					__(
183
+						'%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s',
184
+						'event_espresso'
185
+					),
186
+					'<div class="ee-attention" style="text-align: left;"><b>',
187
+					'</b><br />',
188
+					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link(
189
+							$this->event->ID()
190
+						) . '">',
191
+					'</a></span></div>'
192
+				);
193
+			}
194
+			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
195
+		}
196
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
197
+		$templates['ticket_selector'] = apply_filters(
198
+			'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path',
199
+			$templates['ticket_selector'],
200
+			$this->event
201
+		);
202
+		// redirecting to another site for registration ??
203
+		$external_url = $this->event->external_url() !== null || $this->event->external_url() !== ''
204
+			? $this->event->external_url() : false;
205
+		// set up the form (but not for the admin)
206
+		$ticket_selector = ! is_admin() ? $this->formOpen(
207
+			$this->event->ID(),
208
+			$external_url
209
+		) : '';
210
+		// if not redirecting to another site for registration
211
+		if ( ! $external_url) {
212
+			\EE_Registry::instance()->load_helper('Template');
213
+			\EE_Registry::instance()->load_helper('URL');
214
+			// then display the ticket selector
215
+			$ticket_selector .= \EEH_Template::locate_template($templates['ticket_selector'], $template_args);
216
+		} else {
217
+			// if not we still need to trigger the display of the submit button
218
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
219
+			//display notice to admin that registration is external
220
+			$ticket_selector .= ! is_admin()
221
+				? ''
222
+				: __(
223
+					'Registration is at an external URL for this event.',
224
+					'event_espresso'
225
+				);
226
+		}
227
+		// submit button and form close tag
228
+		$ticket_selector .= ! is_admin() ? $this->displaySubmitButton() : '';
229
+		// set no cache headers and constants
230
+		\EE_System::do_not_cache();
231
+		return $ticket_selector;
232
+	}
233
+
234
+
235
+
236
+	/**
237
+	 *    formOpen
238
+	 *
239
+	 * @access        public
240
+	 * @param        int    $ID
241
+	 * @param        string $external_url
242
+	 * @return        string
243
+	 */
244
+	public function formOpen($ID = 0, $external_url = '')
245
+	{
246
+		// if redirecting, we don't need any anything else
247
+		if ($external_url) {
248
+			\EE_Registry::instance()->load_helper('URL');
249
+			$html = '<form method="GET" action="' . \EEH_URL::refactor_url($external_url) . '">';
250
+			$query_args = \EEH_URL::get_query_string($external_url);
251
+			foreach ($query_args as $query_arg => $value) {
252
+				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
253
+			}
254
+			return $html;
255
+		}
256
+		\EE_Registry::instance()->load_helper('Event_View');
257
+		$checkout_url = \EEH_Event_View::event_link_url($ID);
258
+		if ( ! $checkout_url) {
259
+			\EE_Error::add_error(
260
+				__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
261
+				__FILE__,
262
+				__FUNCTION__,
263
+				__LINE__
264
+			);
265
+		}
266
+		$extra_params = $this->iframe ? ' target="_blank"' : '';
267
+		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
268
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', true, false);
269
+		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
270
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, $this->event);
271
+		return $html;
272
+	}
273
+
274
+
275
+
276
+	/**
277
+	 *    displaySubmitButton
278
+	 *
279
+	 * @access        public
280
+	 * @access        public
281
+	 * @return        string
282
+	 */
283
+	public function displaySubmitButton()
284
+	{
285
+		if ( ! is_admin()) {
286
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
287
+				$btn_text = apply_filters(
288
+					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
289
+					__('Register Now', 'event_espresso'),
290
+					$this->event
291
+				);
292
+				$external_url = $this->event->external_url();
293
+				$html = '<input id="ticket-selector-submit-' . $this->event->ID() . '-btn"';
294
+				$html .= ' class="ticket-selector-submit-btn ';
295
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
296
+				$html .= ' type="submit" value="' . $btn_text . '" />';
297
+				$html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', $this->event);
298
+				$html .= '<div class="clear"><br/></div></form>';
299
+				return $html;
300
+			} else if (is_archive()) {
301
+				return $this->formClose()
302
+					   . $this->displayViewDetailsButton();
303
+			}
304
+		}
305
+		return '';
306
+	}
307
+
308
+
309
+
310
+	/**
311
+	 *    formClose
312
+	 *
313
+	 * @access        public
314
+	 * @access        public
315
+	 * @return        string
316
+	 */
317
+	public function formClose()
318
+	{
319
+		return '</form>';
320
+	}
321
+
322
+
323
+
324
+	/**
325
+	 *    displayViewDetailsButton
326
+	 *
327
+	 * @access        public
328
+	 * @access        public
329
+	 * @return        string
330
+	 */
331
+	public function displayViewDetailsButton()
332
+	{
333
+		if ( ! $this->event->get_permalink()) {
334
+			\EE_Error::add_error(
335
+				__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
336
+				__FILE__,
337
+				__FUNCTION__,
338
+				__LINE__
339
+			);
340
+		}
341
+		$view_details_btn = '<form method="POST" action="' . $this->event->get_permalink() . '">';
342
+		$btn_text = apply_filters(
343
+			'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
344
+			__('View Details', 'event_espresso'),
345
+			$this->event
346
+		);
347
+		$view_details_btn .= '<input id="ticket-selector-submit-'
348
+							 . $this->event->ID()
349
+							 . '-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'
350
+							 . $btn_text
351
+							 . '" />';
352
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', $this->event);
353
+		$view_details_btn .= '<div class="clear"><br/></div>';
354
+		$view_details_btn .= '</form>';
355
+		return $view_details_btn;
356
+	}
357
+
358
+
359
+
360
+	/**
361
+	 * @return string
362
+	 */
363
+	public static function noTicketSelectorEndDiv()
364
+	{
365
+		return '<div class="clear"></div></div>';
366
+	}
367 367
 
368 368
 
369 369
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
             }
71 71
         } else {
72 72
             $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
73
-            $dev_msg = $user_msg . __(
73
+            $dev_msg = $user_msg.__(
74 74
                     'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.',
75 75
                     'event_espresso'
76 76
                 );
77
-            \EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
77
+            \EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
78 78
             return false;
79 79
         }
80 80
         return true;
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
         // is the event expired ?
136 136
         $template_args['event_is_expired'] = $this->event->is_expired();
137 137
         if ($template_args['event_is_expired']) {
138
-            return '<div class="ee-event-expired-notice"><span class="important-notice">' . __(
138
+            return '<div class="ee-event-expired-notice"><span class="important-notice">'.__(
139 139
                 'We\'re sorry, but all tickets sales have ended because the event is expired.',
140 140
                 'event_espresso'
141
-            ) . '</span></div>';
141
+            ).'</span></div>';
142 142
         }
143 143
         $ticket_query_args = array(
144 144
             array('Datetime.EVT_ID' => $this->event->ID()),
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
         // get all tickets for this event ordered by the datetime
163 163
         $template_args['tickets'] = \EEM_Ticket::instance()->get_all($ticket_query_args);
164 164
         if (count($template_args['tickets']) < 1) {
165
-            return '<div class="ee-event-expired-notice"><span class="important-notice">' . __(
165
+            return '<div class="ee-event-expired-notice"><span class="important-notice">'.__(
166 166
                 'We\'re sorry, but all ticket sales have ended.',
167 167
                 'event_espresso'
168
-            ) . '</span></div>';
168
+            ).'</span></div>';
169 169
         }
170 170
         // filter the maximum qty that can appear in the Ticket Selector qty dropdowns
171 171
         $template_args['max_atndz'] = apply_filters(
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
                     ),
186 186
                     '<div class="ee-attention" style="text-align: left;"><b>',
187 187
                     '</b><br />',
188
-                    $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link(
188
+                    $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(
189 189
                             $this->event->ID()
190
-                        ) . '">',
190
+                        ).'">',
191 191
                     '</a></span></div>'
192 192
                 );
193 193
             }
194
-            return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
194
+            return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
195 195
         }
196
-        $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
196
+        $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
197 197
         $templates['ticket_selector'] = apply_filters(
198 198
             'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path',
199 199
             $templates['ticket_selector'],
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
         // if redirecting, we don't need any anything else
247 247
         if ($external_url) {
248 248
             \EE_Registry::instance()->load_helper('URL');
249
-            $html = '<form method="GET" action="' . \EEH_URL::refactor_url($external_url) . '">';
249
+            $html = '<form method="GET" action="'.\EEH_URL::refactor_url($external_url).'">';
250 250
             $query_args = \EEH_URL::get_query_string($external_url);
251 251
             foreach ($query_args as $query_arg => $value) {
252
-                $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
252
+                $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
253 253
             }
254 254
             return $html;
255 255
         }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
             );
265 265
         }
266 266
         $extra_params = $this->iframe ? ' target="_blank"' : '';
267
-        $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
267
+        $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
268 268
         $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', true, false);
269 269
         $html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
270 270
         $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, $this->event);
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
                     $this->event
291 291
                 );
292 292
                 $external_url = $this->event->external_url();
293
-                $html = '<input id="ticket-selector-submit-' . $this->event->ID() . '-btn"';
293
+                $html = '<input id="ticket-selector-submit-'.$this->event->ID().'-btn"';
294 294
                 $html .= ' class="ticket-selector-submit-btn ';
295 295
                 $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
296
-                $html .= ' type="submit" value="' . $btn_text . '" />';
296
+                $html .= ' type="submit" value="'.$btn_text.'" />';
297 297
                 $html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', $this->event);
298 298
                 $html .= '<div class="clear"><br/></div></form>';
299 299
                 return $html;
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
                 __LINE__
339 339
             );
340 340
         }
341
-        $view_details_btn = '<form method="POST" action="' . $this->event->get_permalink() . '">';
341
+        $view_details_btn = '<form method="POST" action="'.$this->event->get_permalink().'">';
342 342
         $btn_text = apply_filters(
343 343
             'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
344 344
             __('View Details', 'event_espresso'),
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 2 patches
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class EED_Ticket_Selector extends  EED_Module {
19 19
 
20
-    /**
21
-     * @var EventEspresso\modules\ticket_selector\DisplayTicketSelector $ticket_selector
22
-     */
23
-    private static $ticket_selector;
20
+	/**
21
+	 * @var EventEspresso\modules\ticket_selector\DisplayTicketSelector $ticket_selector
22
+	 */
23
+	private static $ticket_selector;
24 24
 
25 25
 
26 26
 
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
 
90 90
 
91 91
 
92
-    /**
93
-     * @return \EventEspresso\modules\ticket_selector\DisplayTicketSelector
94
-     */
95
-    public static function ticketSelector()
96
-    {
97
-        if ( ! EED_Ticket_Selector::$ticket_selector instanceof \EventEspresso\modules\ticket_selector\DisplayTicketSelector) {
98
-            EED_Ticket_Selector::$ticket_selector = new EventEspresso\modules\ticket_selector\DisplayTicketSelector();
99
-        }
100
-        return EED_Ticket_Selector::$ticket_selector;
101
-    }
92
+	/**
93
+	 * @return \EventEspresso\modules\ticket_selector\DisplayTicketSelector
94
+	 */
95
+	public static function ticketSelector()
96
+	{
97
+		if ( ! EED_Ticket_Selector::$ticket_selector instanceof \EventEspresso\modules\ticket_selector\DisplayTicketSelector) {
98
+			EED_Ticket_Selector::$ticket_selector = new EventEspresso\modules\ticket_selector\DisplayTicketSelector();
99
+		}
100
+		return EED_Ticket_Selector::$ticket_selector;
101
+	}
102 102
 
103 103
 
104 104
 	/**
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 
157 157
 
158 158
 	/**
159
-	* 	load js
160
-	*
161
-	* 	@access 		public
162
-	* 	@return 		void
163
-	*/
159
+	 * 	load js
160
+	 *
161
+	 * 	@access 		public
162
+	 * 	@return 		void
163
+	 */
164 164
 	public static function load_tckt_slctr_assets() {
165 165
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
166 166
 			// add some style
@@ -178,98 +178,98 @@  discard block
 block discarded – undo
178 178
 
179 179
 
180 180
 
181
-    /**
182
-     * @deprecated
183
-     * @return string
184
-     */
185
-    public static function display_view_details_btn()
186
-    {
187
-        // todo add doing_it_wrong() notice during next major version
188
-        return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton();
189
-    }
190
-
191
-
192
-
193
-    /**
194
-     * @deprecated
195
-     * @return string
196
-     */
197
-    public static function display_ticket_selector_submit()
198
-    {
199
-        // todo add doing_it_wrong() notice during next major version
200
-        return EED_Ticket_Selector::ticketSelector()->displaySubmitButton();
201
-    }
202
-
203
-
204
-
205
-    /**
206
-     * @deprecated
207
-     * @param string $permalink_string
208
-     * @param int    $id
209
-     * @param string $new_title
210
-     * @param string $new_slug
211
-     * @return string
212
-     */
213
-    public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '')
214
-    {
215
-        // todo add doing_it_wrong() notice during next major version
216
-        return \EventEspresso\core\libraries\iframe_display\Iframe::eventListIframeEmbedButton(
217
-            $permalink_string,
218
-            $id,
219
-            $new_title,
220
-            $new_slug,
221
-            'ticket_selector'
222
-        );
223
-    }
224
-
225
-
226
-
227
-    /**
228
-     * @deprecated
229
-     * @param int    $ID
230
-     * @param string $external_url
231
-     * @return string
232
-     */
233
-    public static function ticket_selector_form_open($ID = 0, $external_url = '')
234
-    {
235
-        // todo add doing_it_wrong() notice during next major version
236
-        return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url);
237
-    }
238
-
239
-
240
-
241
-    /**
242
-     * @deprecated
243
-     * @return string
244
-     */
245
-    public static function ticket_selector_form_close()
246
-    {
247
-        // todo add doing_it_wrong() notice during next major version
248
-        return EED_Ticket_Selector::ticketSelector()->formClose();
249
-    }
250
-
251
-
252
-
253
-    /**
254
-     * @deprecated
255
-     * @return string
256
-     */
257
-    public static function no_tkt_slctr_end_dv()
258
-    {
259
-        // todo add doing_it_wrong() notice during next major version
260
-        return EED_Ticket_Selector::ticketSelector()->noTicketSelectorEndDiv();
261
-    }
262
-
263
-
264
-
265
-    /**
266
-     * @deprecated
267
-     */
268
-    public static function load_tckt_slctr_assets_admin()
269
-    {
270
-        // todo add doing_it_wrong() notice during next major version
271
-        \EventEspresso\core\libraries\iframe_display\Iframe::EventsAdminEmbedButtonAssets();
272
-    }
181
+	/**
182
+	 * @deprecated
183
+	 * @return string
184
+	 */
185
+	public static function display_view_details_btn()
186
+	{
187
+		// todo add doing_it_wrong() notice during next major version
188
+		return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton();
189
+	}
190
+
191
+
192
+
193
+	/**
194
+	 * @deprecated
195
+	 * @return string
196
+	 */
197
+	public static function display_ticket_selector_submit()
198
+	{
199
+		// todo add doing_it_wrong() notice during next major version
200
+		return EED_Ticket_Selector::ticketSelector()->displaySubmitButton();
201
+	}
202
+
203
+
204
+
205
+	/**
206
+	 * @deprecated
207
+	 * @param string $permalink_string
208
+	 * @param int    $id
209
+	 * @param string $new_title
210
+	 * @param string $new_slug
211
+	 * @return string
212
+	 */
213
+	public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '')
214
+	{
215
+		// todo add doing_it_wrong() notice during next major version
216
+		return \EventEspresso\core\libraries\iframe_display\Iframe::eventListIframeEmbedButton(
217
+			$permalink_string,
218
+			$id,
219
+			$new_title,
220
+			$new_slug,
221
+			'ticket_selector'
222
+		);
223
+	}
224
+
225
+
226
+
227
+	/**
228
+	 * @deprecated
229
+	 * @param int    $ID
230
+	 * @param string $external_url
231
+	 * @return string
232
+	 */
233
+	public static function ticket_selector_form_open($ID = 0, $external_url = '')
234
+	{
235
+		// todo add doing_it_wrong() notice during next major version
236
+		return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url);
237
+	}
238
+
239
+
240
+
241
+	/**
242
+	 * @deprecated
243
+	 * @return string
244
+	 */
245
+	public static function ticket_selector_form_close()
246
+	{
247
+		// todo add doing_it_wrong() notice during next major version
248
+		return EED_Ticket_Selector::ticketSelector()->formClose();
249
+	}
250
+
251
+
252
+
253
+	/**
254
+	 * @deprecated
255
+	 * @return string
256
+	 */
257
+	public static function no_tkt_slctr_end_dv()
258
+	{
259
+		// todo add doing_it_wrong() notice during next major version
260
+		return EED_Ticket_Selector::ticketSelector()->noTicketSelectorEndDiv();
261
+	}
262
+
263
+
264
+
265
+	/**
266
+	 * @deprecated
267
+	 */
268
+	public static function load_tckt_slctr_assets_admin()
269
+	{
270
+		// todo add doing_it_wrong() notice during next major version
271
+		\EventEspresso\core\libraries\iframe_display\Iframe::EventsAdminEmbedButtonAssets();
272
+	}
273 273
 
274 274
 
275 275
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 	 * @return EED_Ticket_Selector
29 29
 	 */
30 30
 	public static function instance() {
31
-		return parent::get_instance( __CLASS__ );
31
+		return parent::get_instance(__CLASS__);
32 32
 	}
33 33
 
34 34
 
35 35
 
36
-	protected function set_config(){
37
-		$this->set_config_section( 'template_settings' );
38
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
39
-		$this->set_config_name( 'EED_Ticket_Selector' );
36
+	protected function set_config() {
37
+		$this->set_config_section('template_settings');
38
+		$this->set_config_class('EE_Ticket_Selector_Config');
39
+		$this->set_config_name('EED_Ticket_Selector');
40 40
 	}
41 41
 
42 42
 
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public static function set_hooks() {
51 51
 		// routing
52
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
53
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
54
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
55
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
56
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
52
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
53
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
54
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
55
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
56
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
57 57
 	}
58 58
 
59 59
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 *  @return 	void
66 66
 	 */
67 67
 	public static function set_hooks_admin() {
68
-		EventEspresso\core\libraries\iframe_display\Iframe::addEventEditorIframeEmbedButton( 'ticket_selector' );
68
+		EventEspresso\core\libraries\iframe_display\Iframe::addEventEditorIframeEmbedButton('ticket_selector');
69 69
 	}
70 70
 
71 71
 
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
 	 *  @return 	void
78 78
 	 */
79 79
 	public static function set_definitions() {
80
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
81
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
80
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
81
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
82 82
 
83 83
 		//if config is not set, initialize
84 84
 		//If config is not set, set it.
85
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
85
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
86 86
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
87 87
 		}
88 88
 	}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * 	@param	WP $WP
109 109
 	 * 	@return void
110 110
 	 */
111
-	public function run( $WP ) {}
111
+	public function run($WP) {}
112 112
 
113 113
 
114 114
 
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 	 * @param 	bool 	$view_details
135 135
 	 * @return 	string
136 136
 	 */
137
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
138
-		return EED_Ticket_Selector::ticketSelector()->display( $event, $view_details );
137
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
138
+		return EED_Ticket_Selector::ticketSelector()->display($event, $view_details);
139 139
 	}
140 140
 
141 141
 
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 	* 	@return 		void
163 163
 	*/
164 164
 	public static function load_tckt_slctr_assets() {
165
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
165
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
166 166
 			// add some style
167
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
167
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
168 168
 			wp_enqueue_style('ticket_selector');
169 169
 			// make it dance
170 170
 			// wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorIframe.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use EventEspresso\core\libraries\iframe_display\Iframe;
6 6
 
7 7
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
8
-    exit('No direct script access allowed');
8
+	exit('No direct script access allowed');
9 9
 }
10 10
 
11 11
 
@@ -24,66 +24,66 @@  discard block
 block discarded – undo
24 24
 
25 25
 
26 26
 
27
-    /**
28
-     * display
29
-     *
30
-     * @access    public
31
-     * @return    void
32
-     * @throws \EE_Error
33
-     */
34
-    public function display()
35
-    {
36
-        \EE_Registry::instance()->REQ->set_espresso_page(true);
37
-        /** @type \EEM_Event $EEM_Event */
38
-        $EEM_Event = \EE_Registry::instance()->load_model('Event');
39
-        $event = $EEM_Event->get_one_by_ID(
40
-            \EE_Registry::instance()->REQ->get('event', 0)
41
-        );
42
-        $ticket_selector = new DisplayTicketSelector();
43
-        $ticket_selector->setIframe(true);
44
-        /** @var Iframe $iframe */
45
-        $iframe = Factory::create(
46
-            'Iframe',
47
-            array(
48
-                'title'   => __('Ticket Selector', 'event_espresso'),
49
-                'content' => $ticket_selector->display($event),
50
-            )
51
-        );
52
-        $iframe->addStylesheets(
53
-            apply_filters(
54
-                'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
55
-                array(
56
-                    'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL
57
-                                               . 'ticket_selector_embed.css?ver='
58
-                                               . EVENT_ESPRESSO_VERSION,
59
-                    'ticket_selector'       => TICKET_SELECTOR_ASSETS_URL
60
-                                               . 'ticket_selector.css?ver='
61
-                                               . EVENT_ESPRESSO_VERSION,
62
-                )
63
-            )
64
-        );
65
-        $iframe->addScripts(
66
-            apply_filters(
67
-                'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
68
-                array(
69
-                    'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL
70
-                                                      . 'ticket_selector_iframe_embed.js?ver='
71
-                                                      . EVENT_ESPRESSO_VERSION,
72
-                )
73
-            )
74
-        );
75
-        $iframe->addLocalizedVars(
76
-            array(
77
-                'ticket_selector_iframe' => true,
78
-                'EEDTicketSelectorMsg'   => __(
79
-                    'Please choose at least one ticket before continuing.',
80
-                    'event_espresso'
81
-                ),
82
-            )
83
-        );
84
-        $iframe->display();
85
-        exit;
86
-    }
27
+	/**
28
+	 * display
29
+	 *
30
+	 * @access    public
31
+	 * @return    void
32
+	 * @throws \EE_Error
33
+	 */
34
+	public function display()
35
+	{
36
+		\EE_Registry::instance()->REQ->set_espresso_page(true);
37
+		/** @type \EEM_Event $EEM_Event */
38
+		$EEM_Event = \EE_Registry::instance()->load_model('Event');
39
+		$event = $EEM_Event->get_one_by_ID(
40
+			\EE_Registry::instance()->REQ->get('event', 0)
41
+		);
42
+		$ticket_selector = new DisplayTicketSelector();
43
+		$ticket_selector->setIframe(true);
44
+		/** @var Iframe $iframe */
45
+		$iframe = Factory::create(
46
+			'Iframe',
47
+			array(
48
+				'title'   => __('Ticket Selector', 'event_espresso'),
49
+				'content' => $ticket_selector->display($event),
50
+			)
51
+		);
52
+		$iframe->addStylesheets(
53
+			apply_filters(
54
+				'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
55
+				array(
56
+					'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL
57
+											   . 'ticket_selector_embed.css?ver='
58
+											   . EVENT_ESPRESSO_VERSION,
59
+					'ticket_selector'       => TICKET_SELECTOR_ASSETS_URL
60
+											   . 'ticket_selector.css?ver='
61
+											   . EVENT_ESPRESSO_VERSION,
62
+				)
63
+			)
64
+		);
65
+		$iframe->addScripts(
66
+			apply_filters(
67
+				'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
68
+				array(
69
+					'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL
70
+													  . 'ticket_selector_iframe_embed.js?ver='
71
+													  . EVENT_ESPRESSO_VERSION,
72
+				)
73
+			)
74
+		);
75
+		$iframe->addLocalizedVars(
76
+			array(
77
+				'ticket_selector_iframe' => true,
78
+				'EEDTicketSelectorMsg'   => __(
79
+					'Please choose at least one ticket before continuing.',
80
+					'event_espresso'
81
+				),
82
+			)
83
+		);
84
+		$iframe->display();
85
+		exit;
86
+	}
87 87
 
88 88
 }
89 89
 // End of file TicketSelectorIframe.php
Please login to merge, or discard this patch.
modules/ticket_selector/templates/ticket_selector_chart.template.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -8,32 +8,32 @@  discard block
 block discarded – undo
8 8
 
9 9
 $row = 1;
10 10
 $max = 1;
11
-$ticket_count = count( $tickets );
11
+$ticket_count = count($tickets);
12 12
 
13
-if ( ! $ticket_count ) {
13
+if ( ! $ticket_count) {
14 14
 	return;
15 15
 }
16 16
 
17 17
 $required_ticket_sold_out = FALSE;
18
-$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config();
18
+$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config();
19 19
 ob_start();
20 20
 
21
-foreach ( $tickets as $TKT_ID => $ticket ) {
22
-	if ( $ticket instanceof EE_Ticket ) {
21
+foreach ($tickets as $TKT_ID => $ticket) {
22
+	if ($ticket instanceof EE_Ticket) {
23 23
 		//	d( $ticket );
24
-		$max =$ticket->max();
24
+		$max = $ticket->max();
25 25
 		$min = 0;
26 26
 		$remaining = $ticket->remaining();
27
-		if ( $ticket->is_on_sale() && $ticket->is_remaining() ) {
27
+		if ($ticket->is_on_sale() && $ticket->is_remaining()) {
28 28
 			// offer the number of $tickets_remaining or $max_atndz, whichever is smaller
29
-			$max = min( $remaining, $max_atndz );
29
+			$max = min($remaining, $max_atndz);
30 30
 			// but... we also want to restrict the number of tickets by the ticket max setting,
31 31
 			// however, the max still can't be higher than what was just set above
32
-			$max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max;
32
+			$max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max;
33 33
 			// and we also want to restrict the minimum number of tickets by the ticket min setting
34 34
 			$min = $ticket->min() > 0 ? $ticket->min() : 0;
35 35
 			// and if the ticket is required, then make sure that min qty is at least 1
36
-			$min = $ticket->required() ? max( $min, 1 ) : $min;
36
+			$min = $ticket->required() ? max($min, 1) : $min;
37 37
 		} else {
38 38
 			// set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
39 39
 			$required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out;
@@ -43,40 +43,40 @@  discard block
 block discarded – undo
43 43
 		$ticket_bundle = FALSE;
44 44
 		$ticket_min = $ticket->min();
45 45
 		// for ticket bundles, set min and max qty the same
46
-		if ( $ticket_min !== 0 && $ticket_min === $ticket->max() ) {
46
+		if ($ticket_min !== 0 && $ticket_min === $ticket->max()) {
47 47
 			$ticket_price *= $ticket_min;
48 48
 			$ticket_bundle = TRUE;
49 49
 		}
50
-		$ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket );
50
+		$ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket);
51 51
 		// if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well.
52 52
 		// tickets that go on sale at a later date than the required ticket  will NOT be affected
53 53
 		$tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status();
54 54
 		$tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status;
55 55
 		// check ticket status
56
-		switch ( $tkt_status ) {
56
+		switch ($tkt_status) {
57 57
 			// sold_out
58 58
 			case EE_Ticket::sold_out :
59
-				$ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>';
59
+				$ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>';
60 60
 				$status_class = 'ticket-sales-sold-out lt-grey-text';
61 61
 			break;
62 62
 			// expired
63 63
 			case EE_Ticket::expired :
64
-				$ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>';
64
+				$ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>';
65 65
 				$status_class = 'ticket-sales-expired lt-grey-text';
66 66
 			break;
67 67
 			// archived
68 68
 			case EE_Ticket::archived :
69
-				$ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>';
69
+				$ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>';
70 70
 				$status_class = 'archived-ticket hidden';
71 71
 			break;
72 72
 			// pending
73 73
 			case EE_Ticket::pending :
74
-				$ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>';
74
+				$ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>';
75 75
 				$status_class = 'ticket-pending';
76 76
 			break;
77 77
 			// onsale
78 78
 			case EE_Ticket::onsale :
79
-				$ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>';
79
+				$ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>';
80 80
 				$status_class = 'ticket-on-sale';
81 81
 			break;
82 82
 		}
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 			$ticket_status,
104 104
 			$status_class
105 105
 		);
106
-		if ( $new_row_content !== false ) {
106
+		if ($new_row_content !== false) {
107 107
 			echo $new_row_content;
108 108
 			continue;
109 109
 		}
110 110
 		?>
111
-				<tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>">
111
+				<tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>">
112 112
 		<?php
113 113
 		/**
114 114
 		 * Allow plugins to hook in and abort the generation and display of the contents of this
@@ -132,24 +132,24 @@  discard block
 block discarded – undo
132 132
 			$ticket_status,
133 133
 			$status_class
134 134
 		);
135
-		if ( $new_row_cells_content !== false ) {
135
+		if ($new_row_cells_content !== false) {
136 136
 			echo $new_row_cells_content;
137 137
 			echo '</tr>';
138 138
 			continue;
139 139
 		}
140 140
 		?>
141 141
 					<td class="tckt-slctr-tbl-td-name">
142
-						<b><?php echo $ticket->get_pretty('TKT_name');?></b>
143
-						<?php if ( $template_settings->show_ticket_details ) : ?>
144
-							<a id="display-tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>">
145
-								<?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), '&nbsp;' ); ?>
142
+						<b><?php echo $ticket->get_pretty('TKT_name'); ?></b>
143
+						<?php if ($template_settings->show_ticket_details) : ?>
144
+							<a id="display-tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>">
145
+								<?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), '&nbsp;'); ?>
146 146
 							</a>
147
-							<a id="hide-tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;">
148
-								<?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), '&nbsp;' ); ?>
147
+							<a id="hide-tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;">
148
+								<?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), '&nbsp;'); ?>
149 149
 							</a>
150 150
 						<?php endif; //end show details check ?>
151
-					<?php if ( $ticket->required() ) { ?>
152
-						<p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p>
151
+					<?php if ($ticket->required()) { ?>
152
+						<p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p>
153 153
 					<?php } ?>
154 154
 					<?php
155 155
 //	echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>';
@@ -163,63 +163,63 @@  discard block
 block discarded – undo
163 163
 //	echo '<br/><b> $ticket->required() : ' .  $ticket->uses() . '</b>';
164 164
 					?>
165 165
 					</td>
166
-					<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
167
-					<td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency( $ticket_price ); ?>&nbsp;<span class="smaller-text no-bold"><?php
168
-						if ( $ticket_bundle ) {
169
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' ));
166
+					<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
167
+					<td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency($ticket_price); ?>&nbsp;<span class="smaller-text no-bold"><?php
168
+						if ($ticket_bundle) {
169
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso'));
170 170
 						} else {
171
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' ));
171
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso'));
172 172
 						}?></span>&nbsp;</td>
173 173
 					<?php } ?>
174 174
 					<td class="tckt-slctr-tbl-td-qty cntr">
175 175
 					<?php
176 176
 					$hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE;
177 177
 					// sold out or other status ?
178
-					if ( $tkt_status === EE_Ticket::sold_out || $remaining === 0 ) {
178
+					if ($tkt_status === EE_Ticket::sold_out || $remaining === 0) {
179 179
 					?>
180
-						<span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold&nbsp;Out', 'event_espresso' ));?></span>
180
+						<span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold&nbsp;Out', 'event_espresso')); ?></span>
181 181
 					<?php
182
-					} else if ( $tkt_status === EE_Ticket::expired || $tkt_status === EE_Ticket::archived ) {
182
+					} else if ($tkt_status === EE_Ticket::expired || $tkt_status === EE_Ticket::archived) {
183 183
 						echo $ticket_status;
184
-					} else if ( $tkt_status === EE_Ticket::pending ) {
184
+					} else if ($tkt_status === EE_Ticket::pending) {
185 185
 					?>
186 186
 					<div class="ticket-pending-pg">
187
-						<span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes&nbsp;On&nbsp;Sale', 'event_espresso' )); ?></span><br/>
188
-						<span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span>
187
+						<span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes&nbsp;On&nbsp;Sale', 'event_espresso')); ?></span><br/>
188
+						<span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span>
189 189
 					</div>
190 190
 					<?php
191 191
 					// min qty purchasable is less than tickets available
192
-					} else if ( $ticket->min() > $remaining ) {
192
+					} else if ($ticket->min() > $remaining) {
193 193
 					?>
194 194
 					<div class="archived-ticket-pg">
195
-						<span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/>
195
+						<span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/>
196 196
 					</div>
197 197
 					<?php
198 198
 					// if only one attendee is allowed to register at a time
199
-					} else if ( $max_atndz  === 1 ) {
199
+					} else if ($max_atndz === 1) {
200 200
 						// display submit button since we have tickets available
201
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
201
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
202 202
 				?>
203
-					<input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row === 1 ? ' checked="checked"' : ''; ?>  title=""/>
203
+					<input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row === 1 ? ' checked="checked"' : ''; ?>  title=""/>
204 204
 			<?php
205 205
 						$hidden_input_qty = FALSE;
206 206
 
207
-					} else if ( $max_atndz  === 0 ) {
208
-						echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>';
209
-					} elseif ( $max > 0 ) {
207
+					} else if ($max_atndz === 0) {
208
+						echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>';
209
+					} elseif ($max > 0) {
210 210
 						// display submit button since we have tickets available
211
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
211
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
212 212
 
213 213
 				?>
214
-					<select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title="">
214
+					<select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title="">
215 215
 					<?php
216 216
 						// this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
217
-						if ( $min !== 0 && ! $ticket->required() ) {
217
+						if ($min !== 0 && ! $ticket->required()) {
218 218
 					?>
219 219
 						<option value="0">&nbsp;0&nbsp;</option>
220 220
 					<?php }
221 221
 						// offer ticket quantities from the min to the max
222
-						for ( $i = $min; $i <= $max; $i++) {
222
+						for ($i = $min; $i <= $max; $i++) {
223 223
 					?>
224 224
 						<option value="<?php echo $i; ?>">&nbsp;<?php echo $i; ?>&nbsp;</option>
225 225
 					<?php } ?>
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
 					}
231 231
 					// depending on group reg we need to change the format for qty
232
-					if ( $hidden_input_qty ) {
232
+					if ($hidden_input_qty) {
233 233
 					?>
234 234
 					<input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" />
235 235
 					<?php
@@ -239,33 +239,33 @@  discard block
 block discarded – undo
239 239
 
240 240
 					</td>
241 241
 				</tr>
242
-				<?php if ( $template_settings->show_ticket_details ) : ?>
243
-					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>">
242
+				<?php if ($template_settings->show_ticket_details) : ?>
243
+					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>">
244 244
 						<td class="tckt-slctr-tkt-details-td" colspan="3" >
245
-							<div id="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;">
245
+							<div id="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;">
246 246
 
247 247
 								<section class="tckt-slctr-tkt-details-sctn">
248
-									<h3><?php _e( 'Details', 'event_espresso' ); ?></h3>
248
+									<h3><?php _e('Details', 'event_espresso'); ?></h3>
249 249
 									<p><?php echo $ticket->description(); ?></p>
250 250
 
251
-									<?php if ( $ticket_price !== 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
251
+									<?php if ($ticket_price !== 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
252 252
 									<section class="tckt-slctr-tkt-price-sctn">
253
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5>
253
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5>
254 254
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
255 255
 											<table class="tckt-slctr-tkt-details-tbl">
256 256
 												<thead>
257 257
 													<tr>
258
-														<th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th>
259
-														<th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th>
260
-														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th>
258
+														<th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th>
259
+														<th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th>
260
+														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th>
261 261
 													</tr>
262 262
 												</thead>
263 263
 												<tbody>
264
-										<?php if ( $ticket->base_price() instanceof EE_Price ) { ?>
264
+										<?php if ($ticket->base_price() instanceof EE_Price) { ?>
265 265
 													<tr>
266
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
267
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
268
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
266
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
267
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
268
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
269 269
 													</tr>
270 270
 													<?php
271 271
 															$running_total = $ticket->base_price()->amount();
@@ -273,44 +273,44 @@  discard block
 block discarded – undo
273 273
 															$running_total = 0;
274 274
 														}
275 275
 														// now add price modifiers
276
-														foreach ( $ticket->price_modifiers() as $price_mod ) { ?>
276
+														foreach ($ticket->price_modifiers() as $price_mod) { ?>
277 277
 													<tr>
278
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
279
-													<?php if ( $price_mod->is_percent() ) { ?>
280
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
278
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
279
+													<?php if ($price_mod->is_percent()) { ?>
280
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
281 281
 														<?php
282
-															$new_sub_total = $running_total * ( $price_mod->amount() / 100 );
282
+															$new_sub_total = $running_total * ($price_mod->amount() / 100);
283 283
 															$new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total;
284 284
 														?>
285 285
 													<?php } else { ?>
286 286
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
287
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
287
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
288 288
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
289 289
 													<?php } ?>
290
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td>
290
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td>
291 291
 														<?php $running_total += $new_sub_total; ?>
292 292
 													</tr>
293 293
 												<?php } ?>
294
-												<?php if ( $ticket->taxable() ) { ?>
294
+												<?php if ($ticket->taxable()) { ?>
295 295
 													<?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?>
296 296
 													<tr>
297
-														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td>
298
-														<td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency( $running_total ); ?></b></td>
297
+														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td>
298
+														<td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency($running_total); ?></b></td>
299 299
 													</tr>
300 300
 
301
-													<?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?>
301
+													<?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?>
302 302
 													<tr>
303
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
304
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
305
-														<?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?>
306
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td>
303
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
304
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
305
+														<?php $tax_amount = $running_total * ($tax->amount() / 100); ?>
306
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td>
307 307
 														<?php $running_total += $tax_amount; ?>
308 308
 													</tr>
309 309
 													<?php } ?>
310 310
 												<?php } ?>
311 311
 													<tr>
312
-														<td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td>
313
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td>
312
+														<td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td>
313
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td>
314 314
 													</tr>
315 315
 												</tbody>
316 316
 											</table>
@@ -320,106 +320,106 @@  discard block
 block discarded – undo
320 320
 									<?php } ?>
321 321
 
322 322
 									<section class="tckt-slctr-tkt-sale-dates-sctn">
323
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5>
324
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/>
325
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date',  $time_format ) ; ?><br/>
326
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/>
323
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5>
324
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/>
325
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/>
326
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/>
327 327
 									</section>
328 328
 									<br/>
329 329
 
330
-									<?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?>
330
+									<?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?>
331 331
 
332
-									<?php if ( $ticket->min() &&$ticket->max() ) { ?>
332
+									<?php if ($ticket->min() && $ticket->max()) { ?>
333 333
 									<section class="tckt-slctr-tkt-quantities-sctn">
334
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5>
335
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/>
336
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
337
-										<?php if ( $ticket->min() > $remaining ) { ?> &nbsp; <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/>
334
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5>
335
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/>
336
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
337
+										<?php if ($ticket->min() > $remaining) { ?> &nbsp; <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/>
338 338
 										<?php //$max = min( $max, $max_atndz );?>
339
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/>
339
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/>
340 340
 									</section>
341 341
 									<br/>
342 342
 									<?php } ?>
343 343
 
344
-									<?php if ( ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && $ticket->uses() !== EE_INF) { ?>
344
+									<?php if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && $ticket->uses() !== EE_INF) { ?>
345 345
 									<section class="tckt-slctr-tkt-uses-sctn">
346
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5>
346
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5>
347 347
 										<span class="drk-grey-text small-text no-bold"> - <?php
348 348
 											echo apply_filters(
349 349
 												'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message',
350 350
 												sprintf(
351
-													__( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ),
351
+													__('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'),
352 352
 													'<br/>',
353 353
 													'<strong>',
354 354
 													'</strong>'
355 355
 												)
356 356
 											);
357 357
 											?></span><br/>
358
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php  echo $ticket->uses();?><br/>
358
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php  echo $ticket->uses(); ?><br/>
359 359
 									</section>
360 360
 									<?php } ?>
361 361
 
362 362
 									<?php
363
-									$datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE );
363
+									$datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE);
364 364
 									$chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width';
365
-									if ( ! empty( $datetimes )) { ?>
365
+									if ( ! empty($datetimes)) { ?>
366 366
 									<section class="tckt-slctr-tkt-datetimes-sctn">
367
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5>
368
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span>
367
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5>
368
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span>
369 369
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
370 370
 											<table class="tckt-slctr-tkt-details-tbl">
371 371
 												<thead>
372 372
 													<tr>
373 373
 														<th class="tckt-slctr-tkt-details-date-th">
374
-															<span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span>
374
+															<span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span>
375 375
 														</th>
376 376
 														<th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>">
377
-															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span>
377
+															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span>
378 378
 														</th>
379
-														<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
379
+														<?php if ($template_settings->show_ticket_sale_columns) : ?>
380 380
 															<th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr">
381
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span>
381
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span>
382 382
 															</th>
383 383
 															<th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr">
384
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span>
384
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span>
385 385
 															</th>
386 386
 															<th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr">
387
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span>
387
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span>
388 388
 															</th>
389 389
 															<th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr">
390
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span>
390
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span>
391 391
 															</th>
392 392
 														<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
393 393
 													</tr>
394 394
 												</thead>
395 395
 												<tbody>
396 396
 											<?php
397
-												foreach ( $datetimes as $datetime ) {
398
-													if ( $datetime instanceof EE_Datetime ) {
397
+												foreach ($datetimes as $datetime) {
398
+													if ($datetime instanceof EE_Datetime) {
399 399
 											?>
400 400
 
401 401
 												<tr>
402
-													<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text">
402
+													<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text">
403 403
 														<?php $datetime_name = $datetime->name(); ?>
404
-														<?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?>
405
-														<?php echo $datetime->date_range( $date_format, __( ' to  ', 'event_espresso' )); ?>
404
+														<?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?>
405
+														<?php echo $datetime->date_range($date_format, __(' to  ', 'event_espresso')); ?>
406 406
 													</td>
407
-													<td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text">
408
-														<?php echo $datetime->time_range( $time_format, __( ' to  ', 'event_espresso' )); ?>
407
+													<td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text">
408
+														<?php echo $datetime->time_range($time_format, __(' to  ', 'event_espresso')); ?>
409 409
 													</td>
410
-													<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
411
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text">
410
+													<?php if ($template_settings->show_ticket_sale_columns) : ?>
411
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text">
412 412
 															<?php echo $ticket->sold(); ?>
413 413
 														</td>
414
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text">
415
-															<?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?>
414
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text">
415
+															<?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?>
416 416
 														</td>
417
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text">
417
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text">
418 418
 															<?php echo $datetime->sold(); ?>
419 419
 														</td>
420
-												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold&nbsp;Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?>
421
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text">
422
-															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?>
420
+												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold&nbsp;Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?>
421
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text">
422
+															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?>
423 423
 														</td>
424 424
 													<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
425 425
 												</tr>
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 							</div>
438 438
 						</td>
439 439
 					</tr>
440
-				<?php endif;  //end template_settings->show_ticket_details check?>
440
+				<?php endif; //end template_settings->show_ticket_details check?>
441 441
 	<?php
442 442
 			$row++;
443 443
 		}
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 $ticket_row_html = ob_get_clean();
447 447
 // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector
448 448
 $hide_ticket_selector = $ticket_count === 1 && $max === 1 && $ticket->is_free() ? true : false;
449
-$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID );
449
+$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID);
450 450
 //EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ );
451 451
 //EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ );
452 452
 //EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ );
@@ -459,19 +459,19 @@  discard block
 block discarded – undo
459 459
 	'FHEE__EE_Ticket_Selector__after_view_details_btn',
460 460
 	array('\EventEspresso\modules\ticket_selector\DisplayTicketSelector', 'noTicketSelectorEndDiv')
461 461
 );
462
-if ( ! $hide_ticket_selector ) {
462
+if ( ! $hide_ticket_selector) {
463 463
 ?>
464 464
 <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv">
465 465
 
466
-	<?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?>
466
+	<?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?>
467 467
 
468 468
 	<table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl">
469 469
 		<thead>
470 470
 			<tr>
471 471
 				<th scope="col" class="ee-ticket-selector-ticket-details-th">
472
-					<?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?>
472
+					<?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?>
473 473
 				</th>
474
-				<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
474
+				<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
475 475
 				<th scope="col" class="ee-ticket-selector-ticket-price-th cntr">
476 476
 					<?php
477 477
 						/**
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 						 * @param string 'Price' The translatable text to display in the table header for price
483 483
 						 * @param int $EVT_ID The Event ID
484 484
 						 */
485
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) );
485
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID));
486 486
 					?>
487 487
 				</th>
488 488
 				<?php } ?>
@@ -496,24 +496,24 @@  discard block
 block discarded – undo
496 496
 						* @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets
497 497
 						* @param int $EVT_ID The Event ID
498 498
 						*/
499
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) );
499
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID));
500 500
 					?>
501 501
 				</th>
502 502
 			</tr>
503 503
 		</thead>
504 504
 		<tbody>
505
-			<?php echo $ticket_row_html;?>
505
+			<?php echo $ticket_row_html; ?>
506 506
 		</tbody>
507 507
 	</table>
508 508
 
509 509
 	<input type="hidden" name="noheader" value="true" />
510
-	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url();?>" />
510
+	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url(); ?>" />
511 511
 	<input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" />
512 512
 	<input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" />
513 513
 	<input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" />
514 514
 
515 515
 <?php
516
-if ( $max_atndz > 0 && ! $hide_ticket_selector ) {
516
+if ($max_atndz > 0 && ! $hide_ticket_selector) {
517 517
 	echo apply_filters(
518 518
 		'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote',
519 519
 		''
@@ -521,10 +521,10 @@  discard block
 block discarded – undo
521 521
 }
522 522
 ?>
523 523
 
524
-	<?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?>
524
+	<?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?>
525 525
 
526 526
 </div>
527
-<?php } else if ( isset( $TKT_ID ) ) { ?>
527
+<?php } else if (isset($TKT_ID)) { ?>
528 528
 <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/>
529 529
 <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/>
530 530
 <input type="hidden" name="noheader" value="true"/>
@@ -533,14 +533,14 @@  discard block
 block discarded – undo
533 533
 <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/>
534 534
 <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/>
535 535
 <?php
536
-	if ( $ticket instanceof EE_Ticket ) {
537
-		do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event );
536
+	if ($ticket instanceof EE_Ticket) {
537
+		do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event);
538 538
 		$ticket_description = $ticket->description();
539 539
 ?>
540 540
 <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv">
541 541
 	<div class="no-tkt-slctr-ticket-content-dv">
542 542
 		<h5><?php echo $ticket->name(); ?></h5>
543
-		<?php if ( ! empty( $ticket_description ) ) { ?>
543
+		<?php if ( ! empty($ticket_description)) { ?>
544 544
 		<p><?php echo $ticket_description; ?></p>
545 545
 		<?php } ?>
546 546
 	</div>
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 			'FHEE__EE_Ticket_Selector__after_view_details_btn',
554 554
 			array('\EventEspresso\modules\ticket_selector\DisplayTicketSelector', 'noTicketSelectorEndDiv')
555 555
 		);
556
-		do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event );
556
+		do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event);
557 557
 	}
558 558
 }
559 559
 ?>
Please login to merge, or discard this patch.