Completed
Branch BUG-9852-verfiy-ticket-submiss... (fc97be)
by
unknown
57:50 queued 47:53
created
modules/ticket_selector/EED_Ticket_Selector.module.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 	/**
632 632
 	 *    process_ticket_selections
633 633
 	 *
634
-	 * @return false or redirect
634
+	 * @return boolean|null or redirect
635 635
 	 */
636 636
 	public function process_ticket_selections() {
637 637
 		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 	 *    validate_post_data
804 804
 	 *
805 805
 	 * @param int $EVT_ID
806
-	 * @return array or FALSE
806
+	 * @return string or FALSE
807 807
 	 */
808 808
 	private static function _validate_post_data( $EVT_ID ) {
809 809
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
 	 * @access   private
913 913
 	 * @param EE_Ticket $ticket
914 914
 	 * @param int       $qty
915
-	 * @return TRUE on success, FALSE on fail
915
+	 * @return boolean on success, FALSE on fail
916 916
 	 */
917 917
 	private static function _add_ticket_to_cart( EE_Ticket $ticket = null, $qty = 1 ) {
918 918
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 				return $permalink_string;
207 207
 			}
208 208
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
209
-			                     . __( 'Embed', 'event_espresso' )
210
-			                     . '</a> ';
209
+								 . __( 'Embed', 'event_espresso' )
210
+								 . '</a> ';
211 211
 			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
212 212
 			$iframe_string = esc_html(
213 213
 				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 				return $html;
466 466
 			} else if ( is_archive() ) {
467 467
 				return EED_Ticket_Selector::ticket_selector_form_close()
468
-				       . EED_Ticket_Selector::display_view_details_btn();
468
+					   . EED_Ticket_Selector::display_view_details_btn();
469 469
 			}
470 470
 		}
471 471
 		return '';
@@ -509,10 +509,10 @@  discard block
 block discarded – undo
509 509
 			self::$_event
510 510
 		);
511 511
 		$view_details_btn .= '<input id="ticket-selector-submit-'
512
-		                     . self::$_event->ID()
513
-		                     . '-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'
514
-		                     . $btn_text
515
-		                     . '" />';
512
+							 . self::$_event->ID()
513
+							 . '-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'
514
+							 . $btn_text
515
+							 . '" />';
516 516
 		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
517 517
 		$view_details_btn .= '<div class="clear"><br/></div>';
518 518
 		$view_details_btn .= '</form>';
@@ -809,8 +809,8 @@  discard block
 block discarded – undo
809 809
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
810 810
 		// get event via the event id we put in the form
811 811
 		$event = EE_Registry::instance()
