Completed
Branch BUG-9122-authnet-double-chargi... (5a8153)
by
unknown
13:08 queued 39s
created
core/libraries/payment_methods/EE_PMT_Base.lib.php 1 patch
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @since 				$VID:$
15 15
  *
16 16
  */
17
-abstract class EE_PMT_Base{
17
+abstract class EE_PMT_Base {
18 18
 
19 19
 	const onsite = 'on-site';
20 20
 	const offsite = 'off-site';
@@ -95,36 +95,36 @@  discard block
 block discarded – undo
95 95
 	 * @return EE_PMT_Base
96 96
 	 */
97 97
 	function __construct($pm_instance = NULL) {
98
-		if ( $pm_instance instanceof EE_Payment_Method ){
98
+		if ($pm_instance instanceof EE_Payment_Method) {
99 99
 			$this->set_instance($pm_instance);
100 100
 		}
101 101
 		$this->_set_file_folder();
102 102
 		$this->_set_file_url();
103
-		if($this->_gateway){
104
-			$this->_gateway->set_payment_model( EEM_Payment::instance() );
105
-			$this->_gateway->set_payment_log( EEM_Change_Log::instance() );
106
-			EE_Registry::instance()->load_helper( 'Template' );
107
-			$this->_gateway->set_template_helper( new EEH_Template() );
108
-			EE_Registry::instance()->load_helper( 'Line_Item' );
109
-			$this->_gateway->set_line_item_helper( new EEH_Line_Item() );
110
-			EE_Registry::instance()->load_helper( 'Money' );
111
-			$this->_gateway->set_money_helper( new EEH_Money() );
103
+		if ($this->_gateway) {
104
+			$this->_gateway->set_payment_model(EEM_Payment::instance());
105
+			$this->_gateway->set_payment_log(EEM_Change_Log::instance());
106
+			EE_Registry::instance()->load_helper('Template');
107
+			$this->_gateway->set_template_helper(new EEH_Template());
108
+			EE_Registry::instance()->load_helper('Line_Item');
109
+			$this->_gateway->set_line_item_helper(new EEH_Line_Item());
110
+			EE_Registry::instance()->load_helper('Money');
111
+			$this->_gateway->set_money_helper(new EEH_Money());
112 112
 		}
113
-		if ( ! isset( $this->_has_billing_form ) ) {
113
+		if ( ! isset($this->_has_billing_form)) {
114 114
 			// by default, On Site gateways have a billing form
115
-			if ( $this->payment_occurs() == EE_PMT_Base::onsite ) {
116
-				$this->set_has_billing_form( true );
115
+			if ($this->payment_occurs() == EE_PMT_Base::onsite) {
116
+				$this->set_has_billing_form(true);
117 117
 			} else {
118
-				$this->set_has_billing_form( false );
118
+				$this->set_has_billing_form(false);
119 119
 			}
120 120
 		}
121 121
 
122
-		if( ! $this->_pretty_name){
122
+		if ( ! $this->_pretty_name) {
123 123
 			throw new EE_Error(sprintf(__("You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized", "event_espresso")));
124 124
 		}
125 125
 		//if the child didn't specify a default button, use the credit card one
126
-		if( $this->_default_button_url === NULL){
127
-			$this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png';
126
+		if ($this->_default_button_url === NULL) {
127
+			$this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods'.DS.'pay-by-credit-card.png';
128 128
 		}
129 129
 	}
130 130
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	/**
134 134
 	 * @param boolean $has_billing_form
135 135
 	 */
136
-	public function set_has_billing_form( $has_billing_form ) {
137
-		$this->_has_billing_form = filter_var( $has_billing_form, FILTER_VALIDATE_BOOLEAN );
136
+	public function set_has_billing_form($has_billing_form) {
137
+		$this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN);
138 138
 	}
139 139
 
140 140
 
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
 	/**
143 143
 	 * sets the file_folder property
144 144
 	 */
145
-	protected function _set_file_folder(){
145
+	protected function _set_file_folder() {
146 146
 		$reflector = new ReflectionClass(get_class($this));
147 147
 		$fn = $reflector->getFileName();
148
-		$this->_file_folder =  dirname($fn).DS;
148
+		$this->_file_folder = dirname($fn).DS;
149 149
 	}
150 150
 
151 151
 
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 	/**
154 154
 	 * sets the file URL with a trailing slash for this PMT
155 155
 	 */
156
-	protected function _set_file_url(){
157
-		$plugins_dir_fixed = str_replace('\\',DS,WP_PLUGIN_DIR);
158
-		$file_folder_fixed = str_replace('\\',DS,$this->file_folder());
159
-		$file_path = str_replace($plugins_dir_fixed,WP_PLUGIN_URL,$file_folder_fixed);
156
+	protected function _set_file_url() {
157
+		$plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR);
158
+		$file_folder_fixed = str_replace('\\', DS, $this->file_folder());
159
+		$file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed);
160 160
 		$this->_file_url = $file_path;
161 161
 	}
162 162
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 * Gets the default description on all payment methods of this type
165 165
 	 * @return string
166 166
 	 */
167
-	public function default_description(){
167
+	public function default_description() {
168 168
 		return $this->_default_description;
169 169
 	}
170 170
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * Returns the folder containing the PMT child class, with a trailing slash
175 175
 	 * @return string
176 176
 	 */
177
-	public function file_folder(){
177
+	public function file_folder() {
178 178
 		return $this->_file_folder;
179 179
 	}
180 180
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	/**
184 184
 	 * @return string
185 185
 	 */
186
-	public function file_url(){
186
+	public function file_url() {
187 187
 		return $this->_file_url;
188 188
 	}
189 189
 
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 	 * Its important teh payment method instance is set before
195 195
 	 * @param EE_Payment_Method $payment_method_instance
196 196
 	 */
197
-	function set_instance($payment_method_instance){
197
+	function set_instance($payment_method_instance) {
198 198
 		$this->_pm_instance = $payment_method_instance;
199 199
 		//if they have already requested the settings form, make sure its
200 200
 		//data matches this model object
201
-		if($this->_settings_form){
201
+		if ($this->_settings_form) {
202 202
 			$this->settings_form()->populate_model_obj($payment_method_instance);
203 203
 		}
204
-		if($this->_gateway && $this->_gateway instanceof EE_Gateway){
204
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
205 205
 			$this->_gateway->set_settings($payment_method_instance->settings_array());
206 206
 		}
207 207
 	}
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
 	 * Gets teh form for displaying to admins where they setup the payment method
213 213
 	 * @return EE_Payment_Method_Form
214 214
 	 */
215
-	function settings_form(){
216
-		if( ! $this->_settings_form){
215
+	function settings_form() {
216
+		if ( ! $this->_settings_form) {
217 217
 			$this->_settings_form = $this->generate_new_settings_form();
218
-			$this->_settings_form->set_payment_method_type( $this );
219
-			$this->_settings_form->_construct_finalize(NULL, NULL );
218
+			$this->_settings_form->set_payment_method_type($this);
219
+			$this->_settings_form->_construct_finalize(NULL, NULL);
220 220
 			//if we have already assigned a model object to this pmt, make
221 221
 			//sure its reflected in teh form we just generated
222
-			if($this->_pm_instance){
222
+			if ($this->_pm_instance) {
223 223
 				$this->_settings_form->populate_model_obj($this->_pm_instance);
224 224
 			}
225 225
 		}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * this payment method type's settings form later in the request
246 246
 	 * @param EE_Payment_Method_Form $form
247 247
 	 */
248
-	public function set_settings_form($form){
248
+	public function set_settings_form($form) {
249 249
 		$this->_settings_form = $form;
250 250
 	}
251 251
 
@@ -268,10 +268,10 @@  discard block
 block discarded – undo
268 268
 	 * @param array $extra_args
269 269
 	 * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null
270 270
 	 */
271
-	public function billing_form( EE_Transaction $transaction = NULL, $extra_args = array() ){
271
+	public function billing_form(EE_Transaction $transaction = NULL, $extra_args = array()) {
272 272
 		// has billing form already been regenerated ? or overwrite cache?
273
-		if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form ){
274
-			$this->_billing_form = $this->generate_new_billing_form( $transaction, $extra_args );
273
+		if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) {
274
+			$this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args);
275 275
 		}
276 276
 		//if we know who the attendee is, and this is a billing form
277 277
 		//that uses attendee info, populate it
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 			$transaction instanceof EE_Transaction &&
281 281
 			$transaction->primary_registration() instanceof EE_Registration &&
282 282
 			$transaction->primary_registration()->attendee() instanceof EE_Attendee
283
-		){
284
-			$this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() );
283
+		) {
284
+			$this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee());
285 285
 		}
286 286
 		return $this->_billing_form;
287 287
 	}
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 * @param \EE_Transaction $transaction
293 293
 	 * @return \EE_Billing_Info_Form
294 294
 	 */
295
-	abstract function generate_new_billing_form( EE_Transaction $transaction = NULL );
295
+	abstract function generate_new_billing_form(EE_Transaction $transaction = NULL);
296 296
 
297 297
 
298 298
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 * @param \EE_Billing_Info_Form $billing_form
304 304
 	 * @return \EE_Billing_Info_Form
305 305
 	 */
306
-	public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) {
306
+	public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) {
307 307
 		return $billing_form;
308 308
 	}
309 309
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 * if you have form
315 315
 	 * @param EE_Payment_Method $form
316 316
 	 */
317
-	public function set_billing_form($form){
317
+	public function set_billing_form($form) {
318 318
 		$this->_billing_form = $form;
319 319
 	}
320 320
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 * Returns whether or not this payment method requires HTTPS to be used
325 325
 	 * @return boolean
326 326
 	 */
327
-	function requires_https(){
327
+	function requires_https() {
328 328
 		return $this->_requires_https;
329 329
 	}
330 330
 
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
 	 * @return EE_Payment
343 343
 	 * @throws EE_Error
344 344
 	 */
345
-	function process_payment( EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null,$fail_url = '', $method = 'CART', $by_admin = false ){
345
+	function process_payment(EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null, $fail_url = '', $method = 'CART', $by_admin = false) {
346 346
 		// @todo: add surcharge for the payment method, if any
347
-		if ( $this->_gateway ) {
347
+		if ($this->_gateway) {
348 348
 			//there is a gateway, so we're going to make a payment object
349 349
 			//but wait! do they already have a payment in progress that we thought was failed?
350 350
 			$duplicate_properties = array(
@@ -355,10 +355,10 @@  discard block
 block discarded – undo
355 355
 				'PAY_amount' 					=> $amount !== null ? $amount : $transaction->remaining(),
356 356
 				'PAY_gateway_response' 	=> null,
357 357
 			);
358
-			$payment = EEM_Payment::instance()->get_one( array( $duplicate_properties ));
358
+			$payment = EEM_Payment::instance()->get_one(array($duplicate_properties));
359 359
 			//if we didn't already have a payment in progress for the same thing,
360 360
 			//then we actually want to make a new payment
361
-			if ( ! $payment instanceof EE_Payment ){
361
+			if ( ! $payment instanceof EE_Payment) {
362 362
 				$payment = EE_Payment::new_instance(
363 363
 					array_merge(
364 364
 						$duplicate_properties,
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 							'PAY_gateway_response' => apply_filters( 
372 372
 								'FHEE__EE_PMT_Base__process_payment__PAY_details', 
373 373
 								sprintf(
374
-									__( 'No response from %1$s. An administrator should verify the payment status before you reattempt payment.', 'event_espresso' ),
374
+									__('No response from %1$s. An administrator should verify the payment status before you reattempt payment.', 'event_espresso'),
375 375
 									$this->pretty_name() 
376 376
 								) 
377 377
 							)
@@ -381,10 +381,10 @@  discard block
 block discarded – undo
381 381
 			}
382 382
 			//make sure the payment has been saved to show we started it, and so it has an ID should the gateway try to log it
383 383
 			$payment->save();
384
-			$billing_values = $this->_get_billing_values_from_form( $billing_info );
384
+			$billing_values = $this->_get_billing_values_from_form($billing_info);
385 385
 
386 386
 			//  Offsite Gateway
387
-			if( $this->_gateway instanceof EE_Offsite_Gateway ){
387
+			if ($this->_gateway instanceof EE_Offsite_Gateway) {
388 388
 
389 389
 				$payment = $this->_gateway->set_redirection_info(
390 390
 					$payment,
@@ -400,17 +400,17 @@  discard block
 block discarded – undo
400 400
 				);
401 401
 				$payment->save();
402 402
 			//  Onsite Gateway
403
-			} elseif ( $this->_gateway instanceof EE_Onsite_Gateway ) {
403
+			} elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
404 404
 
405
-				$payment = $this->_gateway->do_direct_payment($payment,$billing_values);
405
+				$payment = $this->_gateway->do_direct_payment($payment, $billing_values);
406 406
 				$payment->save();
407 407
 
408 408
 			} else {
409 409
 				throw new EE_Error(
410 410
 					sprintf(
411
-						__('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso' ),
411
+						__('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso'),
412 412
 						get_class($this),
413
-						gettype( $this->_gateway )
413
+						gettype($this->_gateway)
414 414
 					)
415 415
 				);
416 416
 			}
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
 		}
433 433
 
434 434
 		// if there is billing info, clean it and save it now
435
-		if( $billing_info instanceof EE_Billing_Attendee_Info_Form ){
436
-			$this->_save_billing_info_to_attendee( $billing_info, $transaction );
435
+		if ($billing_info instanceof EE_Billing_Attendee_Info_Form) {
436
+			$this->_save_billing_info_to_attendee($billing_info, $transaction);
437 437
 		}
438 438
 
439 439
 		return $payment;
@@ -446,10 +446,10 @@  discard block
 block discarded – undo
446 446
 	 * @param EE_Billing_Info_Form $billing_form
447 447
 	 * @return array
448 448
 	 */
449
-	protected function _get_billing_values_from_form( $billing_form ){
450
-		if($billing_form instanceof EE_Form_Section_Proper ){
451
-			return $billing_form->input_pretty_values( true );
452
-		}else{
449
+	protected function _get_billing_values_from_form($billing_form) {
450
+		if ($billing_form instanceof EE_Form_Section_Proper) {
451
+			return $billing_form->input_pretty_values(true);
452
+		} else {
453 453
 			return NULL;
454 454
 		}
455 455
 	}
@@ -463,13 +463,13 @@  discard block
 block discarded – undo
463 463
 	 * @return EE_Payment
464 464
 	 * @throws EE_Error
465 465
 	 */
466
-	public function handle_ipn($req_data,$transaction){
466
+	public function handle_ipn($req_data, $transaction) {
467 467
 		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
468
-		if( ! $this->_gateway instanceof EE_Offsite_Gateway){
469
-			throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r( $this->_gateway, TRUE )));
468
+		if ( ! $this->_gateway instanceof EE_Offsite_Gateway) {
469
+			throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r($this->_gateway, TRUE)));
470 470
 
471 471
 		}
472
-		$payment = $this->_gateway->handle_payment_update( $req_data, $transaction );
472
+		$payment = $this->_gateway->handle_payment_update($req_data, $transaction);
473 473
 		return $payment;
474 474
 	}
475 475
 
@@ -482,22 +482,22 @@  discard block
 block discarded – undo
482 482
 	 * @param EE_Transaction $transaction
483 483
 	 * @return boolean success
484 484
 	 */
485
-	protected function _save_billing_info_to_attendee($billing_form, $transaction){
486
-		if( ! $transaction || ! $transaction instanceof EE_Transaction){
485
+	protected function _save_billing_info_to_attendee($billing_form, $transaction) {
486
+		if ( ! $transaction || ! $transaction instanceof EE_Transaction) {
487 487
 			EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
488 488
 			return false;
489 489
 		}
490 490
 		$primary_reg = $transaction->primary_registration();
491
-		if( ! $primary_reg ){
491
+		if ( ! $primary_reg) {
492 492
 			EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
493 493
 			return false;
494 494
 		}
495 495
 		$attendee = $primary_reg->attendee();
496
-		if( ! $attendee ){
496
+		if ( ! $attendee) {
497 497
 			EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
498 498
 			return false;
499 499
 		}
500
-		return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method() );
500
+		return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method());
501 501
 
502 502
 	}
503 503
 
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 	 * @param array $req_data
511 511
 	 * @return EE_Payment
512 512
 	 */
513
-	protected function find_payment_for_ipn( EE_Transaction $transaction, $req_data = array() ){
513
+	protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) {
514 514
 		return $transaction->last_payment();
515 515
 	}
516 516
 
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 	 * and identifies the IPN as being for this payment method (not just fo ra payment method of this type)
528 528
 	 * @throws EE_Error
529 529
 	 */
530
-	public function handle_unclaimed_ipn( $req_data = array() ){
531
-		throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this) ));
530
+	public function handle_unclaimed_ipn($req_data = array()) {
531
+		throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this)));
532 532
 	}
533 533
 
534 534
 
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 	 * @param EE_Transaction $transaction
545 545
 	 * @return EE_Payment
546 546
 	 */
547
-	public function finalize_payment_for($transaction){
547
+	public function finalize_payment_for($transaction) {
548 548
 		return $transaction->last_payment();
549 549
 	}
550 550
 
@@ -554,10 +554,10 @@  discard block
 block discarded – undo
554 554
 	 * Whether or not this payment method's gateway supports sending refund requests
555 555
 	 * @return boolean
556 556
 	 */
557
-	public function supports_sending_refunds(){
558
-		if($this->_gateway && $this->_gateway instanceof EE_Gateway){
557
+	public function supports_sending_refunds() {
558
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
559 559
 			return $this->_gateway->supports_sending_refunds();
560
-		}else{
560
+		} else {
561 561
 			return false;
562 562
 		}
563 563
 	}
@@ -571,14 +571,14 @@  discard block
 block discarded – undo
571 571
 	 * @throws EE_Error
572 572
 	 * @return EE_Payment
573 573
 	 */
574
-	public function process_refund( EE_Payment $payment, $refund_info = array()){
575
-		if ( $this->_gateway && $this->_gateway instanceof EE_Gateway ) {
576
-			return $this->_gateway->do_direct_refund( $payment, $refund_info );
574
+	public function process_refund(EE_Payment $payment, $refund_info = array()) {
575
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
576
+			return $this->_gateway->do_direct_refund($payment, $refund_info);
577 577
 		} else {
578 578
 			throw new EE_Error(
579 579
 				sprintf(
580
-					__( 'Payment Method Type "%s" does not support sending refund requests', 'event_espresso' ),
581
-					get_class( $this )
580
+					__('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'),
581
+					get_class($this)
582 582
 				)
583 583
 			);
584 584
 		}
@@ -592,15 +592,15 @@  discard block
 block discarded – undo
592 592
 	 * @return string
593 593
 	 * @throws EE_Error
594 594
 	 */
595
-	public function payment_occurs(){
596
-		if( ! $this->_gateway){
595
+	public function payment_occurs() {
596
+		if ( ! $this->_gateway) {
597 597
 			return EE_PMT_Base::offline;
598
-		}elseif($this->_gateway instanceof EE_Onsite_Gateway){
598
+		}elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
599 599
 			return EE_PMT_Base::onsite;
600
-		}elseif($this->_gateway instanceof EE_Offsite_Gateway){
600
+		}elseif ($this->_gateway instanceof EE_Offsite_Gateway) {
601 601
 			return EE_PMT_Base::offsite;
602
-		}else{
603
-			throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this)));
602
+		} else {
603
+			throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"), get_class($this)));
604 604
 		}
605 605
 	}
606 606
 
@@ -613,9 +613,9 @@  discard block
 block discarded – undo
613 613
 	 * @param EE_Payment $payment
614 614
 	 * @return string
615 615
 	 */
616
-	public function payment_overview_content(EE_Payment $payment){
616
+	public function payment_overview_content(EE_Payment $payment) {
617 617
 		EE_Registry::instance()->load_helper('Template');
618
-		return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance,'payment'=>$payment) , true);
618
+		return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance, 'payment'=>$payment), true);
619 619
 	}
620 620
 
621 621
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 	 *	@type array $template_args any arguments you want passed to the template file while rendering. 
629 629
 	 *				Keys will be variable names and values with be their values.
630 630
 	 */
631
-	public function help_tabs_config(){
631
+	public function help_tabs_config() {
632 632
 		return array();
633 633
 	}
634 634
 
@@ -639,9 +639,9 @@  discard block
 block discarded – undo
639 639
 	 * the payment method's table's PMT_type column)
640 640
 	 * @return string
641 641
 	 */
642
-	public function system_name(){
642
+	public function system_name() {
643 643
 		$classname = get_class($this);
644
-		return str_replace("EE_PMT_",'',$classname);
644
+		return str_replace("EE_PMT_", '', $classname);
645 645
 	}
646 646
 
647 647
 
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	 * A pretty i18n version of the PMT name
651 651
 	 * @return string
652 652
 	 */
653
-	public function pretty_name(){
653
+	public function pretty_name() {
654 654
 		return $this->_pretty_name;
655 655
 	}
656 656
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	 * Gets the default absolute URL to the payment method type's button
661 661
 	 * @return string
662 662
 	 */
663
-	public function default_button_url(){
663
+	public function default_button_url() {
664 664
 		return $this->_default_button_url;
665 665
 	}
666 666
 
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 	 * Gets the gateway used by this payment method (if any)
671 671
 	 * @return EE_Gateway
672 672
 	 */
673
-	public function get_gateway(){
673
+	public function get_gateway() {
674 674
 		return $this->_gateway;
675 675
 	}
676 676
 
@@ -679,9 +679,9 @@  discard block
 block discarded – undo
679 679
 	/**
680 680
 	 * @return string html for the link to a help tab
681 681
 	 */
682
-	public function get_help_tab_link(){
683
-		EE_Registry::instance()->load_helper( 'Template' );
684
-		return EEH_Template::get_help_tab_link( $this->get_help_tab_name() );
682
+	public function get_help_tab_link() {
683
+		EE_Registry::instance()->load_helper('Template');
684
+		return EEH_Template::get_help_tab_link($this->get_help_tab_name());
685 685
 	}
686 686
 
687 687
 
@@ -690,8 +690,8 @@  discard block
 block discarded – undo
690 690
 	 * Returns the name of the help tab for this PMT
691 691
 	 * @return string
692 692
 	 */
693
-	public function get_help_tab_name(){
694
-		return 'ee_' . strtolower( $this->system_name() ) . '_help_tab';
693
+	public function get_help_tab_name() {
694
+		return 'ee_'.strtolower($this->system_name()).'_help_tab';
695 695
 	}
696 696
 
697 697
 	/**
@@ -699,8 +699,8 @@  discard block
 block discarded – undo
699 699
 	 * this PMT by an admin
700 700
 	 * @return string
701 701
 	 */
702
-	public function cap_name(){
703
-		return 'ee_payment_method_' . strtolower( $this->system_name() );
702
+	public function cap_name() {
703
+		return 'ee_payment_method_'.strtolower($this->system_name());
704 704
 	}
705 705
 
706 706
 	/**
@@ -712,9 +712,9 @@  discard block
 block discarded – undo
712 712
 	 * @param EE_Payment $payment
713 713
 	 * @return void
714 714
 	 */
715
-	public function update_txn_based_on_payment( $payment ){
716
-		if( $this->_gateway instanceof EE_Gateway ){
717
-			$this->_gateway->update_txn_based_on_payment( $payment );
715
+	public function update_txn_based_on_payment($payment) {
716
+		if ($this->_gateway instanceof EE_Gateway) {
717
+			$this->_gateway->update_txn_based_on_payment($payment);
718 718
 		}
719 719
 	}
720 720
 
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_SPCO_JSON_Response.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -113,75 +113,75 @@  discard block
 block discarded – undo
113 113
 	public function __toString() {
114 114
 		$JSON_response = array();
115 115
 		// grab notices
116
-		$notices = EE_Error::get_notices( FALSE );
117
-		$this->set_attention( isset( $notices['attention'] ) ? $notices['attention'] : '' );
118
-		$this->set_errors( isset( $notices['errors'] ) ? $notices['errors'] : '' );
119
-		$this->set_success( isset( $notices['success'] ) ? $notices['success'] : '' );
116
+		$notices = EE_Error::get_notices(FALSE);
117
+		$this->set_attention(isset($notices['attention']) ? $notices['attention'] : '');
118
+		$this->set_errors(isset($notices['errors']) ? $notices['errors'] : '');
119
+		$this->set_success(isset($notices['success']) ? $notices['success'] : '');
120 120
 		// add notices to JSON response, but only if they exist
121
-		if ( $this->attention() ) {
121
+		if ($this->attention()) {
122 122
 			$JSON_response['attention'] = $this->attention();
123 123
 		}
124
-		if ( $this->errors() ) {
124
+		if ($this->errors()) {
125 125
 			$JSON_response['errors'] = $this->errors();
126 126
 		}
127
-		if ( $this->unexpected_errors() ) {
127
+		if ($this->unexpected_errors()) {
128 128
 			$JSON_response['unexpected_errors'] = $this->unexpected_errors();
129 129
 		}
130
-		if ( $this->success() ) {
130
+		if ($this->success()) {
131 131
 			$JSON_response['success'] = $this->success();
132 132
 		}
133 133
 		// but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked
134
-		if ( ! isset( $JSON_response[ 'attention' ] ) && ! isset( $JSON_response[ 'errors' ] ) && ! isset( $JSON_response[ 'success' ] ) ) {
134
+		if ( ! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) {
135 135
 			$JSON_response['success'] = null;
136 136
 		}
137 137
 		// set redirect_url, IF it exists
138
-		if ( $this->redirect_url() ) {
138
+		if ($this->redirect_url()) {
139 139
 			$JSON_response['redirect_url'] = $this->redirect_url();
140 140
 		}
141 141
 		// set registration_time_limit, IF it exists
142
-		if ( $this->registration_time_limit() ) {
142
+		if ($this->registration_time_limit()) {
143 143
 			$JSON_response['registration_time_limit'] = $this->registration_time_limit();
144 144
 		}
145 145
 		// set payment_amount, IF it exists
146
-		if ( $this->payment_amount() !== null ) {
147
-			$JSON_response[ 'payment_amount' ] = $this->payment_amount();
146
+		if ($this->payment_amount() !== null) {
147
+			$JSON_response['payment_amount'] = $this->payment_amount();
148 148
 		}
149 149
 		// grab generic return data
150 150
 		$return_data = $this->return_data();
151 151
 		// add billing form validation rules
152
-		if ( $this->validation_rules() ) {
152
+		if ($this->validation_rules()) {
153 153
 			$return_data['validation_rules'] = $this->validation_rules();
154 154
 		}
155 155
 		// set reg_step_html, IF it exists
156
-		if ( $this->reg_step_html() ) {
156
+		if ($this->reg_step_html()) {
157 157
 			$return_data['reg_step_html'] = $this->reg_step_html();
158 158
 		}
159 159
 		// set method of payment, IF it exists
160
-		if ( $this->method_of_payment() ) {
160
+		if ($this->method_of_payment()) {
161 161
 			$return_data['method_of_payment'] = $this->method_of_payment();
162 162
 		}
163 163
 		// set "plz_select_method_of_payment" message, IF it exists
164
-		if ( $this->plz_select_method_of_payment() ) {
164
+		if ($this->plz_select_method_of_payment()) {
165 165
 			$return_data['plz_select_method_of_payment'] = $this->plz_select_method_of_payment();
166 166
 		}
167 167
 		// set redirect_form, IF it exists
168
-		if ( $this->redirect_form() ) {
168
+		if ($this->redirect_form()) {
169 169
 			$return_data['redirect_form'] = $this->redirect_form();
170 170
 		}
171 171
 		// and finally, add return_data array to main JSON response array, IF it contains anything
172 172
 		// why did we add some of the above properties to the return data array?
173 173
 		// because it is easier and cleaner in the Javascript to deal with this way
174
-		if ( ! empty( $return_data )) {
174
+		if ( ! empty($return_data)) {
175 175
 			$JSON_response['return_data'] = $return_data;
176 176
 		}
177 177
 		
178
-		if( ! empty( $this->reg_status_url() ) ) {
179
-			$JSON_response[ 'reg_status_url' ] = $this->reg_status_url();
178
+		if ( ! empty($this->reg_status_url())) {
179
+			$JSON_response['reg_status_url'] = $this->reg_status_url();
180 180
 		}
181 181
 		// filter final array
182
-		$JSON_response = apply_filters( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response );
182
+		$JSON_response = apply_filters('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response);
183 183
 		// return encoded array
184
-		return json_encode( $JSON_response );
184
+		return json_encode($JSON_response);
185 185
 	}
186 186
 
187 187
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	/**
190 190
 	 * @param string $attention
191 191
 	 */
192
-	public function set_attention( $attention ) {
192
+	public function set_attention($attention) {
193 193
 		$this->_attention = $attention;
194 194
 	}
195 195
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	/**
208 208
 	 * @param string $errors
209 209
 	 */
210
-	public function set_errors( $errors ) {
210
+	public function set_errors($errors) {
211 211
 		$this->_errors = $errors;
212 212
 	}
213 213
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	/**
235 235
 	 * @param string $unexpected_errors
236 236
 	 */
237
-	public function set_unexpected_errors( $unexpected_errors ) {
237
+	public function set_unexpected_errors($unexpected_errors) {
238 238
 		$this->_unexpected_errors = $unexpected_errors;
239 239
 	}
240 240
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	/**
244 244
 	 * @param string $success
245 245
 	 */
246
-	public function set_success( $success ) {
246
+	public function set_success($success) {
247 247
 		$this->_success = $success;
248 248
 	}
249 249
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	/**
262 262
 	 * @param string $method_of_payment
263 263
 	 */
264
-	public function set_method_of_payment( $method_of_payment ) {
264
+	public function set_method_of_payment($method_of_payment) {
265 265
 		$this->_method_of_payment = $method_of_payment;
266 266
 	}
267 267
 
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
 	/**
289 289
 	 * @param float $payment_amount
290 290
 	 */
291
-	public function set_payment_amount( $payment_amount ) {
292
-		EE_Registry::instance()->load_helper( 'Money' );
293
-		$this->_payment_amount = EEH_Money::convert_to_float_from_localized_money( $payment_amount );
291
+	public function set_payment_amount($payment_amount) {
292
+		EE_Registry::instance()->load_helper('Money');
293
+		$this->_payment_amount = EEH_Money::convert_to_float_from_localized_money($payment_amount);
294 294
 	}
295 295
 
296 296
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	/**
299 299
 	 * @param string $next_step_html
300 300
 	 */
301
-	public function set_reg_step_html( $next_step_html ) {
301
+	public function set_reg_step_html($next_step_html) {
302 302
 		$this->_reg_step_html = $next_step_html;
303 303
 	}
304 304
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	/**
317 317
 	 * @param string $redirect_form
318 318
 	 */
319
-	public function set_redirect_form( $redirect_form ) {
319
+	public function set_redirect_form($redirect_form) {
320 320
 		$this->_redirect_form = $redirect_form;
321 321
 	}
322 322
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	 * @return string
327 327
 	 */
328 328
 	public function redirect_form() {
329
-		return ! empty( $this->_redirect_form ) ? $this->_redirect_form : FALSE;
329
+		return ! empty($this->_redirect_form) ? $this->_redirect_form : FALSE;
330 330
 	}
331 331
 
332 332
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	/**
335 335
 	 * @param string $plz_select_method_of_payment
336 336
 	 */
337
-	public function set_plz_select_method_of_payment( $plz_select_method_of_payment ) {
337
+	public function set_plz_select_method_of_payment($plz_select_method_of_payment) {
338 338
 		$this->_plz_select_method_of_payment = $plz_select_method_of_payment;
339 339
 	}
340 340
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	/**
353 353
 	 * @param string $redirect_url
354 354
 	 */
355
-	public function set_redirect_url( $redirect_url ) {
355
+	public function set_redirect_url($redirect_url) {
356 356
 		$this->_redirect_url = $redirect_url;
357 357
 	}
358 358
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 	 * 
371 371
 	 * @param string $url
372 372
 	 */
373
-	public function set_reg_status_url( $url ) {
373
+	public function set_reg_status_url($url) {
374 374
 		$this->_reg_status_url = $url;
375 375
 	}
376 376
 	
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	/**
396 396
 	 * @param string $registration_time_limit
397 397
 	 */
398
-	public function set_registration_time_limit( $registration_time_limit ) {
398
+	public function set_registration_time_limit($registration_time_limit) {
399 399
 		$this->_registration_time_limit = $registration_time_limit;
400 400
 	}
401 401
 
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
 	/**
405 405
 	 * @param array $return_data
406 406
 	 */
407
-	public function set_return_data( $return_data ) {
408
-		$this->_return_data = array_merge( $this->_return_data, $return_data );
407
+	public function set_return_data($return_data) {
408
+		$this->_return_data = array_merge($this->_return_data, $return_data);
409 409
 	}
410 410
 
411 411
 
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
 	/**
423 423
 	 * @param array $validation_rules
424 424
 	 */
425
-	public function add_validation_rules( $validation_rules = array() ) {
426
-		if ( is_array( $validation_rules ) && ! empty( $validation_rules )) {
427
-			$this->_validation_rules = array_merge( $this->_validation_rules, $validation_rules );
425
+	public function add_validation_rules($validation_rules = array()) {
426
+		if (is_array($validation_rules) && ! empty($validation_rules)) {
427
+			$this->_validation_rules = array_merge($this->_validation_rules, $validation_rules);
428 428
 		}
429 429
 	}
430 430
 
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 	 * @return array | bool
435 435
 	 */
436 436
 	public function validation_rules() {
437
-		return ! empty( $this->_validation_rules ) ? $this->_validation_rules : FALSE;
437
+		return ! empty($this->_validation_rules) ? $this->_validation_rules : FALSE;
438 438
 	}
439 439
 
440 440
 
Please login to merge, or discard this patch.
attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 1 patch
Spacing   +264 added lines, -265 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 	 * @param    EE_Checkout $checkout
38 38
 	 * @return    \EE_SPCO_Reg_Step_Attendee_Information
39 39
 	 */
40
-	public function __construct( EE_Checkout $checkout ) {
40
+	public function __construct(EE_Checkout $checkout) {
41 41
 		$this->_slug = 'attendee_information';
42 42
 		$this->_name = __('Attendee Information', 'event_espresso');
43
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php';
43
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php';
44 44
 		$this->checkout = $checkout;
45 45
 		$this->_reset_success_message();
46
-		$this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso'));
46
+		$this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso'));
47 47
 	}
48 48
 
49 49
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso');
53 53
 		EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso');
54 54
 		EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso');
55
-		EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' );
55
+		EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>');
56 56
 		EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso');
57 57
 		EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso');
58 58
 		EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso');
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		EEH_Autoloader::register_line_item_display_autoloaders();
86 86
 		$Line_Item_Display = new EE_Line_Item_Display();
87 87
 		// calculate taxes
88
-		$Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) );
88
+		$Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true));
89 89
 		EE_Registry::instance()->load_helper('Line_Item');
90 90
 		/** @var $subsections EE_Form_Section_Proper[] */
91 91
 		$subsections = array(
@@ -97,33 +97,33 @@  discard block
 block discarded – undo
97 97
 			'ticket_count' 	=> array()
98 98
 		);
99 99
 		// grab the saved registrations from the transaction
100
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
101
-		if ( $registrations ) {
102
-			foreach ( $registrations as $registration ) {
103
-				if ( $registration instanceof EE_Registration ) {
100
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
101
+		if ($registrations) {
102
+			foreach ($registrations as $registration) {
103
+				if ($registration instanceof EE_Registration) {
104 104
 					// can this registration be processed during this visit ?
105
-					if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
106
-						$subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration );
107
-						if ( ! $this->checkout->admin_request ) {
108
-							$template_args['registrations'][ $registration->reg_url_link() ] = $registration;
109
-							$template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1;
110
-							$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) );
111
-							$ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item;
112
-							$template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item );
105
+					if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
106
+						$subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration);
107
+						if ( ! $this->checkout->admin_request) {
108
+							$template_args['registrations'][$registration->reg_url_link()] = $registration;
109
+							$template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1;
110
+							$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID()));
111
+							$ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item;
112
+							$template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item);
113 113
 						}
114
-						if ( $registration->is_primary_registrant() ) {
114
+						if ($registration->is_primary_registrant()) {
115 115
 							$primary_registrant = $registration->reg_url_link();
116 116
 						}
117 117
 					}
118 118
 				}
119 119
 			}
120 120
 			// print_copy_info ?
121
-			if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) {
121
+			if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) {
122 122
 				// TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info
123 123
 				$copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info();
124 124
 				// generate hidden input
125
-				if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) {
126
-					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
125
+				if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) {
126
+					$subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false);
127 127
 				}
128 128
 			}
129 129
 
@@ -135,8 +135,7 @@  discard block
 block discarded – undo
135 135
 				'html_id' 					=> $this->reg_form_name(),
136 136
 				'subsections' 			=> $subsections,
137 137
 				'layout_strategy'		=> $this->checkout->admin_request ?
138
-					new EE_Div_Per_Section_Layout() :
139
-					new EE_Template_Layout(
138
+					new EE_Div_Per_Section_Layout() : new EE_Template_Layout(
140 139
 						array(
141 140
 							'layout_template_file' 	=> $this->_template, // layout_template
142 141
 							'template_args' 				=> $template_args
@@ -153,61 +152,61 @@  discard block
 block discarded – undo
153 152
 	 * @param EE_Registration $registration
154 153
 	 * @return EE_Form_Section_Proper
155 154
 	 */
156
-	private function _registrations_reg_form( EE_Registration $registration ) {
157
-		EE_Registry::instance()->load_helper( 'Template' );
155
+	private function _registrations_reg_form(EE_Registration $registration) {
156
+		EE_Registry::instance()->load_helper('Template');
158 157
 		static $attendee_nmbr = 1;
159 158
 		// array of params to pass to parent constructor
160 159
 		$form_args = array(
161
-			'html_id' 				=> 'ee-registration-' . $registration->reg_url_link(),
160
+			'html_id' 				=> 'ee-registration-'.$registration->reg_url_link(),
162 161
 			'html_class' 		=> 'ee-reg-form-attendee-dv',
163 162
 			'html_style' 		=> $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '',
164 163
 			'subsections' 		=> array(),
165 164
 			'layout_strategy' => new EE_Fieldset_Section_Layout(
166 165
 				array(
167 166
 					'legend_class' 	=> 'spco-attendee-lgnd smaller-text lt-grey-text',
168
-					'legend_text' 	=> sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr )
167
+					'legend_text' 	=> sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr)
169 168
 				)
170 169
 			)
171 170
 		);
172 171
 		// verify that registration has valid event
173
-		if ( $registration->event() instanceof EE_Event ) {
172
+		if ($registration->event() instanceof EE_Event) {
174 173
 			$query_params = array(
175 174
 				array(
176 175
 					'Event.EVT_ID' => $registration->event()->ID(),
177 176
 					'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE
178 177
 				),
179
-				'order_by'=>array( 'QSG_order'=>'ASC' )
178
+				'order_by'=>array('QSG_order'=>'ASC')
180 179
 			);
181
-			$question_groups = $registration->event()->question_groups( $query_params );
182
-			if ( $question_groups ) {
183
-				foreach ( $question_groups as $question_group ) {
184
-					if ( $question_group instanceof EE_Question_Group ) {
185
-						$form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group );
180
+			$question_groups = $registration->event()->question_groups($query_params);
181
+			if ($question_groups) {
182
+				foreach ($question_groups as $question_group) {
183
+					if ($question_group instanceof EE_Question_Group) {
184
+						$form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group);
186 185
 						// add hidden input
187
-						$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration );
186
+						$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration);
188 187
 					}
189 188
 				}
190 189
 				// if we have question groups for additional attendees, then display the copy options
191 190
 				$this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info;
192 191
 			} else {
193
-				$form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML(
192
+				$form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML(
194 193
 					EEH_Template::locate_template(
195
-						SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php',
196
-						apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()),
194
+						SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php',
195
+						apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()),
197 196
 						TRUE,
198 197
 						TRUE
199 198
 					)
200 199
 				);
201 200
 				// add hidden input
202
-				$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE );
201
+				$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE);
203 202
 			}
204 203
 		}
205
-		if ( $registration->is_primary_registrant() ) {
204
+		if ($registration->is_primary_registrant()) {
206 205
 			// generate hidden input
207
-			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration );
206
+			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration);
208 207
 		}
209 208
 		$attendee_nmbr++;
210
-		return new EE_Form_Section_Proper( $form_args );
209
+		return new EE_Form_Section_Proper($form_args);
211 210
 	}
212 211
 
213 212
 
@@ -220,11 +219,11 @@  discard block
 block discarded – undo
220 219
 	 * @param bool  $additional_attendee_reg_info
221 220
 	 * @return    EE_Form_Input_Base
222 221
 	 */
223
-	private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){
222
+	private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) {
224 223
 		// generate hidden input
225 224
 		return new EE_Hidden_Input(
226 225
 			array(
227
-				'html_id' 				=> 'additional-attendee-reg-info-' . $registration->reg_url_link(),
226
+				'html_id' 				=> 'additional-attendee-reg-info-'.$registration->reg_url_link(),
228 227
 				'default'				=> $additional_attendee_reg_info
229 228
 			)
230 229
 		);
@@ -237,22 +236,22 @@  discard block
 block discarded – undo
237 236
 	 * @param EE_Question_Group $question_group
238 237
 	 * @return EE_Form_Section_Proper
239 238
 	 */
240
-	private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){
239
+	private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) {
241 240
 		// array of params to pass to parent constructor
242 241
 		$form_args = array(
243
-			'html_id' 					=> 'ee-reg-form-qstn-grp-' . $question_group->identifier(),
242
+			'html_id' 					=> 'ee-reg-form-qstn-grp-'.$question_group->identifier(),
244 243
 			'html_class' 			=> $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv',
245
-			'html_label_id' 		=> 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl',
244
+			'html_label_id' 		=> 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl',
246 245
 			'subsections' 			=> array(
247
-				'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group )
246
+				'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group)
248 247
 			),
249 248
 			'layout_strategy' 	=> $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout()
250 249
 		);
251 250
 		// where params
252
-		$query_params = array( 'QST_deleted' => 0 );
251
+		$query_params = array('QST_deleted' => 0);
253 252
 		// don't load admin only questions on the frontend
254
-		if ( ! $this->checkout->admin_request ) {
255
-			$query_params['QST_admin_only'] = array( '!=', TRUE );
253
+		if ( ! $this->checkout->admin_request) {
254
+			$query_params['QST_admin_only'] = array('!=', TRUE);
256 255
 		}
257 256
 		$questions = $question_group->get_many_related(
258 257
 			'Question',
@@ -264,21 +263,21 @@  discard block
 block discarded – undo
264 263
 			)
265 264
 		);
266 265
 		// filter for additional content before questions
267
-		$form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this ));
266
+		$form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this));
268 267
 		// loop thru questions
269
-		foreach ( $questions as $question ) {
270
-			if( $question instanceof EE_Question ){
268
+		foreach ($questions as $question) {
269
+			if ($question instanceof EE_Question) {
271 270
 				$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
272
-				$form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question );
271
+				$form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question);
273 272
 			}
274 273
 		}
275
-		$form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this );
274
+		$form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this);
276 275
 
277 276
 		// filter for additional content after questions
278
-		$form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this ));
277
+		$form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this));
279 278
 //		d( $form_args );
280
-		$question_group_reg_form = new EE_Form_Section_Proper( $form_args );
281
-		return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this );
279
+		$question_group_reg_form = new EE_Form_Section_Proper($form_args);
280
+		return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this);
282 281
 	}
283 282
 
284 283
 
@@ -288,12 +287,12 @@  discard block
 block discarded – undo
288 287
 	 * @param EE_Question_Group $question_group
289 288
 	 * @return 	EE_Form_Section_HTML
290 289
 	 */
291
-	private function _question_group_header( EE_Question_Group $question_group ){
290
+	private function _question_group_header(EE_Question_Group $question_group) {
292 291
 		$html = '';
293 292
 		// group_name
294
-		if ( $question_group->show_group_name() && $question_group->name() != '' ) {
293
+		if ($question_group->show_group_name() && $question_group->name() != '') {
295 294
 			EE_Registry::instance()->load_helper('HTML');
296
-			if ( $this->checkout->admin_request ) {
295
+			if ($this->checkout->admin_request) {
297 296
 				$html .= EEH_HTML::br();
298 297
 				$html .= EEH_HTML::h3(
299 298
 					$question_group->name(),
@@ -307,7 +306,7 @@  discard block
 block discarded – undo
307 306
 			}
308 307
 		}
309 308
 		// group_desc
310
-		if ( $question_group->show_group_desc() && $question_group->desc() != '' ) {
309
+		if ($question_group->show_group_desc() && $question_group->desc() != '') {
311 310
 			$html .= EEH_HTML::p(
312 311
 				$question_group->desc(),
313 312
 				'',
@@ -315,7 +314,7 @@  discard block
 block discarded – undo
315 314
 			);
316 315
 
317 316
 		}
318
-		return new EE_Form_Section_HTML( $html );
317
+		return new EE_Form_Section_HTML($html);
319 318
 	}
320 319
 
321 320
 
@@ -324,14 +323,14 @@  discard block
 block discarded – undo
324 323
 	 * @access public
325 324
 	 * @return 	EE_Form_Section_Proper
326 325
 	 */
327
-	private function _copy_attendee_info_form(){
326
+	private function _copy_attendee_info_form() {
328 327
 		// array of params to pass to parent constructor
329 328
 		return new EE_Form_Section_Proper(
330 329
 			array(
331 330
 				'subsections' 			=> $this->_copy_attendee_info_inputs(),
332 331
 				'layout_strategy' 	=> new EE_Template_Layout(
333 332
 					array(
334
-						'layout_template_file' 			=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template
333
+						'layout_template_file' 			=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template
335 334
 						'begin_template_file' 			=> NULL,
336 335
 						'input_template_file' 				=> NULL,
337 336
 						'subsection_template_file' 	=> NULL,
@@ -353,8 +352,8 @@  discard block
 block discarded – undo
353 352
 	private function _auto_copy_attendee_info() {
354 353
 		return new EE_Form_Section_HTML(
355 354
 			EEH_Template::locate_template(
356
-				SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php',
357
-				apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()),
355
+				SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php',
356
+				apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()),
358 357
 				TRUE,
359 358
 				TRUE
360 359
 			)
@@ -373,25 +372,25 @@  discard block
 block discarded – undo
373 372
 		$copy_attendee_info_inputs = array();
374 373
 		$prev_ticket = NULL;
375 374
 		// grab the saved registrations from the transaction
376
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
377
-		foreach ( $registrations as $registration ) {
375
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
376
+		foreach ($registrations as $registration) {
378 377
 			// for all  attendees other than the primary attendee
379
-			if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) {
378
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
380 379
 				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
381
-				if ( $registration->ticket()->ID() !== $prev_ticket ) {
380
+				if ($registration->ticket()->ID() !== $prev_ticket) {
382 381
 					$item_name = $registration->ticket()->name();
383
-					$item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : '';
384
-					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML(
385
-						'<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
382
+					$item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : '';
383
+					$copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML(
384
+						'<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
386 385
 					);
387 386
 					$prev_ticket = $registration->ticket()->ID();
388 387
 				}
389 388
 
390
-				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new
389
+				$copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new
391 390
 				EE_Checkbox_Multi_Input(
392
-					array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )),
391
+					array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())),
393 392
 					array(
394
-						'html_id' 								=> 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
393
+						'html_id' 								=> 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
395 394
 						'html_class' 						=> 'spco-copy-attendee-chk ee-do-not-validate',
396 395
 						'display_html_label_text' 	=> FALSE
397 396
 					)
@@ -410,7 +409,7 @@  discard block
 block discarded – undo
410 409
 	 * @param EE_Registration $registration
411 410
 	 * @return    EE_Form_Input_Base
412 411
 	 */
413
-	private function _additional_primary_registrant_inputs( EE_Registration $registration ){
412
+	private function _additional_primary_registrant_inputs(EE_Registration $registration) {
414 413
 		// generate hidden input
415 414
 		return new EE_Hidden_Input(
416 415
 			array(
@@ -428,31 +427,31 @@  discard block
 block discarded – undo
428 427
 	 * @param EE_Question     $question
429 428
 	 * @return 	EE_Form_Input_Base
430 429
 	 */
431
-	public function reg_form_question( EE_Registration $registration, EE_Question $question ){
430
+	public function reg_form_question(EE_Registration $registration, EE_Question $question) {
432 431
 
433 432
 		// if this question was for an attendee detail, then check for that answer
434
-		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->system_ID() );
433
+		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->system_ID());
435 434
 		$answer = $answer_value === null
436
-				? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() )	) )
435
+				? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())))
437 436
 				: null;
438 437
 		// if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object
439
-		if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) {
438
+		if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) {
440 439
 			// create an EE_Answer object for storing everything in
441
-			$answer = EE_Answer::new_instance ( array(
440
+			$answer = EE_Answer::new_instance(array(
442 441
 				'QST_ID'=> $question->ID(),
443 442
 				'REG_ID'=> $registration->ID()
444 443
 			));
445 444
 		}
446 445
 		// verify instance
447
-		if( $answer instanceof EE_Answer ){
448
-			if ( ! empty( $answer_value )) {
449
-				$answer->set( 'ANS_value', $answer_value );
446
+		if ($answer instanceof EE_Answer) {
447
+			if ( ! empty($answer_value)) {
448
+				$answer->set('ANS_value', $answer_value);
450 449
 			}
451
-			$answer->cache( 'Question', $question );
452
-			$answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link();
453
-			$registration->cache( 'Answer', $answer, $answer_cache_id );
450
+			$answer->cache('Question', $question);
451
+			$answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link();
452
+			$registration->cache('Answer', $answer, $answer_cache_id);
454 453
 		}
455
-		return $this->_generate_question_input( $registration, $question, $answer );
454
+		return $this->_generate_question_input($registration, $question, $answer);
456 455
 
457 456
 	}
458 457
 
@@ -464,7 +463,7 @@  discard block
 block discarded – undo
464 463
 	 * @param mixed EE_Answer|NULL      $answer
465 464
 	 * @return EE_Form_Input_Base
466 465
 	 */
467
-	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
466
+	private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) {
468 467
 		//		d( $registration );
469 468
 		//		d( $question );
470 469
 		//		d( $answer );
@@ -487,29 +486,29 @@  discard block
 block discarded – undo
487 486
 		$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
488 487
 
489 488
 		$input_constructor_args = array(
490
-			'html_name' 			=> 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
491
-			'html_id' 					=> 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
492
-			'html_class' 			=> 'ee-reg-qstn ee-reg-qstn-' . $identifier,
489
+			'html_name' 			=> 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
490
+			'html_id' 					=> 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
491
+			'html_class' 			=> 'ee-reg-qstn ee-reg-qstn-'.$identifier,
493 492
 			'required' 				=> $question->required() ? TRUE : FALSE,
494
-			'html_label_id'		=> 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
493
+			'html_label_id'		=> 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
495 494
 			'html_label_class'	=> 'ee-reg-qstn',
496 495
 			'html_label_text'		=> $question->display_text(),
497 496
 			'required_validation_error_message' => $question->required_text()
498 497
 		);
499 498
 		// has this question been answered ?
500
-		if ( $answer instanceof EE_Answer ) {
501
-			if ( $answer->ID() ) {
502
-				$input_constructor_args['html_name'] 		.= '[' . $answer->ID() . ']';
503
-				$input_constructor_args['html_id'] 				.= '-' . $answer->ID();
504
-				$input_constructor_args['html_label_id'] 	.= '-' . $answer->ID();
499
+		if ($answer instanceof EE_Answer) {
500
+			if ($answer->ID()) {
501
+				$input_constructor_args['html_name'] 		.= '['.$answer->ID().']';
502
+				$input_constructor_args['html_id'] 				.= '-'.$answer->ID();
503
+				$input_constructor_args['html_label_id'] .= '-'.$answer->ID();
505 504
 			}
506 505
 			$input_constructor_args['default'] = $answer->value();
507 506
 		}
508 507
 		//add "-lbl" to the end of the label id
509
-		$input_constructor_args['html_label_id'] 	.= '-lbl';
510
-		$max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() );
511
-		if( EEM_Question::instance()->question_type_is_in_category(  $question->type(), 'text' ) ) {
512
-			$input_constructor_args[ 'validation_strategies' ][] = new EE_Max_Length_Validation_Strategy( 
508
+		$input_constructor_args['html_label_id'] .= '-lbl';
509
+		$max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID());
510
+		if (EEM_Question::instance()->question_type_is_in_category($question->type(), 'text')) {
511
+			$input_constructor_args['validation_strategies'][] = new EE_Max_Length_Validation_Strategy( 
513 512
 				null, 
514 513
 				min( 
515 514
 					$max_max_for_question, 
@@ -517,83 +516,83 @@  discard block
 block discarded – undo
517 516
 				) 
518 517
 			);
519 518
 		}
520
-		$input_constructor_args = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args',
519
+		$input_constructor_args = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args',
521 520
 				$input_constructor_args,
522 521
 				$registration,
523 522
 				$question,
524 523
 				$answer
525 524
 				);
526 525
 
527
-		$this->_required_questions[ $identifier ] = $question->required() ? true : false;
526
+		$this->_required_questions[$identifier] = $question->required() ? true : false;
528 527
 
529
-		switch ( $question->type() ) {
528
+		switch ($question->type()) {
530 529
 			// Text
531 530
 			case EEM_Question::QST_type_text :
532
-				if( $identifier == 'email' ){
533
-					return new EE_Email_Input( $input_constructor_args );
534
-				}else{
535
-					return new EE_Text_Input( $input_constructor_args );
531
+				if ($identifier == 'email') {
532
+					return new EE_Email_Input($input_constructor_args);
533
+				} else {
534
+					return new EE_Text_Input($input_constructor_args);
536 535
 				}
537 536
 				break;
538 537
 			// Textarea
539 538
 			case EEM_Question::QST_type_textarea :
540
-				return new EE_Text_Area_Input( $input_constructor_args );
539
+				return new EE_Text_Area_Input($input_constructor_args);
541 540
 				break;
542 541
 			// Radio Buttons
543 542
 			case EEM_Question::QST_type_radio :
544
-				return new EE_Radio_Button_Input( $question->options(), $input_constructor_args );
543
+				return new EE_Radio_Button_Input($question->options(), $input_constructor_args);
545 544
 				break;
546 545
 			// Dropdown
547 546
 			case EEM_Question::QST_type_dropdown :
548
-				return new EE_Select_Input( $question->options(), $input_constructor_args );
547
+				return new EE_Select_Input($question->options(), $input_constructor_args);
549 548
 				break;
550 549
 			// State Dropdown
551 550
 			case EEM_Question::QST_type_state :
552
-				$state_options = array( '' => array( '' => ''));
551
+				$state_options = array('' => array('' => ''));
553 552
 				$states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states();
554
-				if ( ! empty( $states )) {
555
-					foreach( $states as $state ){
556
-						if ( $state instanceof EE_State ) {
557
-							$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
553
+				if ( ! empty($states)) {
554
+					foreach ($states as $state) {
555
+						if ($state instanceof EE_State) {
556
+							$state_options[$state->country()->name()][$state->ID()] = $state->name();
558 557
 						}
559 558
 					}
560 559
 				}
561
-				$state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer );
562
-				return new EE_State_Select_Input( $state_options, $input_constructor_args );
560
+				$state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer);
561
+				return new EE_State_Select_Input($state_options, $input_constructor_args);
563 562
 				break;
564 563
 			// Country Dropdown
565 564
 			case EEM_Question::QST_type_country :
566
-				$country_options = array( '' => '' );
565
+				$country_options = array('' => '');
567 566
 				// get possibly cached list of countries
568 567
 				$countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
569
-				if ( ! empty( $countries )) {
570
-					foreach( $countries as $country ){
571
-						if ( $country instanceof EE_Country ) {
572
-							$country_options[ $country->ID() ] = $country->name();
568
+				if ( ! empty($countries)) {
569
+					foreach ($countries as $country) {
570
+						if ($country instanceof EE_Country) {
571
+							$country_options[$country->ID()] = $country->name();
573 572
 						}
574 573
 					}
575 574
 				}
576
-				$country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer );
577
-				return new EE_Country_Select_Input( $country_options, $input_constructor_args );
575
+				$country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer);
576
+				return new EE_Country_Select_Input($country_options, $input_constructor_args);
578 577
 				break;
579 578
 			// Checkboxes
580 579
 			case EEM_Question::QST_type_checkbox :
581
-				return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args );
580
+				return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args);
582 581
 				break;
583 582
 			// Date
584 583
 			case EEM_Question::QST_type_date :
585
-				return new EE_Datepicker_Input( $input_constructor_args );
584
+				return new EE_Datepicker_Input($input_constructor_args);
586 585
 				break;
587 586
 			case EEM_Question::QST_type_html_textarea :
588
-				$input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy();
589
-				$input =  new EE_Text_Area_Input( $input_constructor_args );
590
-				$input->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' );
587
+				$input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy();
588
+				$input = new EE_Text_Area_Input($input_constructor_args);
589
+				$input->remove_validation_strategy('EE_Plaintext_Validation_Strategy');
591 590
 				return $input;
592 591
 			// fallback
593 592
 			default :
594
-				$default_input = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args );
595
-				if( ! $default_input ){
596
-					$default_input = new EE_Text_Input( $input_constructor_args );
593
+				$default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args);
594
+				if ( ! $default_input) {
595
+					$default_input = new EE_Text_Input($input_constructor_args);
597 596
 				}
598 597
 				return $default_input;
599 598
 		}
@@ -618,66 +617,66 @@  discard block
 block discarded – undo
618 617
 	 */
619 618
 	public function process_reg_step() {
620 619
 
621
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
620
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
622 621
 		// grab validated data from form
623 622
 		$valid_data = $this->checkout->current_step->valid_data();
624 623
 		//EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
625 624
 		//EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );
626 625
 		// if we don't have any $valid_data then something went TERRIBLY WRONG !!!
627
-		if ( empty( $valid_data ))  {
628
-			EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
626
+		if (empty($valid_data)) {
627
+			EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
629 628
 			return FALSE;
630 629
 		}
631 630
 		//EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ );
632
-		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) {
633
-			EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
631
+		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
632
+			EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
634 633
 			return FALSE;
635 634
 		}
636 635
 		// get cached registrations
637
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
636
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
638 637
 		// verify we got the goods
639
-		if ( empty( $registrations )) {
640
-			EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
638
+		if (empty($registrations)) {
639
+			EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
641 640
 			return FALSE;
642 641
 		}
643 642
 		// extract attendee info from form data and save to model objects
644
-		$registrations_processed = $this->_process_registrations( $registrations, $valid_data );
643
+		$registrations_processed = $this->_process_registrations($registrations, $valid_data);
645 644
 		// if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart
646
-		if ( $registrations_processed === FALSE ) {
645
+		if ($registrations_processed === FALSE) {
647 646
 			// but return immediately if the previous step exited early due to errors
648 647
 			return FALSE;
649
-		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) {
648
+		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
650 649
 			// generate a correctly translated string for all possible singular/plural combinations
651
-			if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) {
650
+			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
652 651
 				$error_msg = sprintf(
653
-					__( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ),
652
+					__('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'),
654 653
 					$this->checkout->total_ticket_count,
655 654
 					$registrations_processed
656 655
 				);
657
-			} else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) {
656
+			} else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
658 657
 				$error_msg = sprintf(
659
-					__( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ),
658
+					__('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'),
660 659
 					$this->checkout->total_ticket_count,
661 660
 					$registrations_processed
662 661
 				);
663 662
 			} else {
664 663
 				$error_msg = sprintf(
665
-					__( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ),
664
+					__('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'),
666 665
 					$this->checkout->total_ticket_count,
667 666
 					$registrations_processed
668 667
 				);
669 668
 
670 669
 			}
671
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
670
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
672 671
 			return FALSE;
673 672
 		}
674 673
 		//set the reg status URL, where we'll send registrants if somehow things blow up
675
-		if ( $this->checkout->transaction_has_primary_registrant() ) {
674
+		if ($this->checkout->transaction_has_primary_registrant()) {
676 675
 			// setup URL for redirect
677
-			if( $this->checkout->json_response instanceof EE_SPCO_JSON_Response ) {
676
+			if ($this->checkout->json_response instanceof EE_SPCO_JSON_Response) {
678 677
 				$this->checkout->json_response->set_reg_status_url(
679 678
 					add_query_arg(
680
-						array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ),
679
+						array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()),
681 680
 						$this->checkout->thank_you_page_url
682 681
 					)
683 682
 				);
@@ -685,10 +684,10 @@  discard block
 block discarded – undo
685 684
 		}
686 685
 		// mark this reg step as completed
687 686
 		$this->set_completed();
688
-		$this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' ));
687
+		$this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso'));
689 688
 		//do action in case a plugin wants to do something with the data submitted in step 1.
690 689
 		//passes EE_Single_Page_Checkout, and it's posted data
691
-		do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data );
690
+		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
692 691
 		return TRUE;
693 692
 
694 693
 	}
@@ -702,9 +701,9 @@  discard block
 block discarded – undo
702 701
 	 * @param array             $valid_data
703 702
 	 * @return boolean | int
704 703
 	 */
705
-	private function _process_registrations( $registrations = array(), $valid_data = array() ) {
704
+	private function _process_registrations($registrations = array(), $valid_data = array()) {
706 705
 		// load resources and set some defaults
707
-		EE_Registry::instance()->load_model( 'Attendee' );
706
+		EE_Registry::instance()->load_model('Attendee');
708 707
 		// holder for primary registrant attendee object
709 708
 		$this->checkout->primary_attendee_obj = NULL;
710 709
 		// array for tracking reg form data for the primary registrant
@@ -721,19 +720,19 @@  discard block
 block discarded – undo
721 720
 		// attendee counter
722 721
 		$att_nmbr = 0;
723 722
 		// grab the saved registrations from the transaction
724
-		foreach ( $registrations  as $registration ) {
723
+		foreach ($registrations  as $registration) {
725 724
 			// verify EE_Registration object
726
-			if ( ! $registration instanceof EE_Registration ) {
727
-				EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
725
+			if ( ! $registration instanceof EE_Registration) {
726
+				EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
728 727
 				return FALSE;
729 728
 			}
730 729
 			$reg_url_link = $registration->reg_url_link();
731 730
 			// reg_url_link exists ?
732
-			if ( $reg_url_link ) {
731
+			if ($reg_url_link) {
733 732
 				// should this registration be processed during this visit ?
734
-				if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
733
+				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
735 734
 					// if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects
736
-					if ( ! $this->checkout->revisit ) {
735
+					if ( ! $this->checkout->revisit) {
737 736
 						$registration->save();
738 737
 					}
739 738
 
@@ -744,41 +743,41 @@  discard block
 block discarded – undo
744 743
 					 * @var bool   if TRUE is returned by the plugin then the
745 744
 					 *      		registration processing is halted.
746 745
 					 */
747
-					if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) {
746
+					if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) {
748 747
 						return FALSE;
749 748
 					}
750 749
 
751 750
 					// Houston, we have a registration!
752 751
 					$att_nmbr++;
753
-					$this->_attendee_data[ $reg_url_link ] = array();
752
+					$this->_attendee_data[$reg_url_link] = array();
754 753
 					// unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
755
-					if ( isset( $valid_data[ $reg_url_link ] )) {
754
+					if (isset($valid_data[$reg_url_link])) {
756 755
 						// do we need to copy basic info from primary attendee ?
757
-						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE;
756
+						$copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE;
758 757
 						// filter form input data for this registration
759
-						$valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] );
758
+						$valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]);
760 759
 						//EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ );
761
-						if ( isset( $valid_data['primary_attendee'] )) {
762
-							$primary_registrant['line_item_id'] =  ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE;
763
-							unset( $valid_data['primary_attendee'] );
760
+						if (isset($valid_data['primary_attendee'])) {
761
+							$primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE;
762
+							unset($valid_data['primary_attendee']);
764 763
 						}
765 764
 						// now loop through our array of valid post data && process attendee reg forms
766
-						foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) {
767
-							if ( ! in_array( $form_section, $non_input_form_sections )) {
768
-								foreach ( $form_inputs as $form_input => $input_value ) {
765
+						foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) {
766
+							if ( ! in_array($form_section, $non_input_form_sections)) {
767
+								foreach ($form_inputs as $form_input => $input_value) {
769 768
 									// check for critical inputs
770
-									if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) {
769
+									if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) {
771 770
 										return FALSE;
772 771
 									}
773 772
 									// store a bit of data about the primary attendee
774
-									if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) {
775
-										$primary_registrant[ $form_input ] = $input_value;
776
-									} else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) {
777
-										$input_value = $primary_registrant[ $form_input ];
773
+									if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) {
774
+										$primary_registrant[$form_input] = $input_value;
775
+									} else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) {
776
+										$input_value = $primary_registrant[$form_input];
778 777
 									}
779 778
 									// now attempt to save the input data
780
-									if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value ))  {
781
-										EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ );
779
+									if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) {
780
+										EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__);
782 781
 										return FALSE;
783 782
 									}
784 783
 								}
@@ -787,51 +786,51 @@  discard block
 block discarded – undo
787 786
 					}
788 787
 					//EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ );
789 788
 					// this registration does not require additional attendee information ?
790
-					if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
789
+					if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
791 790
 						// just copy the primary registrant
792 791
 						$attendee = $this->checkout->primary_attendee_obj;
793 792
 					} else {
794 793
 						// have we met before?
795
-						$attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] );
794
+						$attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]);
796 795
 						// did we find an already existing record for this attendee ?
797
-						if ( $attendee instanceof EE_Attendee ) {
798
-							$attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] );
796
+						if ($attendee instanceof EE_Attendee) {
797
+							$attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]);
799 798
 						} else {
800 799
 							// ensure critical details are set for additional attendees
801
-							$this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ];
802
-							$attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] );
800
+							$this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link];
801
+							$attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]);
803 802
 						}
804 803
 						// who's #1 ?
805
-						if ( $att_nmbr == 1 ) {
804
+						if ($att_nmbr == 1) {
806 805
 							$this->checkout->primary_attendee_obj = $attendee;
807 806
 						}
808 807
 					}
809 808
 					//EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );
810 809
 					// add relation to registration, set attendee ID, and cache attendee
811
-					$this->_associate_attendee_with_registration( $registration, $attendee );
812
-					if ( ! $registration->attendee() instanceof EE_Attendee ) {
813
-						EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ );
810
+					$this->_associate_attendee_with_registration($registration, $attendee);
811
+					if ( ! $registration->attendee() instanceof EE_Attendee) {
812
+						EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__);
814 813
 						return FALSE;
815 814
 					}
816 815
 					/** @type EE_Registration_Processor $registration_processor */
817
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
816
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
818 817
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
819
-					$registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE );
818
+					$registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE);
820 819
 					/** @type EE_Transaction_Processor $transaction_processor */
821
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
820
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
822 821
 					// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
823
-					$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
822
+					$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
824 823
 					// if we've gotten this far, then let's save what we have
825 824
 					$registration->save();
826 825
 					// add relation between TXN and registration
827
-					$this->_associate_registration_with_transaction( $registration );
826
+					$this->_associate_registration_with_transaction($registration);
828 827
 
829 828
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
830 829
 
831
-			}  else {
832
-				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
830
+			} else {
831
+				EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
833 832
 				// remove malformed data
834
-				unset( $valid_data[ $reg_url_link ] );
833
+				unset($valid_data[$reg_url_link]);
835 834
 				return FALSE;
836 835
 			}
837 836
 
@@ -849,22 +848,22 @@  discard block
 block discarded – undo
849 848
 	 * @param string           	$input_value
850 849
 	 * @return boolean
851 850
 	 */
852
-	private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) {
851
+	private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') {
853 852
 		//echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span>    <b style="font-size:10px;">  ' . __LINE__ . ' </b></h3>';
854 853
 		//EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ );
855 854
 		// allow for plugins to hook in and do their own processing of the form input.
856 855
 		// For plugins to bypass normal processing here, they just need to return a boolean value.
857
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) {
856
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) {
858 857
 			return TRUE;
859 858
 		}
860 859
 
861 860
 		// grab related answer objects
862 861
 		$answers = $registration->answers();
863 862
 		// $answer_cache_id is the key used to find the EE_Answer we want
864
-		$answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link();
865
-		$answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE;
863
+		$answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link();
864
+		$answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE;
866 865
 		//rename form_inputs if they are EE_Attendee properties
867
-		switch( (string)$form_input ) {
866
+		switch ((string) $form_input) {
868 867
 
869 868
 			case 'state' :
870 869
 			case 'STA_ID' :
@@ -879,33 +878,33 @@  discard block
 block discarded – undo
879 878
 				break;
880 879
 
881 880
 			default :
882
-				$ATT_input = 'ATT_' . $form_input;
881
+				$ATT_input = 'ATT_'.$form_input;
883 882
 				//EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );
884
-				$attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE;
885
-				$form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;
883
+				$attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE;
884
+				$form_input = $attendee_property ? 'ATT_'.$form_input : $form_input;
886 885
 		}
887 886
 		//EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );
888 887
 		//EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );
889 888
 		//EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );
890 889
 		//EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );
891 890
 		// if this form input has a corresponding attendee property
892
-		if ( $attendee_property ) {
893
-			$this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
894
-			if (  $answer_is_obj ) {
891
+		if ($attendee_property) {
892
+			$this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;
893
+			if ($answer_is_obj) {
895 894
 				// and delete the corresponding answer since we won't be storing this data in that object
896
-				$registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' );
897
-				$answers[ $answer_cache_id ]->delete_permanently();
895
+				$registration->_remove_relation_to($answers[$answer_cache_id], 'Answer');
896
+				$answers[$answer_cache_id]->delete_permanently();
898 897
 			}
899 898
 			return TRUE;
900
-		} elseif ( $answer_is_obj ) {
899
+		} elseif ($answer_is_obj) {
901 900
 			// save this data to the answer object
902
-			$answers[ $answer_cache_id ]->set_value( $input_value );
903
-			$result = $answers[ $answer_cache_id ]->save();
901
+			$answers[$answer_cache_id]->set_value($input_value);
902
+			$result = $answers[$answer_cache_id]->save();
904 903
 			return $result !== false ? true : false;
905 904
 		} else {
906
-			foreach ( $answers as $answer ) {
907
-				if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) {
908
-					$answer->set_value( $input_value );
905
+			foreach ($answers as $answer) {
906
+				if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) {
907
+					$answer->set_value($input_value);
909 908
 					$result = $answer->save();
910 909
 					return $result !== false ? true : false;
911 910
 				}
@@ -923,33 +922,33 @@  discard block
 block discarded – undo
923 922
 	 * @param string $input_value
924 923
 	 * @return boolean
925 924
 	 */
926
-	private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) {
927
-		if ( empty( $input_value )) {
925
+	private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') {
926
+		if (empty($input_value)) {
928 927
 			// if the form input isn't marked as being required, then just return
929
-			if ( ! isset( $this->_required_questions[ $form_input ]  ) || ! $this->_required_questions[ $form_input ] ) {
928
+			if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) {
930 929
 				return true;
931 930
 			}
932
-			switch( $form_input ) {
931
+			switch ($form_input) {
933 932
 				case 'fname' :
934
-					EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
933
+					EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
935 934
 					return FALSE;
936 935
 					break;
937 936
 				case 'lname' :
938
-					EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
937
+					EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
939 938
 					return FALSE;
940 939
 					break;
941 940
 				case 'email' :
942
-					EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
941
+					EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
943 942
 					return FALSE;
944 943
 					break;
945 944
 			}
946
-		} else if ( $form_input === 'email' ) {
945
+		} else if ($form_input === 'email') {
947 946
 			// clean the email address
948
-			$valid_email = sanitize_email( $input_value );
947
+			$valid_email = sanitize_email($input_value);
949 948
 			// check if it matches
950
-			if ( $input_value != $valid_email ) {
949
+			if ($input_value != $valid_email) {
951 950
 				// whoops!!!
952
-				EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
951
+				EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
953 952
 				return FALSE;
954 953
 			}
955 954
 		}
@@ -977,14 +976,14 @@  discard block
 block discarded – undo
977 976
 	 * @param array           $attendee_data
978 977
 	 * @return boolean
979 978
 	 */
980
-	private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) {
979
+	private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) {
981 980
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
982
-		$ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : '';
983
-		$ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : '';
984
-		$ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : '';
981
+		$ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : '';
982
+		$ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : '';
983
+		$ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : '';
985 984
 		// but only if those have values
986
-		if ( $ATT_fname && $ATT_lname && $ATT_email ) {
987
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
985
+		if ($ATT_fname && $ATT_lname && $ATT_email) {
986
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
988 987
 				'ATT_fname' => $ATT_fname,
989 988
 				'ATT_lname' => $ATT_lname,
990 989
 				'ATT_email' => $ATT_email
@@ -992,7 +991,7 @@  discard block
 block discarded – undo
992 991
 		} else {
993 992
 			$existing_attendee = NULL;
994 993
 		}
995
-		return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data );
994
+		return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data);
996 995
 	}
997 996
 
998 997
 
@@ -1004,13 +1003,13 @@  discard block
 block discarded – undo
1004 1003
 	 * @param array           $attendee_data
1005 1004
 	 * @return \EE_Attendee
1006 1005
 	 */
1007
-	private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) {
1006
+	private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) {
1008 1007
 		// first remove fname, lname, and email from attendee data
1009
-		$dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1008
+		$dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email');
1010 1009
 		// now loop thru what's left and add to attendee CPT
1011
-		foreach ( $attendee_data as $property_name => $property_value ) {
1012
-			if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) {
1013
-				$existing_attendee->set( $property_name, $property_value );
1010
+		foreach ($attendee_data as $property_name => $property_value) {
1011
+			if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) {
1012
+				$existing_attendee->set($property_name, $property_value);
1014 1013
 			}
1015 1014
 		}
1016 1015
 		// better save that now
@@ -1027,11 +1026,11 @@  discard block
 block discarded – undo
1027 1026
 	 * @param EE_Attendee     $attendee
1028 1027
 	 * @return void
1029 1028
 	 */
1030
-	private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) {
1029
+	private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) {
1031 1030
 		// add relation to attendee
1032
-		$registration->_add_relation_to( $attendee, 'Attendee' );
1033
-		$registration->set_attendee_id( $attendee->ID() );
1034
-		$registration->update_cache_after_object_save( 'Attendee', $attendee );
1031
+		$registration->_add_relation_to($attendee, 'Attendee');
1032
+		$registration->set_attendee_id($attendee->ID());
1033
+		$registration->update_cache_after_object_save('Attendee', $attendee);
1035 1034
 	}
1036 1035
 
1037 1036
 
@@ -1042,10 +1041,10 @@  discard block
 block discarded – undo
1042 1041
 	 * @param EE_Registration $registration
1043 1042
 	 * @return void
1044 1043
 	 */
1045
-	private function _associate_registration_with_transaction( EE_Registration $registration ) {
1044
+	private function _associate_registration_with_transaction(EE_Registration $registration) {
1046 1045
 		// add relation to attendee
1047
-		$this->checkout->transaction->_add_relation_to( $registration, 'Registration' );
1048
-		$this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration );
1046
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
1047
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
1049 1048
 	}
1050 1049
 
1051 1050
 
@@ -1057,17 +1056,17 @@  discard block
 block discarded – undo
1057 1056
 	 * @param array $attendee_data
1058 1057
 	 * @return array
1059 1058
 	 */
1060
-	private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) {
1059
+	private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) {
1061 1060
 		// bare minimum critical details include first name, last name, email address
1062
-		$critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1061
+		$critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email');
1063 1062
 		// add address info to critical details?
1064
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) {
1065
-			$address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' );
1066
-			$critical_attendee_details = array_merge( $critical_attendee_details, $address_details );
1063
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) {
1064
+			$address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone');
1065
+			$critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1067 1066
 		}
1068
-		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1069
-			if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) {
1070
-				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail );
1067
+		foreach ($critical_attendee_details as $critical_attendee_detail) {
1068
+			if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) {
1069
+				$attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail);
1071 1070
 			}
1072 1071
 		}
1073 1072
 		return $attendee_data;
@@ -1082,11 +1081,11 @@  discard block
 block discarded – undo
1082 1081
 	 * @param array           $attendee_data
1083 1082
 	 * @return \EE_Attendee
1084 1083
 	 */
1085
-	private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) {
1084
+	private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) {
1086 1085
 		// create new attendee object
1087
-		$new_attendee = EE_Attendee::new_instance( $attendee_data );
1086
+		$new_attendee = EE_Attendee::new_instance($attendee_data);
1088 1087
 		// set author to event creator
1089
-		$new_attendee->set( 'ATT_author', $registration->event()->wp_user() );
1088
+		$new_attendee->set('ATT_author', $registration->event()->wp_user());
1090 1089
 		$new_attendee->save();
1091 1090
 		return $new_attendee;
1092 1091
 	}
@@ -1102,7 +1101,7 @@  discard block
 block discarded – undo
1102 1101
 	 */
1103 1102
 	public function update_reg_step() {
1104 1103
 		// save everything
1105
-		if ( $this->process_reg_step() ) {
1104
+		if ($this->process_reg_step()) {
1106 1105
 			$this->checkout->redirect = TRUE;
1107 1106
 			$this->checkout->redirect_url = add_query_arg(
1108 1107
 				array(
@@ -1111,7 +1110,7 @@  discard block
 block discarded – undo
1111 1110
 				),
1112 1111
 				$this->checkout->thank_you_page_url
1113 1112
 			);
1114
-			$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1113
+			$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1115 1114
 			return TRUE;
1116 1115
 		}
1117 1116
 		return FALSE;
Please login to merge, or discard this patch.
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_SPCO_Reg_Step_Payment_Options
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage 	core
10
- * @author 				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_SPCO_Reg_Step_Payment_Options
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage 	core
10
+  * @author 				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_SPCO_Reg_Step_Payment_Options extends EE_SPCO_Reg_Step {
15 15
 
16 16
 	/**
@@ -764,13 +764,13 @@  discard block
 block discarded – undo
764 764
 			return FALSE;
765 765
 		}
766 766
 		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
767
-            EE_Error::add_success(
768
-                apply_filters(
769
-                    'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
770
-                    sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
771
-                )
772
-            );
773
-        }
767
+			EE_Error::add_success(
768
+				apply_filters(
769
+					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
770
+					sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
771
+				)
772
+			);
773
+		}
774 774
 		// now generate billing form for selected method of payment
775 775
 		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
776 776
 		// fill form with attendee info if applicable
@@ -802,14 +802,14 @@  discard block
 block discarded – undo
802 802
 		$billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) );
803 803
 		if ( $billing_form instanceof EE_Billing_Info_Form ) {
804 804
 			if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) {
805
-                if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
806
-                    EE_Error::add_success(
807
-                        apply_filters(
808
-                            'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
809
-                            sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
810
-                        )
811
-                    );
812
-                }
805
+				if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
806
+					EE_Error::add_success(
807
+						apply_filters(
808
+							'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
809
+							sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
810
+						)
811
+					);
812
+				}
813 813
 			}
814 814
 			return apply_filters(
815 815
 				'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form',
Please login to merge, or discard this patch.
Spacing   +370 added lines, -370 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
@@ -194,15 +194,15 @@  discard block
 block discarded – undo
194 194
 		$sold_out_events = array();
195 195
 		$reg_count = 0;
196 196
 		// loop thru registrations to gather info
197
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
198
-		foreach ( $registrations as $registration ) {
197
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
198
+		foreach ($registrations as $registration) {
199 199
 			/** @var $registration EE_Registration */
200 200
 			$reg_count++;
201 201
 			// if returning registrant is Approved then do NOT do this
202
-			if ( ! ( $this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved )) {
203
-				if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true )) {
202
+			if ( ! ($this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved)) {
203
+				if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) {
204 204
 					// add event to list of events that are sold out
205
-					$sold_out_events[ $registration->event()->ID() ] = $registration->event();
205
+					$sold_out_events[$registration->event()->ID()] = $registration->event();
206 206
 					do_action(
207 207
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
208 208
 						$registration->event(),
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 					);
211 211
 				}
212 212
 				// event requires admin approval
213
-				if ( $registration->status_ID() == EEM_Registration::status_id_not_approved ) {
213
+				if ($registration->status_ID() == EEM_Registration::status_id_not_approved) {
214 214
 					// add event to list of events with pre-approval reg status
215
-					$registrations_requiring_pre_approval[ $registration->ID() ] = $registration;
215
+					$registrations_requiring_pre_approval[$registration->ID()] = $registration;
216 216
 					do_action(
217 217
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
218 218
 						$registration->event(),
@@ -221,29 +221,29 @@  discard block
 block discarded – undo
221 221
 				}
222 222
 			}
223 223
 			// are they allowed to pay now and is there monies owing?
224
-			if ( $registration->owes_monies_and_can_pay() ) {
225
-				$registrations_requiring_payment[ $registration->ID() ] = $registration;
224
+			if ($registration->owes_monies_and_can_pay()) {
225
+				$registrations_requiring_payment[$registration->ID()] = $registration;
226 226
 				do_action(
227 227
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
228 228
 					$registration->event(),
229 229
 					$this
230 230
 				);
231
-			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()  ) {
232
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
231
+			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) {
232
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
233 233
 			}
234 234
 		}
235 235
 		$subsections = array();
236 236
 		// now decide which template to load
237
-		if ( ! empty( $sold_out_events )) {
238
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
237
+		if ( ! empty($sold_out_events)) {
238
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
239 239
 		}
240
-		if ( ! empty( $registrations_requiring_pre_approval )) {
241
-			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval );
240
+		if ( ! empty($registrations_requiring_pre_approval)) {
241
+			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval);
242 242
 		}
243
-		if ( ! empty( $registrations_for_free_events ) ) {
244
-			$subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events );
243
+		if ( ! empty($registrations_for_free_events)) {
244
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
245 245
 		}
246
-		if ( ! empty( $registrations_requiring_payment ) ) {
246
+		if ( ! empty($registrations_requiring_payment)) {
247 247
 			// autoload Line_Item_Display classes
248 248
 			EEH_Autoloader::register_line_item_filter_autoloaders();
249 249
 			$line_item_filter_processor = new EE_Line_Item_Filter_Processor(
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 				$this->checkout->cart->get_grand_total()
255 255
 			);
256 256
 			$filtered_line_item_tree = $line_item_filter_processor->process();
257
-			if ( $this->checkout->amount_owing > 0 ) {
257
+			if ($this->checkout->amount_owing > 0) {
258 258
 				EEH_Autoloader::register_line_item_display_autoloaders();
259
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
260
-				$subsections[ 'payment_options' ] = $this->_display_payment_options(
259
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
260
+				$subsections['payment_options'] = $this->_display_payment_options(
261 261
 					$this->line_item_display->display_line_item(
262 262
 						$filtered_line_item_tree,
263
-						array( 'registrations' => $registrations )
263
+						array('registrations' => $registrations)
264 264
 					)
265 265
 				);
266 266
 				$this->checkout->amount_owing = $filtered_line_item_tree->total();
267
-				$this->_apply_registration_payments_to_amount_owing( $registrations );
267
+				$this->_apply_registration_payments_to_amount_owing($registrations);
268 268
 			}
269 269
 		} else {
270 270
 			$this->_hide_reg_step_submit_button_if_revisit();
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection
298 298
 	 * @return \EE_Line_Item_Filter_Collection
299 299
 	 */
300
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
300
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
301 301
 		$line_item_filter_collection->add(
302 302
 			new EE_Billable_Line_Item_Filter(
303 303
 				EE_Registry::instance()->SSN->checkout()->transaction->registrations(
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 				)
306 306
 			)
307 307
 		);
308
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
308
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
309 309
 		return $line_item_filter_collection;
310 310
 	}
311 311
 
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 	 * @return void
320 320
 	 */
321 321
 	protected function _hide_reg_step_submit_button_if_revisit() {
322
-		if ( $this->checkout->revisit ) {
323
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
322
+		if ($this->checkout->revisit) {
323
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
324 324
 		}
325 325
 	}
326 326
 
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
 	 * @param \EE_Event[] $sold_out_events_array
332 332
 	 * @return \EE_Form_Section_Proper
333 333
 	 */
334
-	private function _sold_out_events( $sold_out_events_array = array() ) {
334
+	private function _sold_out_events($sold_out_events_array = array()) {
335 335
 		// set some defaults
336 336
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
337 337
 		$sold_out_events = '';
338
-		foreach ( $sold_out_events_array as $sold_out_event ) {
339
-			$sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ));
338
+		foreach ($sold_out_events_array as $sold_out_event) {
339
+			$sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text'));
340 340
 		}
341 341
 		return new EE_Form_Section_Proper(
342 342
 			array(
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 				),
349 349
 				'layout_strategy'		=> new EE_Template_Layout(
350 350
 					array(
351
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template
351
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template
352 352
 						'template_args'  				=> apply_filters(
353 353
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
354 354
 							array(
355 355
 								'sold_out_events' 			=> $sold_out_events,
356 356
 								'sold_out_events_msg' 	=> apply_filters(
357 357
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg',
358
-									__( '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.', 'event_espresso' )
358
+									__('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.', 'event_espresso')
359 359
 								)
360 360
 							)
361 361
 						)
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 	 * @param array $registrations_requiring_pre_approval
373 373
 	 * @return \EE_Form_Section_Proper
374 374
 	 */
375
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) {
375
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
376 376
 		$events_requiring_pre_approval = '';
377
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
378
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
379
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
380
-					EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
377
+		foreach ($registrations_requiring_pre_approval as $registration) {
378
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
379
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
380
+					EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
381 381
 					)
382
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
382
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
383 383
 				);
384 384
 			}
385 385
 		}
@@ -391,14 +391,14 @@  discard block
 block discarded – undo
391 391
 				),
392 392
 				'layout_strategy'		=> new EE_Template_Layout(
393 393
 					array(
394
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template
394
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template
395 395
 						'template_args'  				=> apply_filters(
396 396
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
397 397
 							array(
398
-								'events_requiring_pre_approval' 			=> implode( '', $events_requiring_pre_approval ),
398
+								'events_requiring_pre_approval' 			=> implode('', $events_requiring_pre_approval),
399 399
 								'events_requiring_pre_approval_msg' 	=> apply_filters(
400 400
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
401
-									__( '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' )
401
+									__('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')
402 402
 								)
403 403
 							)
404 404
 						),
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 * @param \EE_Event[] $registrations_for_free_events
417 417
 	 * @return \EE_Form_Section_Proper
418 418
 	 */
419
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
419
+	private function _no_payment_required($registrations_for_free_events = array()) {
420 420
 		// set some defaults
421 421
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
422 422
 		// generate no_payment_required form
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 				),
429 429
 				'layout_strategy' 	=> new EE_Template_Layout(
430 430
 					array(
431
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template
431
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template
432 432
 						'template_args'  				=> apply_filters(
433 433
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
434 434
 							array(
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 								'registrations' => array(),
437 437
 								'ticket_count' 	=> array(),
438 438
 								'registrations_for_free_events' 	=> $registrations_for_free_events,
439
-								'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' ))
439
+								'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso'))
440 440
 							)
441 441
 						),
442 442
 					)
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 * @param string $transaction_details
454 454
 	 * @return \EE_Form_Section_Proper
455 455
 	 */
456
-	private function _display_payment_options( $transaction_details = '' ) {
456
+	private function _display_payment_options($transaction_details = '') {
457 457
 		// has method_of_payment been set by no-js user?
458 458
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
459 459
 		// build payment options form
@@ -465,20 +465,20 @@  discard block
 block discarded – undo
465 465
 						'before_payment_options' => apply_filters(
466 466
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
467 467
 							new EE_Form_Section_Proper(
468
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
468
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
469 469
 							)
470 470
 						),
471 471
 						'payment_options' => $this->_setup_payment_options(),
472 472
 						'after_payment_options' => apply_filters(
473 473
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
474 474
 							new EE_Form_Section_Proper(
475
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
475
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
476 476
 							)
477 477
 						),
478 478
 						'default_hidden_inputs' => $this->reg_step_hidden_inputs(),
479
-						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs( FALSE )
479
+						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs(FALSE)
480 480
 					),
481
-					'layout_strategy'	=> new EE_Template_Layout( array(
481
+					'layout_strategy'	=> new EE_Template_Layout(array(
482 482
 							'layout_template_file' 	=> $this->_template,
483 483
 							'template_args'  				=> apply_filters(
484 484
 								'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args',
@@ -502,11 +502,11 @@  discard block
 block discarded – undo
502 502
 	 * @param bool $no_payment_required
503 503
 	 * @return \EE_Form_Section_Proper
504 504
 	 */
505
-	private function _extra_hidden_inputs( $no_payment_required = TRUE ) {
505
+	private function _extra_hidden_inputs($no_payment_required = TRUE) {
506 506
 
507 507
 		return new EE_Form_Section_Proper(
508 508
 			array(
509
-				'html_id' 				=> 'ee-' . $this->slug() . '-extra-hidden-inputs',
509
+				'html_id' 				=> 'ee-'.$this->slug().'-extra-hidden-inputs',
510 510
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
511 511
 				'subsections' 		=> array(
512 512
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -539,16 +539,16 @@  discard block
 block discarded – undo
539 539
 	 * @access    protected
540 540
 	 * @return    void
541 541
 	 */
542
-	protected function _apply_registration_payments_to_amount_owing( $registrations ) {
542
+	protected function _apply_registration_payments_to_amount_owing($registrations) {
543 543
 		$payments = array();
544
-		foreach ( $registrations as $registration ) {
545
-			if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
544
+		foreach ($registrations as $registration) {
545
+			if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
546 546
 				$payments = $payments + $registration->registration_payments();
547 547
 			}
548 548
 		}
549
-		if ( ! empty( $payments ) ) {
550
-			foreach ( $payments as $payment ) {
551
-				if ( $payment instanceof EE_Registration_Payment ) {
549
+		if ( ! empty($payments)) {
550
+			foreach ($payments as $payment) {
551
+				if ($payment instanceof EE_Registration_Payment) {
552 552
 					$this->checkout->amount_owing -= $payment->amount();
553 553
 				}
554 554
 			}
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
 	 * @param 	bool $force_reset
564 564
 	 * @return 	void
565 565
 	 */
566
-	private function _reset_selected_method_of_payment( $force_reset = FALSE ) {
567
-		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE ));
568
-		if ( $reset_payment_method ) {
566
+	private function _reset_selected_method_of_payment($force_reset = FALSE) {
567
+		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE));
568
+		if ($reset_payment_method) {
569 569
 			$this->checkout->selected_method_of_payment = NULL;
570 570
 			$this->checkout->payment_method = NULL;
571 571
 			$this->checkout->billing_form = NULL;
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 	 * @param string $selected_method_of_payment
585 585
 	 * 	@return 		EE_Billing_Info_Form
586 586
 	 */
587
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
588
-		$selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
589
-		EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment ));
587
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
588
+		$selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
589
+		EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment));
590 590
 	}
591 591
 
592 592
 
@@ -599,40 +599,40 @@  discard block
 block discarded – undo
599 599
 		// load payment method classes
600 600
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
601 601
 		// switch up header depending on number of available payment methods
602
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
603
-			? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' ))
604
-			: apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' ));
602
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
603
+			? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso'))
604
+			: apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso'));
605 605
 		$available_payment_methods = array(
606 606
 			// display the "Payment Method" header
607 607
 			'payment_method_header' => new EE_Form_Section_HTML(
608
-				EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' )
608
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
609 609
 			)
610 610
 		);
611 611
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
612 612
 		$available_payment_method_options = array();
613 613
 		$default_payment_method_option = array();
614 614
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
615
-		$payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' )));
615
+		$payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;')));
616 616
 		// loop through payment methods
617
-		foreach( $this->checkout->available_payment_methods as $payment_method ) {
618
-			if ( $payment_method instanceof EE_Payment_Method ) {
619
-				$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' );
617
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
618
+			if ($payment_method instanceof EE_Payment_Method) {
619
+				$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');
620 620
 				// check if any payment methods are set as default
621 621
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
622
-				if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) {
622
+				if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) {
623 623
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
624 624
 					$this->_save_selected_method_of_payment();
625
-					$default_payment_method_option[ $payment_method->slug() ] =  $payment_method_button;
625
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
626 626
 				} else {
627
-					$available_payment_method_options[ $payment_method->slug() ] =  $payment_method_button;
627
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
628 628
 				}
629
-				$payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method );
629
+				$payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method);
630 630
 			}
631 631
 		}
632 632
 		// prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs
633 633
 		$available_payment_method_options = $default_payment_method_option + $available_payment_method_options;
634 634
 		// now generate the actual form  inputs
635
-		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options );
635
+		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options);
636 636
 		$available_payment_methods = $available_payment_methods + $payment_methods_billing_info;
637 637
 
638 638
 		// build the available payment methods form
@@ -652,19 +652,19 @@  discard block
 block discarded – undo
652 652
 	 * @return EE_Payment_Method[]
653 653
 	 */
654 654
 	protected function _get_available_payment_methods() {
655
-		if ( ! empty( $this->checkout->available_payment_methods )) {
655
+		if ( ! empty($this->checkout->available_payment_methods)) {
656 656
 			return $this->checkout->available_payment_methods;
657 657
 		}
658 658
 		$available_payment_methods = array();
659 659
 		// load EEM_Payment_Method
660
-		EE_Registry::instance()->load_model( 'Payment_Method' );
660
+		EE_Registry::instance()->load_model('Payment_Method');
661 661
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
662 662
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
663 663
 		// get all active payment methods
664
-		$payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart );
665
-		foreach ( $payment_methods as $payment_method ) {
666
-			if ( $payment_method instanceof EE_Payment_Method ) {
667
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
664
+		$payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart);
665
+		foreach ($payment_methods as $payment_method) {
666
+			if ($payment_method instanceof EE_Payment_Method) {
667
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
668 668
 			}
669 669
 		}
670 670
 		return $available_payment_methods;
@@ -680,14 +680,14 @@  discard block
 block discarded – undo
680 680
 	 * @param 	array $available_payment_method_options
681 681
 	 * @return 	\EE_Form_Section_Proper
682 682
 	 */
683
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
683
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
684 684
 		// generate inputs
685 685
 		return new EE_Form_Section_Proper(
686 686
 			array(
687 687
 				'html_id' 				=> 'ee-available-payment-method-inputs',
688 688
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
689 689
 				'subsections' 		=> array(
690
-					'' => new EE_Radio_Button_Input (
690
+					'' => new EE_Radio_Button_Input(
691 691
 						$available_payment_method_options,
692 692
 						array(
693 693
 							'html_name' 				=> 'selected_method_of_payment',
@@ -711,36 +711,36 @@  discard block
 block discarded – undo
711 711
 	 * @param 	EE_Payment_Method $payment_method
712 712
 	 * @return 	\EE_Form_Section_Proper
713 713
 	 */
714
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
714
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
715 715
 		$currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE;
716 716
 		// generate the billing form for payment method
717
-		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML();
717
+		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML();
718 718
 		$this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form;
719 719
 		// it's all in the details
720
-		$info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' );
720
+		$info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr');
721 721
 		// 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
722
-		if ( $payment_method->description() ) {
722
+		if ($payment_method->description()) {
723 723
 			$payment_method_info = $payment_method->description();
724
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
725
-			$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() );
724
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
725
+			$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());
726 726
 		} else {
727
-			$payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
727
+			$payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
728 728
 		}
729
-		$info_html .= EEH_HTML::p (
730
-			apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ),
729
+		$info_html .= EEH_HTML::p(
730
+			apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info),
731 731
 			'',
732 732
 			'spco-payment-method-desc ee-attention'
733 733
 		);
734 734
 
735 735
 		return new EE_Form_Section_Proper(
736 736
 			array(
737
-				'html_id' 					=> 'spco-payment-method-info-' . $payment_method->slug(),
737
+				'html_id' 					=> 'spco-payment-method-info-'.$payment_method->slug(),
738 738
 				'html_class' 			=> 'spco-payment-method-info-dv',
739 739
 				// only display the selected or default PM
740 740
 				'html_style' 			=> $currently_selected ? '' : 'display:none;',
741 741
 				'layout_strategy'		=> new EE_Div_Per_Section_Layout(),
742 742
 				'subsections' 			=> array(
743
-					'info' 					=> new EE_Form_Section_HTML( $info_html ),
743
+					'info' 					=> new EE_Form_Section_HTML($info_html),
744 744
 					'billing_form' 		=> $currently_selected ? $billing_form : new EE_Form_Section_HTML()
745 745
 				)
746 746
 			)
@@ -758,12 +758,12 @@  discard block
 block discarded – undo
758 758
 	 */
759 759
 	public function get_billing_form_html_for_payment_method() {
760 760
 		// how have they chosen to pay?
761
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
761
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
762 762
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
763
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
763
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
764 764
 			return FALSE;
765 765
 		}
766
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
766
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
767 767
             EE_Error::add_success(
768 768
                 apply_filters(
769 769
                     'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -772,20 +772,20 @@  discard block
 block discarded – undo
772 772
             );
773 773
         }
774 774
 		// now generate billing form for selected method of payment
775
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
775
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
776 776
 		// fill form with attendee info if applicable
777
-		if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
778
-			$payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
777
+		if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
778
+			$payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
779 779
 		}
780 780
 		// and debug content
781
-		if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
782
-			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form );
781
+		if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
782
+			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form);
783 783
 		}
784 784
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : '';
785
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ));
785
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
786 786
 		// localize validation rules for main form
787 787
 		$this->checkout->current_step->reg_form->localize_validation_rules();
788
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
788
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
789 789
 		return TRUE;
790 790
 	}
791 791
 
@@ -798,15 +798,15 @@  discard block
 block discarded – undo
798 798
 	 * @param EE_Payment_Method $payment_method
799 799
 	 * @return \EE_Billing_Info_Form
800 800
 	 */
801
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
802
-		$billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) );
803
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
804
-			if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) {
805
-                if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
801
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
802
+		$billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing));
803
+		if ($billing_form instanceof EE_Billing_Info_Form) {
804
+			if (EE_Registry::instance()->REQ->is_set('payment_method')) {
805
+                if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
806 806
                     EE_Error::add_success(
807 807
                         apply_filters(
808 808
                             'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
809
-                            sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
809
+                            sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name())
810 810
                         )
811 811
                     );
812 812
                 }
@@ -831,27 +831,27 @@  discard block
 block discarded – undo
831 831
 	 * @param string 		$request_param
832 832
 	 * @return NULL|string
833 833
 	 */
834
-	private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) {
834
+	private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') {
835 835
 		// is selected_method_of_payment set in the request ?
836
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE );
837
-		if ( $selected_method_of_payment ) {
836
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE);
837
+		if ($selected_method_of_payment) {
838 838
 			// sanitize it
839
-			$selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment;
840
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
839
+			$selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment;
840
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
841 841
 			// store it in the session so that it's available for all subsequent requests including AJAX
842
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
842
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
843 843
 		} else {
844 844
 			// or is is set in the session ?
845
-			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' );
845
+			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment');
846 846
 		}
847 847
 		// do ya really really gotta have it?
848
-		if ( empty( $selected_method_of_payment ) && $required ) {
848
+		if (empty($selected_method_of_payment) && $required) {
849 849
 			EE_Error::add_error(
850 850
 				sprintf(
851
-					__( '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' ),
851
+					__('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'),
852 852
 					'<br/>',
853 853
 					'<br/>',
854
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
854
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
855 855
 				),
856 856
 				__FILE__, __FUNCTION__, __LINE__
857 857
 			);
@@ -877,37 +877,37 @@  discard block
 block discarded – undo
877 877
 	 * @return string
878 878
 	 */
879 879
 	public function switch_payment_method() {
880
-		if ( ! $this->_verify_payment_method_is_set() ) {
880
+		if ( ! $this->_verify_payment_method_is_set()) {
881 881
 			return FALSE;
882 882
 		}
883
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
883
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
884 884
 			EE_Error::add_success(
885 885
 				apply_filters(
886 886
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
887
-					sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() )
887
+					sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
888 888
 				)
889 889
 			);
890 890
 		}
891 891
 		// generate billing form for selected method of payment if it hasn't been done already
892
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
893
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
892
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
893
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
894 894
 		}
895 895
 		// fill form with attendee info if applicable
896
-		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
897
-			$this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
896
+		if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
897
+			$this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
898 898
 		}
899 899
 		// and debug content
900
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
901
-			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form );
900
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
901
+			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form);
902 902
 		}
903 903
 		// get html and validation rules for form
904
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
905
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() ));
904
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
905
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html()));
906 906
 			// localize validation rules for main form
907
-			$this->checkout->billing_form->localize_validation_rules( TRUE );
908
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
907
+			$this->checkout->billing_form->localize_validation_rules(TRUE);
908
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
909 909
 		} else {
910
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ));
910
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
911 911
 		}
912 912
 		//prevents advancement to next step
913 913
 		$this->checkout->continue_reg = FALSE;
@@ -922,12 +922,12 @@  discard block
 block discarded – undo
922 922
 	 */
923 923
 	protected function _verify_payment_method_is_set() {
924 924
 		// generate billing form for selected method of payment if it hasn't been done already
925
-		if ( empty( $this->checkout->selected_method_of_payment )) {
925
+		if (empty($this->checkout->selected_method_of_payment)) {
926 926
 			// how have they chosen to pay?
927
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
927
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
928 928
 		}
929 929
 		// verify payment method
930
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
930
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
931 931
 			// get payment method for selected method of payment
932 932
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
933 933
 		}
@@ -947,23 +947,23 @@  discard block
 block discarded – undo
947 947
 	 * @return void
948 948
 	 */
949 949
 	public function save_payer_details_via_ajax() {
950
-		if ( ! $this->_verify_payment_method_is_set() ) {
950
+		if ( ! $this->_verify_payment_method_is_set()) {
951 951
 			return;
952 952
 		}
953 953
 		// generate billing form for selected method of payment if it hasn't been done already
954
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
955
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
954
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
955
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
956 956
 		}
957 957
 		// generate primary attendee from payer info if applicable
958 958
 		if ( ! $this->checkout->transaction_has_primary_registrant()) {
959 959
 			$attendee = $this->_create_attendee_from_request_data();
960
-			if ( $attendee instanceof EE_Attendee ) {
961
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
962
-					if ( $registration->is_primary_registrant() ) {
960
+			if ($attendee instanceof EE_Attendee) {
961
+				foreach ($this->checkout->transaction->registrations() as $registration) {
962
+					if ($registration->is_primary_registrant()) {
963 963
 						$this->checkout->primary_attendee_obj = $attendee;
964
-						$registration->_add_relation_to( $attendee, 'Attendee' );
965
-						$registration->set_attendee_id( $attendee->ID() );
966
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
964
+						$registration->_add_relation_to($attendee, 'Attendee');
965
+						$registration->set_attendee_id($attendee->ID());
966
+						$registration->update_cache_after_object_save('Attendee', $attendee);
967 967
 					}
968 968
 				}
969 969
 			}
@@ -976,56 +976,56 @@  discard block
 block discarded – undo
976 976
 	 * uses info from alternate GET or POST data (such as AJAX) to create a new attendee
977 977
 	 * @return \EE_Attendee
978 978
 	 */
979
-	protected function _create_attendee_from_request_data(){
979
+	protected function _create_attendee_from_request_data() {
980 980
 		// get State ID
981
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
982
-		if ( ! empty( $STA_ID )) {
981
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
982
+		if ( ! empty($STA_ID)) {
983 983
 			// can we get state object from name ?
984
-			EE_Registry::instance()->load_model( 'State' );
985
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' );
986
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
984
+			EE_Registry::instance()->load_model('State');
985
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
986
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
987 987
 		}
988 988
 		// get Country ISO
989
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
990
-		if ( ! empty( $CNT_ISO )) {
989
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
990
+		if ( ! empty($CNT_ISO)) {
991 991
 			// can we get country object from name ?
992
-			EE_Registry::instance()->load_model( 'Country' );
993
-			$country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' );
994
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
992
+			EE_Registry::instance()->load_model('Country');
993
+			$country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO');
994
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
995 995
 		}
996 996
 		// grab attendee data
997 997
 		$attendee_data = array(
998
-			'ATT_fname' 		=> ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
999
-			'ATT_lname' 		=> ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
1000
-			'ATT_email' 		=> ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1001
-			'ATT_address' 		=> ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1002
-			'ATT_address2' 	=> ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1003
-			'ATT_city' 			=> ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
998
+			'ATT_fname' 		=> ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
999
+			'ATT_lname' 		=> ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
1000
+			'ATT_email' 		=> ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1001
+			'ATT_address' 		=> ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1002
+			'ATT_address2' 	=> ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1003
+			'ATT_city' 			=> ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1004 1004
 			'STA_ID' 				=> $STA_ID,
1005 1005
 			'CNT_ISO' 			=> $CNT_ISO,
1006
-			'ATT_zip' 				=> ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1007
-			'ATT_phone' 		=> ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1006
+			'ATT_zip' 				=> ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1007
+			'ATT_phone' 		=> ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1008 1008
 		);
1009 1009
 		// validate the email address since it is the most important piece of info
1010
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) {
1011
-			EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1010
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) {
1011
+			EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1012 1012
 		}
1013 1013
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1014
-		if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) {
1015
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1014
+		if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) {
1015
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1016 1016
 				'ATT_fname' => $attendee_data['ATT_fname'],
1017 1017
 				'ATT_lname' => $attendee_data['ATT_lname'],
1018 1018
 				'ATT_email' => $attendee_data['ATT_email']
1019 1019
 			));
1020
-			if ( $existing_attendee instanceof EE_Attendee ) {
1020
+			if ($existing_attendee instanceof EE_Attendee) {
1021 1021
 				return $existing_attendee;
1022 1022
 			}
1023 1023
 		}
1024 1024
 		// no existing attendee? kk let's create a new one
1025 1025
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1026
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1027
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1028
-		return EE_Attendee::new_instance( $attendee_data );
1026
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1027
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1028
+		return EE_Attendee::new_instance($attendee_data);
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1045,22 +1045,22 @@  discard block
 block discarded – undo
1045 1045
 	 */
1046 1046
 	public function process_reg_step() {
1047 1047
 		// how have they chosen to pay?
1048
-		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE );
1048
+		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE);
1049 1049
 		// choose your own adventure based on method_of_payment
1050
-		switch(  $this->checkout->selected_method_of_payment ) {
1050
+		switch ($this->checkout->selected_method_of_payment) {
1051 1051
 
1052 1052
 			case 'events_sold_out' :
1053 1053
 				$this->checkout->redirect = TRUE;
1054 1054
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1055
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1055
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1056 1056
 				// mark this reg step as completed
1057 1057
 				$this->set_completed();
1058 1058
 				return FALSE;
1059 1059
 				break;
1060 1060
 
1061 1061
 			case 'payments_closed' :
1062
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) {
1063
-					EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1062
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) {
1063
+					EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1064 1064
 				}
1065 1065
 				// mark this reg step as completed
1066 1066
 				$this->set_completed();
@@ -1068,8 +1068,8 @@  discard block
 block discarded – undo
1068 1068
 				break;
1069 1069
 
1070 1070
 			case 'no_payment_required' :
1071
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) {
1072
-					EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1071
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) {
1072
+					EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1073 1073
 				}
1074 1074
 				// mark this reg step as completed
1075 1075
 				$this->set_completed();
@@ -1080,9 +1080,9 @@  discard block
 block discarded – undo
1080 1080
 				//double-check payment is actually due. It's possible the situation changed because
1081 1081
 				//of a server-timeout during a previous request or change by admin
1082 1082
 				$payment_successful = $this->checkout->amount_owing > 0 ? $this->_process_payment() : true;
1083
-				if ( $payment_successful ) {
1083
+				if ($payment_successful) {
1084 1084
 					$this->checkout->continue_reg = true;
1085
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1085
+					$this->_maybe_set_completed($this->checkout->payment_method);
1086 1086
 				} else {
1087 1087
 					$this->checkout->continue_reg = false;
1088 1088
 				}
@@ -1100,8 +1100,8 @@  discard block
 block discarded – undo
1100 1100
 	 * @param \EE_Payment_Method $payment_method
1101 1101
 	 * @return void
1102 1102
 	 */
1103
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1104
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1103
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1104
+		switch ($payment_method->type_obj()->payment_occurs()) {
1105 1105
 			case EE_PMT_Base::offsite :
1106 1106
 				break;
1107 1107
 			case EE_PMT_Base::onsite :
@@ -1124,15 +1124,15 @@  discard block
 block discarded – undo
1124 1124
 	public function update_reg_step() {
1125 1125
 		$success = TRUE;
1126 1126
 		// if payment required
1127
-		if ( $this->checkout->transaction->total() > 0 ) {
1128
-			do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction );
1127
+		if ($this->checkout->transaction->total() > 0) {
1128
+			do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction);
1129 1129
 			// attempt payment via payment method
1130 1130
 			$success = $this->process_reg_step();
1131 1131
 		}
1132
-		if ( $success && ! $this->checkout->redirect ) {
1133
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() );
1132
+		if ($success && ! $this->checkout->redirect) {
1133
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID());
1134 1134
 			 // set return URL
1135
-			$this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url );
1135
+			$this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url);
1136 1136
 		}
1137 1137
 		return $success;
1138 1138
 	}
@@ -1152,24 +1152,24 @@  discard block
 block discarded – undo
1152 1152
 		// clear any previous errors related to not selecting a payment method
1153 1153
 //		EE_Error::overwrite_errors();
1154 1154
 		// ya gotta make a choice man
1155
-		if ( empty( $this->checkout->selected_method_of_payment )) {
1156
-			$this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' ));
1155
+		if (empty($this->checkout->selected_method_of_payment)) {
1156
+			$this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso'));
1157 1157
 			return FALSE;
1158 1158
 		}
1159 1159
 		// get EE_Payment_Method object
1160
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1160
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1161 1161
 			return FALSE;
1162 1162
 		}
1163 1163
 		// setup billing form
1164
-		if ( $this->checkout->payment_method->is_on_site() ) {
1165
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1164
+		if ($this->checkout->payment_method->is_on_site()) {
1165
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1166 1166
 			// bad billing form ?
1167
-			if ( ! $this->_billing_form_is_valid() ) {
1167
+			if ( ! $this->_billing_form_is_valid()) {
1168 1168
 				return FALSE;
1169 1169
 			}
1170 1170
 		}
1171 1171
 		// ensure primary registrant has been fully processed
1172
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1172
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1173 1173
 			return FALSE;
1174 1174
 		}
1175 1175
 		/** @type EE_Transaction_Processor $transaction_processor */
@@ -1177,24 +1177,24 @@  discard block
 block discarded – undo
1177 1177
 		// 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
1178 1178
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1179 1179
 		// attempt payment
1180
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1180
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1181 1181
 		// process results
1182
-		$payment = $this->_validate_payment( $payment );
1183
-		$payment = $this->_post_payment_processing( $payment );
1182
+		$payment = $this->_validate_payment($payment);
1183
+		$payment = $this->_post_payment_processing($payment);
1184 1184
 		// verify payment
1185
-		if ( $payment instanceof EE_Payment ) {
1185
+		if ($payment instanceof EE_Payment) {
1186 1186
 			// store that for later
1187 1187
 			$this->checkout->payment = $payment;
1188 1188
 			/** @type EE_Transaction_Processor $transaction_processor */
1189
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1189
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1190 1190
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1191
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1192
-			if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) {
1191
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1192
+			if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) {
1193 1193
 				return true;
1194 1194
 			} else {
1195 1195
 				return false;
1196 1196
 			}
1197
-		} else if ( $payment === true ) {
1197
+		} else if ($payment === true) {
1198 1198
 			// please note that offline payment methods will NOT make a payment,
1199 1199
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1200 1200
 			$this->checkout->payment = $payment;
@@ -1213,10 +1213,10 @@  discard block
 block discarded – undo
1213 1213
 	 * @return bool
1214 1214
 	 */
1215 1215
 	public function redirect_form() {
1216
-		$payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() );
1216
+		$payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment());
1217 1217
 		$html = $payment_method_billing_info->get_html_and_js();
1218 1218
 		$html .= $this->checkout->redirect_form;
1219
-		EE_Registry::instance()->REQ->add_output( $html );
1219
+		EE_Registry::instance()->REQ->add_output($html);
1220 1220
 		return TRUE;
1221 1221
 	}
1222 1222
 
@@ -1229,36 +1229,36 @@  discard block
 block discarded – undo
1229 1229
 	 * @return bool
1230 1230
 	 */
1231 1231
 	private function _billing_form_is_valid() {
1232
-		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1232
+		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) {
1233 1233
 			return TRUE;
1234 1234
 		}
1235
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1236
-			if ( $this->checkout->billing_form->was_submitted() ) {
1235
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1236
+			if ($this->checkout->billing_form->was_submitted()) {
1237 1237
 				$this->checkout->billing_form->receive_form_submission();
1238
-				if ( $this->checkout->billing_form->is_valid() ) {
1238
+				if ($this->checkout->billing_form->is_valid()) {
1239 1239
 					return TRUE;
1240 1240
 				}
1241 1241
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1242 1242
 				$error_strings = array();
1243
-				foreach( $validation_errors as $validation_error ){
1244
-					if( $validation_error instanceof EE_Validation_Error ){
1243
+				foreach ($validation_errors as $validation_error) {
1244
+					if ($validation_error instanceof EE_Validation_Error) {
1245 1245
 						$form_section = $validation_error->get_form_section();
1246
-						if( $form_section instanceof EE_Form_Input_Base ){
1246
+						if ($form_section instanceof EE_Form_Input_Base) {
1247 1247
 							$label = $form_section->html_label_text();
1248
-						}elseif( $form_section instanceof EE_Form_Section_Base ){
1248
+						}elseif ($form_section instanceof EE_Form_Section_Base) {
1249 1249
 							$label = $form_section->name();
1250
-						}else{
1251
-							$label = __( 'Validation Error', 'event_espresso' );
1250
+						} else {
1251
+							$label = __('Validation Error', 'event_espresso');
1252 1252
 						}
1253
-						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() );
1253
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1254 1254
 					}
1255 1255
 				}
1256
-				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__ );
1256
+				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__);
1257 1257
 			} else {
1258
-				EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1258
+				EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1259 1259
 			}
1260 1260
 		} else {
1261
-			EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1261
+			EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1262 1262
 		}
1263 1263
 		return FALSE;
1264 1264
 	}
@@ -1276,9 +1276,9 @@  discard block
 block discarded – undo
1276 1276
 	 */
1277 1277
 		private function _setup_primary_registrant_prior_to_payment() {
1278 1278
 			// check if transaction has a primary registrant and that it has a related Attendee object
1279
-			if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1279
+			if ( ! $this->checkout->transaction_has_primary_registrant()) {
1280 1280
 				// need to at least gather some primary registrant data before attempting payment
1281
-				if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) {
1281
+				if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) {
1282 1282
 					return FALSE;
1283 1283
 				}
1284 1284
 			}
@@ -1286,13 +1286,13 @@  discard block
 block discarded – undo
1286 1286
 			// grab the primary_registration object
1287 1287
 			$primary_registration = $this->checkout->transaction->primary_registration();
1288 1288
 			/** @type EE_Transaction_Processor $transaction_processor */
1289
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1289
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1290 1290
 			// at this point we'll consider a TXN to not have been failed
1291
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1291
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1292 1292
 			// save the TXN ( which clears cached copy of primary_registration)
1293 1293
 			$this->checkout->transaction->save();
1294 1294
 			// grab TXN ID and save it to the primary_registration
1295
-			$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1295
+			$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1296 1296
 			// save what we have so far
1297 1297
 			$primary_registration->save();
1298 1298
 			return TRUE;
@@ -1309,41 +1309,41 @@  discard block
 block discarded – undo
1309 1309
 		private function _capture_primary_registration_data_from_billing_form() {
1310 1310
 			// convert billing form data into an attendee
1311 1311
 			$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1312
-			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1312
+			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1313 1313
 				EE_Error::add_error(
1314 1314
 					sprintf(
1315
-						__( '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' ),
1315
+						__('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'),
1316 1316
 						'<br/>',
1317
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1317
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1318 1318
 					), __FILE__, __FUNCTION__, __LINE__
1319 1319
 				);
1320 1320
 				return FALSE;
1321 1321
 			}
1322 1322
 			$primary_registration = $this->checkout->transaction->primary_registration();
1323
-			if ( ! $primary_registration instanceof EE_Registration ) {
1323
+			if ( ! $primary_registration instanceof EE_Registration) {
1324 1324
 				EE_Error::add_error(
1325 1325
 					sprintf(
1326
-						__( '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' ),
1326
+						__('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'),
1327 1327
 						'<br/>',
1328
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1328
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1329 1329
 					), __FILE__, __FUNCTION__, __LINE__
1330 1330
 				);
1331 1331
 				return FALSE;
1332 1332
 			}
1333
-			if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) {
1333
+			if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) {
1334 1334
 				EE_Error::add_error(
1335 1335
 					sprintf(
1336
-						__( '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' ),
1336
+						__('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'),
1337 1337
 						'<br/>',
1338
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1338
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1339 1339
 					), __FILE__, __FUNCTION__, __LINE__
1340 1340
 				);
1341 1341
 				return FALSE;
1342 1342
 			}
1343 1343
 			/** @type EE_Registration_Processor $registration_processor */
1344
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1344
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1345 1345
 			// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1346
-			$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1346
+			$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1347 1347
 
1348 1348
 			return TRUE;
1349 1349
 		}
@@ -1359,35 +1359,35 @@  discard block
 block discarded – undo
1359 1359
 	 */
1360 1360
 		private function _get_payment_method_for_selected_method_of_payment() {
1361 1361
 			// get EE_Payment_Method object
1362
-			if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) {
1363
-				$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1362
+			if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1363
+				$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1364 1364
 			} else {
1365 1365
 				// load EEM_Payment_Method
1366
-				EE_Registry::instance()->load_model( 'Payment_Method' );
1366
+				EE_Registry::instance()->load_model('Payment_Method');
1367 1367
 				/** @type EEM_Payment_Method $EEM_Payment_Method */
1368 1368
 				$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1369
-				$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1369
+				$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1370 1370
 			}
1371 1371
 			// verify $payment_method
1372
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
1372
+			if ( ! $payment_method instanceof EE_Payment_Method) {
1373 1373
 				// not a payment
1374 1374
 				EE_Error::add_error(
1375 1375
 					sprintf(
1376
-						__( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1376
+						__('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1377 1377
 						'<br/>',
1378
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1378
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1379 1379
 					), __FILE__, __FUNCTION__, __LINE__
1380 1380
 				);
1381 1381
 				return NULL;
1382 1382
 			}
1383 1383
 			// and verify it has a valid Payment_Method Type object
1384
-			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1384
+			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1385 1385
 				// not a payment
1386 1386
 				EE_Error::add_error(
1387 1387
 					sprintf(
1388
-						__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1388
+						__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1389 1389
 						'<br/>',
1390
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1390
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1391 1391
 					), __FILE__, __FUNCTION__, __LINE__
1392 1392
 				);
1393 1393
 				return NULL;
@@ -1406,30 +1406,30 @@  discard block
 block discarded – undo
1406 1406
 	 * 	@type 	EE_Payment_Method $payment_method
1407 1407
 	 * 	@return 	mixed	EE_Payment | boolean
1408 1408
 	 */
1409
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1410
-		$payment =NULL;
1409
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1410
+		$payment = NULL;
1411 1411
 		$this->checkout->transaction->save();
1412
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1413
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1412
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1413
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1414 1414
 			return FALSE;
1415 1415
 		}
1416 1416
 		try {
1417
-			$payment_processor->set_revisit( $this->checkout->revisit );
1417
+			$payment_processor->set_revisit($this->checkout->revisit);
1418 1418
 			// generate payment object
1419 1419
 			$payment = $payment_processor->process_payment(
1420 1420
 				$payment_method,
1421 1421
 				$this->checkout->transaction,
1422 1422
 				$this->checkout->amount_owing,
1423 1423
 				$this->checkout->billing_form,
1424
-				$this->_get_return_url( $payment_method ),
1424
+				$this->_get_return_url($payment_method),
1425 1425
 				'CART',
1426 1426
 				$this->checkout->admin_request,
1427 1427
 				TRUE,
1428 1428
 				$this->reg_step_url()
1429 1429
 			);
1430 1430
 
1431
-		} catch( Exception $e ) {
1432
-			$this->_handle_payment_processor_exception( $e );
1431
+		} catch (Exception $e) {
1432
+			$this->_handle_payment_processor_exception($e);
1433 1433
 		}
1434 1434
 		return $payment;
1435 1435
 	}
@@ -1443,12 +1443,12 @@  discard block
 block discarded – undo
1443 1443
 	 * @param \Exception $e
1444 1444
 	 * @return void
1445 1445
 	 */
1446
-	protected function _handle_payment_processor_exception( Exception $e ) {
1446
+	protected function _handle_payment_processor_exception(Exception $e) {
1447 1447
 		EE_Error::add_error(
1448 1448
 			sprintf(
1449
-				__( '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' ),
1449
+				__('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'),
1450 1450
 				'<br/>',
1451
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
1451
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
1452 1452
 				$e->getMessage(),
1453 1453
 				$e->getFile(),
1454 1454
 				$e->getLine()
@@ -1465,9 +1465,9 @@  discard block
 block discarded – undo
1465 1465
 	 * @param \EE_Payment_Method $payment_method
1466 1466
 	 * @return string
1467 1467
 	 */
1468
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
1468
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
1469 1469
 		$return_url = '';
1470
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1470
+		switch ($payment_method->type_obj()->payment_occurs()) {
1471 1471
 
1472 1472
 			case EE_PMT_Base::offsite :
1473 1473
 				$return_url = add_query_arg(
@@ -1498,27 +1498,27 @@  discard block
 block discarded – undo
1498 1498
 	 * @param EE_Payment $payment
1499 1499
 	 * @return EE_Payment | FALSE
1500 1500
 	 */
1501
-	private function _validate_payment( $payment = NULL ) {
1502
-		if (  $this->checkout->payment_method->is_off_line() ) {
1501
+	private function _validate_payment($payment = NULL) {
1502
+		if ($this->checkout->payment_method->is_off_line()) {
1503 1503
 			return TRUE;
1504 1504
 		}
1505 1505
 		// verify payment object
1506
-		if ( $payment instanceof EE_Payment ) {
1506
+		if ($payment instanceof EE_Payment) {
1507 1507
 			if (
1508 1508
 				$payment->status() != EEM_Payment::status_id_approved
1509 1509
 				&& $payment->status() != EEM_Payment::status_id_pending
1510 1510
 				&& $payment->status() != EEM_Payment::status_id_cancelled
1511 1511
 				&& $payment->gateway_response() != ''
1512 1512
 			) {
1513
-				EE_Error::add_error( $payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__ );
1513
+				EE_Error::add_error($payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__);
1514 1514
 			}
1515 1515
 		} else {
1516 1516
 			// not a payment
1517 1517
 			EE_Error::add_error(
1518 1518
 				sprintf(
1519
-					__( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1519
+					__('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1520 1520
 					'<br/>',
1521
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1521
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1522 1522
 				), __FILE__, __FUNCTION__, __LINE__
1523 1523
 			);
1524 1524
 			return FALSE;
@@ -1535,23 +1535,23 @@  discard block
 block discarded – undo
1535 1535
 	 * @param EE_Payment $payment
1536 1536
 	 * @return bool
1537 1537
 	 */
1538
-	private function _post_payment_processing( $payment = NULL ) {
1538
+	private function _post_payment_processing($payment = NULL) {
1539 1539
 		// On-Site payment?
1540
-		if ( $this->checkout->payment_method->is_on_site() ) {
1541
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) {
1540
+		if ($this->checkout->payment_method->is_on_site()) {
1541
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
1542 1542
 				//$this->_setup_redirect_for_next_step();
1543 1543
 				$this->checkout->continue_reg = false;
1544 1544
 			}
1545 1545
 			// Off-Site payment?
1546
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
1546
+		} else if ($this->checkout->payment_method->is_off_site()) {
1547 1547
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
1548
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ){
1549
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
1548
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
1549
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
1550 1550
 				$this->checkout->redirect = TRUE;
1551 1551
 				$this->checkout->redirect_form = $payment->redirect_form();
1552
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
1552
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
1553 1553
 				// set JSON response
1554
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
1554
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
1555 1555
 				// set cron job for finalizing the TXN
1556 1556
 				// in case the user does not return from the off-site gateway
1557 1557
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -1559,21 +1559,21 @@  discard block
 block discarded – undo
1559 1559
 					$this->checkout->transaction->ID()
1560 1560
 				);
1561 1561
 				// and lastly, let's bump the payment status to pending
1562
-				$payment->set_status( EEM_Payment::status_id_pending );
1562
+				$payment->set_status(EEM_Payment::status_id_pending);
1563 1563
 				$payment->save();
1564 1564
 			} else {
1565 1565
 				// not a payment
1566 1566
 				$this->checkout->continue_reg = false;
1567 1567
 				EE_Error::add_error(
1568 1568
 					sprintf(
1569
-						__( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1569
+						__('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1570 1570
 						'<br/>',
1571
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1571
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1572 1572
 					), __FILE__, __FUNCTION__, __LINE__
1573 1573
 				);
1574 1574
 			}
1575 1575
 			// Off-Line payment?
1576
-		} else if ( $payment === TRUE ) {
1576
+		} else if ($payment === TRUE) {
1577 1577
 			//$this->_setup_redirect_for_next_step();
1578 1578
 			return TRUE;
1579 1579
 		} else {
@@ -1609,65 +1609,65 @@  discard block
 block discarded – undo
1609 1609
 	 * @return bool
1610 1610
 	 * @throws \EE_Error
1611 1611
 	 */
1612
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
1612
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
1613 1613
 		// off-line payment? carry on
1614
-		if ( $payment_occurs == EE_PMT_Base::offline ) {
1614
+		if ($payment_occurs == EE_PMT_Base::offline) {
1615 1615
 			return true;
1616 1616
 		}
1617 1617
 		// verify payment validity
1618
-		if ( $payment instanceof EE_Payment ) {
1619
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
1618
+		if ($payment instanceof EE_Payment) {
1619
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
1620 1620
 			$msg = $payment->gateway_response();
1621 1621
 			// check results
1622
-			switch ( $payment->status() ) {
1622
+			switch ($payment->status()) {
1623 1623
 
1624 1624
 				// good payment
1625 1625
 				case EEM_Payment::status_id_approved :
1626
-					EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1626
+					EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1627 1627
 					return TRUE;
1628 1628
 					break;
1629 1629
 
1630 1630
 				// slow payment
1631 1631
 				case EEM_Payment::status_id_pending :
1632
-					if ( empty( $msg )) {
1633
-						$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' );
1632
+					if (empty($msg)) {
1633
+						$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');
1634 1634
 					}
1635
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
1635
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
1636 1636
 					return TRUE;
1637 1637
 					break;
1638 1638
 
1639 1639
 				// don't wanna payment
1640 1640
 				case EEM_Payment::status_id_cancelled :
1641
-					if ( empty( $msg )) {
1641
+					if (empty($msg)) {
1642 1642
 						$msg = _n(
1643 1643
 							'Payment cancelled. Please try again.',
1644 1644
 							'Payment cancelled. Please try again or select another method of payment.',
1645
-							count( $this->checkout->available_payment_methods ),
1645
+							count($this->checkout->available_payment_methods),
1646 1646
 							'event_espresso'
1647 1647
 						);
1648 1648
 					}
1649
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1649
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1650 1650
 					return FALSE;
1651 1651
 					break;
1652 1652
 
1653 1653
 				// not enough payment
1654 1654
 				case EEM_Payment::status_id_declined :
1655
-					if ( empty( $msg )) {
1655
+					if (empty($msg)) {
1656 1656
 						$msg = _n(
1657 1657
 							'We\'re sorry but your payment was declined. Please try again.',
1658 1658
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
1659
-							count( $this->checkout->available_payment_methods ),
1659
+							count($this->checkout->available_payment_methods),
1660 1660
 							'event_espresso'
1661 1661
 						);
1662 1662
 					}
1663
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1663
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1664 1664
 					return FALSE;
1665 1665
 					break;
1666 1666
 
1667 1667
 				// bad payment
1668 1668
 				case EEM_Payment::status_id_failed :
1669
-					if ( ! empty( $msg ) ) {
1670
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1669
+					if ( ! empty($msg)) {
1670
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1671 1671
 						return false;
1672 1672
 					}
1673 1673
 					// default to error below
@@ -1677,14 +1677,14 @@  discard block
 block discarded – undo
1677 1677
 		}
1678 1678
 		// off-site payment gateway responses are too unreliable, so let's just assume that
1679 1679
 		// the payment processing is just running slower than the registrant's request
1680
-		if ( $payment_occurs == EE_PMT_Base::offsite ) {
1680
+		if ($payment_occurs == EE_PMT_Base::offsite) {
1681 1681
 			return true;
1682 1682
 		}
1683 1683
 		EE_Error::add_error(
1684 1684
 				sprintf(
1685
-					__( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1685
+					__('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1686 1686
 					'<br/>',
1687
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1687
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1688 1688
 				),
1689 1689
 				__FILE__, __FUNCTION__, __LINE__
1690 1690
 			);
@@ -1717,13 +1717,13 @@  discard block
 block discarded – undo
1717 1717
 	public function process_gateway_response() {
1718 1718
 		$payment = null;
1719 1719
 		// how have they chosen to pay?
1720
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1720
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1721 1721
 		// get EE_Payment_Method object
1722
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1722
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1723 1723
 			$this->checkout->continue_reg = false;
1724 1724
 			return false;
1725 1725
 		}
1726
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
1726
+		if ( ! $this->checkout->payment_method->is_off_site()) {
1727 1727
 			return false;
1728 1728
 		}
1729 1729
 		$this->_validate_offsite_return();
@@ -1737,23 +1737,23 @@  discard block
 block discarded – undo
1737 1737
 		//	true
1738 1738
 		//);
1739 1739
 		// verify TXN
1740
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
1740
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1741 1741
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
1742
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
1742
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
1743 1743
 				$this->checkout->continue_reg = false;
1744 1744
 				return false;
1745 1745
 			}
1746
-			$payment = $this->_process_off_site_payment( $gateway );
1747
-			$payment = $this->_process_cancelled_payments( $payment );
1748
-			$payment = $this->_validate_payment( $payment );
1746
+			$payment = $this->_process_off_site_payment($gateway);
1747
+			$payment = $this->_process_cancelled_payments($payment);
1748
+			$payment = $this->_validate_payment($payment);
1749 1749
 			// if payment was not declined by the payment gateway or cancelled by the registrant
1750
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
1750
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
1751 1751
 				//$this->_setup_redirect_for_next_step();
1752 1752
 				// store that for later
1753 1753
 				$this->checkout->payment = $payment;
1754 1754
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
1755 1755
 				// because we will complete this step during the IPN processing then
1756
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) {
1756
+				if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) {
1757 1757
 					$this->set_completed();
1758 1758
 				}
1759 1759
 				return true;
@@ -1776,19 +1776,19 @@  discard block
 block discarded – undo
1776 1776
 	 * @return bool
1777 1777
 	 */
1778 1778
 	private function _validate_offsite_return() {
1779
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
1780
-		if ( $TXN_ID != $this->checkout->transaction->ID() ) {
1779
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
1780
+		if ($TXN_ID != $this->checkout->transaction->ID()) {
1781 1781
 			// Houston... we might have a problem
1782 1782
 			$invalid_TXN = false;
1783 1783
 			// first gather some info
1784
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1784
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1785 1785
 			$primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null;
1786 1786
 			// let's start by retrieving the cart for this TXN
1787
-			$cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction );
1788
-			if ( $cart instanceof EE_Cart ) {
1787
+			$cart = EE_Cart::get_cart_from_txn($this->checkout->transaction);
1788
+			if ($cart instanceof EE_Cart) {
1789 1789
 				// verify that the current cart has tickets
1790 1790
 				$tickets = $cart->get_tickets();
1791
-				if ( empty( $tickets ) ) {
1791
+				if (empty($tickets)) {
1792 1792
 					$invalid_TXN = true;
1793 1793
 				}
1794 1794
 			} else {
@@ -1796,39 +1796,39 @@  discard block
 block discarded – undo
1796 1796
 			}
1797 1797
 			$valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null;
1798 1798
 			// validate current Session ID and compare against valid TXN session ID
1799
-			if ( EE_Session::instance()->id() === null ) {
1799
+			if (EE_Session::instance()->id() === null) {
1800 1800
 				$invalid_TXN = true;
1801
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
1801
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
1802 1802
 				// WARNING !!!
1803 1803
 				// this could be PayPal sending back duplicate requests (ya they do that)
1804 1804
 				// or it **could** mean someone is simply registering AGAIN after having just done so
1805 1805
 				// so now we need to determine if this current TXN looks valid or not
1806 1806
 				/** @type EE_Transaction_Processor $transaction_processor */
1807
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1807
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1808 1808
 				// has this step even been started ?
1809
-				if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false )
1809
+				if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false)
1810 1810
 				) {
1811 1811
 					// really? you're half way through this reg step, but you never started it ?
1812 1812
 					$invalid_TXN = true;
1813 1813
 				}
1814 1814
 			}
1815
-			if ( $invalid_TXN ) {
1815
+			if ($invalid_TXN) {
1816 1816
 				// is the valid TXN completed ?
1817
-				if ( $valid_TXN instanceof EE_Transaction ) {
1817
+				if ($valid_TXN instanceof EE_Transaction) {
1818 1818
 					/** @type EE_Transaction_Processor $transaction_processor */
1819
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1819
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1820 1820
 					// has this step even been started ?
1821
-					$reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() );
1822
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
1821
+					$reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug());
1822
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
1823 1823
 						// so it **looks** like this is a double request from PayPal
1824 1824
 						// so let's try to pick up where we left off
1825 1825
 						$this->checkout->transaction = $valid_TXN;
1826
-						$this->checkout->refresh_all_entities( true );
1826
+						$this->checkout->refresh_all_entities(true);
1827 1827
 						return;
1828 1828
 					}
1829 1829
 				}
1830 1830
 				// you appear to be lost?
1831
-				$this->_redirect_wayward_request( $primary_registrant );
1831
+				$this->_redirect_wayward_request($primary_registrant);
1832 1832
 			}
1833 1833
 		}
1834 1834
 	}
@@ -1842,16 +1842,16 @@  discard block
 block discarded – undo
1842 1842
 	 * @param \EE_Registration $primary_registrant
1843 1843
 	 * @return bool
1844 1844
 	 */
1845
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
1846
-		if ( ! $primary_registrant instanceof EE_Registration ) {
1845
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
1846
+		if ( ! $primary_registrant instanceof EE_Registration) {
1847 1847
 			// try redirecting based on the current TXN
1848 1848
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null;
1849
-			if ( ! $primary_registrant instanceof EE_Registration ) {
1849
+			if ( ! $primary_registrant instanceof EE_Registration) {
1850 1850
 				EE_Error::add_error(
1851 1851
 					sprintf(
1852
-						__( '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' ),
1852
+						__('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'),
1853 1853
 						'<br/>',
1854
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1854
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1855 1855
 					),
1856 1856
 					__FILE__, __FUNCTION__, __LINE__
1857 1857
 				);
@@ -1879,16 +1879,16 @@  discard block
 block discarded – undo
1879 1879
 	 * @param \EE_Offsite_Gateway $gateway
1880 1880
 	 * @return \EE_Payment
1881 1881
 	 */
1882
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
1882
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
1883 1883
 		try {
1884 1884
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
1885
-			if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) {
1885
+			if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) {
1886 1886
 				$payment = $this->checkout->transaction->last_payment();
1887 1887
 				//$payment_source = 'last_payment';
1888 1888
 			} else {
1889 1889
 				// get payment details and process results
1890 1890
 				/** @type EE_Payment_Processor $payment_processor */
1891
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1891
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1892 1892
 				$payment = $payment_processor->process_ipn(
1893 1893
 					$_REQUEST,
1894 1894
 					$this->checkout->transaction,
@@ -1898,14 +1898,14 @@  discard block
 block discarded – undo
1898 1898
 				);
1899 1899
 				//$payment_source = 'process_ipn';
1900 1900
 			}
1901
-		} catch ( Exception $e ) {
1901
+		} catch (Exception $e) {
1902 1902
 			// let's just eat the exception and try to move on using any previously set payment info
1903 1903
 			$payment = $this->checkout->transaction->last_payment();
1904 1904
 			//$payment_source = 'last_payment after Exception';
1905 1905
 			// but if we STILL don't have a payment object
1906
-			if ( ! $payment instanceof EE_Payment ) {
1906
+			if ( ! $payment instanceof EE_Payment) {
1907 1907
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
1908
-				$this->_handle_payment_processor_exception( $e );
1908
+				$this->_handle_payment_processor_exception($e);
1909 1909
 			}
1910 1910
 		}
1911 1911
 		// DEBUG LOG
@@ -1929,13 +1929,13 @@  discard block
 block discarded – undo
1929 1929
 	 * @param EE_Payment $payment
1930 1930
 	 * @return EE_Payment | FALSE
1931 1931
 	 */
1932
-	private function _process_cancelled_payments( $payment = NULL ) {
1932
+	private function _process_cancelled_payments($payment = NULL) {
1933 1933
 		if (
1934
-			isset( $_REQUEST[ 'ee_cancel_payment' ] )
1934
+			isset($_REQUEST['ee_cancel_payment'])
1935 1935
 			&& $payment instanceof EE_Payment
1936 1936
 			&& $payment->status() == EEM_Payment::status_id_failed
1937 1937
 		) {
1938
-			$payment->set_status( EEM_Payment::status_id_cancelled );
1938
+			$payment->set_status(EEM_Payment::status_id_cancelled);
1939 1939
 		}
1940 1940
 		return $payment;
1941 1941
 	}
@@ -1952,23 +1952,23 @@  discard block
 block discarded – undo
1952 1952
 	public function get_transaction_details_for_gateways() {
1953 1953
 		$txn_details = array();
1954 1954
 		// ya gotta make a choice man
1955
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1955
+		if (empty($this->checkout->selected_method_of_payment)) {
1956 1956
 			$txn_details = array(
1957
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
1957
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
1958 1958
 			);
1959 1959
 		}
1960 1960
 		// get EE_Payment_Method object
1961 1961
 		if (
1962
-			empty( $txn_details ) &&
1962
+			empty($txn_details) &&
1963 1963
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
1964 1964
 		) {
1965 1965
 			$txn_details = array(
1966 1966
 				'selected_method_of_payment' => $this->checkout->selected_method_of_payment,
1967
-				'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' )
1967
+				'error' => __('A valid Payment Method could not be determined.', 'event_espresso')
1968 1968
 			);
1969 1969
 		}
1970
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
1971
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
1970
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
1971
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
1972 1972
 			$txn_details = array(
1973 1973
 				'TXN_ID'        			=> $this->checkout->transaction->ID(),
1974 1974
 				'TXN_timestamp' 	=> $this->checkout->transaction->datetime(),
@@ -1979,7 +1979,7 @@  discard block
 block discarded – undo
1979 1979
 				'PMD_ID'        			=> $this->checkout->transaction->payment_method_ID(),
1980 1980
 				'payment_amount' => $this->checkout->amount_owing,
1981 1981
 				'return_url' 				=> $return_url,
1982
-				'cancel_url' 				=> add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
1982
+				'cancel_url' 				=> add_query_arg(array('ee_cancel_payment' => true), $return_url),
1983 1983
 				'notify_url' 				=> EE_Config::instance()->core->txn_page_url(
1984 1984
 					array(
1985 1985
 						'e_reg_url_link'    			=> $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -1988,7 +1988,7 @@  discard block
 block discarded – undo
1988 1988
 				)
1989 1989
 			);
1990 1990
 		}
1991
-		echo json_encode( $txn_details );
1991
+		echo json_encode($txn_details);
1992 1992
 		exit();
1993 1993
 	}
1994 1994
 
Please login to merge, or discard this patch.