Completed
Branch BUG-8698-ticket-sellouts (4611a0)
by
unknown
143:47 queued 129:52
created
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 1 patch
Spacing   +281 added lines, -281 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 	 * @return EED_Single_Page_Checkout
39 39
 	 */
40 40
 	public static function instance() {
41
-		add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' );
42
-		return parent::get_instance( __CLASS__ );
41
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
42
+		return parent::get_instance(__CLASS__);
43 43
 	}
44 44
 
45 45
 
@@ -84,22 +84,22 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public static function set_hooks_admin() {
86 86
 		EED_Single_Page_Checkout::set_definitions();
87
-		if ( defined( 'DOING_AJAX' )) {
87
+		if (defined('DOING_AJAX')) {
88 88
 			// going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
89 89
 			ob_start();
90 90
 			EED_Single_Page_Checkout::load_request_handler();
91 91
 			EED_Single_Page_Checkout::load_reg_steps();
92 92
 		} else {
93 93
 			// hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called
94
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
94
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
95 95
 		}
96 96
 		// set ajax hooks
97
-		add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
98
-		add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
99
-		add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
100
-		add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
101
-		add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
102
-		add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
97
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
98
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
99
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
100
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
101
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
102
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
103 103
 	}
104 104
 
105 105
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * 	process ajax request
109 109
 	 * @param string $ajax_action
110 110
 	 */
111
-	public static function process_ajax_request( $ajax_action ) {
112
-		EE_Registry::instance()->REQ->set( 'action', $ajax_action );
111
+	public static function process_ajax_request($ajax_action) {
112
+		EE_Registry::instance()->REQ->set('action', $ajax_action);
113 113
 		EED_Single_Page_Checkout::instance()->_initialize();
114 114
 	}
115 115
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * 	ajax display registration step
120 120
 	 */
121 121
 	public static function display_reg_step() {
122
-		EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' );
122
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
123 123
 	}
124 124
 
125 125
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * 	ajax process registration step
129 129
 	 */
130 130
 	public static function process_reg_step() {
131
-		EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' );
131
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
132 132
 	}
133 133
 
134 134
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * 	ajax process registration step
138 138
 	 */
139 139
 	public static function update_reg_step() {
140
-		EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' );
140
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
141 141
 	}
142 142
 
143 143
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @return void
150 150
 	 */
151 151
 	public static function update_checkout() {
152
-		EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' );
152
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
153 153
 	}
154 154
 
155 155
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public static function load_request_handler() {
164 164
 		// load core Request_Handler class
165
-		if ( ! isset( EE_Registry::instance()->REQ )) {
166
-			EE_Registry::instance()->load_core( 'Request_Handler' );
165
+		if ( ! isset(EE_Registry::instance()->REQ)) {
166
+			EE_Registry::instance()->load_core('Request_Handler');
167 167
 		}
168 168
 	}
169 169
 
@@ -176,21 +176,21 @@  discard block
 block discarded – undo
176 176
 	 *  @return 	void
177 177
 	 */
178 178
 	public static function set_definitions() {
179
-		define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
180
-		define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS );
181
-		define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS );
182
-		define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS );
183
-		define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS );
184
-		define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS );
185
-		define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS );
186
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE );
187
-		EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ] = sprintf(
188
-			__( '%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ),
179
+		define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
180
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
181
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
182
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
183
+		define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
184
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
185
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
186
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE);
187
+		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
188
+			__('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'),
189 189
 			'<h4 class="important-notice">',
190 190
 			'</h4>',
191 191
 			'<br />',
192 192
 			'<p>',
193
-			'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
193
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
194 194
 			'">',
195 195
 			'</a>',
196 196
 			'</p>'
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	public static function load_reg_steps() {
211 211
 		static $reg_steps_loaded = FALSE;
212
-		if ( $reg_steps_loaded ) {
212
+		if ($reg_steps_loaded) {
213 213
 			return;
214 214
 		}
215 215
 		// filter list of reg_steps
@@ -218,24 +218,24 @@  discard block
 block discarded – undo
218 218
 			EED_Single_Page_Checkout::get_reg_steps()
219 219
 		);
220 220
 		// sort by key (order)
221
-		ksort( $reg_steps_to_load );
221
+		ksort($reg_steps_to_load);
222 222
 		// loop through folders
223
-		foreach ( $reg_steps_to_load as $order => $reg_step ) {
223
+		foreach ($reg_steps_to_load as $order => $reg_step) {
224 224
 			// we need a
225
-			if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
225
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
226 226
 				// copy over to the reg_steps_array
227
-				EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step;
227
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
228 228
 				// register custom key route for each reg step
229 229
 				// ie: step=>"slug" - this is the entire reason we load the reg steps array now
230
-				EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' );
230
+				EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
231 231
 				// add AJAX or other hooks
232
-				if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) {
232
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
233 233
 					// setup autoloaders if necessary
234
-					if ( ! class_exists( $reg_step['class_name'] )) {
235
-						EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE );
234
+					if ( ! class_exists($reg_step['class_name'])) {
235
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE);
236 236
 					}
237
-					if ( is_callable( $reg_step['class_name'], 'set_hooks' )) {
238
-						call_user_func( array( $reg_step['class_name'], 'set_hooks' ));
237
+					if (is_callable($reg_step['class_name'], 'set_hooks')) {
238
+						call_user_func(array($reg_step['class_name'], 'set_hooks'));
239 239
 					}
240 240
 				}
241 241
 			}
@@ -254,28 +254,28 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public static function get_reg_steps() {
256 256
 		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
257
-		if ( empty( $reg_steps )) {
257
+		if (empty($reg_steps)) {
258 258
 			$reg_steps = array(
259 259
 				10 => array(
260
-					'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information',
260
+					'file_path' => SPCO_REG_STEPS_PATH.'attendee_information',
261 261
 					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
262 262
 					'slug' => 'attendee_information',
263 263
 					'has_hooks' => FALSE
264 264
 				),
265 265
 				20 => array(
266
-					'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation',
266
+					'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation',
267 267
 					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
268 268
 					'slug' => 'registration_confirmation',
269 269
 					'has_hooks' => FALSE
270 270
 				),
271 271
 				30 => array(
272
-					'file_path' => SPCO_REG_STEPS_PATH . 'payment_options',
272
+					'file_path' => SPCO_REG_STEPS_PATH.'payment_options',
273 273
 					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
274 274
 					'slug' => 'payment_options',
275 275
 					'has_hooks' => TRUE
276 276
 				),
277 277
 				999 => array(
278
-					'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration',
278
+					'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration',
279 279
 					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
280 280
 					'slug' => 'finalize_registration',
281 281
 					'has_hooks' => FALSE
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
 	 */
296 296
 	public static function registration_checkout_for_admin() {
297 297
 		EED_Single_Page_Checkout::load_reg_steps();
298
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
299
-		EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' );
300
-		EE_Registry::instance()->REQ->set( 'process_form_submission', false );
298
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
299
+		EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
300
+		EE_Registry::instance()->REQ->set('process_form_submission', false);
301 301
 		EED_Single_Page_Checkout::instance()->_initialize();
302 302
 		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
303 303
 		return EE_Registry::instance()->REQ->get_output();
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
 	 */
314 314
 	public static function process_registration_from_admin() {
315 315
 		EED_Single_Page_Checkout::load_reg_steps();
316
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
317
-		EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' );
318
-		EE_Registry::instance()->REQ->set( 'process_form_submission', true );
316
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
317
+		EE_Registry::instance()->REQ->set('action', 'process_reg_step');
318
+		EE_Registry::instance()->REQ->set('process_form_submission', true);
319 319
 		EED_Single_Page_Checkout::instance()->_initialize();
320
-		if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) {
321
-			$final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps );
322
-			if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
323
-				if ( $final_reg_step->process_reg_step() ) {
320
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
321
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
322
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
323
+				if ($final_reg_step->process_reg_step()) {
324 324
 					return EED_Single_Page_Checkout::instance()->checkout->transaction;
325 325
 				}
326 326
 			}
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	 * @param WP_Query $WP_Query
338 338
 	 * @return    void
339 339
 	 */
340
-	public function run( $WP_Query ) {
340
+	public function run($WP_Query) {
341 341
 		if (
342 342
 			$WP_Query instanceof WP_Query
343 343
 			&& $WP_Query->is_main_query()
344
-			&& apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )
344
+			&& apply_filters('FHEE__EED_Single_Page_Checkout__run', true)
345 345
 		) {
346 346
 			$this->_initialize();
347 347
 		}
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 	 * @param WP_Query $WP_Query
358 358
 	 * @return    void
359 359
 	 */
360
-	public static function init( $WP_Query ) {
361
-		EED_Single_Page_Checkout::instance()->run( $WP_Query );
360
+	public static function init($WP_Query) {
361
+		EED_Single_Page_Checkout::instance()->run($WP_Query);
362 362
 	}
363 363
 
364 364
 
@@ -372,29 +372,29 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	private function _initialize() {
374 374
 		// ensure SPCO doesn't run twice
375
-		if ( EED_Single_Page_Checkout::$_initialized ) {
375
+		if (EED_Single_Page_Checkout::$_initialized) {
376 376
 			return;
377 377
 		}
378 378
 		$this->_verify_session();
379 379
 		// setup the EE_Checkout object
380 380
 		$this->checkout = $this->_initialize_checkout();
381 381
 		// filter checkout
382
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout );
382
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
383 383
 		// get the $_GET
384 384
 		$this->_get_request_vars();
385 385
 		// filter continue_reg
386
-		$this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout );
386
+		$this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout);
387 387
 		// load the reg steps array
388
-		if ( ! $this->_load_and_instantiate_reg_steps() ) {
388
+		if ( ! $this->_load_and_instantiate_reg_steps()) {
389 389
 			EED_Single_Page_Checkout::$_initialized = true;
390 390
 			return;
391 391
 		}
392 392
 		// set the current step
393
-		$this->checkout->set_current_step( $this->checkout->step );
393
+		$this->checkout->set_current_step($this->checkout->step);
394 394
 		// and the next step
395 395
 		$this->checkout->set_next_step();
396 396
 		// verify that everything has been setup correctly
397
-		if ( ! ( $this->_verify_transaction_and_get_registrations() && $this->_final_verifications() ) ) {
397
+		if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) {
398 398
 			EED_Single_Page_Checkout::$_initialized = true;
399 399
 			return;
400 400
 		}
@@ -419,9 +419,9 @@  discard block
 block discarded – undo
419 419
 		// set no cache headers and constants
420 420
 		EE_System::do_not_cache();
421 421
 		// add anchor
422
-		add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 );
422
+		add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
423 423
 		// remove transaction lock
424
-		add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 );
424
+		add_action('shutdown', array($this, 'unlock_transaction'), 1);
425 425
 	}
426 426
 
427 427
 
@@ -434,16 +434,16 @@  discard block
 block discarded – undo
434 434
 	 * @throws EE_Error
435 435
 	 */
436 436
 	private function _verify_session() {
437
-		if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) {
438
-			throw new EE_Error( __( 'The EE_Session class could not be loaded.', 'event_espresso' ) );
437
+		if ( ! EE_Registry::instance()->SSN instanceof EE_Session) {
438
+			throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso'));
439 439
 		}
440 440
 		// is session still valid ?
441
-		if ( EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) === '' ) {
441
+		if (EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '') {
442 442
 			$this->checkout = new EE_Checkout();
443 443
 			EE_Registry::instance()->SSN->reset_cart();
444 444
 			EE_Registry::instance()->SSN->reset_checkout();
445 445
 			EE_Registry::instance()->SSN->reset_transaction();
446
-			EE_Error::add_attention( EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ], __FILE__, __FUNCTION__, __LINE__ );
446
+			EE_Error::add_attention(EE_Registry::$i18n_js_strings['registration_expiration_notice'], __FILE__, __FUNCTION__, __LINE__);
447 447
 			EE_Registry::instance()->SSN->reset_expired();
448 448
 		}
449 449
 	}
@@ -463,20 +463,20 @@  discard block
 block discarded – undo
463 463
 		/** @type EE_Checkout $checkout */
464 464
 		$checkout = EE_Registry::instance()->SSN->checkout();
465 465
 		// verify
466
-		if ( ! $checkout instanceof EE_Checkout ) {
466
+		if ( ! $checkout instanceof EE_Checkout) {
467 467
 			// instantiate EE_Checkout object for handling the properties of the current checkout process
468
-			$checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE  );
468
+			$checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE);
469 469
 			// verify again
470
-			if ( ! $checkout instanceof EE_Checkout ) {
471
-				throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) );
470
+			if ( ! $checkout instanceof EE_Checkout) {
471
+				throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
472 472
 			}
473 473
 		} else {
474
-			if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true )  {
475
-				wp_safe_redirect( $checkout->redirect_url );
474
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
475
+				wp_safe_redirect($checkout->redirect_url);
476 476
 				exit();
477 477
 			}
478 478
 		}
479
-		$checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout );
479
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
480 480
 		// reset anything that needs a clean slate for each request
481 481
 		$checkout->reset_for_current_request();
482 482
 		return $checkout;
@@ -494,24 +494,24 @@  discard block
 block discarded – undo
494 494
 		// load classes
495 495
 		EED_Single_Page_Checkout::load_request_handler();
496 496
 		//make sure this request is marked as belonging to EE
497
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
497
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
498 498
 		// which step is being requested ?
499
-		$this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() );
499
+		$this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
500 500
 		// which step is being edited ?
501
-		$this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' );
501
+		$this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
502 502
 		// and what we're doing on the current step
503
-		$this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' );
503
+		$this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
504 504
 		// returning to edit ?
505
-		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' );
505
+		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
506 506
 		// or some other kind of revisit ?
507
-		$this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE );
507
+		$this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE);
508 508
 		// and whether or not to generate a reg form for this request
509
-		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); 		// TRUE 	FALSE
509
+		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE 	FALSE
510 510
 		// and whether or not to process a reg form submission for this request
511
-		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); 		// TRUE 	FALSE
511
+		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE 	FALSE
512 512
 		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step'
513 513
 			? $this->checkout->process_form_submission
514
-			: FALSE; 		// TRUE 	FALSE
514
+			: FALSE; // TRUE 	FALSE
515 515
 		//$this->_display_request_vars();
516 516
 	}
517 517
 
@@ -524,17 +524,17 @@  discard block
 block discarded – undo
524 524
 	 * @return    void
525 525
 	 */
526 526
 	protected function _display_request_vars() {
527
-		if ( ! WP_DEBUG ) {
527
+		if ( ! WP_DEBUG) {
528 528
 			return;
529 529
 		}
530
-		EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
531
-		EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ );
532
-		EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ );
533
-		EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ );
534
-		EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ );
535
-		EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ );
536
-		EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ );
537
-		EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ );
530
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
531
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
532
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
533
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
534
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
535
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
536
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
537
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
538 538
 	}
539 539
 
540 540
 
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 	 * @return    array
549 549
 	 */
550 550
 	private function _get_first_step() {
551
-		$first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array );
552
-		return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information';
551
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
552
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
553 553
 	}
554 554
 
555 555
 
@@ -565,27 +565,27 @@  discard block
 block discarded – undo
565 565
 	private function _load_and_instantiate_reg_steps() {
566 566
 		// have reg_steps already been instantiated ?
567 567
 		if (
568
-			empty( $this->checkout->reg_steps ) ||
569
-			apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout )
568
+			empty($this->checkout->reg_steps) ||
569
+			apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
570 570
 		) {
571 571
 			// if not, then loop through raw reg steps array
572
-			foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) {
573
-				if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) {
572
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
573
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
574 574
 					return false;
575 575
 				}
576 576
 			}
577 577
 			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE;
578 578
 			EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE;
579 579
 			// skip the registration_confirmation page ?
580
-			if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) {
580
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
581 581
 				// just remove it from the reg steps array
582
-				$this->checkout->remove_reg_step( 'registration_confirmation', false );
582
+				$this->checkout->remove_reg_step('registration_confirmation', false);
583 583
 			} else if (
584 584
 				EE_Registry::instance()->CFG->registration->reg_confirmation_last
585
-				&& isset( $this->checkout->reg_steps['registration_confirmation'] )
585
+				&& isset($this->checkout->reg_steps['registration_confirmation'])
586 586
 			) {
587 587
 				// set the order to something big like 100
588
-				$this->checkout->set_reg_step_order( 'registration_confirmation', 100 );
588
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
589 589
 			}
590 590
 			// filter the array for good luck