812
-		                    ->load_model( 'Event' )
813
-		                    ->get_one_by_ID( $EVT_ID );
812
+							->load_model( 'Event' )
813
+							->get_one_by_ID( $EVT_ID );
814 814
 		if ( ! $event instanceof EE_Event ) {
815 815
 			EE_Error::add_error(
816 816
 				__( 'The submitted Event ID was either invalid or the Event could not be found.', 'event_espresso' ),
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 	public static function load_tckt_slctr_assets_admin() {
1112 1112
 		//iframe button js on admin event editor page
1113 1113
 		if ( EE_Registry::instance()->REQ->get( 'page' ) == 'espresso_events'
1114
-		     && EE_Registry::instance()->REQ->get( 'action' ) == 'edit'
1114
+			 && EE_Registry::instance()->REQ->get( 'action' ) == 'edit'
1115 1115
 		) {
1116 1116
 			wp_register_script(
1117 1117
 				'ticket_selector_embed',
Please login to merge, or discard this patch.
Spacing   +224 added lines, -224 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
 /**
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
 	 * @return EED_Ticket_Selector
47 47
 	 */
48 48
 	public static function instance() {
49
-		return parent::get_instance( __CLASS__ );
49
+		return parent::get_instance(__CLASS__);
50 50
 	}
51 51
 
52 52
 
53 53
 
54 54
 	protected function set_config() {
55
-		$this->set_config_section( 'template_settings' );
56
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
57
-		$this->set_config_name( 'EED_Ticket_Selector' );
55
+		$this->set_config_section('template_settings');
56
+		$this->set_config_class('EE_Ticket_Selector_Config');
57
+		$this->set_config_name('EED_Ticket_Selector');
58 58
 	}
59 59
 
60 60
 
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public static function set_hooks() {
69 69
 		// routing
70
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
71
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
72
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
70
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
71
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
72
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
73 73
 		add_action(
74 74
 			'AHEE_event_details_header_bottom',
75
-			array( 'EED_Ticket_Selector', 'display_ticket_selector' ),
75
+			array('EED_Ticket_Selector', 'display_ticket_selector'),
76 76
 			10,
77 77
 			1
78 78
 		);
79
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
79
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
80 80
 	}
81 81
 
82 82
 
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 	 * @return    void
89 89
 	 */
90 90
 	public static function set_hooks_admin() {
91
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
91
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
92 92
 		//add button for iframe code to event editor.
93
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
94
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
93
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
94
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
95 95
 	}
96 96
 
97 97
 
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 	 * @return    void
104 104
 	 */
105 105
 	public static function set_definitions() {
106
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
106
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
107 107
 		define(
108 108
 			'TICKET_SELECTOR_TEMPLATES_PATH',
109
-			str_replace( '\\', DS, plugin_dir_path( __FILE__ ) ) . 'templates' . DS
109
+			str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS
110 110
 		);
111 111
 		//if config is not set, initialize
112 112
 		//If config is not set, set it.
113
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
113
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
114 114
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
115 115
 		}
116 116
 		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __(
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @param    object $WP
129 129
 	 * @return    void
130 130
 	 */
131
-	public function run( $WP ) {
131
+	public function run($WP) {
132 132
 	}
133 133
 
134 134
 
@@ -142,19 +142,19 @@  discard block
 block discarded – undo
142 142
 	public function ticket_selector_iframe() {
143 143
 		self::$_in_iframe = true;
144 144
 		/** @type EEM_Event $EEM_Event */
145
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
145
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
146 146
 		$event = $EEM_Event->get_one_by_ID(
147
-			EE_Registry::instance()->REQ->get( 'event', 0 )
147
+			EE_Registry::instance()->REQ->get('event', 0)
148 148
 		);
149
-		EE_Registry::instance()->REQ->set_espresso_page( true );
150
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
149
+		EE_Registry::instance()->REQ->set_espresso_page(true);
150
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
151 151
 		$template_args['css'] = apply_filters(
152 152
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
153 153
 			array(
154
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
155
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
156
-				includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
157
-				EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
154
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
155
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
156
+				includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
157
+				EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION,
158 158
 			)
159 159
 		);
160 160
 		EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true;
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
 		$template_args['js'] = apply_filters(
170 170
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
171 171
 			array(
172
-				includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
173
-				EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
174
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION,
172
+				includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
173
+				EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
174
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION,
175 175
 			)
176 176
 		);
177 177
 		$template_args['notices'] = EEH_Template::display_template(
178
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
178
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
179 179
 			array(),
180 180
 			true
181 181
 		);
182 182
 		EEH_Template::display_template(
183
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
183
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
184 184
 			$template_args
185 185
 		);
186 186
 		exit;
@@ -197,25 +197,25 @@  discard block
 block discarded – undo
197 197
 	 * @param string $new_slug         The slug for the event.
198 198
 	 * @return string The new html string for the permalink area.
199 199
 	 */
200
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
200
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
201 201
 		//make sure this is ONLY when editing and the event id has been set.
202
-		if ( ! empty( $id ) ) {
203
-			$post = get_post( $id );
202
+		if ( ! empty($id)) {
203
+			$post = get_post($id);
204 204
 			//if NOT event then let's get out.
205
-			if ( $post->post_type !== 'espresso_events' ) {
205
+			if ($post->post_type !== 'espresso_events') {
206 206
 				return $permalink_string;
207 207
 			}
208 208
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
209
-			                     . __( 'Embed', 'event_espresso' )
209
+			                     . __('Embed', 'event_espresso')
210 210
 			                     . '</a> ';
211
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
211
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
212 212
 			$iframe_string = esc_html(
213
-				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
213
+				'<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>'
214 214
 			);
215 215
 			$permalink_string .= '
216 216
 <div id="js-ts-iframe" style="display:none">
217 217
 	<div style="width:100%; height: 500px;">
218
-		' . $iframe_string . '
218
+		' . $iframe_string.'
219 219
 	</div>
220 220
 </div>';
221 221
 		}
@@ -231,25 +231,25 @@  discard block
 block discarded – undo
231 231
 	 * @param    mixed $event
232 232
 	 * @return    bool
233 233
 	 */
234
-	protected static function set_event( $event = null ) {
235
-		if ( $event === null ) {
234
+	protected static function set_event($event = null) {
235
+		if ($event === null) {
236 236
 			global $post;
237 237
 			$event = $post;
238 238
 		}
239
-		if ( $event instanceof EE_Event ) {
239
+		if ($event instanceof EE_Event) {
240 240
 			self::$_event = $event;
241
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
241
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
242 242
 			self::$_event = $event->EE_Event;
243
-		} else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) {
244
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
243
+		} else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') {
244
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
245 245
 			self::$_event = $event->EE_Event;
246 246
 		} else {
247
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
248
-			$dev_msg = $user_msg . __(
247
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
248
+			$dev_msg = $user_msg.__(
249 249
 					'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.',
250 250
 					'event_espresso'
251 251
 				);
252
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
252
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
253 253
 			return false;
254 254
 		}
255 255
 		return true;
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 	 * @param    bool   $view_details
266 266
 	 * @return    string
267 267
 	 */
268
-	public static function display_ticket_selector( $event = null, $view_details = false ) {
268
+	public static function display_ticket_selector($event = null, $view_details = false) {
269 269
 		// reset filter for displaying submit button
270
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
270
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
271 271
 		// poke and prod incoming event till it tells us what it is
272
-		if ( ! EED_Ticket_Selector::set_event( $event ) ) {
272
+		if ( ! EED_Ticket_Selector::set_event($event)) {
273 273
 			return false;
274 274
 		}
275 275
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 			&& (
281 281
 				! self::$_event->display_ticket_selector()
282 282
 				|| $view_details
283
-				|| post_password_required( $event_post )
283
+				|| post_password_required($event_post)
284 284
 				|| (
285 285
 					$_event_active_status != EE_Datetime::active
286 286
 					&& $_event_active_status != EE_Datetime::upcoming
@@ -298,24 +298,24 @@  discard block
 block discarded – undo
298 298
 		$template_args['event_status'] = $_event_active_status;
299 299
 		$template_args['date_format'] = apply_filters(
300 300
 			'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format',
301
-			get_option( 'date_format' )
301
+			get_option('date_format')
302 302
 		);
303 303
 		$template_args['time_format'] = apply_filters(
304 304
 			'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format',
305
-			get_option( 'time_format' )
305
+			get_option('time_format')
306 306
 		);
307 307
 		$template_args['EVT_ID'] = self::$_event->ID();
308 308
 		$template_args['event'] = self::$_event;
309 309
 		// is the event expired ?
310 310
 		$template_args['event_is_expired'] = self::$_event->is_expired();
311
-		if ( $template_args['event_is_expired'] ) {
312
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __(
311
+		if ($template_args['event_is_expired']) {
312
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__(
313 313
 				'We\'re sorry, but all tickets sales have ended because the event is expired.',
314 314
 				'event_espresso'
315
-			) . '</span></div>';
315
+			).'</span></div>';
316 316
 		}
317 317
 		$ticket_query_args = array(
318
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
318
+			array('Datetime.EVT_ID' => self::$_event->ID()),
319 319
 			'order_by' => array(
320 320
 				'TKT_order'              => 'ASC',
321 321
 				'TKT_required'           => 'DESC',
@@ -324,32 +324,32 @@  discard block
 block discarded – undo
324 324
 				'Datetime.DTT_EVT_start' => 'DESC',
325 325
 			),
326 326
 		);
327
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
327
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
328 328
 			//use the correct applicable time query depending on what version of core is being run.
329
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' )
329
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query')
330 330
 				? time()
331 331
 				: current_time('timestamp');
332
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
332
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
333 333
 		}
334 334
 		// get all tickets for this event ordered by the datetime
335
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
336
-		if ( count( $template_args['tickets'] ) < 1 ) {
337
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __(
335
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
336
+		if (count($template_args['tickets']) < 1) {
337
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__(
338 338
 				'We\'re sorry, but all ticket sales have ended.',
339 339
 				'event_espresso'
340
-			) . '</span></div>';
340
+			).'</span></div>';
341 341
 		}
342 342
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
343 343
 		$template_args['max_atndz'] = apply_filters(
344 344
 			'FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets',
345 345
 			self::$_event->additional_limit()
346 346
 		);
347
-		if ( $template_args['max_atndz'] < 1 ) {
347
+		if ($template_args['max_atndz'] < 1) {
348 348
 			$sales_closed_msg = __(
349 349
 				'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.',
350 350
 				'event_espresso'
351 351
 			);
352
-			if ( current_user_can( 'edit_post', self::$_event->ID() ) ) {
352
+			if (current_user_can('edit_post', self::$_event->ID())) {
353 353
 				$sales_closed_msg .= sprintf(
354 354
 					__(
355 355
 						'%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',
@@ -357,15 +357,15 @@  discard block
 block discarded – undo
357 357
 					),
358 358
 					'<div class="ee-attention" style="text-align: left;"><b>',
359 359
 					'</b><br />',
360
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link(
360
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(
361 361
 							self::$_event->ID()
362
-						) . '">',
362
+						).'">',
363 363
 					'</a></span></div>'
364 364
 				);
365 365
 			}
366
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
366
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
367 367
 		}
368
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
368
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
369 369
 		$templates['ticket_selector'] = apply_filters(
370 370
 			'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path',
371 371
 			$templates['ticket_selector'],
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
 			$external_url
381 381
 		) : '';
382 382
 		// if not redirecting to another site for registration
383
-		if ( ! $external_url ) {
383
+		if ( ! $external_url) {
384 384
 			// then display the ticket selector
385
-			$ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
385
+			$ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args);
386 386
 		} else {
387 387
 			// if not we still need to trigger the display of the submit button
388
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
388
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
389 389
 			//display notice to admin that registration is external
390 390
 			$ticket_selector .= ! is_admin()
391 391
 				? ''
@@ -411,30 +411,30 @@  discard block
 block discarded – undo
411 411
 	 * @param        string $external_url
412 412
 	 * @return        string
413 413
 	 */
414
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
414
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
415 415
 		// if redirecting, we don't need any anything else
416
-		if ( $external_url ) {
417
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
418
-			$query_args = EEH_URL::get_query_string( $external_url );
419
-			foreach ( $query_args as $query_arg => $value ) {
420
-				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
416
+		if ($external_url) {
417
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
418
+			$query_args = EEH_URL::get_query_string($external_url);
419
+			foreach ($query_args as $query_arg => $value) {
420
+				$html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
421 421
 			}
422 422
 			return $html;
423 423
 		}
424
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
425
-		if ( ! $checkout_url ) {
424
+		$checkout_url = EEH_Event_View::event_link_url($ID);
425
+		if ( ! $checkout_url) {
426 426
 			EE_Error::add_error(
427
-				__( 'The URL for the Event Details page could not be retrieved.', 'event_espresso' ),
427
+				__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
428 428
 				__FILE__,
429 429
 				__FUNCTION__,
430 430
 				__LINE__
431 431
 			);
432 432
 		}
433 433
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
434
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
435
-		$html .= wp_nonce_field( 'process_ticket_selections-' . $ID, 'process_ticket_selections_nonce', true, false );
434
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
435
+		$html .= wp_nonce_field('process_ticket_selections-'.$ID, 'process_ticket_selections_nonce', true, false);
436 436
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
437
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
437
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
438 438
 		return $html;
439 439
 	}
440 440
 
@@ -448,22 +448,22 @@  discard block
 block discarded – undo
448 448
 	 * @return        string
449 449
 	 */
450 450
 	public static function display_ticket_selector_submit() {
451
-		if ( ! is_admin() ) {
452
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) {
451
+		if ( ! is_admin()) {
452
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
453 453
 				$btn_text = apply_filters(
454 454
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
455
-					__( 'Register Now', 'event_espresso' ),
455
+					__('Register Now', 'event_espresso'),
456 456
 					self::$_event
457 457
 				);
458 458
 				$external_url = self::$_event->external_url();
459
-				$html = '<input id="ticket-selector-submit-' . self::$_event->ID() . '-btn"';
459
+				$html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"';
460 460
 				$html .= ' class="ticket-selector-submit-btn ';
461
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
462
-				$html .= ' type="submit" value="' . $btn_text . '" />';
463
-				$html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event );
461
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
462
+				$html .= ' type="submit" value="'.$btn_text.'" />';
463
+				$html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event);
464 464
 				$html .= '<div class="clear"><br/></div></form>';
465 465
 				return $html;
466
-			} else if ( is_archive() ) {
466
+			} else if (is_archive()) {
467 467
 				return EED_Ticket_Selector::ticket_selector_form_close()
468 468
 				       . EED_Ticket_Selector::display_view_details_btn();
469 469
 			}
@@ -494,18 +494,18 @@  discard block
 block discarded – undo
494 494
 	 * @return        string
495 495
 	 */
496 496
 	public static function display_view_details_btn() {
497
-		if ( ! self::$_event->get_permalink() ) {
497
+		if ( ! self::$_event->get_permalink()) {
498 498
 			EE_Error::add_error(
499
-				__( 'The URL for the Event Details page could not be retrieved.', 'event_espresso' ),
499
+				__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
500 500
 				__FILE__,
501 501
 				__FUNCTION__,
502 502
 				__LINE__
503 503
 			);
504 504
 		}
505
-		$view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">';
505
+		$view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">';
506 506
 		$btn_text = apply_filters(
507 507
 			'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
508
-			__( 'View Details', 'event_espresso' ),
508
+			__('View Details', 'event_espresso'),
509 509
 			self::$_event
510 510
 		);
511 511
 		$view_details_btn .= '<input id="ticket-selector-submit-'
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 		                     . '-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'
514 514
 		                     . $btn_text
515 515
 		                     . '" />';
516
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
516
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
517 517
 		$view_details_btn .= '<div class="clear"><br/></div>';
518 518
 		$view_details_btn .= '</form>';
519 519
 		return $view_details_btn;
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 	 * @return int
528 528
 	 */
529 529
 	private function _get_event_id_and_process_nonce() {
530
-		$EVT_ID = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ) );
531
-		if ( ! $EVT_ID ) {
530
+		$EVT_ID = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
531
+		if ( ! $EVT_ID) {
532 532
 			EE_Error::add_error(
533 533
 				sprintf(
534 534
 					__(
@@ -547,8 +547,8 @@  discard block
 block discarded – undo
547 547
 		if (
548 548
 			! is_admin()
549 549
 			&& ! wp_verify_nonce(
550
-				EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce', '' ),
551
-				'process_ticket_selections-' . $EVT_ID
550
+				EE_Registry::instance()->REQ->get('process_ticket_selections_nonce', ''),
551
+				'process_ticket_selections-'.$EVT_ID
552 552
 			)
553 553
 		) {
554 554
 			EE_Error::add_error(
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 	 * @param EE_Event $event
577 577
 	 * @return boolean
578 578
 	 */
579
-	private function _allow_ticket_submission_for_event( EE_Event $event ) {
579
+	private function _allow_ticket_submission_for_event(EE_Event $event) {
580 580
 		// don't allow ticket submissions for password protected events if password hasn't been provided
581
-		if ( post_password_required( $event->ID() ) ) {
581
+		if (post_password_required($event->ID())) {
582 582
 			EE_Error::add_error(
583 583
 				__(
584 584
 					'You can not register for a password protected event without first providing the correct password.',
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 			$event->status() === 'private'
596 596
 			&& ! apply_filters(
597 597
 				'FHEE__EED_Ticket_Selector___allow_ticket_submission_for_event__current_user_can_private_event',
598
-				current_user_can( 'edit_post', $event->ID() ),
598
+				current_user_can('edit_post', $event->ID()),
599 599
 				$event
600 600
 			)
601 601
 		) {
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 			return false;
612 612
 		}
613 613
 		// don't allow ticket submissions for events that do not have any active or upcoming datetimes
614
-		if ( $event->status() !== 'private' && ! $event->is_active_or_upcoming() ) {
614
+		if ($event->status() !== 'private' && ! $event->is_active_or_upcoming()) {
615 615
 			EE_Error::add_error(
616 616
 				__(
617 617
 					'You can not register for an event that does not have any active or upcoming datetimes.',
@@ -634,10 +634,10 @@  discard block
 block discarded – undo
634 634
 	 * @return false or redirect
635 635
 	 */
636 636
 	public function process_ticket_selections() {
637
-		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
637
+		do_action('EED_Ticket_Selector__process_ticket_selections__before');
638 638
 		EED_Ticket_Selector::log();
639 639
 		$EVT_ID = $this->_get_event_id_and_process_nonce();
640
-		if ( ! $EVT_ID ) {
640
+		if ( ! $EVT_ID) {
641 641
 			return false;
642 642
 		}
643 643
 		self::$_available_spaces = array(
@@ -648,18 +648,18 @@  discard block
 block discarded – undo
648 648
 		// (ie, no MER) so clear any previous items in the cart.
649 649
 		// When MER happens this will probably need to be tweaked,
650 650
 		// possibly wrapped in a conditional checking for some constant defined in MER etc.
651
-		EE_Registry::instance()->load_core( 'Session' );
651
+		EE_Registry::instance()->load_core('Session');
652 652
 		// unless otherwise requested, clear the session
653
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', true ) ) {
654
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
653
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', true)) {
654
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
655 655
 		}
656
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
656
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
657 657
 		// validate/sanitize data
658
-		$valid = self::_validate_post_data( $EVT_ID );
659
-		if ( ! $valid ) {
658
+		$valid = self::_validate_post_data($EVT_ID);
659
+		if ( ! $valid) {
660 660
 			return false;
661 661
 		}
662
-		if ( ! $this->_allow_ticket_submission_for_event( $valid['event'] ) ) {
662
+		if ( ! $this->_allow_ticket_submission_for_event($valid['event'])) {
663 663
 			return false;
664 664
 		}
665 665
 		//EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 		//EEH_Debug_Tools::printr( $valid[ 'total_tickets' ], 'total_tickets', __FILE__, __LINE__ );
668 668
 		//EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
669 669
 		//check total tickets ordered vs max number of attendees that can register
670
-		if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
670
+		if ($valid['total_tickets'] > $valid['max_atndz']) {
671 671
 			// ordering too many tickets !!!
672 672
 			$total_tickets_string = _n(
673 673
 				'You have attempted to purchase %s ticket.',
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 				$valid['total_tickets'],
676 676
 				'event_espresso'
677 677
 			);
678
-			$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
678
+			$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
679 679
 			// dev only message
680 680
 			$max_atndz_string = _n(
681 681
 				'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.',
@@ -683,22 +683,22 @@  discard block
 block discarded – undo
683 683
 				$valid['max_atndz'],
684 684
 				'event_espresso'
685 685
 			);
686
-			$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
687
-			EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
686
+			$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
687
+			EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
688 688
 		} else {
689 689
 			// all data appears to be valid
690 690
 			$tckts_slctd = false;
691 691
 			$success = true;
692 692
 			// load cart
693
-			EE_Registry::instance()->load_core( 'Cart' );
693
+			EE_Registry::instance()->load_core('Cart');
694 694
 			// cycle thru the number of data rows sent from the event listing
695
-			for ( $x = 0; $x < $valid['rows']; $x++ ) {
695
+			for ($x = 0; $x < $valid['rows']; $x++) {
696 696
 				// does this row actually contain a ticket quantity?
697
-				if ( isset( $valid['qty'][ $x ], $valid['ticket_obj'][ $x ] ) && $valid['qty'][ $x ] > 0 ) {
697
+				if (isset($valid['qty'][$x], $valid['ticket_obj'][$x]) && $valid['qty'][$x] > 0) {
698 698
 					// YES we have a ticket quantity
699 699
 					$tckts_slctd = true;
700
-					$ticket_obj = $valid['ticket_obj'][ $x ];
701
-					if ( ! $ticket_obj instanceof EE_Ticket ) {
700
+					$ticket_obj = $valid['ticket_obj'][$x];
701
+					if ( ! $ticket_obj instanceof EE_Ticket) {
702 702
 						// nothing added to cart retrieved
703 703
 						EE_Error::add_error(
704 704
 							sprintf(
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 						);
715 715
 						continue;
716 716
 					}
717
-					if ( ! $ticket_obj->is_on_sale() || ! $ticket_obj->is_remaining() ) {
717
+					if ( ! $ticket_obj->is_on_sale() || ! $ticket_obj->is_remaining()) {
718 718
 						EE_Error::add_error(
719 719
 							__(
720 720
 								'You can not register for this ticket because it is either no longer on sale or available at this time.',
@@ -727,27 +727,27 @@  discard block
 block discarded – undo
727 727
 						return false;
728 728
 					}
729 729
 					// then add ticket to cart
730
-					$ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][ $x ], $valid['qty'][ $x ] );
730
+					$ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
731 731
 					$success = ! $ticket_added ? false : $success;
732
-					if ( EE_Error::has_error() ) {
732
+					if (EE_Error::has_error()) {
733 733
 						break;
734 734
 					}
735 735
 				}
736 736
 			}
737 737
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
738
-			if ( $tckts_slctd ) {
739
-				if ( $success ) {
738
+			if ($tckts_slctd) {
739
+				if ($success) {
740 740
 					do_action(
741 741
 						'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout',
742 742
 						EE_Registry::instance()->CART,
743 743
 						$this
744 744
 					);
745 745
 					EE_Registry::instance()->CART->recalculate_all_cart_totals();
746
-					EE_Registry::instance()->CART->save_cart( false );
746
+					EE_Registry::instance()->CART->save_cart(false);
747 747
 					EE_Registry::instance()->SSN->update();
748 748
 					//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
749 749
 					// just return TRUE for registrations being made from admin
750
-					if ( is_admin() ) {
750
+					if (is_admin()) {
751 751
 						return true;
752 752
 					}
753 753
 					wp_safe_redirect(
@@ -758,10 +758,10 @@  discard block
 block discarded – undo
758 758
 					);
759 759
 					exit();
760 760
 				} else {
761
-					if ( ! EE_Error::has_error() ) {
761
+					if ( ! EE_Error::has_error()) {
762 762
 						// nothing added to cart
763 763
 						EE_Error::add_attention(
764
-							__( 'No tickets were added for the event', 'event_espresso' ),
764
+							__('No tickets were added for the event', 'event_espresso'),
765 765
 							__FILE__,
766 766
 							__FUNCTION__,
767 767
 							__LINE__
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 			} else {
772 772
 				// no ticket quantities were selected
773 773
 				EE_Error::add_error(
774
-					__( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ),
774
+					__('You need to select a ticket quantity before you can proceed.', 'event_espresso'),
775 775
 					__FILE__,
776 776
 					__FUNCTION__,
777 777
 					__LINE__
@@ -780,16 +780,16 @@  discard block
 block discarded – undo
780 780
 		}
781 781
 		//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
782 782
 		// at this point, just return if registration is being made from admin
783
-		if ( is_admin() ) {
783
+		if (is_admin()) {
784 784
 			return false;
785 785
 		}
786
-		if ( $valid['return_url'] ) {
787
-			EE_Error::get_notices( false, true );
788
-			wp_safe_redirect( $valid['return_url'] );
786
+		if ($valid['return_url']) {
787
+			EE_Error::get_notices(false, true);
788
+			wp_safe_redirect($valid['return_url']);
789 789
 			exit();
790
-		} elseif ( isset( $event_to_add['id'] ) ) {
791
-			EE_Error::get_notices( false, true );
792
-			wp_safe_redirect( get_permalink( $event_to_add['id'] ) );
790
+		} elseif (isset($event_to_add['id'])) {
791
+			EE_Error::get_notices(false, true);
792
+			wp_safe_redirect(get_permalink($event_to_add['id']));
793 793
 			exit();
794 794
 		} else {
795 795
 			echo EE_Error::get_notices();
@@ -805,15 +805,15 @@  discard block
 block discarded – undo
805 805
 	 * @param int $EVT_ID
806 806
 	 * @return array or FALSE
807 807
 	 */
808
-	private static function _validate_post_data( $EVT_ID ) {
809
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
808
+	private static function _validate_post_data($EVT_ID) {
809
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
810 810
 		// get event via the event id we put in the form
811 811
 		$event = EE_Registry::instance()
812
-		                    ->load_model( 'Event' )
813
-		                    ->get_one_by_ID( $EVT_ID );
814
-		if ( ! $event instanceof EE_Event ) {
812
+		                    ->load_model('Event')
813
+		                    ->get_one_by_ID($EVT_ID);
814
+		if ( ! $event instanceof EE_Event) {
815 815
 			EE_Error::add_error(
816
-				__( 'The submitted Event ID was either invalid or the Event could not be found.', 'event_espresso' ),
816
+				__('The submitted Event ID was either invalid or the Event could not be found.', 'event_espresso'),
817 817
 				__FILE__,
818 818
 				__FUNCTION__,
819 819
 				__LINE__
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 		);
828 828
 		// grab and sanitize return-url
829 829
 		$valid_data['return_url'] = esc_url_raw(
830
-			EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $EVT_ID )
830
+			EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$EVT_ID)
831 831
 		);
832 832
 		// array of other form names
833 833
 		$inputs_to_clean = array(
@@ -841,43 +841,43 @@  discard block
 block discarded – undo
841 841
 		// let's track the total number of tickets ordered.'
842 842
 		$valid_data['total_tickets'] = 0;
843 843
 		// cycle through $inputs_to_clean array
844
-		foreach ( $inputs_to_clean as $what => $input_to_clean ) {
844
+		foreach ($inputs_to_clean as $what => $input_to_clean) {
845 845
 			// check for POST data
846
-			if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $EVT_ID ) ) {
846
+			if (EE_Registry::instance()->REQ->is_set($input_to_clean.$EVT_ID)) {
847 847
 				// grab value
848
-				$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $EVT_ID );
849
-				switch ( $what ) {
848
+				$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$EVT_ID);
849
+				switch ($what) {
850 850
 					// integers
851 851
 					case 'rows':
852 852
 					case 'max_atndz':
853
-						$valid_data[ $what ] = absint( $input_value );
853
+						$valid_data[$what] = absint($input_value);
854 854
 						break;
855 855
 					// arrays of integers
856 856
 					case 'qty':
857 857
 						$row_qty = $input_value;
858 858
 						// if qty is coming from a radio button input, then we need to assemble an array of rows
859
-						if ( ! is_array( $row_qty ) ) {
859
+						if ( ! is_array($row_qty)) {
860 860
 							// get number of rows
861
-							$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $EVT_ID )
862
-								? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $EVT_ID ) )
861
+							$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$EVT_ID)
862
+								? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$EVT_ID))
863 863
 								: 1;
864 864
 							// explode ints by the dash
865
-							$row_qty = explode( '-', $row_qty );
866
-							$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] ) ) : 1;
867
-							$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
868
-							$row_qty = array( $row => $qty );
869
-							for ( $x = 1; $x <= $rows; $x++ ) {
870
-								if ( ! isset( $row_qty[ $x ] ) ) {
871
-									$row_qty[ $x ] = 0;
865
+							$row_qty = explode('-', $row_qty);
866
+							$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
867
+							$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
868
+							$row_qty = array($row => $qty);
869
+							for ($x = 1; $x <= $rows; $x++) {
870
+								if ( ! isset($row_qty[$x])) {
871
+									$row_qty[$x] = 0;
872 872
 								}
873 873
 							}
874 874
 						}
875
-						ksort( $row_qty );
875
+						ksort($row_qty);
876 876
 						// cycle thru values
877
-						foreach ( $row_qty as $qty ) {
878
-							$qty = absint( $qty );
877
+						foreach ($row_qty as $qty) {
878
+							$qty = absint($qty);
879 879
 							// sanitize as integers
880
-							$valid_data[ $what ][] = $qty;
880
+							$valid_data[$what][] = $qty;
881 881
 							$valid_data['total_tickets'] += $qty;
882 882
 						}
883 883
 						break;
@@ -885,18 +885,18 @@  discard block
 block discarded – undo
885 885
 					case 'ticket_id':
886 886
 						$value_array = array();
887 887
 						// cycle thru values
888
-						foreach ( $input_value as $key => $value ) {
888
+						foreach ($input_value as $key => $value) {
889 889
 							// allow only numbers, letters,  spaces, commas and dashes
890
-							$value_array[ $key ] = wp_strip_all_tags( $value );
890
+							$value_array[$key] = wp_strip_all_tags($value);
891 891
 							// get ticket via the ticket id we put in the form
892
-							$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
893
-							$valid_data['ticket_obj'][ $key ] = $ticket_obj;
892
+							$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
893
+							$valid_data['ticket_obj'][$key] = $ticket_obj;
894 894
 						}
895
-						$valid_data[ $what ] = $value_array;
895
+						$valid_data[$what] = $value_array;
896 896
 						break;
897 897
 					case 'return_url' :
898 898
 						// grab and sanitize return-url
899
-						$valid_data[ $what ] = esc_url_raw( $input_value );
899
+						$valid_data[$what] = esc_url_raw($input_value);
900 900
 						break;
901 901
 				}    // end switch $what
902 902
 			}
@@ -914,12 +914,12 @@  discard block
 block discarded – undo
914 914
 	 * @param int       $qty
915 915
 	 * @return TRUE on success, FALSE on fail
916 916
 	 */
917
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = null, $qty = 1 ) {
918
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
917
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = null, $qty = 1) {
918
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
919 919
 		// get the number of spaces left for this datetime ticket
920
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
920
+		$available_spaces = self::_ticket_datetime_availability($ticket);
921 921
 		// compare available spaces against the number of tickets being purchased
922
-		if ( $available_spaces >= $qty ) {
922
+		if ($available_spaces >= $qty) {
923 923
 			// allow addons to prevent a ticket from being added to cart
924 924
 			if ( ! apply_filters(
925 925
 				'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart',
@@ -932,8 +932,8 @@  discard block
 block discarded – undo
932 932
 				return false;
933 933
 			}
934 934
 			// add event to cart
935
-			if ( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty ) ) {
936
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
935
+			if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
936
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
937 937
 				return true;
938 938
 			} else {
939 939
 				return false;
@@ -941,9 +941,9 @@  discard block
 block discarded – undo
941 941
 		} else {
942 942
 			// tickets can not be purchased but let's find the exact number left
943 943
 			// for the last ticket selected PRIOR to subtracting tickets
944
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
944
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
945 945
 			// greedy greedy greedy eh?
946
-			if ( $available_spaces > 0 ) {
946
+			if ($available_spaces > 0) {
947 947
 				// add error messaging - we're using the _n function that will generate
948 948
 				// the appropriate singular or plural message based on the number of $available_spaces
949 949
 				EE_Error::add_error(
@@ -988,26 +988,26 @@  discard block
 block discarded – undo
988 988
 	 * @param    bool      $get_original_ticket_spaces
989 989
 	 * @return    int
990 990
 	 */
991
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = false ) {
991
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = false) {
992 992
 		// if the $_available_spaces array has not been set up yet...
993
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] ) ) {
994
-			self::_set_initial_ticket_datetime_availability( $ticket );
993
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
994
+			self::_set_initial_ticket_datetime_availability($ticket);
995 995
 		}
996 996
 		$available_spaces = $ticket->qty() - $ticket->sold();
997
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] ) ) {
997
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
998 998
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
999
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) {
999
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
1000 1000
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
1001
-				if ( $get_original_ticket_spaces ) {
1001
+				if ($get_original_ticket_spaces) {
1002 1002
 					// then grab the available spaces from the "tickets" array
1003 1003
 					// and compare with the above to get the lowest number
1004 1004
 					$available_spaces = min(
1005 1005
 						$available_spaces,
1006
-						self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ]
1006
+						self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]
1007 1007
 					);
1008 1008
 				} else {
1009 1009
 					// we want the updated ticket availability as stored in the "datetimes" array
1010
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
1010
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
1011 1011
 				}
1012 1012
 			}
1013 1013
 		}
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 	 * @param    EE_Ticket $ticket
1024 1024
 	 * @return    int
1025 1025
 	 */
1026
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
1026
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
1027 1027
 		// first, get all of the datetimes that are available to this ticket
1028 1028
 		$datetimes = $ticket->get_many_related(
1029 1029
 			'Datetime',
@@ -1031,16 +1031,16 @@  discard block
 block discarded – undo
1031 1031
 				array(
1032 1032
 					'DTT_EVT_end' => array(
1033 1033
 						'>=',
1034
-						EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ),
1034
+						EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'),
1035 1035
 					),
1036 1036
 				),
1037
-				'order_by' => array( 'DTT_EVT_start' => 'ASC' ),
1037
+				'order_by' => array('DTT_EVT_start' => 'ASC'),
1038 1038
 			)
1039 1039
 		);
1040
-		if ( ! empty( $datetimes ) ) {
1040
+		if ( ! empty($datetimes)) {
1041 1041
 			// now loop thru all of the datetimes
1042
-			foreach ( $datetimes as $datetime ) {
1043
-				if ( $datetime instanceof EE_Datetime ) {
1042
+			foreach ($datetimes as $datetime) {
1043
+				if ($datetime instanceof EE_Datetime) {
1044 1044
 					// the number of spaces available for the datetime
1045 1045
 					// without considering individual ticket quantities
1046 1046
 					$spaces_remaining = $datetime->spaces_remaining();
@@ -1048,17 +1048,17 @@  discard block
 block discarded – undo
1048 1048
 					// ( the lesser of the ticket qty minus the number of tickets sold
1049 1049
 					// or the datetime spaces remaining)
1050 1050
 					// to this ticket using the datetime ID as the key
1051
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(
1052
-						( $ticket->qty() - $ticket->sold() ),
1051
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(
1052
+						($ticket->qty() - $ticket->sold()),
1053 1053
 						$spaces_remaining
1054 1054
 					);
1055 1055
 					// if the remaining spaces for this datetime is already set,
1056 1056
 					// then compare that against the datetime spaces remaining, and take the lowest number,
1057 1057
 					// else just take the datetime spaces remaining, and assign to the datetimes array
1058
-					self::$_available_spaces['datetimes'][ $datetime->ID(
1059
-					) ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] )
1058
+					self::$_available_spaces['datetimes'][$datetime->ID(
1059
+					)] = isset(self::$_available_spaces['datetimes'][$datetime->ID()])
1060 1060
 						? min(
1061
-							self::$_available_spaces['datetimes'][ $datetime->ID() ],
1061
+							self::$_available_spaces['datetimes'][$datetime->ID()],
1062 1062
 							$spaces_remaining
1063 1063
 						)
1064 1064
 						: $spaces_remaining;
@@ -1077,12 +1077,12 @@  discard block
 block discarded – undo
1077 1077
 	 * @param    int       $qty
1078 1078
 	 * @return    int
1079 1079
 	 */
1080
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
1081
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] ) ) {
1080
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
1081
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
1082 1082
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
1083
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) {
1083
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
1084 1084
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
1085
-				self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty;
1085
+				self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty;
1086 1086
 			}
1087 1087
 		}
1088 1088
 	}
@@ -1097,9 +1097,9 @@  discard block
 block discarded – undo
1097 1097
 	 */
1098 1098
 	public static function load_tckt_slctr_assets() {
1099 1099
 		// add some style
1100
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', false ) ) {
1101
-			wp_register_style( 'ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css' );
1102
-			wp_enqueue_style( 'ticket_selector' );
1100
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', false)) {
1101
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
1102
+			wp_enqueue_style('ticket_selector');
1103 1103
 			// make it dance
1104 1104
 			//			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
1105 1105
 			//			wp_enqueue_script('ticket_selector');
@@ -1110,17 +1110,17 @@  discard block
 block discarded – undo
1110 1110
 
1111 1111
 	public static function load_tckt_slctr_assets_admin() {
1112 1112
 		//iframe button js on admin event editor page
1113
-		if ( EE_Registry::instance()->REQ->get( 'page' ) == 'espresso_events'
1114
-		     && EE_Registry::instance()->REQ->get( 'action' ) == 'edit'
1113
+		if (EE_Registry::instance()->REQ->get('page') == 'espresso_events'
1114
+		     && EE_Registry::instance()->REQ->get('action') == 'edit'
1115 1115
 		) {
1116 1116
 			wp_register_script(
1117 1117
 				'ticket_selector_embed',
1118
-				TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js',
1119
-				array( 'ee-dialog' ),
1118
+				TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js',
1119
+				array('ee-dialog'),
1120 1120
 				EVENT_ESPRESSO_VERSION,
1121 1121
 				true
1122 1122
 			);
1123
-			wp_enqueue_script( 'ticket_selector_embed' );
1123
+			wp_enqueue_script('ticket_selector_embed');
1124 1124
 		}
1125 1125
 	}
1126 1126
 
@@ -1139,20 +1139,20 @@  discard block
 block discarded – undo
1139 1139
 	 * log
1140 1140
 	 */
1141 1141
 	public static function log() {
1142
-		$log = get_option( EED_Ticket_Selector::LOG_NAME, array() );
1142
+		$log = get_option(EED_Ticket_Selector::LOG_NAME, array());
1143 1143
 		// copy incoming $_SERVER and $_REQUEST globals
1144 1144
 		// then sanitize them so we can save them to the log
1145 1145
 		$server = $_SERVER;
1146 1146
 		$request = $_REQUEST;
1147
-		array_walk_recursive( $server, 'sanitize_text_field' );
1148
-		array_walk_recursive( $request, 'sanitize_text_field' );
1149
-		$log[ (string) microtime( true ) ] = array(
1147
+		array_walk_recursive($server, 'sanitize_text_field');
1148
+		array_walk_recursive($request, 'sanitize_text_field');
1149
+		$log[(string) microtime(true)] = array(
1150 1150
 			'server' => $server,
1151 1151
 			'request' => $request,
1152 1152
 		);
1153 1153
 		update_option(
1154 1154
 			EED_Ticket_Selector::LOG_NAME,
1155
-			EED_Ticket_Selector::trim_log( (array) $log ),
1155
+			EED_Ticket_Selector::trim_log((array) $log),
1156 1156
 			false
1157 1157
 		);
1158 1158
 	}
@@ -1166,13 +1166,13 @@  discard block
 block discarded – undo
1166 1166
 	 * @param array $log
1167 1167
 	 * @return array
1168 1168
 	 */
1169
-	public static function trim_log( $log = array() ) {
1170
-		$log = is_array( $log ) && ! empty( $log )
1169
+	public static function trim_log($log = array()) {
1170
+		$log = is_array($log) && ! empty($log)
1171 1171
 			? $log
1172
-			: get_option( EED_Ticket_Selector::LOG_NAME, array() );
1173
-		$log_length = count( $log );
1174
-		if ( $log_length > EED_Ticket_Selector::LOG_LENGTH ) {
1175
-			ksort( $log );
1172
+			: get_option(EED_Ticket_Selector::LOG_NAME, array());
1173
+		$log_length = count($log);
1174
+		if ($log_length > EED_Ticket_Selector::LOG_LENGTH) {
1175
+			ksort($log);
1176 1176
 			$log = array_slice(
1177 1177
 				$log,
1178 1178
 				$log_length - EED_Ticket_Selector::LOG_LENGTH,
Please login to merge, or discard this patch.