591 591
 			$this->checkout->reg_steps = apply_filters(
@@ -595,13 +595,13 @@  discard block
 block discarded – undo
595 595
 			// finally re-sort based on the reg step class order properties
596 596
 			$this->checkout->sort_reg_steps();
597 597
 		} else {
598
-			foreach ( $this->checkout->reg_steps as $reg_step ) {
598
+			foreach ($this->checkout->reg_steps as $reg_step) {
599 599
 				// set all current step stati to FALSE
600
-				$reg_step->set_is_current_step( FALSE );
600
+				$reg_step->set_is_current_step(FALSE);
601 601
 			}
602 602
 		}
603
-		if ( empty( $this->checkout->reg_steps )) {
604
-			EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
603
+		if (empty($this->checkout->reg_steps)) {
604
+			EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
605 605
 			return false;
606 606
 		}
607 607
 			// make reg step details available to JS
@@ -619,10 +619,10 @@  discard block
 block discarded – undo
619 619
 	 * @param int   $order
620 620
 	 * @return bool
621 621
 	 */
622
-	private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) {
622
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) {
623 623
 
624 624
 		// we need a file_path, class_name, and slug to add a reg step
625
-		if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
625
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
626 626
 			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
627 627
 			if (
628 628
 				$this->checkout->reg_url_link
@@ -640,26 +640,26 @@  discard block
 block discarded – undo
640 640
 				FALSE
641 641
 			);
642 642
 			// did we gets the goods ?
643
-			if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) {
643
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
644 644
 				// set reg step order based on config
645
-				$reg_step_obj->set_order( $order );
645
+				$reg_step_obj->set_order($order);
646 646
 				// add instantiated reg step object to the master reg steps array
647
-				$this->checkout->add_reg_step( $reg_step_obj );
647
+				$this->checkout->add_reg_step($reg_step_obj);
648 648
 			} else {
649 649
 				EE_Error::add_error(
650
-					__( 'The current step could not be set.', 'event_espresso' ),
650
+					__('The current step could not be set.', 'event_espresso'),
651 651
 					__FILE__, __FUNCTION__, __LINE__
652 652
 				);
653 653
 				return false;
654 654
 			}
655 655
 		} else {
656
-			if ( WP_DEBUG ) {
656
+			if (WP_DEBUG) {
657 657
 				EE_Error::add_error(
658 658
 					sprintf(
659
-						__( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ),
660
-						isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '',
661
-						isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '',
662
-						isset( $reg_step['slug'] ) ? $reg_step['slug'] : '',
659
+						__('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'),
660
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
661
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
662
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
663 663
 						'<ul>',
664 664
 						'<li>',
665 665
 						'</li>',
@@ -683,15 +683,15 @@  discard block
 block discarded – undo
683 683
 	 */
684 684
 	private function _verify_transaction_and_get_registrations() {
685 685
 		// was there already a valid transaction in the checkout from the session ?
686
-		if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
686
+		if ( ! $this->checkout->transaction instanceof EE_Transaction) {
687 687
 			// get transaction from db or session
688 688
 			$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin()
689 689
 				? $this->_get_transaction_and_cart_for_previous_visit()
690 690
 				: $this->_get_cart_for_current_session_and_setup_new_transaction();
691 691
 
692
-			if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
692
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
693 693
 				EE_Error::add_error(
694
-					__( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ),
694
+					__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'),
695 695
 					__FILE__, __FUNCTION__, __LINE__
696 696
 				);
697 697
 				$this->checkout->transaction = EE_Transaction::new_instance();
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 				return false;
702 702
 			}
703 703
 			// and the registrations for the transaction
704
-			$this->_get_registrations( $this->checkout->transaction );
704
+			$this->_get_registrations($this->checkout->transaction);
705 705
 		}
706 706
 		return true;
707 707
 	}
@@ -716,16 +716,16 @@  discard block
 block discarded – undo
716 716
 	 */
717 717
 	private function _get_transaction_and_cart_for_previous_visit() {
718 718
 		/** @var $TXN_model EEM_Transaction */
719
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
719
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
720 720
 		// because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db
721
-		$transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link );
721
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
722 722
 		// verify transaction
723
-		if ( $transaction instanceof EE_Transaction ) {
723
+		if ($transaction instanceof EE_Transaction) {
724 724
 			// and get the cart that was used for that transaction
725
-			$this->checkout->cart = $this->_get_cart_for_transaction( $transaction );
725
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
726 726
 			return $transaction;
727 727
 		} else {
728
-			EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
728
+			EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
729 729
 			return NULL;
730 730
 		}
731 731
 	}
@@ -739,11 +739,11 @@  discard block
 block discarded – undo
739 739
 	 * @param EE_Transaction $transaction
740 740
 	 * @return EE_Cart
741 741
 	 */
742
-	private function _get_cart_for_transaction( $transaction ) {
743
-		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL;
742
+	private function _get_cart_for_transaction($transaction) {
743
+		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL;
744 744
 		// verify cart
745
-		if ( ! $cart instanceof EE_Cart ) {
746
-			$cart = EE_Registry::instance()->load_core( 'Cart' );
745
+		if ( ! $cart instanceof EE_Cart) {
746
+			$cart = EE_Registry::instance()->load_core('Cart');
747 747
 		}
748 748
 		return $cart;
749 749
 	}
@@ -758,8 +758,8 @@  discard block
 block discarded – undo
758 758
 	 * @param EE_Transaction $transaction
759 759
 	 * 	@return EE_Cart
760 760
 	 */
761
-	public function get_cart_for_transaction( EE_Transaction $transaction ) {
762
-		return EE_Cart::get_cart_from_txn( $transaction );
761
+	public function get_cart_for_transaction(EE_Transaction $transaction) {
762
+		return EE_Cart::get_cart_from_txn($transaction);
763 763
 	}
764 764
 
765 765
 
@@ -774,15 +774,15 @@  discard block
 block discarded – undo
774 774
 	private function _get_cart_for_current_session_and_setup_new_transaction() {
775 775
 		//  if there's no transaction, then this is the FIRST visit to SPCO
776 776
 		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
777
-		$this->checkout->cart = $this->_get_cart_for_transaction( NULL );
777
+		$this->checkout->cart = $this->_get_cart_for_transaction(NULL);
778 778
 		// and then create a new transaction
779 779
 		$transaction = $this->_initialize_transaction();
780 780
 		// verify transaction
781
-		if ( $transaction instanceof EE_Transaction ) {
781
+		if ($transaction instanceof EE_Transaction) {
782 782
 			// and save TXN data to the cart
783
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() );
783
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
784 784
 		} else {
785
-			EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
785
+			EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
786 786
 		}
787 787
 		return $transaction;
788 788
 	}
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 			// grab the cart grand total
803 803
 			$cart_total = $this->checkout->cart->get_cart_grand_total();
804 804
 			// create new TXN
805
-			$transaction = EE_Transaction::new_instance( array(
805
+			$transaction = EE_Transaction::new_instance(array(
806 806
 				'TXN_timestamp' 	=> time(),
807 807
 				'TXN_reg_steps' 		=> $this->checkout->initialize_txn_reg_steps_array(),
808 808
 				'TXN_total' 				=> $cart_total > 0 ? $cart_total : 0,
@@ -817,8 +817,8 @@  discard block
 block discarded – undo
817 817
 				$transaction->ID()
818 818
 			);
819 819
 			return $transaction;
820
-		} catch( Exception $e ) {
821
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
820
+		} catch (Exception $e) {
821
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
822 822
 		}
823 823
 		return NULL;
824 824
 	}
@@ -832,34 +832,34 @@  discard block
 block discarded – undo
832 832
 	 * @param EE_Transaction $transaction
833 833
 	 * @return EE_Cart
834 834
 	 */
835
-	private function _get_registrations( EE_Transaction $transaction ) {
835
+	private function _get_registrations(EE_Transaction $transaction) {
836 836
 		// first step: grab the registrants  { : o
837
-		$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true );
837
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
838 838
 		// verify registrations have been set
839
-		if ( empty( $registrations )) {
839
+		if (empty($registrations)) {
840 840
 			// if no cached registrations, then check the db
841
-			$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false );
841
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
842 842
 			// still nothing ? well as long as this isn't a revisit
843
-			if ( empty( $registrations ) && ! $this->checkout->revisit ) {
843
+			if (empty($registrations) && ! $this->checkout->revisit) {
844 844
 				// generate new registrations from scratch
845
-				$registrations = $this->_initialize_registrations( $transaction );
845
+				$registrations = $this->_initialize_registrations($transaction);
846 846
 			}
847 847
 		}
848 848
 		// sort by their original registration order
849
-		usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' ));
849
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
850 850
 		// then loop thru the array
851
-		foreach ( $registrations as $registration ) {
851
+		foreach ($registrations as $registration) {
852 852
 			// verify each registration
853
-			if ( $registration instanceof EE_Registration ) {
853
+			if ($registration instanceof EE_Registration) {
854 854
 				// we display all attendee info for the primary registrant
855
-				if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) {
855
+				if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) {
856 856
 					$this->checkout->primary_revisit = TRUE;
857 857
 					break;
858
-				} else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) {
858
+				} else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) {
859 859
 					// but hide info if it doesn't belong to you
860
-					$transaction->clear_cache( 'Registration', $registration->ID() );
860
+					$transaction->clear_cache('Registration', $registration->ID());
861 861
 				}
862
-				$this->checkout->set_reg_status_updated( $registration->ID(), false );
862
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
863 863
 			}
864 864
 		}
865 865
 	}
@@ -873,17 +873,17 @@  discard block
 block discarded – undo
873 873
 	 * @param EE_Transaction $transaction
874 874
 	 * @return    array
875 875
 	 */
876
-	private function _initialize_registrations( EE_Transaction $transaction ) {
876
+	private function _initialize_registrations(EE_Transaction $transaction) {
877 877
 		$att_nmbr = 0;
878 878
 		$registrations = array();
879
-		if ( $transaction instanceof EE_Transaction ) {
879
+		if ($transaction instanceof EE_Transaction) {
880 880
 			/** @type EE_Registration_Processor $registration_processor */
881
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
881
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
882 882
 			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
883 883
 			// now let's add the cart items to the $transaction
884
-			foreach ( $this->checkout->cart->get_tickets() as $line_item ) {
884
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
885 885
 				//do the following for each ticket of this type they selected
886
-				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
886
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
887 887
 					$att_nmbr++;
888 888
 					$registration = $registration_processor->generate_ONE_registration_from_line_item(
889 889
 						$line_item,
@@ -891,12 +891,12 @@  discard block
 block discarded – undo
891 891
 						$att_nmbr,
892 892
 						$this->checkout->total_ticket_count
893 893
 					);
894
-					if ( $registration instanceof EE_Registration ) {
895
-						$registrations[ $registration->ID() ] = $registration;
894
+					if ($registration instanceof EE_Registration) {
895
+						$registrations[$registration->ID()] = $registration;
896 896
 					}
897 897
 				}
898 898
 			}
899
-			$registration_processor->fix_reg_final_price_rounding_issue( $transaction );
899
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
900 900
 		}
901 901
 		return $registrations;
902 902
 	}
@@ -911,12 +911,12 @@  discard block
 block discarded – undo
911 911
 	 * @param EE_Registration $reg_B
912 912
 	 * @return array()
913 913
 	 */
914
-	public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) {
914
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) {
915 915
 		// this shouldn't ever happen within the same TXN, but oh well
916
-		if ( $reg_A->count() == $reg_B->count() ) {
916
+		if ($reg_A->count() == $reg_B->count()) {
917 917
 			return 0;
918 918
 		}
919
-		return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1;
919
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
920 920
 	}
921 921
 
922 922
 
@@ -931,35 +931,35 @@  discard block
 block discarded – undo
931 931
 	 */
932 932
 	private function _final_verifications() {
933 933
 		// filter checkout
934
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout );
934
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
935 935
 		//verify that current step is still set correctly
936
-		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) {
937
-			EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
936
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
937
+			EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
938 938
 			return false;
939 939
 		}
940 940
 		// if returning to SPCO, then verify that primary registrant is set
941
-		if ( ! empty( $this->checkout->reg_url_link )) {
941
+		if ( ! empty($this->checkout->reg_url_link)) {
942 942
 			$valid_registrant = $this->checkout->transaction->primary_registration();
943
-			if ( ! $valid_registrant instanceof EE_Registration ) {
944
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
943
+			if ( ! $valid_registrant instanceof EE_Registration) {
944
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
945 945
 				return false;
946 946
 			}
947 947
 			$valid_registrant = null;
948
-			foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) {
949
-				if ( $registration instanceof EE_Registration ) {
950
-					if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) {
948
+			foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
949
+				if ($registration instanceof EE_Registration) {
950
+					if ($registration->reg_url_link() == $this->checkout->reg_url_link) {
951 951
 						$valid_registrant = $registration;
952 952
 					}
953 953
 				}
954 954
 			}
955
-			if ( ! $valid_registrant instanceof EE_Registration ) {
956
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
955
+			if ( ! $valid_registrant instanceof EE_Registration) {
956
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
957 957
 				return false;
958 958
 			}
959 959
 		}
960 960
 		// now that things have been kinda sufficiently verified,
961 961
 		// let's add the checkout to the session so that's available other systems
962
-		EE_Registry::instance()->SSN->set_checkout( $this->checkout );
962
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
963 963
 		return true;
964 964
 	}
965 965
 
@@ -975,28 +975,28 @@  discard block
 block discarded – undo
975 975
 	 * @access    private
976 976
 	 * @param bool $reinitializing
977 977
 	 */
978
-	private function _initialize_reg_steps( $reinitializing = false ) {
979
-		$this->checkout->set_reg_step_initiated( $this->checkout->current_step );
978
+	private function _initialize_reg_steps($reinitializing = false) {
979
+		$this->checkout->set_reg_step_initiated($this->checkout->current_step);
980 980
 		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
981
-		foreach ( $this->checkout->reg_steps as $reg_step ) {
982
-			if ( ! $reg_step->initialize_reg_step() ) {
981
+		foreach ($this->checkout->reg_steps as $reg_step) {
982
+			if ( ! $reg_step->initialize_reg_step()) {
983 983
 				// if not initialized then maybe this step is being removed...
984
-				if ( $reg_step->is_current_step() && ! $reinitializing ) {
984
+				if ($reg_step->is_current_step() && ! $reinitializing) {
985 985
 					// if it was the current step, then we need to start over here
986
-					$this->_initialize_reg_steps( true );
986
+					$this->_initialize_reg_steps(true);
987 987
 					return;
988 988
 				}
989 989
 				continue;
990 990
 			}
991 991
 			// i18n
992 992
 			$reg_step->translate_js_strings();
993
-			if ( $reg_step->is_current_step() ) {
993
+			if ($reg_step->is_current_step()) {
994 994
 				// the text that appears on the reg step form submit button
995 995
 				$reg_step->set_submit_button_text();
996 996
 			}
997 997
 		}
998 998
 		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
999
-		do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step );
999
+		do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
1000 1000
 	}
1001 1001
 
1002 1002
 
@@ -1009,39 +1009,39 @@  discard block
 block discarded – undo
1009 1009
 	 */
1010 1010
 	private function _check_form_submission() {
1011 1011
 		//does this request require the reg form to be generated ?
1012
-		if ( $this->checkout->generate_reg_form ) {
1012
+		if ($this->checkout->generate_reg_form) {
1013 1013
 			// ever heard that song by Blue Rodeo ?
1014 1014
 			try {
1015 1015
 				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
1016 1016
 				// if not displaying a form, then check for form submission
1017
-				if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) {
1017
+				if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) {
1018 1018
 					// clear out any old data in case this step is being run again
1019
-					$this->checkout->current_step->set_valid_data( array() );
1019
+					$this->checkout->current_step->set_valid_data(array());
1020 1020
 					// capture submitted form data
1021 1021
 					$this->checkout->current_step->reg_form->receive_form_submission(
1022
-						apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout )
1022
+						apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout)
1023 1023
 					);
1024 1024
 					// validate submitted form data
1025
-					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) {
1025
+					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) {
1026 1026
 						// thou shall not pass !!!
1027 1027
 						$this->checkout->continue_reg = FALSE;
1028 1028
 						// any form validation errors?
1029
-						if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) {
1029
+						if ($this->checkout->current_step->reg_form->submission_error_message() != '') {
1030 1030
 							$submission_error_messages = array();
1031 1031
 							// bad, bad, bad registrant
1032
-							foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){
1033
-								if ( $validation_error instanceof EE_Validation_Error ) {
1034
-									$submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() );
1032
+							foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
1033
+								if ($validation_error instanceof EE_Validation_Error) {
1034
+									$submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage());
1035 1035
 								}
1036 1036
 							}
1037
-							EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1037
+							EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1038 1038
 						}
1039 1039
 						// well not really... what will happen is we'll just get redirected back to redo the current step
1040 1040
 						$this->go_to_next_step();
1041 1041
 						return;
1042 1042
 					}
1043 1043
 				}
1044
-			} catch( EE_Error $e ) {
1044
+			} catch (EE_Error $e) {
1045 1045
 				$e->get_error();
1046 1046
 			}
1047 1047
 		}
@@ -1057,38 +1057,38 @@  discard block
 block discarded – undo
1057 1057
 	 */
1058 1058
 	private function _process_form_action() {
1059 1059
 		// what cha wanna do?
1060
-		switch( $this->checkout->action ) {
1060
+		switch ($this->checkout->action) {
1061 1061
 			// AJAX next step reg form
1062 1062
 			case 'display_spco_reg_step' :
1063 1063
 				$this->checkout->redirect = FALSE;
1064
-				if ( EE_Registry::instance()->REQ->ajax ) {
1065
-					$this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() );
1064
+				if (EE_Registry::instance()->REQ->ajax) {
1065
+					$this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
1066 1066
 				}
1067 1067
 				break;
1068 1068
 
1069 1069
 			default :
1070 1070
 				// meh... do one of those other steps first
1071
-				if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) {
1071
+				if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
1072 1072
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
1073
-					do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
1073
+					do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1074 1074
 					// call action on current step
1075
-					if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) {
1075
+					if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
1076 1076
 						// good registrant, you get to proceed
1077
-						if ( $this->checkout->current_step->success_message() != '' ) {
1078
-							if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) {
1079
-								EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() );
1077
+						if ($this->checkout->current_step->success_message() != '') {
1078
+							if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) {
1079
+								EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions());
1080 1080
 							}
1081 1081
 						}
1082 1082
 						// pack it up, pack it in...
1083 1083
 						$this->_setup_redirect();
1084 1084
 					}
1085 1085
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
1086
-					do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
1086
+					do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1087 1087
 
1088 1088
 				} else {
1089 1089
 					EE_Error::add_error(
1090 1090
 						sprintf(
1091
-							__( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ),
1091
+							__('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1092 1092
 							$this->checkout->action,
1093 1093
 							$this->checkout->current_step->name()
1094 1094
 						),
@@ -1114,10 +1114,10 @@  discard block
 block discarded – undo
1114 1114
 	public function add_styles_and_scripts() {
1115 1115
 		// i18n
1116 1116
 		$this->translate_js_strings();
1117
-		if ( $this->checkout->admin_request ) {
1118
-			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 );
1117
+		if ($this->checkout->admin_request) {
1118
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1119 1119
 		} else {
1120
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 );
1120
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1121 1121
 		}
1122 1122
 	}
1123 1123
 
@@ -1133,50 +1133,50 @@  discard block
 block discarded – undo
1133 1133
 		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1134 1134
 		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1135 1135
 		EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1136
-		EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' );
1137
-		EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' );
1138
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' );
1136
+		EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1137
+		EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso');
1138
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso');
1139 1139
 		EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1140 1140
 		EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso');
1141 1141
 		EE_Registry::$i18n_js_strings['process_registration'] = sprintf(
1142
-			__( 'Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso' ),
1142
+			__('Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso'),
1143 1143
 			'<br/>'
1144 1144
 		);
1145
-		EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' );
1145
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1146 1146
 		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1147 1147
 		EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1148 1148
 		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1149
-		EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' );
1150
-		EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' );
1151
-		EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' );
1152
-		EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' );
1153
-		EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' );
1154
-		EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' );
1155
-		EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' );
1156
-		EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' );
1157
-		EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' );
1158
-		EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' );
1159
-		EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' );
1160
-		EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' );
1161
-		EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' );
1162
-		EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' );
1149
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1150
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1151
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1152
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1153
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1154
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1155
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1156
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1157
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1158
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1159
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1160
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1161
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1162
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1163 1163
 		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1164
-			__( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ),
1164
+			__('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'),
1165 1165
 			'<h4 class="important-notice">',
1166 1166
 			'</h4>',
1167 1167
 			'<br />',
1168 1168
 			'<p>',
1169
-			'<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="',
1169
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1170 1170
 			'">',
1171 1171
 			'</a>',
1172 1172
 			'</p>'
1173 1173
 		);
1174
-		EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true );
1175
-		EE_Registry::$i18n_js_strings[ 'session_extension' ] = absint(
1176
-			apply_filters( 'FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS )
1174
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1175
+		EE_Registry::$i18n_js_strings['session_extension'] = absint(
1176
+			apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS)
1177 1177
 		);
1178
-		EE_Registry::$i18n_js_strings[ 'session_expiration' ] = gmdate(
1179
-			'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS )
1178
+		EE_Registry::$i18n_js_strings['session_expiration'] = gmdate(
1179
+			'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)
1180 1180
 		);
1181 1181
 
1182 1182
 
@@ -1192,31 +1192,31 @@  discard block
 block discarded – undo
1192 1192
 	 */
1193 1193
 	public function enqueue_styles_and_scripts() {
1194 1194
 		// load css
1195
-		wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION );
1196
-		wp_enqueue_style( 'single_page_checkout' );
1195
+		wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1196
+		wp_enqueue_style('single_page_checkout');
1197 1197
 		// load JS
1198
-		wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array( 'jquery' ), '1.0.1', TRUE );
1199
-		wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE );
1198
+		wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery	.plugin.min.js', array('jquery'), '1.0.1', TRUE);
1199
+		wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE);
1200 1200
 		wp_register_script(
1201 1201
 			'single_page_checkout',
1202
-			SPCO_JS_URL . 'single_page_checkout.js',
1203
-			array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ),
1202
+			SPCO_JS_URL.'single_page_checkout.js',
1203
+			array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'),
1204 1204
 			EVENT_ESPRESSO_VERSION,
1205 1205
 			TRUE
1206 1206
 		);
1207
-		wp_enqueue_script( 'single_page_checkout' );
1207
+		wp_enqueue_script('single_page_checkout');
1208 1208
 
1209 1209
 		/**
1210 1210
 		 * global action hook for enqueueing styles and scripts with
1211 1211
 		 * spco calls.
1212 1212
 		 */
1213
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this );
1213
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1214 1214
 
1215 1215
 		/**
1216 1216
 		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1217 1217
 		 * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1218 1218
 		 */
1219
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this );
1219
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this);
1220 1220
 
1221 1221
 		// add css and JS for current step
1222 1222
 		$this->checkout->current_step->enqueue_styles_and_scripts();
@@ -1232,21 +1232,21 @@  discard block
 block discarded – undo
1232 1232
 	 */
1233 1233
 	private function _display_spco_reg_form() {
1234 1234
 		// if registering via the admin, just display the reg form for the current step
1235
-		if ( $this->checkout->admin_request ) {
1236
-			EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() );
1235
+		if ($this->checkout->admin_request) {
1236
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1237 1237
 		} else {
1238 1238
 			// add powered by EE msg
1239
-			add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' ));
1239
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1240 1240
 
1241
-			$empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false;
1242
-			EE_Registry::$i18n_js_strings[ 'empty_cart' ] = $empty_cart;
1241
+			$empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false;
1242
+			EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart;
1243 1243
 			$cookies_not_set_msg = '';
1244
-			if ( $empty_cart ) {
1245
-				if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) {
1244
+			if ($empty_cart) {
1245
+				if ( ! isset($_COOKIE['ee_cookie_test'])) {
1246 1246
 					$cookies_not_set_msg = apply_filters(
1247 1247
 						'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1248 1248
 						sprintf(
1249
-							__( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ),
1249
+							__('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'),
1250 1250
 							'<div class="ee-attention">',
1251 1251
 							'</div>',
1252 1252
 							'<h6 class="important-notice">',
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
 					'layout_strategy' =>
1268 1268
 						new EE_Template_Layout(
1269 1269
 							array(
1270
-								'layout_template_file' 			=> SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1270
+								'layout_template_file' 			=> SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1271 1271
 								'template_args' => array(
1272 1272
 									'empty_cart' 		=> $empty_cart,
1273 1273
 									'revisit' 				=> $this->checkout->revisit,
@@ -1276,8 +1276,8 @@  discard block
 block discarded – undo
1276 1276
 									'empty_msg' 		=> apply_filters(
1277 1277
 										'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1278 1278
 										sprintf(
1279
-											__( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ),
1280
-											'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
1279
+											__('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'),
1280
+											'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1281 1281
 											'">',
1282 1282
 											'</a>'
1283 1283
 										)
@@ -1295,7 +1295,7 @@  discard block
 block discarded – undo
1295 1295
 				)
1296 1296
 			);
1297 1297
 			// load template and add to output sent that gets filtered into the_content()
1298
-			EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() );
1298
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js());
1299 1299
 		}
1300 1300
 	}
1301 1301
 
@@ -1309,8 +1309,8 @@  discard block
 block discarded – undo
1309 1309
 	 * @internal  param string $label
1310 1310
 	 * @return        string
1311 1311
 	 */
1312
-	public function add_extra_finalize_registration_inputs( $next_step ) {
1313
-		if ( $next_step == 'finalize_registration' ) {
1312
+	public function add_extra_finalize_registration_inputs($next_step) {
1313
+		if ($next_step == 'finalize_registration') {
1314 1314
 			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1315 1315
 		}
1316 1316
 	}
@@ -1324,18 +1324,18 @@  discard block
 block discarded – undo
1324 1324
 	 *  @return 	string
1325 1325
 	 */
1326 1326
 	public static function display_registration_footer() {
1327
-		if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) {
1328
-			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1329
-			$url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' );
1330
-			$url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url );
1327
+		if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) {
1328
+			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1329
+			$url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/');
1330
+			$url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1331 1331
 			echo apply_filters(
1332 1332
 				'FHEE__EE_Front_Controller__display_registration_footer',
1333 1333
 				sprintf(
1334
-					__( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ),
1335
-					'<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="',
1334
+					__('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'),
1335
+					'<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="',
1336 1336
 					'" target="_blank">',
1337 1337
 					'</a>',
1338
-					'<a href="' . $url . '" title="',
1338
+					'<a href="'.$url.'" title="',
1339 1339
 					'" target="_blank">',
1340 1340
 					'</a></div>'
1341 1341
 				)
@@ -1366,12 +1366,12 @@  discard block
 block discarded – undo
1366 1366
 	 * @return 	array
1367 1367
 	 */
1368 1368
 	private function _setup_redirect() {
1369
-		if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
1369
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1370 1370
 			$this->checkout->redirect = TRUE;
1371
-			if ( empty( $this->checkout->redirect_url )) {
1371
+			if (empty($this->checkout->redirect_url)) {
1372 1372
 				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1373 1373
 			}
1374
-			$this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout );
1374
+			$this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout);
1375 1375
 		}
1376 1376
 	}
1377 1377
 
@@ -1384,12 +1384,12 @@  discard block
 block discarded – undo
1384 1384
 	 * @return void
1385 1385
 	 */
1386 1386
 	public function go_to_next_step() {
1387
-		if ( EE_Registry::instance()->REQ->ajax ) {
1387
+		if (EE_Registry::instance()->REQ->ajax) {
1388 1388
 			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1389
-			$this->checkout->json_response->set_unexpected_errors( ob_get_clean() );
1389
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1390 1390
 		}
1391 1391
 		// just return for these conditions
1392
-		if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) {
1392
+		if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') {
1393 1393
 			return;
1394 1394
 		}
1395 1395
 		// AJAX response
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
 	 */
1411 1411
 	protected function _handle_json_response() {
1412 1412
 		// if this is an ajax request
1413
-		if ( EE_Registry::instance()->REQ->ajax ) {
1413
+		if (EE_Registry::instance()->REQ->ajax) {
1414 1414
 			// DEBUG LOG
1415 1415
 			//$this->checkout->log(
1416 1416
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1420,10 +1420,10 @@  discard block
 block discarded – undo
1420 1420
 			//		'continue_reg'               => $this->checkout->continue_reg,
1421 1421
 			//	)
1422 1422
 			//);
1423
-			$this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() );
1424
-			$this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing );
1423
+			$this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit());
1424
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1425 1425
 			// just send the ajax (
1426
-			$json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response );
1426
+			$json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response);
1427 1427
 			$this->unlock_transaction();
1428 1428
 			echo $json_response;
1429 1429
 			exit();
@@ -1440,9 +1440,9 @@  discard block
 block discarded – undo
1440 1440
 	 */
1441 1441
 	protected function _handle_html_redirects() {
1442 1442
 		// going somewhere ?
1443
-		if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) {
1443
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1444 1444
 			// store notices in a transient
1445
-			EE_Error::get_notices( false, true, true );
1445
+			EE_Error::get_notices(false, true, true);
1446 1446
 			$this->unlock_transaction();
1447 1447
 			// DEBUG LOG
1448 1448
 			//$this->checkout->log(
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
 			//		'headers_list'    => headers_list(),
1454 1454
 			//	)
1455 1455
 			//);
1456
-			wp_safe_redirect( $this->checkout->redirect_url );
1456
+			wp_safe_redirect($this->checkout->redirect_url);
1457 1457
 			exit();
1458 1458
 		}
1459 1459
 	}
Please login to merge, or discard this patch.
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 1 patch
Spacing   +385 added lines, -385 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 	 *  @return 	void
29 29
 	 */
30 30
 	public static function set_hooks() {
31
-		add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) );
32
-		add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
33
-		add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
34
-		add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
35
-		add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
36
-		add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) );
37
-		add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
31
+		add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters'));
32
+		add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
33
+		add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
34
+		add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
35
+		add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
36
+		add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details'));
37
+		add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
38 38
 		);
39
-		add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 );
39
+		add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1);
40 40
 	}
41 41
 
42 42
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * 	ajax switch_spco_billing_form
46 46
 	 */
47 47
 	public static function switch_spco_billing_form() {
48
-		EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' );
48
+		EED_Single_Page_Checkout::process_ajax_request('switch_payment_method');
49 49
 	}
50 50
 
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * 	ajax save_payer_details
55 55
 	 */
56 56
 	public static function save_payer_details() {
57
-		EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' );
57
+		EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax');
58 58
 	}
59 59
 
60 60
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * 	ajax get_transaction_details
64 64
 	 */
65 65
 	public static function get_transaction_details() {
66
-		EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' );
66
+		EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways');
67 67
 	}
68 68
 
69 69
 
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 	 * @param    EE_Checkout $checkout
92 92
 	 * @return    \EE_SPCO_Reg_Step_Payment_Options
93 93
 	 */
94
-	public function __construct( EE_Checkout $checkout ) {
94
+	public function __construct(EE_Checkout $checkout) {
95 95
 		$this->_slug = 'payment_options';
96 96
 		$this->_name = __('Payment Options', 'event_espresso');
97
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
97
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
98 98
 		$this->checkout = $checkout;
99 99
 		$this->_reset_success_message();
100
-		$this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
100
+		$this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
101 101
 	}
102 102
 
103 103
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * @param null $line_item_display
116 116
 	 */
117
-	public function set_line_item_display( $line_item_display ) {
117
+	public function set_line_item_display($line_item_display) {
118 118
 		$this->line_item_display = $line_item_display;
119 119
 	}
120 120
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	 * @return void
126 126
 	 */
127 127
 	public function translate_js_strings() {
128
-		EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' );
129
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' );
130
-		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' );
128
+		EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso');
129
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso');
130
+		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso');
131 131
 	}
132 132
 
133 133
 
@@ -156,20 +156,20 @@  discard block
 block discarded – undo
156 156
 			// 	$ 0.00 transactions (no payment required)
157 157
 			! $this->checkout->payment_required()
158 158
 			// but do NOT remove if current action being called belongs to this reg step
159
-			&& ! is_callable( array( $this, $this->checkout->action ) )
159
+			&& ! is_callable(array($this, $this->checkout->action))
160 160
 			&& ! $this->completed()
161 161
 		) {
162 162
 			// and if so, then we no longer need the Payment Options step
163
-			if ( $this->is_current_step() ) {
163
+			if ($this->is_current_step()) {
164 164
 				$this->checkout->generate_reg_form = false;
165 165
 			}
166
-			$this->checkout->remove_reg_step( $this->_slug );
166
+			$this->checkout->remove_reg_step($this->_slug);
167 167
 			// DEBUG LOG
168 168
 			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
169 169
 			return false;
170 170
 		}
171 171
 		// load EEM_Payment_Method
172
-		EE_Registry::instance()->load_model( 'Payment_Method' );
172
+		EE_Registry::instance()->load_model('Payment_Method');
173 173
 		// get all active payment methods
174 174
 		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
175 175
 			$this->checkout->transaction, EEM_Payment_Method::scope_cart
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return bool
184 184
 	 */
185 185
 	public function generate_reg_form() {
186
-		EE_Registry::instance()->load_helper( 'HTML' );
186
+		EE_Registry::instance()->load_helper('HTML');
187 187
 		// reset in case someone changes their mind
188 188
 		$this->_reset_selected_method_of_payment();
189 189
 		// set some defaults
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 		$reg_count = 0;
196 196
 		$no_payment_required = true;
197 197
 		// loop thru registrations to gather info
198
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
199
-		foreach ( $registrations as $registration ) {
198
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
199
+		foreach ($registrations as $registration) {
200 200
 			/** @var $registration EE_Registration */
201 201
 			$reg_count++;
202 202
 			// registrant is NOT Approved
203
-			if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) {
203
+			if ($registration->status_ID() === EEM_Registration::status_id_not_approved) {
204 204
 				// add event to list of events with pre-approval reg status
205
-				$registrations_requiring_pre_approval[ $registration->ID() ] = $registration;
205
+				$registrations_requiring_pre_approval[$registration->ID()] = $registration;
206 206
 				do_action(
207 207
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
208 208
 					$registration->event(),
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 				// anything other than Approved
217 217
 				&& $registration->status_ID() !== EEM_Registration::status_id_approved
218 218
 				// event hasn't sold out since initial visit
219
-				&& $registration->event()->is_sold_out( true )
219
+				&& $registration->event()->is_sold_out(true)
220 220
 			) {
221 221
 				// add event to list of events that are sold out
222
-				$sold_out_events[ $registration->event()->ID() ] = $registration->event();
222
+				$sold_out_events[$registration->event()->ID()] = $registration->event();
223 223
 				do_action(
224 224
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
225 225
 					$registration->event(),
@@ -228,29 +228,29 @@  discard block
 block discarded – undo
228 228
 				continue;
229 229
 			}
230 230
 			// are they allowed to pay now and is there monies owing?
231
-			if ( $registration->owes_monies_and_can_pay() ) {
232
-				$registrations_requiring_payment[ $registration->ID() ] = $registration;
231
+			if ($registration->owes_monies_and_can_pay()) {
232
+				$registrations_requiring_payment[$registration->ID()] = $registration;
233 233
 				do_action(
234 234
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
235 235
 					$registration->event(),
236 236
 					$this
237 237
 				);
238
-			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()  ) {
239
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
238
+			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) {
239
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
240 240
 			}
241 241
 		}
242 242
 		$subsections = array();
243 243
 		// now decide which template to load
244
-		if ( ! empty( $sold_out_events )) {
245
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
244
+		if ( ! empty($sold_out_events)) {
245
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
246 246
 		}
247
-		if ( ! empty( $registrations_requiring_pre_approval )) {
248
-			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval );
247
+		if ( ! empty($registrations_requiring_pre_approval)) {
248
+			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval);
249 249
 		}
250
-		if ( ! empty( $registrations_for_free_events ) ) {
251
-			$subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events );
250
+		if ( ! empty($registrations_for_free_events)) {
251
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
252 252
 		}
253
-		if ( ! empty( $registrations_requiring_payment ) ) {
253
+		if ( ! empty($registrations_requiring_payment)) {
254 254
 			// autoload Line_Item_Display classes
255 255
 			EEH_Autoloader::register_line_item_filter_autoloaders();
256 256
 			$line_item_filter_processor = new EE_Line_Item_Filter_Processor(
@@ -261,17 +261,17 @@  discard block
 block discarded – undo
261 261
 				$this->checkout->cart->get_grand_total()
262 262
 			);
263 263
 			$filtered_line_item_tree = $line_item_filter_processor->process();
264
-			if ( $this->checkout->amount_owing > 0 ) {
264
+			if ($this->checkout->amount_owing > 0) {
265 265
 				EEH_Autoloader::register_line_item_display_autoloaders();
266
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
267
-				$subsections[ 'payment_options' ] = $this->_display_payment_options(
266
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
267
+				$subsections['payment_options'] = $this->_display_payment_options(
268 268
 					$this->line_item_display->display_line_item(
269 269
 						$filtered_line_item_tree,
270
-						array( 'registrations' => $registrations )
270
+						array('registrations' => $registrations)
271 271
 					)
272 272
 				);
273 273
 				$this->checkout->amount_owing = $filtered_line_item_tree->total();
274
-				$this->_apply_registration_payments_to_amount_owing( $registrations );
274
+				$this->_apply_registration_payments_to_amount_owing($registrations);
275 275
 			}
276 276
 			$no_payment_required = false;
277 277
 		} else {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 		$this->_save_selected_method_of_payment();
281 281
 
282 282
 		$subsections['default_hidden_inputs'] = $this->reg_step_hidden_inputs();
283
-		$subsections['extra_hidden_inputs' ] = $this->_extra_hidden_inputs( $no_payment_required );
283
+		$subsections['extra_hidden_inputs'] = $this->_extra_hidden_inputs($no_payment_required);
284 284
 
285 285
 		return new EE_Form_Section_Proper(
286 286
 			array(
@@ -308,21 +308,21 @@  discard block
 block discarded – undo
308 308
 	 * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection
309 309
 	 * @return \EE_Line_Item_Filter_Collection
310 310
 	 */
311
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
312
-		if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) {
311
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
312
+		if ( ! EE_Registry::instance()->SSN instanceof EE_Session) {
313 313
 			return $line_item_filter_collection;
314 314
 		}
315
-		if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout ) {
315
+		if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout) {
316 316
 			return $line_item_filter_collection;
317 317
 		}
318
-		if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction ) {
318
+		if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction) {
319 319
 			return $line_item_filter_collection;
320 320
 		}
321 321
 		$registrations = EE_Registry::instance()->SSN->checkout()->transaction->registrations(
322 322
 			EE_Registry::instance()->SSN->checkout()->reg_cache_where_params
323 323
 		);
324
-		$line_item_filter_collection->add( new EE_Billable_Line_Item_Filter( $registrations ) );
325
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
324
+		$line_item_filter_collection->add(new EE_Billable_Line_Item_Filter($registrations));
325
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
326 326
 		return $line_item_filter_collection;
327 327
 	}
328 328
 
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 * @return void
337 337
 	 */
338 338
 	protected function _hide_reg_step_submit_button_if_revisit() {
339
-		if ( $this->checkout->revisit ) {
340
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
339
+		if ($this->checkout->revisit) {
340
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
341 341
 		}
342 342
 	}
343 343
 
@@ -348,18 +348,18 @@  discard block
 block discarded – undo
348 348
 	 * @param \EE_Event[] $sold_out_events_array
349 349
 	 * @return \EE_Form_Section_Proper
350 350
 	 */
351
-	private function _sold_out_events( $sold_out_events_array = array() ) {
351
+	private function _sold_out_events($sold_out_events_array = array()) {
352 352
 		// set some defaults
353 353
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
354 354
 		$sold_out_events = '';
355
-		foreach ( $sold_out_events_array as $sold_out_event ) {
356
-			$sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ));
355
+		foreach ($sold_out_events_array as $sold_out_event) {
356
+			$sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text'));
357 357
 		}
358 358
 		return new EE_Form_Section_Proper(
359 359
 			array(
360 360
 				'layout_strategy'		=> new EE_Template_Layout(
361 361
 					array(
362
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template
362
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template
363 363
 						'template_args'  				=> apply_filters(
364 364
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
365 365
 							array(
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 								'sold_out_events_msg' 	=> apply_filters(
368 368
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg',
369 369
 									sprintf(
370
-										__( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.%3$s%3$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%2$s', 'event_espresso' ),
370
+										__('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.%3$s%3$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%2$s', 'event_espresso'),
371 371
 										'<strong>',
372 372
 										'</strong>',
373 373
 										'<br />'
@@ -388,14 +388,14 @@  discard block
 block discarded – undo
388 388
 	 * @param array $registrations_requiring_pre_approval
389 389
 	 * @return \EE_Form_Section_Proper
390 390
 	 */
391
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) {
391
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
392 392
 		$events_requiring_pre_approval = '';
393
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
394
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
395
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
396
-					EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
393
+		foreach ($registrations_requiring_pre_approval as $registration) {
394
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
395
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
396
+					EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
397 397
 					)
398
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
398
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
399 399
 				);
400 400
 			}
401 401
 		}
@@ -403,14 +403,14 @@  discard block
 block discarded – undo
403 403
 			array(
404 404
 				'layout_strategy'		=> new EE_Template_Layout(
405 405
 					array(
406
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template
406
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template
407 407
 						'template_args'  				=> apply_filters(
408 408
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
409 409
 							array(
410
-								'events_requiring_pre_approval' 			=> implode( '', $events_requiring_pre_approval ),
410
+								'events_requiring_pre_approval' 			=> implode('', $events_requiring_pre_approval),
411 411
 								'events_requiring_pre_approval_msg' 	=> apply_filters(
412 412
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
413
-									__( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' )
413
+									__('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso')
414 414
 								)
415 415
 							)
416 416
 						),
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 * @param \EE_Event[] $registrations_for_free_events
429 429
 	 * @return \EE_Form_Section_Proper
430 430
 	 */
431
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
431
+	private function _no_payment_required($registrations_for_free_events = array()) {
432 432
 		// set some defaults
433 433
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
434 434
 		// generate no_payment_required form
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 			array(
437 437
 				'layout_strategy' 	=> new EE_Template_Layout(
438 438
 					array(
439
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template
439
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template
440 440
 						'template_args'  				=> apply_filters(
441 441
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
442 442
 							array(
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 								'registrations' => array(),
445 445
 								'ticket_count' 	=> array(),
446 446
 								'registrations_for_free_events' 	=> $registrations_for_free_events,
447
-								'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' ))
447
+								'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso'))
448 448
 							)
449 449
 						),
450 450
 					)
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	 * @param string $transaction_details
462 462
 	 * @return \EE_Form_Section_Proper
463 463
 	 */
464
-	private function _display_payment_options( $transaction_details = '' ) {
464
+	private function _display_payment_options($transaction_details = '') {
465 465
 		// has method_of_payment been set by no-js user?
466 466
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
467 467
 		// build payment options form
@@ -473,18 +473,18 @@  discard block
 block discarded – undo
473 473
 						'before_payment_options' => apply_filters(
474 474
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
475 475
 							new EE_Form_Section_Proper(
476
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
476
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
477 477
 							)
478 478
 						),
479 479
 						'payment_options' => $this->_setup_payment_options(),
480 480
 						'after_payment_options' => apply_filters(
481 481
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
482 482
 							new EE_Form_Section_Proper(
483
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
483
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
484 484
 							)
485 485
 						),
486 486
 					),
487
-					'layout_strategy'	=> new EE_Template_Layout( array(
487
+					'layout_strategy'	=> new EE_Template_Layout(array(
488 488
 							'layout_template_file' 	=> $this->_template,
489 489
 							'template_args'  				=> apply_filters(
490 490
 								'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args',
@@ -508,11 +508,11 @@  discard block
 block discarded – undo
508 508
 	 * @param bool $no_payment_required
509 509
 	 * @return \EE_Form_Section_Proper
510 510
 	 */
511
-	private function _extra_hidden_inputs( $no_payment_required = TRUE ) {
511
+	private function _extra_hidden_inputs($no_payment_required = TRUE) {
512 512
 
513 513
 		return new EE_Form_Section_Proper(
514 514
 			array(
515
-				'html_id' 				=> 'ee-' . $this->slug() . '-extra-hidden-inputs',
515
+				'html_id' 				=> 'ee-'.$this->slug().'-extra-hidden-inputs',
516 516
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
517 517
 				'subsections' 		=> array(
518 518
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -545,16 +545,16 @@  discard block
 block discarded – undo
545 545
 	 * @access    protected
546 546
 	 * @return    void
547 547
 	 */
548
-	protected function _apply_registration_payments_to_amount_owing( $registrations ) {
548
+	protected function _apply_registration_payments_to_amount_owing($registrations) {
549 549
 		$payments = array();
550
-		foreach ( $registrations as $registration ) {
551
-			if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
550
+		foreach ($registrations as $registration) {
551
+			if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
552 552
 				$payments = $payments + $registration->registration_payments();
553 553
 			}
554 554
 		}
555
-		if ( ! empty( $payments ) ) {
556
-			foreach ( $payments as $payment ) {
557
-				if ( $payment instanceof EE_Registration_Payment ) {
555
+		if ( ! empty($payments)) {
556
+			foreach ($payments as $payment) {
557
+				if ($payment instanceof EE_Registration_Payment) {
558 558
 					$this->checkout->amount_owing -= $payment->amount();
559 559
 				}
560 560
 			}
@@ -569,9 +569,9 @@  discard block
 block discarded – undo
569 569
 	 * @param 	bool $force_reset
570 570
 	 * @return 	void
571 571
 	 */
572
-	private function _reset_selected_method_of_payment( $force_reset = FALSE ) {
573
-		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE ));
574
-		if ( $reset_payment_method ) {
572
+	private function _reset_selected_method_of_payment($force_reset = FALSE) {
573
+		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE));
574
+		if ($reset_payment_method) {
575 575
 			$this->checkout->selected_method_of_payment = NULL;
576 576
 			$this->checkout->payment_method = NULL;
577 577
 			$this->checkout->billing_form = NULL;
@@ -590,9 +590,9 @@  discard block
 block discarded – undo
590 590
 	 * @param string $selected_method_of_payment
591 591
 	 * 	@return 		EE_Billing_Info_Form
592 592
 	 */
593
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
594
-		$selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
595
-		EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment ));
593
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
594
+		$selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
595
+		EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment));
596 596
 	}
597 597
 
598 598
 
@@ -605,40 +605,40 @@  discard block
 block discarded – undo
605 605
 		// load payment method classes
606 606
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
607 607
 		// switch up header depending on number of available payment methods
608
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
609
-			? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' ))
610
-			: apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' ));
608
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
609
+			? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso'))
610
+			: apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso'));
611 611
 		$available_payment_methods = array(
612 612
 			// display the "Payment Method" header
613 613
 			'payment_method_header' => new EE_Form_Section_HTML(
614
-				EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' )
614
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
615 615
 			)
616 616
 		);
617 617
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
618 618
 		$available_payment_method_options = array();
619 619
 		$default_payment_method_option = array();
620 620
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
621
-		$payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' )));
621
+		$payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;')));
622 622
 		// loop through payment methods
623
-		foreach( $this->checkout->available_payment_methods as $payment_method ) {
624
-			if ( $payment_method instanceof EE_Payment_Method ) {
625
-				$payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' );
623
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
624
+			if ($payment_method instanceof EE_Payment_Method) {
625
+				$payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img');
626 626
 				// check if any payment methods are set as default
627 627
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
628
-				if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) {
628
+				if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) {
629 629
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
630 630
 					$this->_save_selected_method_of_payment();
631
-					$default_payment_method_option[ $payment_method->slug() ] =  $payment_method_button;
631
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
632 632
 				} else {
633
-					$available_payment_method_options[ $payment_method->slug() ] =  $payment_method_button;
633
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
634 634
 				}
635
-				$payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method );
635
+				$payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method);
636 636
 			}
637 637
 		}
638 638
 		// prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs
639 639
 		$available_payment_method_options = $default_payment_method_option + $available_payment_method_options;
640 640
 		// now generate the actual form  inputs
641
-		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options );
641
+		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options);
642 642
 		$available_payment_methods = $available_payment_methods + $payment_methods_billing_info;
643 643
 
644 644
 		// build the available payment methods form
@@ -658,19 +658,19 @@  discard block
 block discarded – undo
658 658
 	 * @return EE_Payment_Method[]
659 659
 	 */
660 660
 	protected function _get_available_payment_methods() {
661
-		if ( ! empty( $this->checkout->available_payment_methods )) {
661
+		if ( ! empty($this->checkout->available_payment_methods)) {
662 662
 			return $this->checkout->available_payment_methods;
663 663
 		}
664 664
 		$available_payment_methods = array();
665 665
 		// load EEM_Payment_Method
666
-		EE_Registry::instance()->load_model( 'Payment_Method' );
666
+		EE_Registry::instance()->load_model('Payment_Method');
667 667
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
668 668
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
669 669
 		// get all active payment methods
670
-		$payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart );
671
-		foreach ( $payment_methods as $payment_method ) {
672
-			if ( $payment_method instanceof EE_Payment_Method ) {
673
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
670
+		$payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart);
671
+		foreach ($payment_methods as $payment_method) {
672
+			if ($payment_method instanceof EE_Payment_Method) {
673
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
674 674
 			}
675 675
 		}
676 676
 		return $available_payment_methods;
@@ -686,14 +686,14 @@  discard block
 block discarded – undo
686 686
 	 * @param 	array $available_payment_method_options
687 687
 	 * @return 	\EE_Form_Section_Proper
688 688
 	 */
689
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
689
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
690 690
 		// generate inputs
691 691
 		return new EE_Form_Section_Proper(
692 692
 			array(
693 693
 				'html_id' 				=> 'ee-available-payment-method-inputs',
694 694
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
695 695
 				'subsections' 		=> array(
696
-					'' => new EE_Radio_Button_Input (
696
+					'' => new EE_Radio_Button_Input(
697 697
 						$available_payment_method_options,
698 698
 						array(
699 699
 							'html_name' 				=> 'selected_method_of_payment',
@@ -717,36 +717,36 @@  discard block
 block discarded – undo
717 717
 	 * @param 	EE_Payment_Method $payment_method
718 718
 	 * @return 	\EE_Form_Section_Proper
719 719
 	 */
720
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
720
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
721 721
 		$currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE;
722 722
 		// generate the billing form for payment method
723
-		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML();
723
+		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML();
724 724
 		$this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form;
725 725
 		// it's all in the details
726
-		$info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' );
726
+		$info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr');
727 727
 		// add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not
728
-		if ( $payment_method->description() ) {
728
+		if ($payment_method->description()) {
729 729
 			$payment_method_info = $payment_method->description();
730
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
731
-			$payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
730
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
731
+			$payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
732 732
 		} else {
733
-			$payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
733
+			$payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
734 734
 		}
735
-		$info_html .= EEH_HTML::p (
736
-			apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ),
735
+		$info_html .= EEH_HTML::p(
736
+			apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info),
737 737
 			'',
738 738
 			'spco-payment-method-desc ee-attention'
739 739
 		);
740 740
 
741 741
 		return new EE_Form_Section_Proper(
742 742
 			array(
743
-				'html_id' 					=> 'spco-payment-method-info-' . $payment_method->slug(),
743
+				'html_id' 					=> 'spco-payment-method-info-'.$payment_method->slug(),
744 744
 				'html_class' 			=> 'spco-payment-method-info-dv',
745 745
 				// only display the selected or default PM
746 746
 				'html_style' 			=> $currently_selected ? '' : 'display:none;',
747 747
 				'layout_strategy'		=> new EE_Div_Per_Section_Layout(),
748 748
 				'subsections' 			=> array(
749
-					'info' 					=> new EE_Form_Section_HTML( $info_html ),
749
+					'info' 					=> new EE_Form_Section_HTML($info_html),
750 750
 					'billing_form' 		=> $currently_selected ? $billing_form : new EE_Form_Section_HTML()
751 751
 				)
752 752
 			)
@@ -764,12 +764,12 @@  discard block
 block discarded – undo
764 764
 	 */
765 765
 	public function get_billing_form_html_for_payment_method() {
766 766
 		// how have they chosen to pay?
767
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
767
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
768 768
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
769
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
769
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
770 770
 			return FALSE;
771 771
 		}
772
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
772
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
773 773
             EE_Error::add_success(
774 774
                 apply_filters(
775 775
                     'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -778,20 +778,20 @@  discard block
 block discarded – undo
778 778
             );
779 779
         }
780 780
 		// now generate billing form for selected method of payment
781
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
781
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
782 782
 		// fill form with attendee info if applicable
783
-		if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
784
-			$payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
783
+		if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
784
+			$payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
785 785
 		}
786 786
 		// and debug content
787
-		if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
788
-			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form );
787
+		if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
788
+			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form);
789 789
 		}
790 790
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : '';
791
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ));
791
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
792 792
 		// localize validation rules for main form
793 793
 		$this->checkout->current_step->reg_form->localize_validation_rules();
794
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
794
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
795 795
 		return TRUE;
796 796
 	}
797 797
 
@@ -804,15 +804,15 @@  discard block
 block discarded – undo
804 804
 	 * @param EE_Payment_Method $payment_method
805 805
 	 * @return \EE_Billing_Info_Form
806 806
 	 */
807
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
808
-		$billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) );
809
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
810
-			if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) {
811
-                if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
807
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
808
+		$billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing));
809
+		if ($billing_form instanceof EE_Billing_Info_Form) {
810
+			if (EE_Registry::instance()->REQ->is_set('payment_method')) {
811
+                if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
812 812
                     EE_Error::add_success(
813 813
                         apply_filters(
814 814
                             'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
815
-                            sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
815
+                            sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name())
816 816
                         )
817 817
                     );
818 818
                 }
@@ -837,27 +837,27 @@  discard block
 block discarded – undo
837 837
 	 * @param string 		$request_param
838 838
 	 * @return NULL|string
839 839
 	 */
840
-	private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) {
840
+	private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') {
841 841
 		// is selected_method_of_payment set in the request ?
842
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE );
843
-		if ( $selected_method_of_payment ) {
842
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE);
843
+		if ($selected_method_of_payment) {
844 844
 			// sanitize it
845
-			$selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment;
846
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
845
+			$selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment;
846
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
847 847
 			// store it in the session so that it's available for all subsequent requests including AJAX
848
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
848
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
849 849
 		} else {
850 850
 			// or is is set in the session ?
851
-			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' );
851
+			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment');
852 852
 		}
853 853
 		// do ya really really gotta have it?
854
-		if ( empty( $selected_method_of_payment ) && $required ) {
854
+		if (empty($selected_method_of_payment) && $required) {
855 855
 			EE_Error::add_error(
856 856
 				sprintf(
857
-					__( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ),
857
+					__('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'),
858 858
 					'<br/>',
859 859
 					'<br/>',
860
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
860
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
861 861
 				),
862 862
 				__FILE__, __FUNCTION__, __LINE__
863 863
 			);
@@ -883,37 +883,37 @@  discard block
 block discarded – undo
883 883
 	 * @return string
884 884
 	 */
885 885
 	public function switch_payment_method() {
886
-		if ( ! $this->_verify_payment_method_is_set() ) {
886
+		if ( ! $this->_verify_payment_method_is_set()) {
887 887
 			return false;
888 888
 		}
889
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
889
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
890 890
 			EE_Error::add_success(
891 891
 				apply_filters(
892 892
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
893
-					sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() )
893
+					sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
894 894
 				)
895 895
 			);
896 896
 		}
897 897
 		// generate billing form for selected method of payment if it hasn't been done already
898
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
899
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
898
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
899
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
900 900
 		}
901 901
 		// fill form with attendee info if applicable
902
-		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
903
-			$this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
902
+		if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
903
+			$this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
904 904
 		}
905 905
 		// and debug content
906
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
907
-			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form );
906
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
907
+			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form);
908 908
 		}
909 909
 		// get html and validation rules for form
910
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
911
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() ));
910
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
911
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html()));
912 912
 			// localize validation rules for main form
913
-			$this->checkout->billing_form->localize_validation_rules( TRUE );
914
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
913
+			$this->checkout->billing_form->localize_validation_rules(TRUE);
914
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
915 915
 		} else {
916
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ));
916
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
917 917
 		}
918 918
 		//prevents advancement to next step
919 919
 		$this->checkout->continue_reg = FALSE;
@@ -928,18 +928,18 @@  discard block
 block discarded – undo
928 928
 	 */
929 929
 	protected function _verify_payment_method_is_set() {
930 930
 		// generate billing form for selected method of payment if it hasn't been done already
931
-		if ( empty( $this->checkout->selected_method_of_payment )) {
931
+		if (empty($this->checkout->selected_method_of_payment)) {
932 932
 			// how have they chosen to pay?
933
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
933
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
934 934
 		} else {
935 935
 			// choose your own adventure based on method_of_payment
936
-			switch ( $this->checkout->selected_method_of_payment ) {
936
+			switch ($this->checkout->selected_method_of_payment) {
937 937
 				case 'events_sold_out' :
938 938
 					EE_Error::add_attention(
939 939
 						apply_filters(
940 940
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__sold_out_events_msg',
941
-							__( 'It appears that the event you were about to make a payment for has sold out since this form first loaded. Please contact the event administrator if you believe this is an error.',
942
-								'event_espresso' )
941
+							__('It appears that the event you were about to make a payment for has sold out since this form first loaded. Please contact the event administrator if you believe this is an error.',
942
+								'event_espresso')
943 943
 						),
944 944
 						__FILE__, __FUNCTION__, __LINE__
945 945
 					);
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 					EE_Error::add_attention(
950 950
 						apply_filters(
951 951
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__payments_closed_msg',
952
-							__( 'It appears that the event you were about to make a payment for is not accepting payments at this time. Please contact the event administrator if you believe this is an error.', 'event_espresso' )
952
+							__('It appears that the event you were about to make a payment for is not accepting payments at this time. Please contact the event administrator if you believe this is an error.', 'event_espresso')
953 953
 						),
954 954
 						__FILE__, __FUNCTION__, __LINE__
955 955
 					);
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 					EE_Error::add_attention(
960 960
 						apply_filters(
961 961
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__no_payment_required_msg',
962
-							__( 'It appears that the event you were about to make a payment for does not require payment. Please contact the event administrator if you believe this is an error.', 'event_espresso' )
962
+							__('It appears that the event you were about to make a payment for does not require payment. Please contact the event administrator if you believe this is an error.', 'event_espresso')
963 963
 						),
964 964
 						__FILE__, __FUNCTION__, __LINE__
965 965
 					);
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 			}
970 970
 		}
971 971
 		// verify payment method
972
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
972
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
973 973
 			// get payment method for selected method of payment
974 974
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
975 975
 		}
@@ -989,23 +989,23 @@  discard block
 block discarded – undo
989 989
 	 * @return void
990 990
 	 */
991 991
 	public function save_payer_details_via_ajax() {
992
-		if ( ! $this->_verify_payment_method_is_set() ) {
992
+		if ( ! $this->_verify_payment_method_is_set()) {
993 993
 			return;
994 994
 		}
995 995
 		// generate billing form for selected method of payment if it hasn't been done already
996
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
997
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
996
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
997
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
998 998
 		}
999 999
 		// generate primary attendee from payer info if applicable
1000 1000
 		if ( ! $this->checkout->transaction_has_primary_registrant()) {
1001 1001
 			$attendee = $this->_create_attendee_from_request_data();
1002
-			if ( $attendee instanceof EE_Attendee ) {
1003
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
1004
-					if ( $registration->is_primary_registrant() ) {
1002
+			if ($attendee instanceof EE_Attendee) {
1003
+				foreach ($this->checkout->transaction->registrations() as $registration) {
1004
+					if ($registration->is_primary_registrant()) {
1005 1005
 						$this->checkout->primary_attendee_obj = $attendee;
1006
-						$registration->_add_relation_to( $attendee, 'Attendee' );
1007
-						$registration->set_attendee_id( $attendee->ID() );
1008
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
1006
+						$registration->_add_relation_to($attendee, 'Attendee');
1007
+						$registration->set_attendee_id($attendee->ID());
1008
+						$registration->update_cache_after_object_save('Attendee', $attendee);
1009 1009
 					}
1010 1010
 				}
1011 1011
 			}
@@ -1018,56 +1018,56 @@  discard block
 block discarded – undo
1018 1018
 	 * uses info from alternate GET or POST data (such as AJAX) to create a new attendee
1019 1019
 	 * @return \EE_Attendee
1020 1020
 	 */
1021
-	protected function _create_attendee_from_request_data(){
1021
+	protected function _create_attendee_from_request_data() {
1022 1022
 		// get State ID
1023
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
1024
-		if ( ! empty( $STA_ID )) {
1023
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
1024
+		if ( ! empty($STA_ID)) {
1025 1025
 			// can we get state object from name ?
1026
-			EE_Registry::instance()->load_model( 'State' );
1027
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' );
1028
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
1026
+			EE_Registry::instance()->load_model('State');
1027
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
1028
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
1029 1029
 		}
1030 1030
 		// get Country ISO
1031
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
1032
-		if ( ! empty( $CNT_ISO )) {
1031
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
1032
+		if ( ! empty($CNT_ISO)) {
1033 1033
 			// can we get country object from name ?
1034
-			EE_Registry::instance()->load_model( 'Country' );
1035
-			$country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' );
1036
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
1034
+			EE_Registry::instance()->load_model('Country');
1035
+			$country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO');
1036
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
1037 1037
 		}
1038 1038
 		// grab attendee data
1039 1039
 		$attendee_data = array(
1040
-			'ATT_fname' 		=> ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
1041
-			'ATT_lname' 		=> ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
1042
-			'ATT_email' 		=> ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1043
-			'ATT_address' 		=> ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1044
-			'ATT_address2' 	=> ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1045
-			'ATT_city' 			=> ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
1040
+			'ATT_fname' 		=> ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
1041
+			'ATT_lname' 		=> ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
1042
+			'ATT_email' 		=> ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1043
+			'ATT_address' 		=> ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1044
+			'ATT_address2' 	=> ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1045
+			'ATT_city' 			=> ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1046 1046
 			'STA_ID' 				=> $STA_ID,
1047 1047
 			'CNT_ISO' 			=> $CNT_ISO,
1048
-			'ATT_zip' 				=> ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1049
-			'ATT_phone' 		=> ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1048
+			'ATT_zip' 				=> ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1049
+			'ATT_phone' 		=> ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1050 1050
 		);
1051 1051
 		// validate the email address since it is the most important piece of info
1052
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) {
1053
-			EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1052
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) {
1053
+			EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1054 1054
 		}
1055 1055
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1056
-		if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) {
1057
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1056
+		if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) {
1057
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1058 1058
 				'ATT_fname' => $attendee_data['ATT_fname'],
1059 1059
 				'ATT_lname' => $attendee_data['ATT_lname'],
1060 1060
 				'ATT_email' => $attendee_data['ATT_email']
1061 1061
 			));
1062
-			if ( $existing_attendee instanceof EE_Attendee ) {
1062
+			if ($existing_attendee instanceof EE_Attendee) {
1063 1063
 				return $existing_attendee;
1064 1064
 			}
1065 1065
 		}
1066 1066
 		// no existing attendee? kk let's create a new one
1067 1067
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1068
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1069
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1070
-		return EE_Attendee::new_instance( $attendee_data );
1068
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1069
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1070
+		return EE_Attendee::new_instance($attendee_data);
1071 1071
 	}
1072 1072
 
1073 1073
 
@@ -1087,22 +1087,22 @@  discard block
 block discarded – undo
1087 1087
 	 */
1088 1088
 	public function process_reg_step() {
1089 1089
 		// how have they chosen to pay?
1090
-		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE );
1090
+		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE);
1091 1091
 		// choose your own adventure based on method_of_payment
1092
-		switch(  $this->checkout->selected_method_of_payment ) {
1092
+		switch ($this->checkout->selected_method_of_payment) {
1093 1093
 
1094 1094
 			case 'events_sold_out' :
1095 1095
 				$this->checkout->redirect = TRUE;
1096 1096
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1097
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1097
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1098 1098
 				// mark this reg step as completed
1099 1099
 				$this->set_completed();
1100 1100
 				return FALSE;
1101 1101
 				break;
1102 1102
 
1103 1103
 			case 'payments_closed' :
1104
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) {
1105
-					EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1104
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) {
1105
+					EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1106 1106
 				}
1107 1107
 				// mark this reg step as completed
1108 1108
 				$this->set_completed();
@@ -1110,8 +1110,8 @@  discard block
 block discarded – undo
1110 1110
 				break;
1111 1111
 
1112 1112
 			case 'no_payment_required' :
1113
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) {
1114
-					EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1113
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) {
1114
+					EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1115 1115
 				}
1116 1116
 				// mark this reg step as completed
1117 1117
 				$this->set_completed();
@@ -1120,9 +1120,9 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
 			default:
1122 1122
 				$payment_successful = $this->_process_payment();
1123
-				if ( $payment_successful ) {
1123
+				if ($payment_successful) {
1124 1124
 					$this->checkout->continue_reg = true;
1125
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1125
+					$this->_maybe_set_completed($this->checkout->payment_method);
1126 1126
 				} else {
1127 1127
 					$this->checkout->continue_reg = false;
1128 1128
 				}
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
 	 * @param \EE_Payment_Method $payment_method
1141 1141
 	 * @return void
1142 1142
 	 */
1143
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1144
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1143
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1144
+		switch ($payment_method->type_obj()->payment_occurs()) {
1145 1145
 			case EE_PMT_Base::offsite :
1146 1146
 				break;
1147 1147
 			case EE_PMT_Base::onsite :
@@ -1164,15 +1164,15 @@  discard block
 block discarded – undo
1164 1164
 	public function update_reg_step() {
1165 1165
 		$success = TRUE;
1166 1166
 		// if payment required
1167
-		if ( $this->checkout->transaction->total() > 0 ) {
1168
-			do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction );
1167
+		if ($this->checkout->transaction->total() > 0) {
1168
+			do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction);
1169 1169
 			// attempt payment via payment method
1170 1170
 			$success = $this->process_reg_step();
1171 1171
 		}
1172
-		if ( $success && ! $this->checkout->redirect ) {
1173
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() );
1172
+		if ($success && ! $this->checkout->redirect) {
1173
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID());
1174 1174
 			 // set return URL
1175
-			$this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url );
1175
+			$this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url);
1176 1176
 		}
1177 1177
 		return $success;
1178 1178
 	}
@@ -1190,32 +1190,32 @@  discard block
 block discarded – undo
1190 1190
 	 */
1191 1191
 	private function _process_payment() {
1192 1192
 		// basically confirm that the event hasn't sold out since they hit the page
1193
-		if ( ! $this->_last_second_ticket_verifications() ) {
1193
+		if ( ! $this->_last_second_ticket_verifications()) {
1194 1194
 			return false;
1195 1195
 		}
1196 1196
 		// ya gotta make a choice man
1197
-		if ( empty( $this->checkout->selected_method_of_payment )) {
1198
-			$this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' ));
1197
+		if (empty($this->checkout->selected_method_of_payment)) {
1198
+			$this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso'));
1199 1199
 			return FALSE;
1200 1200
 		}
1201 1201
 		// get EE_Payment_Method object
1202
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1202
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1203 1203
 			return FALSE;
1204 1204
 		}
1205 1205
 		// setup billing form
1206
-		if ( $this->checkout->payment_method->is_on_site() ) {
1207
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1206
+		if ($this->checkout->payment_method->is_on_site()) {
1207
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1208 1208
 			// bad billing form ?
1209
-			if ( ! $this->_billing_form_is_valid() ) {
1209
+			if ( ! $this->_billing_form_is_valid()) {
1210 1210
 				return FALSE;
1211 1211
 			}
1212 1212
 		}
1213 1213
 		// ensure primary registrant has been fully processed
1214
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1214
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1215 1215
 			return FALSE;
1216 1216
 		}
1217 1217
 		// if session is close to expiring (under 10 minutes by default)
1218
-		if ( ( time() - EE_Registry::instance()->SSN->expiration() ) < EE_Registry::instance()->SSN->extension() ) {
1218
+		if ((time() - EE_Registry::instance()->SSN->expiration()) < EE_Registry::instance()->SSN->extension()) {
1219 1219
 			// add some time to session expiration so that payment can be completed
1220 1220
 			EE_Registry::instance()->SSN->extend_expiration();
1221 1221
 		}
@@ -1224,24 +1224,24 @@  discard block
 block discarded – undo
1224 1224
 		// in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved
1225 1225
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1226 1226
 		// attempt payment
1227
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1227
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1228 1228
 		// process results
1229
-		$payment = $this->_validate_payment( $payment );
1230
-		$payment = $this->_post_payment_processing( $payment );
1229
+		$payment = $this->_validate_payment($payment);
1230
+		$payment = $this->_post_payment_processing($payment);
1231 1231
 		// verify payment
1232
-		if ( $payment instanceof EE_Payment ) {
1232
+		if ($payment instanceof EE_Payment) {
1233 1233
 			// store that for later
1234 1234
 			$this->checkout->payment = $payment;
1235 1235
 			/** @type EE_Transaction_Processor $transaction_processor */
1236
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1236
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1237 1237
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1238
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1239
-			if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) {
1238
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1239
+			if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) {
1240 1240
 				return true;
1241 1241
 			} else {
1242 1242
 				return false;
1243 1243
 			}
1244
-		} else if ( $payment === true ) {
1244
+		} else if ($payment === true) {
1245 1245
 			// please note that offline payment methods will NOT make a payment,
1246 1246
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1247 1247
 			$this->checkout->payment = $payment;
@@ -1261,22 +1261,22 @@  discard block
 block discarded – undo
1261 1261
 	 */
1262 1262
 	protected function _last_second_ticket_verifications() {
1263 1263
 		// don't bother re-validating if not a return visit
1264
-		if ( ! $this->checkout->revisit ) {
1264
+		if ( ! $this->checkout->revisit) {
1265 1265
 			return true;
1266 1266
 		}
1267 1267
 		$registrations = $this->checkout->transaction->registrations();
1268
-		if ( empty( $registrations ) ) {
1268
+		if (empty($registrations)) {
1269 1269
 			return false;
1270 1270
 		}
1271
-		foreach ( $registrations as $registration ) {
1272
-			if ( $registration instanceof EE_Registration ) {
1271
+		foreach ($registrations as $registration) {
1272
+			if ($registration instanceof EE_Registration) {
1273 1273
 				$event = $registration->event_obj();
1274
-				if ( ! ( $event instanceof EE_Event && $event->is_sold_out( true ) ) ) {
1274
+				if ( ! ($event instanceof EE_Event && $event->is_sold_out(true))) {
1275 1275
 					EE_Error::add_error(
1276 1276
 						apply_filters(
1277 1277
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___last_second_ticket_verifications__sold_out_events_msg',
1278 1278
 							sprintf(
1279
-								__( 'It appears that the %1$s event that you were about to make a payment for has sold out since you first registered and/or arrived at this page. Please refresh the page and try again. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' ),
1279
+								__('It appears that the %1$s event that you were about to make a payment for has sold out since you first registered and/or arrived at this page. Please refresh the page and try again. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso'),
1280 1280
 								$event->name()
1281 1281
 							)
1282 1282
 						),
@@ -1300,10 +1300,10 @@  discard block
 block discarded – undo
1300 1300
 	 * @return bool
1301 1301
 	 */
1302 1302
 	public function redirect_form() {
1303
-		$payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() );
1303
+		$payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment());
1304 1304
 		$html = $payment_method_billing_info->get_html_and_js();
1305 1305
 		$html .= $this->checkout->redirect_form;
1306
-		EE_Registry::instance()->REQ->add_output( $html );
1306
+		EE_Registry::instance()->REQ->add_output($html);
1307 1307
 		return TRUE;
1308 1308
 	}
1309 1309
 
@@ -1316,36 +1316,36 @@  discard block
 block discarded – undo
1316 1316
 	 * @return bool
1317 1317
 	 */
1318 1318
 	private function _billing_form_is_valid() {
1319
-		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1319
+		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) {
1320 1320
 			return TRUE;
1321 1321
 		}
1322
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1323
-			if ( $this->checkout->billing_form->was_submitted() ) {
1322
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1323
+			if ($this->checkout->billing_form->was_submitted()) {
1324 1324
 				$this->checkout->billing_form->receive_form_submission();
1325
-				if ( $this->checkout->billing_form->is_valid() ) {
1325
+				if ($this->checkout->billing_form->is_valid()) {
1326 1326
 					return TRUE;
1327 1327
 				}
1328 1328
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1329 1329
 				$error_strings = array();
1330
-				foreach( $validation_errors as $validation_error ){
1331
-					if( $validation_error instanceof EE_Validation_Error ){
1330
+				foreach ($validation_errors as $validation_error) {
1331
+					if ($validation_error instanceof EE_Validation_Error) {
1332 1332
 						$form_section = $validation_error->get_form_section();
1333
-						if( $form_section instanceof EE_Form_Input_Base ){
1333
+						if ($form_section instanceof EE_Form_Input_Base) {
1334 1334
 							$label = $form_section->html_label_text();
1335
-						}elseif( $form_section instanceof EE_Form_Section_Base ){
1335
+						}elseif ($form_section instanceof EE_Form_Section_Base) {
1336 1336
 							$label = $form_section->name();
1337
-						}else{
1338
-							$label = __( 'Validation Error', 'event_espresso' );
1337
+						} else {
1338
+							$label = __('Validation Error', 'event_espresso');
1339 1339
 						}
1340
-						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() );
1340
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1341 1341
 					}
1342 1342
 				}
1343
-				EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings )  ), __FILE__, __FUNCTION__, __LINE__ );
1343
+				EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__);
1344 1344
 			} else {
1345
-				EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1345
+				EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1346 1346
 			}
1347 1347
 		} else {
1348
-			EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1348
+			EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1349 1349
 		}
1350 1350
 		return FALSE;
1351 1351
 	}
@@ -1363,9 +1363,9 @@  discard block
 block discarded – undo
1363 1363
 	 */
1364 1364
 		private function _setup_primary_registrant_prior_to_payment() {
1365 1365
 			// check if transaction has a primary registrant and that it has a related Attendee object
1366
-			if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1366
+			if ( ! $this->checkout->transaction_has_primary_registrant()) {
1367 1367
 				// need to at least gather some primary registrant data before attempting payment
1368
-				if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) {
1368
+				if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) {
1369 1369
 					return FALSE;
1370 1370
 				}
1371 1371
 			}
@@ -1373,13 +1373,13 @@  discard block
 block discarded – undo
1373 1373
 			// grab the primary_registration object
1374 1374
 			$primary_registration = $this->checkout->transaction->primary_registration();
1375 1375
 			/** @type EE_Transaction_Processor $transaction_processor */
1376
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1376
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1377 1377
 			// at this point we'll consider a TXN to not have been failed
1378
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1378
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1379 1379
 			// save the TXN ( which clears cached copy of primary_registration)
1380 1380
 			$this->checkout->transaction->save();
1381 1381
 			// grab TXN ID and save it to the primary_registration
1382
-			$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1382
+			$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1383 1383
 			// save what we have so far
1384 1384
 			$primary_registration->save();
1385 1385
 			return TRUE;
@@ -1396,41 +1396,41 @@  discard block
 block discarded – undo
1396 1396
 		private function _capture_primary_registration_data_from_billing_form() {
1397 1397
 			// convert billing form data into an attendee
1398 1398
 			$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1399
-			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1399
+			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1400 1400
 				EE_Error::add_error(
1401 1401
 					sprintf(
1402
-						__( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1402
+						__('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1403 1403
 						'<br/>',
1404
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1404
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1405 1405
 					), __FILE__, __FUNCTION__, __LINE__
1406 1406
 				);
1407 1407
 				return FALSE;
1408 1408
 			}
1409 1409
 			$primary_registration = $this->checkout->transaction->primary_registration();
1410
-			if ( ! $primary_registration instanceof EE_Registration ) {
1410
+			if ( ! $primary_registration instanceof EE_Registration) {
1411 1411
 				EE_Error::add_error(
1412 1412
 					sprintf(
1413
-						__( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1413
+						__('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1414 1414
 						'<br/>',
1415
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1415
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1416 1416
 					), __FILE__, __FUNCTION__, __LINE__
1417 1417
 				);
1418 1418
 				return FALSE;
1419 1419
 			}
1420
-			if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) {
1420
+			if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) {
1421 1421
 				EE_Error::add_error(
1422 1422
 					sprintf(
1423
-						__( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1423
+						__('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1424 1424
 						'<br/>',
1425
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1425
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1426 1426
 					), __FILE__, __FUNCTION__, __LINE__
1427 1427
 				);
1428 1428
 				return FALSE;
1429 1429
 			}
1430 1430
 			/** @type EE_Registration_Processor $registration_processor */
1431
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1431
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1432 1432
 			// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1433
-			$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1433
+			$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1434 1434
 
1435 1435
 			return TRUE;
1436 1436
 		}
@@ -1446,35 +1446,35 @@  discard block
 block discarded – undo
1446 1446
 	 */
1447 1447
 		private function _get_payment_method_for_selected_method_of_payment() {
1448 1448
 			// get EE_Payment_Method object
1449
-			if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) {
1450
-				$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1449
+			if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1450
+				$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1451 1451
 			} else {
1452 1452
 				// load EEM_Payment_Method
1453
-				EE_Registry::instance()->load_model( 'Payment_Method' );
1453
+				EE_Registry::instance()->load_model('Payment_Method');
1454 1454
 				/** @type EEM_Payment_Method $EEM_Payment_Method */
1455 1455
 				$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1456
-				$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1456
+				$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1457 1457
 			}
1458 1458
 			// verify $payment_method
1459
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
1459
+			if ( ! $payment_method instanceof EE_Payment_Method) {
1460 1460
 				// not a payment
1461 1461
 				EE_Error::add_error(
1462 1462
 					sprintf(
1463
-						__( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1463
+						__('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1464 1464
 						'<br/>',
1465
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1465
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1466 1466
 					), __FILE__, __FUNCTION__, __LINE__
1467 1467
 				);
1468 1468
 				return NULL;
1469 1469
 			}
1470 1470
 			// and verify it has a valid Payment_Method Type object
1471
-			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1471
+			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1472 1472
 				// not a payment
1473 1473
 				EE_Error::add_error(
1474 1474
 					sprintf(
1475
-						__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1475
+						__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1476 1476
 						'<br/>',
1477
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1477
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1478 1478
 					), __FILE__, __FUNCTION__, __LINE__
1479 1479
 				);
1480 1480
 				return NULL;
@@ -1493,30 +1493,30 @@  discard block
 block discarded – undo
1493 1493
 	 * 	@type 	EE_Payment_Method $payment_method
1494 1494
 	 * 	@return 	mixed	EE_Payment | boolean
1495 1495
 	 */
1496
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1497
-		$payment =NULL;
1496
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1497
+		$payment = NULL;
1498 1498
 		$this->checkout->transaction->save();
1499
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1500
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1499
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1500
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1501 1501
 			return FALSE;
1502 1502
 		}
1503 1503
 		try {
1504
-			$payment_processor->set_revisit( $this->checkout->revisit );
1504
+			$payment_processor->set_revisit($this->checkout->revisit);
1505 1505
 			// generate payment object
1506 1506
 			$payment = $payment_processor->process_payment(
1507 1507
 				$payment_method,
1508 1508
 				$this->checkout->transaction,
1509 1509
 				$this->checkout->amount_owing,
1510 1510
 				$this->checkout->billing_form,
1511
-				$this->_get_return_url( $payment_method ),
1511
+				$this->_get_return_url($payment_method),
1512 1512
 				'CART',
1513 1513
 				$this->checkout->admin_request,
1514 1514
 				TRUE,
1515 1515
 				$this->reg_step_url()
1516 1516
 			);
1517 1517
 
1518
-		} catch( Exception $e ) {
1519
-			$this->_handle_payment_processor_exception( $e );
1518
+		} catch (Exception $e) {
1519
+			$this->_handle_payment_processor_exception($e);
1520 1520
 		}
1521 1521
 		return $payment;
1522 1522
 	}
@@ -1530,12 +1530,12 @@  discard block
 block discarded – undo
1530 1530
 	 * @param \Exception $e
1531 1531
 	 * @return void
1532 1532
 	 */
1533
-	protected function _handle_payment_processor_exception( Exception $e ) {
1533
+	protected function _handle_payment_processor_exception(Exception $e) {
1534 1534
 		EE_Error::add_error(
1535 1535
 			sprintf(
1536
-				__( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ),
1536
+				__('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'),
1537 1537
 				'<br/>',
1538
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
1538
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
1539 1539
 				$e->getMessage(),
1540 1540
 				$e->getFile(),
1541 1541
 				$e->getLine()
@@ -1552,9 +1552,9 @@  discard block
 block discarded – undo
1552 1552
 	 * @param \EE_Payment_Method $payment_method
1553 1553
 	 * @return string
1554 1554
 	 */
1555
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
1555
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
1556 1556
 		$return_url = '';
1557
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1557
+		switch ($payment_method->type_obj()->payment_occurs()) {
1558 1558
 
1559 1559
 			case EE_PMT_Base::offsite :
1560 1560
 				$return_url = add_query_arg(
@@ -1585,18 +1585,18 @@  discard block
 block discarded – undo
1585 1585
 	 * @param EE_Payment $payment
1586 1586
 	 * @return EE_Payment | FALSE
1587 1587
 	 */
1588
-	private function _validate_payment( $payment = NULL ) {
1589
-		if (  $this->checkout->payment_method->is_off_line() ) {
1588
+	private function _validate_payment($payment = NULL) {
1589
+		if ($this->checkout->payment_method->is_off_line()) {
1590 1590
 			return TRUE;
1591 1591
 		}
1592 1592
 		// verify payment object
1593
-		if ( ! $payment instanceof EE_Payment ) {
1593
+		if ( ! $payment instanceof EE_Payment) {
1594 1594
 			// not a payment
1595 1595
 			EE_Error::add_error(
1596 1596
 				sprintf(
1597
-					__( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1597
+					__('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1598 1598
 					'<br/>',
1599
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1599
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1600 1600
 				), __FILE__, __FUNCTION__, __LINE__
1601 1601
 			);
1602 1602
 			return FALSE;
@@ -1613,23 +1613,23 @@  discard block
 block discarded – undo
1613 1613
 	 * @param EE_Payment $payment
1614 1614
 	 * @return bool
1615 1615
 	 */
1616
-	private function _post_payment_processing( $payment = NULL ) {
1616
+	private function _post_payment_processing($payment = NULL) {
1617 1617
 		// On-Site payment?
1618
-		if ( $this->checkout->payment_method->is_on_site() ) {
1619
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) {
1618
+		if ($this->checkout->payment_method->is_on_site()) {
1619
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
1620 1620
 				//$this->_setup_redirect_for_next_step();
1621 1621
 				$this->checkout->continue_reg = false;
1622 1622
 			}
1623 1623
 			// Off-Site payment?
1624
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
1624
+		} else if ($this->checkout->payment_method->is_off_site()) {
1625 1625
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
1626
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ){
1627
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
1626
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
1627
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
1628 1628
 				$this->checkout->redirect = TRUE;
1629 1629
 				$this->checkout->redirect_form = $payment->redirect_form();
1630
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
1630
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
1631 1631
 				// set JSON response
1632
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
1632
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
1633 1633
 				// set cron job for finalizing the TXN
1634 1634
 				// in case the user does not return from the off-site gateway
1635 1635
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -1637,21 +1637,21 @@  discard block
 block discarded – undo
1637 1637
 					$this->checkout->transaction->ID()
1638 1638
 				);
1639 1639
 				// and lastly, let's bump the payment status to pending
1640
-				$payment->set_status( EEM_Payment::status_id_pending );
1640
+				$payment->set_status(EEM_Payment::status_id_pending);
1641 1641
 				$payment->save();
1642 1642
 			} else {
1643 1643
 				// not a payment
1644 1644
 				$this->checkout->continue_reg = false;
1645 1645
 				EE_Error::add_error(
1646 1646
 					sprintf(
1647
-						__( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1647
+						__('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1648 1648
 						'<br/>',
1649
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1649
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1650 1650
 					), __FILE__, __FUNCTION__, __LINE__
1651 1651
 				);
1652 1652
 			}
1653 1653
 			// Off-Line payment?
1654
-		} else if ( $payment === TRUE ) {
1654
+		} else if ($payment === TRUE) {
1655 1655
 			//$this->_setup_redirect_for_next_step();
1656 1656
 			return TRUE;
1657 1657
 		} else {
@@ -1687,65 +1687,65 @@  discard block
 block discarded – undo
1687 1687
 	 * @return bool
1688 1688
 	 * @throws \EE_Error
1689 1689
 	 */
1690
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
1690
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
1691 1691
 		// off-line payment? carry on
1692
-		if ( $payment_occurs == EE_PMT_Base::offline ) {
1692
+		if ($payment_occurs == EE_PMT_Base::offline) {
1693 1693
 			return true;
1694 1694
 		}
1695 1695
 		// verify payment validity
1696
-		if ( $payment instanceof EE_Payment ) {
1697
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
1696
+		if ($payment instanceof EE_Payment) {
1697
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
1698 1698
 			$msg = $payment->gateway_response();
1699 1699
 			// check results
1700
-			switch ( $payment->status() ) {
1700
+			switch ($payment->status()) {
1701 1701
 
1702 1702
 				// good payment
1703 1703
 				case EEM_Payment::status_id_approved :
1704
-					EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1704
+					EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1705 1705
 					return TRUE;
1706 1706
 					break;
1707 1707
 
1708 1708
 				// slow payment
1709 1709
 				case EEM_Payment::status_id_pending :
1710
-					if ( empty( $msg )) {
1711
-						$msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' );
1710
+					if (empty($msg)) {
1711
+						$msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso');
1712 1712
 					}
1713
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
1713
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
1714 1714
 					return TRUE;
1715 1715
 					break;
1716 1716
 
1717 1717
 				// don't wanna payment
1718 1718
 				case EEM_Payment::status_id_cancelled :
1719
-					if ( empty( $msg )) {
1719
+					if (empty($msg)) {
1720 1720
 						$msg = _n(
1721 1721
 							'Payment cancelled. Please try again.',
1722 1722
 							'Payment cancelled. Please try again or select another method of payment.',
1723
-							count( $this->checkout->available_payment_methods ),
1723
+							count($this->checkout->available_payment_methods),
1724 1724
 							'event_espresso'
1725 1725
 						);
1726 1726
 					}
1727
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1727
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1728 1728
 					return FALSE;
1729 1729
 					break;
1730 1730
 
1731 1731
 				// not enough payment
1732 1732
 				case EEM_Payment::status_id_declined :
1733
-					if ( empty( $msg )) {
1733
+					if (empty($msg)) {
1734 1734
 						$msg = _n(
1735 1735
 							'We\'re sorry but your payment was declined. Please try again.',
1736 1736
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
1737
-							count( $this->checkout->available_payment_methods ),
1737
+							count($this->checkout->available_payment_methods),
1738 1738
 							'event_espresso'
1739 1739
 						);
1740 1740
 					}
1741
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1741
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1742 1742
 					return FALSE;
1743 1743
 					break;
1744 1744
 
1745 1745
 				// bad payment
1746 1746
 				case EEM_Payment::status_id_failed :
1747
-					if ( ! empty( $msg ) ) {
1748
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1747
+					if ( ! empty($msg)) {
1748
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1749 1749
 						return false;
1750 1750
 					}
1751 1751
 					// default to error below
@@ -1755,14 +1755,14 @@  discard block
 block discarded – undo
1755 1755
 		}
1756 1756
 		// off-site payment gateway responses are too unreliable, so let's just assume that
1757 1757
 		// the payment processing is just running slower than the registrant's request
1758
-		if ( $payment_occurs == EE_PMT_Base::offsite ) {
1758
+		if ($payment_occurs == EE_PMT_Base::offsite) {
1759 1759
 			return true;
1760 1760
 		}
1761 1761
 		EE_Error::add_error(
1762 1762
 				sprintf(
1763
-					__( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1763
+					__('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1764 1764
 					'<br/>',
1765
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1765
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1766 1766
 				),
1767 1767
 				__FILE__, __FUNCTION__, __LINE__
1768 1768
 			);
@@ -1795,13 +1795,13 @@  discard block
 block discarded – undo
1795 1795
 	public function process_gateway_response() {
1796 1796
 		$payment = null;
1797 1797
 		// how have they chosen to pay?
1798
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1798
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1799 1799
 		// get EE_Payment_Method object
1800
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1800
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1801 1801
 			$this->checkout->continue_reg = false;
1802 1802
 			return false;
1803 1803
 		}
1804
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
1804
+		if ( ! $this->checkout->payment_method->is_off_site()) {
1805 1805
 			return false;
1806 1806
 		}
1807 1807
 		$this->_validate_offsite_return();
@@ -1815,23 +1815,23 @@  discard block
 block discarded – undo
1815 1815
 		//	true
1816 1816
 		//);
1817 1817
 		// verify TXN
1818
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
1818
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1819 1819
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
1820
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
1820
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
1821 1821
 				$this->checkout->continue_reg = false;
1822 1822
 				return false;
1823 1823
 			}
1824
-			$payment = $this->_process_off_site_payment( $gateway );
1825
-			$payment = $this->_process_cancelled_payments( $payment );
1826
-			$payment = $this->_validate_payment( $payment );
1824
+			$payment = $this->_process_off_site_payment($gateway);
1825
+			$payment = $this->_process_cancelled_payments($payment);
1826
+			$payment = $this->_validate_payment($payment);
1827 1827
 			// if payment was not declined by the payment gateway or cancelled by the registrant
1828
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
1828
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
1829 1829
 				//$this->_setup_redirect_for_next_step();
1830 1830
 				// store that for later
1831 1831
 				$this->checkout->payment = $payment;
1832 1832
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
1833 1833
 				// because we will complete this step during the IPN processing then
1834
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) {
1834
+				if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) {
1835 1835
 					$this->set_completed();
1836 1836
 				}
1837 1837
 				return true;
@@ -1854,19 +1854,19 @@  discard block
 block discarded – undo
1854 1854
 	 * @return bool
1855 1855
 	 */
1856 1856
 	private function _validate_offsite_return() {
1857
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
1858
-		if ( $TXN_ID != $this->checkout->transaction->ID() ) {
1857
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
1858
+		if ($TXN_ID != $this->checkout->transaction->ID()) {
1859 1859
 			// Houston... we might have a problem
1860 1860
 			$invalid_TXN = false;
1861 1861
 			// first gather some info
1862
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1862
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1863 1863
 			$primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null;
1864 1864
 			// let's start by retrieving the cart for this TXN
1865
-			$cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction );
1866
-			if ( $cart instanceof EE_Cart ) {
1865
+			$cart = EE_Cart::get_cart_from_txn($this->checkout->transaction);
1866
+			if ($cart instanceof EE_Cart) {
1867 1867
 				// verify that the current cart has tickets
1868 1868
 				$tickets = $cart->get_tickets();
1869
-				if ( empty( $tickets ) ) {
1869
+				if (empty($tickets)) {
1870 1870
 					$invalid_TXN = true;
1871 1871
 				}
1872 1872
 			} else {
@@ -1874,39 +1874,39 @@  discard block
 block discarded – undo
1874 1874
 			}
1875 1875
 			$valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null;
1876 1876
 			// validate current Session ID and compare against valid TXN session ID
1877
-			if ( EE_Session::instance()->id() === null ) {
1877
+			if (EE_Session::instance()->id() === null) {
1878 1878
 				$invalid_TXN = true;
1879
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
1879
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
1880 1880
 				// WARNING !!!
1881 1881
 				// this could be PayPal sending back duplicate requests (ya they do that)
1882 1882
 				// or it **could** mean someone is simply registering AGAIN after having just done so
1883 1883
 				// so now we need to determine if this current TXN looks valid or not
1884 1884
 				/** @type EE_Transaction_Processor $transaction_processor */
1885
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1885
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1886 1886
 				// has this step even been started ?
1887
-				if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false )
1887
+				if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false)
1888 1888
 				) {
1889 1889
 					// really? you're half way through this reg step, but you never started it ?
1890 1890
 					$invalid_TXN = true;
1891 1891
 				}
1892 1892
 			}
1893
-			if ( $invalid_TXN ) {
1893
+			if ($invalid_TXN) {
1894 1894
 				// is the valid TXN completed ?
1895
-				if ( $valid_TXN instanceof EE_Transaction ) {
1895
+				if ($valid_TXN instanceof EE_Transaction) {
1896 1896
 					/** @type EE_Transaction_Processor $transaction_processor */
1897
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1897
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1898 1898
 					// has this step even been started ?
1899
-					$reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() );
1900
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
1899
+					$reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug());
1900
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
1901 1901
 						// so it **looks** like this is a double request from PayPal
1902 1902
 						// so let's try to pick up where we left off
1903 1903
 						$this->checkout->transaction = $valid_TXN;
1904
-						$this->checkout->refresh_all_entities( true );
1904
+						$this->checkout->refresh_all_entities(true);
1905 1905
 						return;
1906 1906
 					}
1907 1907
 				}
1908 1908
 				// you appear to be lost?
1909
-				$this->_redirect_wayward_request( $primary_registrant );
1909
+				$this->_redirect_wayward_request($primary_registrant);
1910 1910
 			}
1911 1911
 		}
1912 1912
 	}
@@ -1920,16 +1920,16 @@  discard block
 block discarded – undo
1920 1920
 	 * @param \EE_Registration $primary_registrant
1921 1921
 	 * @return bool
1922 1922
 	 */
1923
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
1924
-		if ( ! $primary_registrant instanceof EE_Registration ) {
1923
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
1924
+		if ( ! $primary_registrant instanceof EE_Registration) {
1925 1925
 			// try redirecting based on the current TXN
1926 1926
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null;
1927
-			if ( ! $primary_registrant instanceof EE_Registration ) {
1927
+			if ( ! $primary_registrant instanceof EE_Registration) {
1928 1928
 				EE_Error::add_error(
1929 1929
 					sprintf(
1930
-						__( 'Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1930
+						__('Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1931 1931
 						'<br/>',
1932
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1932
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1933 1933
 					),
1934 1934
 					__FILE__, __FUNCTION__, __LINE__
1935 1935
 				);
@@ -1957,16 +1957,16 @@  discard block
 block discarded – undo
1957 1957
 	 * @param \EE_Offsite_Gateway $gateway
1958 1958
 	 * @return \EE_Payment
1959 1959
 	 */
1960
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
1960
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
1961 1961
 		try {
1962 1962
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
1963
-			if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) {
1963
+			if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) {
1964 1964
 				$payment = $this->checkout->transaction->last_payment();
1965 1965
 				//$payment_source = 'last_payment';
1966 1966
 			} else {
1967 1967
 				// get payment details and process results
1968 1968
 				/** @type EE_Payment_Processor $payment_processor */
1969
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1969
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1970 1970
 				$payment = $payment_processor->process_ipn(
1971 1971
 					$_REQUEST,
1972 1972
 					$this->checkout->transaction,
@@ -1976,14 +1976,14 @@  discard block
 block discarded – undo
1976 1976
 				);
1977 1977
 				//$payment_source = 'process_ipn';
1978 1978
 			}
1979
-		} catch ( Exception $e ) {
1979
+		} catch (Exception $e) {
1980 1980
 			// let's just eat the exception and try to move on using any previously set payment info
1981 1981
 			$payment = $this->checkout->transaction->last_payment();
1982 1982
 			//$payment_source = 'last_payment after Exception';
1983 1983
 			// but if we STILL don't have a payment object
1984
-			if ( ! $payment instanceof EE_Payment ) {
1984
+			if ( ! $payment instanceof EE_Payment) {
1985 1985
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
1986
-				$this->_handle_payment_processor_exception( $e );
1986
+				$this->_handle_payment_processor_exception($e);
1987 1987
 			}
1988 1988
 		}
1989 1989
 		// DEBUG LOG
@@ -2007,13 +2007,13 @@  discard block
 block discarded – undo
2007 2007
 	 * @param EE_Payment $payment
2008 2008
 	 * @return EE_Payment | FALSE
2009 2009
 	 */
2010
-	private function _process_cancelled_payments( $payment = NULL ) {
2010
+	private function _process_cancelled_payments($payment = NULL) {
2011 2011
 		if (
2012
-			isset( $_REQUEST[ 'ee_cancel_payment' ] )
2012
+			isset($_REQUEST['ee_cancel_payment'])
2013 2013
 			&& $payment instanceof EE_Payment
2014 2014
 			&& $payment->status() == EEM_Payment::status_id_failed
2015 2015
 		) {
2016
-			$payment->set_status( EEM_Payment::status_id_cancelled );
2016
+			$payment->set_status(EEM_Payment::status_id_cancelled);
2017 2017
 		}
2018 2018
 		return $payment;
2019 2019
 	}
@@ -2030,23 +2030,23 @@  discard block
 block discarded – undo
2030 2030
 	public function get_transaction_details_for_gateways() {
2031 2031
 		$txn_details = array();
2032 2032
 		// ya gotta make a choice man
2033
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
2033
+		if (empty($this->checkout->selected_method_of_payment)) {
2034 2034
 			$txn_details = array(
2035
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
2035
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
2036 2036
 			);
2037 2037
 		}
2038 2038
 		// get EE_Payment_Method object
2039 2039
 		if (
2040
-			empty( $txn_details ) &&
2040
+			empty($txn_details) &&
2041 2041
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
2042 2042
 		) {
2043 2043
 			$txn_details = array(
2044 2044
 				'selected_method_of_payment' => $this->checkout->selected_method_of_payment,
2045
-				'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' )
2045
+				'error' => __('A valid Payment Method could not be determined.', 'event_espresso')
2046 2046
 			);
2047 2047
 		}
2048
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
2049
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
2048
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
2049
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
2050 2050
 			$txn_details = array(
2051 2051
 				'TXN_ID'        			=> $this->checkout->transaction->ID(),
2052 2052
 				'TXN_timestamp' 	=> $this->checkout->transaction->datetime(),
@@ -2057,7 +2057,7 @@  discard block
 block discarded – undo
2057 2057
 				'PMD_ID'        			=> $this->checkout->transaction->payment_method_ID(),
2058 2058
 				'payment_amount' => $this->checkout->amount_owing,
2059 2059
 				'return_url' 				=> $return_url,
2060
-				'cancel_url' 				=> add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
2060
+				'cancel_url' 				=> add_query_arg(array('ee_cancel_payment' => true), $return_url),
2061 2061
 				'notify_url' 				=> EE_Config::instance()->core->txn_page_url(
2062 2062
 					array(
2063 2063
 						'e_reg_url_link'    			=> $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -2066,7 +2066,7 @@  discard block
 block discarded – undo
2066 2066
 				)
2067 2067
 			);
2068 2068
 		}
2069
-		echo json_encode( $txn_details );
2069
+		echo json_encode($txn_details);
2070 2070
 		exit();
2071 2071
 	}
2072 2072
 
Please login to merge, or discard this patch.
modules/ticket_sales_monitor/EED_Ticket_Sales_Monitor.module.php 1 patch
Spacing   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  * Class EED_Ticket_Sales_Monitor
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class EED_Ticket_Sales_Monitor extends EED_Module {
19 19
 
20
-	const debug = false; 	//	true false
20
+	const debug = false; //	true false
21 21
 
22 22
 	/**
23 23
 	 * an array of raw ticket data from EED_Ticket_Selector
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public static function set_hooks() {
61 61
 		// check ticket reserves AFTER MER does it's check (hence priority 20)
62
-		add_filter( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty',
63
-			array( 'EED_Ticket_Sales_Monitor', 'validate_ticket_sale' ),
62
+		add_filter('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty',
63
+			array('EED_Ticket_Sales_Monitor', 'validate_ticket_sale'),
64 64
 			20, 3
65 65
 		);
66 66
 		// add notices for sold out tickets
67
-		add_action( 'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart',
68
-			array( 'EED_Ticket_Sales_Monitor', 'post_notices' ),
67
+		add_action('AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart',
68
+			array('EED_Ticket_Sales_Monitor', 'post_notices'),
69 69
 			10
70 70
 		);
71 71
 		// handle ticket quantities adjusted in cart
@@ -77,40 +77,40 @@  discard block
 block discarded – undo
77 77
 		// handle tickets deleted from cart
78 78
 		add_action(
79 79
 			'FHEE__EED_Multi_Event_Registration__delete_ticket__ticket_removed_from_cart',
80
-			array( 'EED_Ticket_Sales_Monitor', 'ticket_removed_from_cart' ),
80
+			array('EED_Ticket_Sales_Monitor', 'ticket_removed_from_cart'),
81 81
 			10, 2
82 82
 		);
83 83
 		// handle emptied carts
84 84
 		add_action(
85 85
 			'AHEE__EE_Session__reset_cart__before_reset',
86
-			array( 'EED_Ticket_Sales_Monitor', 'session_cart_reset' ),
86
+			array('EED_Ticket_Sales_Monitor', 'session_cart_reset'),
87 87
 			10, 1
88 88
 		);
89 89
 		add_action(
90 90
 			'AHEE__EED_Multi_Event_Registration__empty_event_cart__before_delete_cart',
91
-			array( 'EED_Ticket_Sales_Monitor', 'session_cart_reset' ),
91
+			array('EED_Ticket_Sales_Monitor', 'session_cart_reset'),
92 92
 			10, 1
93 93
 		);
94 94
 		// handle cancelled registrations
95 95
 		add_action(
96 96
 			'AHEE__EE_Session__reset_checkout__before_reset',
97
-			array( 'EED_Ticket_Sales_Monitor', 'session_checkout_reset' ),
97
+			array('EED_Ticket_Sales_Monitor', 'session_checkout_reset'),
98 98
 			10, 1
99 99
 		);
100 100
 		// cron tasks
101 101
 		add_action(
102 102
 			'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions__abandoned_transaction',
103
-			array( 'EED_Ticket_Sales_Monitor', 'process_abandoned_transactions' ),
103
+			array('EED_Ticket_Sales_Monitor', 'process_abandoned_transactions'),
104 104
 			10, 1
105 105
 		);
106 106
 		add_action(
107 107
 			'AHEE__EE_Cron_Tasks__process_expired_transactions__incomplete_transaction',
108
-			array( 'EED_Ticket_Sales_Monitor', 'process_abandoned_transactions' ),
108
+			array('EED_Ticket_Sales_Monitor', 'process_abandoned_transactions'),
109 109
 			10, 1
110 110
 		);
111 111
 		add_action(
112 112
 			'AHEE__EE_Cron_Tasks__process_expired_transactions__failed_transaction',
113
-			array( 'EED_Ticket_Sales_Monitor', 'process_failed_transactions' ),
113
+			array('EED_Ticket_Sales_Monitor', 'process_failed_transactions'),
114 114
 			10, 1
115 115
 		);
116 116
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @return EED_Ticket_Sales_Monitor
135 135
 	 */
136 136
 	public static function instance() {
137
-		return parent::get_instance( __CLASS__ );
137
+		return parent::get_instance(__CLASS__);
138 138
 	}
139 139
 
140 140
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @param WP_Query $WP_Query
147 147
 	 * @return    void
148 148
 	 */
149
-	public function run( $WP_Query ) {
149
+	public function run($WP_Query) {
150 150
 	}
151 151
 
152 152
 
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
 	 * @param \EE_Ticket $ticket
165 165
 	 * @return bool
166 166
 	 */
167
-	public static function validate_ticket_sale( $qty = 1, EE_Ticket $ticket  ) {
168
-		$qty = absint( $qty );
169
-		if ( $qty > 0 ) {
170
-			$qty = EED_Ticket_Sales_Monitor::instance()->_validate_ticket_sale( $ticket, $qty );
167
+	public static function validate_ticket_sale($qty = 1, EE_Ticket $ticket) {
168
+		$qty = absint($qty);
169
+		if ($qty > 0) {
170
+			$qty = EED_Ticket_Sales_Monitor::instance()->_validate_ticket_sale($ticket, $qty);
171 171
 		}
172
-		if ( self::debug ) {
173
-			echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />";
174
-			echo "\n qty: " . $qty;
172
+		if (self::debug) {
173
+			echo "\n\n ".__LINE__.") ".__METHOD__."() <br />";
174
+			echo "\n qty: ".$qty;
175 175
 		}
176 176
 		return $qty;
177 177
 	}
@@ -187,45 +187,45 @@  discard block
 block discarded – undo
187 187
 	 * @param int          $qty
188 188
 	 * @return int
189 189
 	 */
190
-	protected function _validate_ticket_sale( EE_Ticket $ticket, $qty = 1 ) {
191
-		if ( self::debug ) {
192
-			echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />";
190
+	protected function _validate_ticket_sale(EE_Ticket $ticket, $qty = 1) {
191
+		if (self::debug) {
192
+			echo "\n\n ".__LINE__.") ".__METHOD__."() <br />";
193 193
 		}
194
-		if ( ! $ticket instanceof EE_Ticket ) {
194
+		if ( ! $ticket instanceof EE_Ticket) {
195 195
 			return 0;
196 196
 		}
197
-		if ( self::debug ) {
198
-			echo "\n . ticket->ID: " . $ticket->ID() . '<br />';
199
-			echo "\n . original ticket->reserved: " . $ticket->reserved() . '<br />';
197
+		if (self::debug) {
198
+			echo "\n . ticket->ID: ".$ticket->ID().'<br />';
199
+			echo "\n . original ticket->reserved: ".$ticket->reserved().'<br />';
200 200
 		}
201 201
 		$ticket->refresh_from_db();
202 202
 		// first let's determine the ticket availability based on sales
203
-		$available = $ticket->qty( 'saleable' );
204
-		if ( self::debug ) {
205
-			echo "\n . . . ticket->qty: " . $ticket->qty() . '<br />';
206
-			echo "\n . . . ticket->sold: " . $ticket->sold() . '<br />';
207
-			echo "\n . . . ticket->reserved: " . $ticket->reserved() . '<br />';
208
-			echo "\n . . . ticket->qty(saleable): " . $ticket->qty( 'saleable' ) . '<br />';
209
-			echo "\n . . . available: " . $available . '<br />';
210
-		}
211
-		if ( $available < 1 ) {
212
-			$this->_ticket_sold_out( $ticket );
203
+		$available = $ticket->qty('saleable');
204
+		if (self::debug) {
205
+			echo "\n . . . ticket->qty: ".$ticket->qty().'<br />';
206
+			echo "\n . . . ticket->sold: ".$ticket->sold().'<br />';
207
+			echo "\n . . . ticket->reserved: ".$ticket->reserved().'<br />';
208
+			echo "\n . . . ticket->qty(saleable): ".$ticket->qty('saleable').'<br />';
209
+			echo "\n . . . available: ".$available.'<br />';
210
+		}
211
+		if ($available < 1) {
212
+			$this->_ticket_sold_out($ticket);
213 213
 			return 0;
214 214
 		}
215
-		if ( self::debug ) {
216
-			echo "\n . . . qty: " . $qty . '<br />';
215
+		if (self::debug) {
216
+			echo "\n . . . qty: ".$qty.'<br />';
217 217
 		}
218
-		if ( $available < $qty ) {
218
+		if ($available < $qty) {
219 219
 			$qty = $available;
220
-			if ( self::debug ) {
221
-				echo "\n . . . QTY ADJUSTED: " . $qty . '<br />';
220
+			if (self::debug) {
221
+				echo "\n . . . QTY ADJUSTED: ".$qty.'<br />';
222 222
 			}
223
-			$this->_ticket_quantity_decremented( $ticket );
223
+			$this->_ticket_quantity_decremented($ticket);
224 224
 		}
225
-		if ( self::debug ) {
226
-			echo "\n\n . . . INCREASE RESERVED: " . $qty . '<br/><br/>';
225
+		if (self::debug) {
226
+			echo "\n\n . . . INCREASE RESERVED: ".$qty.'<br/><br/>';
227 227
 		}
228
-		$this->_reserve_ticket( $ticket, $qty );
228
+		$this->_reserve_ticket($ticket, $qty);
229 229
 		return $qty;
230 230
 	}
231 231
 
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 	 * @return bool
242 242
 	 * @throws \EE_Error
243 243
 	 */
244
-	protected function _reserve_ticket( EE_Ticket $ticket, $quantity = 1 ) {
245
-		if ( self::debug ) {
246
-			echo "\n\n . . . INCREASE RESERVED: " . $quantity . '<br/><br/>';
244
+	protected function _reserve_ticket(EE_Ticket $ticket, $quantity = 1) {
245
+		if (self::debug) {
246
+			echo "\n\n . . . INCREASE RESERVED: ".$quantity.'<br/><br/>';
247 247
 		}
248
-		$ticket->increase_reserved( $quantity );
248
+		$ticket->increase_reserved($quantity);
249 249
 		return $ticket->save();
250 250
 	}
251 251
 
@@ -260,14 +260,14 @@  discard block
 block discarded – undo
260 260
 	 * @return bool
261 261
 	 * @throws \EE_Error
262 262
 	 */
263
-	protected function _release_reserved_ticket( EE_Ticket $ticket, $quantity = 1 ) {
264
-		if ( self::debug ) {
265
-			echo "\n . . . ticket->ID: " . $ticket->ID() . '<br />';
266
-			echo "\n . . . ticket->reserved: " . $ticket->reserved() . '<br />';
263
+	protected function _release_reserved_ticket(EE_Ticket $ticket, $quantity = 1) {
264
+		if (self::debug) {
265
+			echo "\n . . . ticket->ID: ".$ticket->ID().'<br />';
266
+			echo "\n . . . ticket->reserved: ".$ticket->reserved().'<br />';
267 267
 		}
268
-		$ticket->decrease_reserved( $quantity );
269
-		if ( self::debug ) {
270
-			echo "\n . . . ticket->reserved: " . $ticket->reserved() . '<br />';
268
+		$ticket->decrease_reserved($quantity);
269
+		if (self::debug) {
270
+			echo "\n . . . ticket->reserved: ".$ticket->reserved().'<br />';
271 271
 		}
272 272
 		return $ticket->save() ? 1 : 0;
273 273
 	}
@@ -283,12 +283,12 @@  discard block
 block discarded – undo
283 283
 	 * @return 	bool
284 284
 	 * @throws \EE_Error
285 285
 	 */
286
-	protected function _ticket_sold_out( EE_Ticket $ticket ) {
287
-		if ( self::debug ) {
288
-			echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />";
289
-			echo "\n . . ticket->name: " . $this->_get_ticket_and_event_name( $ticket ) . '<br />';
286
+	protected function _ticket_sold_out(EE_Ticket $ticket) {
287
+		if (self::debug) {
288
+			echo "\n\n ".__LINE__.") ".__METHOD__."() <br />";
289
+			echo "\n . . ticket->name: ".$this->_get_ticket_and_event_name($ticket).'<br />';
290 290
 		}
291
-		$this->sold_out_tickets[] = $this->_get_ticket_and_event_name( $ticket );
291
+		$this->sold_out_tickets[] = $this->_get_ticket_and_event_name($ticket);
292 292
 	}
293 293
 
294 294
 
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
 	 * @param    \EE_Ticket $ticket
302 302
 	 * @return bool
303 303
 	 */
304
-	protected function _ticket_quantity_decremented( EE_Ticket $ticket ) {
305
-		if ( self::debug ) {
306
-			echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />";
307
-			echo "\n . . ticket->name: " . $this->_get_ticket_and_event_name( $ticket ) . '<br />';
304
+	protected function _ticket_quantity_decremented(EE_Ticket $ticket) {
305
+		if (self::debug) {
306
+			echo "\n\n ".__LINE__.") ".__METHOD__."() <br />";
307
+			echo "\n . . ticket->name: ".$this->_get_ticket_and_event_name($ticket).'<br />';
308 308
 		}
309
-		$this->decremented_tickets[] = $this->_get_ticket_and_event_name( $ticket );
309
+		$this->decremented_tickets[] = $this->_get_ticket_and_event_name($ticket);
310 310
 	}
311 311
 
312 312
 
@@ -319,11 +319,11 @@  discard block
 block discarded – undo
319 319
 	 * @param    \EE_Ticket $ticket
320 320
 	 * @return string
321 321
 	 */
322
-	protected function _get_ticket_and_event_name( EE_Ticket $ticket ) {
322
+	protected function _get_ticket_and_event_name(EE_Ticket $ticket) {
323 323
 		$event = $ticket->get_related_event();
324
-		if ( $event instanceof EE_Event ) {
324
+		if ($event instanceof EE_Event) {
325 325
 			$ticket_name = sprintf(
326
-				_x( '%1$s for %2$s', 'ticket name for event name', 'event_espresso' ),
326
+				_x('%1$s for %2$s', 'ticket name for event name', 'event_espresso'),
327 327
 				$ticket->name(),
328 328
 				$event->name()
329 329
 			);
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 	 * @param  int          $quantity
349 349
 	 * @return void
350 350
 	 */
351
-	public static function ticket_quantity_updated( EE_Line_Item $line_item, $quantity = 1 ) {
352
-		$ticket = EEM_Ticket::instance()->get_one_by_ID( absint( $line_item->OBJ_ID() ) );
353
-		if ( $ticket instanceof EE_Ticket ) {
354
-			if ( $quantity > 0 ) {
355
-				EED_Ticket_Sales_Monitor::instance()->_reserve_ticket( $ticket, $quantity );
351
+	public static function ticket_quantity_updated(EE_Line_Item $line_item, $quantity = 1) {
352
+		$ticket = EEM_Ticket::instance()->get_one_by_ID(absint($line_item->OBJ_ID()));
353
+		if ($ticket instanceof EE_Ticket) {
354
+			if ($quantity > 0) {
355
+				EED_Ticket_Sales_Monitor::instance()->_reserve_ticket($ticket, $quantity);
356 356
 			} else {
357
-				EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket( $ticket, $quantity );
357
+				EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket($ticket, $quantity);
358 358
 			}
359 359
 		}
360 360
 	}
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 	 * @param  int       $quantity
371 371
 	 * @return void
372 372
 	 */
373
-	public static function ticket_removed_from_cart( EE_Ticket $ticket, $quantity = 1 ) {
374
-		EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket( $ticket, $quantity );
373
+	public static function ticket_removed_from_cart(EE_Ticket $ticket, $quantity = 1) {
374
+		EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket($ticket, $quantity);
375 375
 	}
376 376
 
377 377
 
@@ -399,34 +399,34 @@  discard block
 block discarded – undo
399 399
 	 * @return    void
400 400
 	 */
401 401
 	protected function _post_notices() {
402
-		if ( self::debug ) {
403
-			echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />";
402
+		if (self::debug) {
403
+			echo "\n\n ".__LINE__.") ".__METHOD__."() <br />";
404 404
 		}
405
-		if ( ! empty( $this->sold_out_tickets ) ) {
405
+		if ( ! empty($this->sold_out_tickets)) {
406 406
 			EE_Error::add_attention(
407 407
 				sprintf(
408 408
 					apply_filters(
409 409
 						'FHEE__EED_Ticket_Sales_Monitor___post_notices__sold_out_tickets_notice',
410
-						__( 'We\'re sorry...%1$sThe following items have sold out since you first viewed this page, and can no longer be registered for:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.', 'event_espresso' )
410
+						__('We\'re sorry...%1$sThe following items have sold out since you first viewed this page, and can no longer be registered for:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.', 'event_espresso')
411 411
 					),
412 412
 					'<br />',
413
-					implode( '<br />', $this->sold_out_tickets )
413
+					implode('<br />', $this->sold_out_tickets)
414 414
 				)
415 415
 			);
416 416
 			// alter code flow in the Ticket Selector for better UX
417
-			add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', '__return_true' );
418
-			add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', '__return_false' );
417
+			add_filter('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', '__return_true');
418
+			add_filter('FHEE__EED_Ticket_Selector__process_ticket_selections__success', '__return_false');
419 419
 			$this->sold_out_tickets = array();
420 420
 		}
421
-		if ( ! empty( $this->decremented_tickets ) ) {
421
+		if ( ! empty($this->decremented_tickets)) {
422 422
 			EE_Error::add_attention(
423 423
 				sprintf(
424 424
 					apply_filters(
425 425
 						'FHEE__EED_Ticket_Sales_Monitor___ticket_quantity_decremented__notice',
426
-						__( 'We\'re sorry...%1$sDue to sales that have occurred since you first viewed the last page, the following items have had their quantities adjusted to match the current available amount:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.', 'event_espresso' )
426
+						__('We\'re sorry...%1$sDue to sales that have occurred since you first viewed the last page, the following items have had their quantities adjusted to match the current available amount:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.', 'event_espresso')
427 427
 					),
428 428
 					'<br />',
429
-					implode( '<br />', $this->decremented_tickets )
429
+					implode('<br />', $this->decremented_tickets)
430 430
 				)
431 431
 			);
432 432
 			$this->decremented_tickets = array();
@@ -448,27 +448,27 @@  discard block
 block discarded – undo
448 448
 	 * @param 	EE_Transaction 	$transaction
449 449
 	 * @return int
450 450
 	 */
451
-	protected function _release_all_reserved_tickets_for_transaction( EE_Transaction $transaction ) {
452
-		if ( self::debug ) {
453
-			echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />";
454
-			echo "\n . transaction->ID: " . $transaction->ID() . '<br />';
451
+	protected function _release_all_reserved_tickets_for_transaction(EE_Transaction $transaction) {
452
+		if (self::debug) {
453
+			echo "\n\n ".__LINE__.") ".__METHOD__."() <br />";
454
+			echo "\n . transaction->ID: ".$transaction->ID().'<br />';
455 455
 		}
456 456
 		/** @type EE_Transaction_Processor $transaction_processor */
457
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
457
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
458 458
 		// check if 'finalize_registration' step has been completed...
459
-		$finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' );
460
-		if ( self::debug ) {
459
+		$finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration');
460
+		if (self::debug) {
461 461
 			// DEBUG LOG
462 462
 			EEH_Debug_Tools::log(
463 463
 				__CLASS__, __FUNCTION__, __LINE__,
464
-				array( 'finalized' => $finalized ),
465
-				false, 'EE_Transaction: ' . $transaction->ID()
464
+				array('finalized' => $finalized),
465
+				false, 'EE_Transaction: '.$transaction->ID()
466 466
 			);
467 467
 		}
468 468
 		// how many tickets were released
469 469
 		$count = 0;
470
-		if ( self::debug ) {
471
-			echo "\n . . . finalized: " . $finalized . '<br />';
470
+		if (self::debug) {
471
+			echo "\n . . . finalized: ".$finalized.'<br />';
472 472
 		}
473 473
 		$release_tickets_with_TXN_status = array(
474 474
 			EEM_Transaction::failed_status_code,
@@ -476,13 +476,13 @@  discard block
 block discarded – undo
476 476
 			EEM_Transaction::incomplete_status_code,
477 477
 		);
478 478
 		// if the session is getting cleared BEFORE the TXN has been finalized
479
-		if ( ! $finalized || in_array( $transaction->status_ID(), $release_tickets_with_TXN_status ) ) {
479
+		if ( ! $finalized || in_array($transaction->status_ID(), $release_tickets_with_TXN_status)) {
480 480
 			// let's cancel any reserved tickets
481 481
 			$registrations = $transaction->registrations();
482
-			if ( ! empty( $registrations ) ) {
483
-				foreach ( $registrations as $registration ) {
484
-					if ( $registration instanceof EE_Registration ) {
485
-						$count += $this->_release_reserved_ticket_for_registration( $registration, $transaction );
482
+			if ( ! empty($registrations)) {
483
+				foreach ($registrations as $registration) {
484
+					if ($registration instanceof EE_Registration) {
485
+						$count += $this->_release_reserved_ticket_for_registration($registration, $transaction);
486 486
 					}
487 487
 				}
488 488
 			}
@@ -503,12 +503,12 @@  discard block
 block discarded – undo
503 503
 	 * @return 	int
504 504
 	 * @throws 	\EE_Error
505 505
 	 */
506
-	protected function _release_reserved_ticket_for_registration( EE_Registration $registration, EE_Transaction $transaction ) {
507
-		if ( self::debug ) {
508
-			echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />";
509
-			echo "\n . . registration->ID: " . $registration->ID() . '<br />';
510
-			echo "\n . . registration->status_ID: " . $registration->status_ID() . '<br />';
511
-			echo "\n . . transaction->status_ID(): " . $transaction->status_ID() . '<br />';
506
+	protected function _release_reserved_ticket_for_registration(EE_Registration $registration, EE_Transaction $transaction) {
507
+		if (self::debug) {
508
+			echo "\n\n ".__LINE__.") ".__METHOD__."() <br />";
509
+			echo "\n . . registration->ID: ".$registration->ID().'<br />';
510
+			echo "\n . . registration->status_ID: ".$registration->status_ID().'<br />';
511
+			echo "\n . . transaction->status_ID(): ".$transaction->status_ID().'<br />';
512 512
 		}
513 513
 		if (
514 514
 			// release Tickets for Failed Transactions and Abandoned Transactions
@@ -521,8 +521,8 @@  discard block
 block discarded – undo
521 521
 			)
522 522
 		) {
523 523
 			$ticket = $registration->ticket();
524
-			if ( $ticket instanceof EE_Ticket ) {
525
-				return $this->_release_reserved_ticket( $ticket );
524
+			if ($ticket instanceof EE_Ticket) {
525
+				return $this->_release_reserved_ticket($ticket);
526 526
 			}
527 527
 		}
528 528
 		return 0;
@@ -542,20 +542,20 @@  discard block
 block discarded – undo
542 542
 	 * @param    EE_Session $session
543 543
 	 * @return    void
544 544
 	 */
545
-	public static function session_cart_reset( EE_Session $session ) {
546
-		if ( self::debug ) {
547
-			echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />";
545
+	public static function session_cart_reset(EE_Session $session) {
546
+		if (self::debug) {
547
+			echo "\n\n ".__LINE__.") ".__METHOD__."() <br />";
548 548
 		}
549 549
 		$cart = $session->cart();
550
-		if ( $cart instanceof EE_Cart ) {
551
-			if ( self::debug ) {
552
-				echo "\n\n cart instanceof EE_Cart: " . "<br />";
550
+		if ($cart instanceof EE_Cart) {
551
+			if (self::debug) {
552
+				echo "\n\n cart instanceof EE_Cart: "."<br />";
553 553
 			}
554
-			EED_Ticket_Sales_Monitor::instance()->_session_cart_reset( $cart );
554
+			EED_Ticket_Sales_Monitor::instance()->_session_cart_reset($cart);
555 555
 		} else {
556
-			if ( self::debug ) {
557
-				echo "\n\n invalid EE_Cart: " . "<br />";
558
-				var_dump( $cart );
556
+			if (self::debug) {
557
+				echo "\n\n invalid EE_Cart: "."<br />";
558
+				var_dump($cart);
559 559
 			}
560 560
 		}
561 561
 	}
@@ -570,30 +570,30 @@  discard block
 block discarded – undo
570 570
 	 * @param    EE_Cart $cart
571 571
 	 * @return    void
572 572
 	 */
573
-	protected function _session_cart_reset( EE_Cart $cart ) {
574
-		if ( self::debug ) {
575
-			echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />";
573
+	protected function _session_cart_reset(EE_Cart $cart) {
574
+		if (self::debug) {
575
+			echo "\n\n ".__LINE__.") ".__METHOD__."() <br />";
576 576
 		}
577
-		EE_Registry::instance()->load_helper( 'Line_Item' );
577
+		EE_Registry::instance()->load_helper('Line_Item');
578 578
 		$ticket_line_items = $cart->get_tickets();
579
-		if ( empty( $ticket_line_items ) ) {
579
+		if (empty($ticket_line_items)) {
580 580
 			return;
581 581
 		}
582
-		foreach ( $ticket_line_items as $ticket_line_item ) {
583
-			if ( self::debug ) {
584
-				echo "\n . ticket_line_item->ID(): " . $ticket_line_item->ID() . "<br />";
582
+		foreach ($ticket_line_items as $ticket_line_item) {
583
+			if (self::debug) {
584
+				echo "\n . ticket_line_item->ID(): ".$ticket_line_item->ID()."<br />";
585 585
 			}
586
-			if ( $ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_type() == 'Ticket' ) {
587
-				if ( self::debug ) {
588
-					echo "\n . . ticket_line_item->OBJ_ID(): " . $ticket_line_item->OBJ_ID() . "<br />";
586
+			if ($ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_type() == 'Ticket') {
587
+				if (self::debug) {
588
+					echo "\n . . ticket_line_item->OBJ_ID(): ".$ticket_line_item->OBJ_ID()."<br />";
589 589
 				}
590
-				$ticket = EEM_Ticket::instance()->get_one_by_ID( $ticket_line_item->OBJ_ID() );
591
-				if ( $ticket instanceof EE_Ticket ) {
592
-					if ( self::debug ) {
593
-						echo "\n . . ticket->ID(): " . $ticket->ID() . "<br />";
594
-						echo "\n . . ticket_line_item->quantity(): " . $ticket_line_item->quantity() . "<br />";
590
+				$ticket = EEM_Ticket::instance()->get_one_by_ID($ticket_line_item->OBJ_ID());
591
+				if ($ticket instanceof EE_Ticket) {
592
+					if (self::debug) {
593
+						echo "\n . . ticket->ID(): ".$ticket->ID()."<br />";
594
+						echo "\n . . ticket_line_item->quantity(): ".$ticket_line_item->quantity()."<br />";
595 595
 					}
596
-					$this->_release_reserved_ticket( $ticket, $ticket_line_item->quantity() );
596
+					$this->_release_reserved_ticket($ticket, $ticket_line_item->quantity());
597 597
 				}
598 598
 			}
599 599
 		}
@@ -613,10 +613,10 @@  discard block
 block discarded – undo
613 613
 	 * @param    EE_Session $session
614 614
 	 * @return    void
615 615
 	 */
616
-	public static function session_checkout_reset( EE_Session $session ) {
616
+	public static function session_checkout_reset(EE_Session $session) {
617 617
 		$checkout = $session->checkout();
618
-		if ( $checkout instanceof EE_Checkout ) {
619
-			EED_Ticket_Sales_Monitor::instance()->_session_checkout_reset( $checkout );
618
+		if ($checkout instanceof EE_Checkout) {
619
+			EED_Ticket_Sales_Monitor::instance()->_session_checkout_reset($checkout);
620 620
 		}
621 621
 	}
622 622
 
@@ -630,15 +630,15 @@  discard block
 block discarded – undo
630 630
 	 * @param    EE_Checkout $checkout
631 631
 	 * @return    void
632 632
 	 */
633
-	protected function _session_checkout_reset( EE_Checkout $checkout ) {
634
-		if ( self::debug ) {
635
-			echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />";
633
+	protected function _session_checkout_reset(EE_Checkout $checkout) {
634
+		if (self::debug) {
635
+			echo "\n\n ".__LINE__.") ".__METHOD__."() <br />";
636 636
 		}
637 637
 		// we want to release the each registration's reserved tickets if the session was cleared, but not if this is a revisit
638
-		if ( $checkout->revisit || ! $checkout->transaction instanceof EE_Transaction ) {
638
+		if ($checkout->revisit || ! $checkout->transaction instanceof EE_Transaction) {
639 639
 			return;
640 640
 		}
641
-		$this->_release_all_reserved_tickets_for_transaction( $checkout->transaction );
641
+		$this->_release_all_reserved_tickets_for_transaction($checkout->transaction);
642 642
 	}
643 643
 
644 644
 
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 	 * @param    EE_Session $session
655 655
 	 * @return    void
656 656
 	 */
657
-	public static function session_expired_reset( EE_Session $session ) {
657
+	public static function session_expired_reset(EE_Session $session) {
658 658
 
659 659
 	}
660 660
 
@@ -673,30 +673,30 @@  discard block
 block discarded – undo
673 673
 	 * @param    EE_Transaction $transaction
674 674
 	 * @return    void
675 675
 	 */
676
-	public static function process_abandoned_transactions( EE_Transaction $transaction ) {
676
+	public static function process_abandoned_transactions(EE_Transaction $transaction) {
677 677
 		// is this TXN free or has any money been paid towards this TXN? If so, then leave it alone
678
-		if ( $transaction->is_free() || $transaction->paid() > 0 ) {
679
-			if ( self::debug ) {
678
+		if ($transaction->is_free() || $transaction->paid() > 0) {
679
+			if (self::debug) {
680 680
 				// DEBUG LOG
681 681
 				EEH_Debug_Tools::log(
682 682
 					__CLASS__, __FUNCTION__, __LINE__,
683
-					array( $transaction ),
684
-					false, 'EE_Transaction: ' . $transaction->ID()
683
+					array($transaction),
684
+					false, 'EE_Transaction: '.$transaction->ID()
685 685
 				);
686 686
 			}
687 687
 			return;
688 688
 		}
689 689
 		// have their been any successful payments made ?
690 690
 		$payments = $transaction->payments();
691
-		foreach ( $payments as $payment ) {
692
-			if ( $payment instanceof EE_Payment ) {
693
-				if ( $payment->status() === EEM_Payment::status_id_approved ) {
694
-					if ( self::debug ) {
691
+		foreach ($payments as $payment) {
692
+			if ($payment instanceof EE_Payment) {
693
+				if ($payment->status() === EEM_Payment::status_id_approved) {
694
+					if (self::debug) {
695 695
 						// DEBUG LOG
696 696
 						EEH_Debug_Tools::log(
697 697
 							__CLASS__, __FUNCTION__, __LINE__,
698
-							array( $payment ),
699
-							false, 'EE_Transaction: ' . $transaction->ID()
698
+							array($payment),
699
+							false, 'EE_Transaction: '.$transaction->ID()
700 700
 						);
701 701
 					}
702 702
 					return;
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 			}
705 705
 		}
706 706
 		// since you haven't even attempted to pay for your ticket...
707
-		EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction( $transaction );
707
+		EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction($transaction);
708 708
 	}
709 709
 
710 710
 
@@ -721,9 +721,9 @@  discard block
 block discarded – undo
721 721
 	 * @param    EE_Transaction $transaction
722 722
 	 * @return    void
723 723
 	 */
724
-	public static function process_failed_transactions( EE_Transaction $transaction ) {
724
+	public static function process_failed_transactions(EE_Transaction $transaction) {
725 725
 		// since you haven't even attempted to pay for your ticket...
726
-		EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction( $transaction );
726
+		EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction($transaction);
727 727
 	}
728 728
 
729 729
 
Please login to merge, or discard this patch.