Completed
Branch FET-9856-direct-instantiation (a39e7f)
by
unknown
50:47 queued 37:40
created
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -466,38 +466,38 @@  discard block
 block discarded – undo
466 466
 	 * @throws \EE_Error
467 467
 	 */
468 468
 	public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) {
469
-        // registrations per event
469
+		// registrations per event
470 470
 		$event_reg_count = array();
471 471
 		// spaces left per event
472 472
 		$event_spaces_remaining = array();
473
-        // tickets left sorted by ID
474
-        $tickets_remaining = array();
475
-        // registrations that have lost their space
473
+		// tickets left sorted by ID
474
+		$tickets_remaining = array();
475
+		// registrations that have lost their space
476 476
 		$ejected_registrations = array();
477 477
 		foreach ( $registrations as $REG_ID => $registration ) {
478 478
 			if ( $registration->status_ID() === EEM_Registration::status_id_approved ) {
479 479
 				continue;
480 480
 			}
481 481
 			$EVT_ID = $registration->event_ID();
482
-            $ticket = $registration->ticket();
483
-            if ( ! isset($tickets_remaining[$ticket->ID()])) {
484
-                $tickets_remaining[$ticket->ID()] = $ticket->remaining();
485
-            }
486
-            if ($tickets_remaining[$ticket->ID()] > 0) {
487
-                if ( ! isset($event_reg_count[$EVT_ID])) {
488
-                    $event_reg_count[$EVT_ID] = 0;
489
-                }
490
-                $event_reg_count[$EVT_ID]++;
491
-                if ( ! isset($event_spaces_remaining[$EVT_ID])) {
492
-                    $event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale();
493
-                }
494
-            }
482
+			$ticket = $registration->ticket();
483
+			if ( ! isset($tickets_remaining[$ticket->ID()])) {
484
+				$tickets_remaining[$ticket->ID()] = $ticket->remaining();
485
+			}
486
+			if ($tickets_remaining[$ticket->ID()] > 0) {
487
+				if ( ! isset($event_reg_count[$EVT_ID])) {
488
+					$event_reg_count[$EVT_ID] = 0;
489
+				}
490
+				$event_reg_count[$EVT_ID]++;
491
+				if ( ! isset($event_spaces_remaining[$EVT_ID])) {
492
+					$event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale();
493
+				}
494
+			}
495 495
 			if (
496 496
 				$revisit
497 497
 				&& (
498
-                    $tickets_remaining[$ticket->ID()] === 0
499
-				    || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
500
-                )
498
+					$tickets_remaining[$ticket->ID()] === 0
499
+					|| $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
500
+				)
501 501
 			) {
502 502
 				$ejected_registrations[ $REG_ID ] = $registration->event();
503 503
 				if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) {
@@ -572,9 +572,9 @@  discard block
 block discarded – undo
572 572
 				'layout_strategy' => new EE_Template_Layout(
573 573
 					array(
574 574
 						'layout_template_file' => SPCO_REG_STEPS_PATH
575
-						                          . $this->_slug
576
-						                          . DS
577
-						                          . 'sold_out_events.template.php',
575
+												  . $this->_slug
576
+												  . DS
577
+												  . 'sold_out_events.template.php',
578 578
 						'template_args'        => apply_filters(
579 579
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
580 580
 							array(
@@ -625,9 +625,9 @@  discard block
 block discarded – undo
625 625
 				'layout_strategy' => new EE_Template_Layout(
626 626
 					array(
627 627
 						'layout_template_file' => SPCO_REG_STEPS_PATH
628
-						                          . $this->_slug
629
-						                          . DS
630
-						                          . 'sold_out_events.template.php',
628
+												  . $this->_slug
629
+												  . DS
630
+												  . 'sold_out_events.template.php',
631 631
 						'template_args'        => apply_filters(
632 632
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___insufficient_spaces_available__template_args',
633 633
 							array(
@@ -679,9 +679,9 @@  discard block
 block discarded – undo
679 679
 				'layout_strategy' => new EE_Template_Layout(
680 680
 					array(
681 681
 						'layout_template_file' => SPCO_REG_STEPS_PATH
682
-						                          . $this->_slug
683
-						                          . DS
684
-						                          . 'events_requiring_pre_approval.template.php', // layout_template
682
+												  . $this->_slug
683
+												  . DS
684
+												  . 'events_requiring_pre_approval.template.php', // layout_template
685 685
 						'template_args'        => apply_filters(
686 686
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
687 687
 							array(
@@ -723,9 +723,9 @@  discard block
 block discarded – undo
723 723
 				'layout_strategy' => new EE_Template_Layout(
724 724
 					array(
725 725
 						'layout_template_file' => SPCO_REG_STEPS_PATH
726
-						                          . $this->_slug
727
-						                          . DS
728
-						                          . 'no_payment_required.template.php', // layout_template
726
+												  . $this->_slug
727
+												  . DS
728
+												  . 'no_payment_required.template.php', // layout_template
729 729
 						'template_args'        => apply_filters(
730 730
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
731 731
 							array(
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
 					$available_payment_method_options[ $payment_method->slug() ] = $payment_method_button;
956 956
 				}
957 957
 				$payment_methods_billing_info[ $payment_method->slug()
958
-				                               . '-info' ] = $this->_payment_method_billing_info(
958
+											   . '-info' ] = $this->_payment_method_billing_info(
959 959
 					$payment_method
960 960
 				);
961 961
 			}
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
 		// fill form with attendee info if applicable
1144 1144
 		if (
1145 1145
 			$payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form
1146
-		    && $this->checkout->transaction_has_primary_registrant()
1146
+			&& $this->checkout->transaction_has_primary_registrant()
1147 1147
 		) {
1148 1148
 			$payment_method_billing_form->populate_from_attendee(
1149 1149
 				$this->checkout->transaction->primary_registration()->attendee()
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 		// and debug content
1153 1153
 		if (
1154 1154
 			$payment_method_billing_form instanceof EE_Billing_Info_Form
1155
-		    && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1155
+			&& $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1156 1156
 		) {
1157 1157
 			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
1158 1158
 				$payment_method_billing_form
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
 		}
1328 1328
 		// and debug content
1329 1329
 		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form
1330
-		     && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1330
+			 && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1331 1331
 		) {
1332 1332
 			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
1333 1333
 				$this->checkout->billing_form
@@ -1461,8 +1461,8 @@  discard block
 block discarded – undo
1461 1461
 		}
1462 1462
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1463 1463
 		if ( ! empty( $attendee_data['ATT_fname'] )
1464
-		     && ! empty( $attendee_data['ATT_lname'] )
1465
-		     && ! empty( $attendee_data['ATT_email'] )
1464
+			 && ! empty( $attendee_data['ATT_lname'] )
1465
+			 && ! empty( $attendee_data['ATT_email'] )
1466 1466
 		) {
1467 1467
 			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(
1468 1468
 				array(
@@ -1702,7 +1702,7 @@  discard block
 block discarded – undo
1702 1702
 			$payment_status = $payment->status();
1703 1703
 			if (
1704 1704
 				$payment_status === EEM_Payment::status_id_approved
1705
-			    || $payment_status === EEM_Payment::status_id_pending
1705
+				|| $payment_status === EEM_Payment::status_id_pending
1706 1706
 			) {
1707 1707
 				return true;
1708 1708
 			} else {
@@ -1888,8 +1888,8 @@  discard block
 block discarded – undo
1888 1888
 			return false;
1889 1889
 		}
1890 1890
 		if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' )
1891
-		       instanceof
1892
-		       EE_Attendee
1891
+			   instanceof
1892
+			   EE_Attendee
1893 1893
 		) {
1894 1894
 			EE_Error::add_error(
1895 1895
 				sprintf(
@@ -2607,19 +2607,19 @@  discard block
 block discarded – undo
2607 2607
 
2608 2608
 
2609 2609
 
2610
-    /**
2611
-     *    __sleep
2612
-     * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon serialization
2613
-     * EE_Checkout will handle the reimplementation of itself upon waking,
2614
-     * but we won't bother with the reg form, because if needed, it will be regenerated anyways
2615
-     *
2616
-     * @return array
2617
-     */
2618
-    public function __sleep()
2619
-    {
2620
-        // remove the reg form and the checkout
2621
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'reg_form', 'checkout', 'line_item_display' ) );
2622
-    }
2610
+	/**
2611
+	 *    __sleep
2612
+	 * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon serialization
2613
+	 * EE_Checkout will handle the reimplementation of itself upon waking,
2614
+	 * but we won't bother with the reg form, because if needed, it will be regenerated anyways
2615
+	 *
2616
+	 * @return array
2617
+	 */
2618
+	public function __sleep()
2619
+	{
2620
+		// remove the reg form and the checkout
2621
+		return array_diff( array_keys( get_object_vars( $this ) ), array( 'reg_form', 'checkout', 'line_item_display' ) );
2622
+	}
2623 2623
 
2624 2624
 
2625 2625
 
Please login to merge, or discard this patch.
Spacing   +348 added lines, -348 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -38,32 +38,32 @@  discard block
 block discarded – undo
38 38
 	public static function set_hooks() {
39 39
 		add_filter(
40 40
 			'FHEE__SPCO__EE_Line_Item_Filter_Collection',
41
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' )
41
+			array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters')
42 42
 		);
43 43
 		add_action(
44 44
 			'wp_ajax_switch_spco_billing_form',
45
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )
45
+			array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')
46 46
 		);
47 47
 		add_action(
48 48
 			'wp_ajax_nopriv_switch_spco_billing_form',
49
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )
49
+			array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')
50 50
 		);
51
-		add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ) );
51
+		add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
52 52
 		add_action(
53 53
 			'wp_ajax_nopriv_save_payer_details',
54
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )
54
+			array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')
55 55
 		);
56 56
 		add_action(
57 57
 			'wp_ajax_get_transaction_details_for_gateways',
58
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
58
+			array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
59 59
 		);
60 60
 		add_action(
61 61
 			'wp_ajax_nopriv_get_transaction_details_for_gateways',
62
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
62
+			array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
63 63
 		);
64 64
 		add_filter(
65 65
 			'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array',
66
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ),
66
+			array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'),
67 67
 			10,
68 68
 			1
69 69
 		);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @throws \EE_Error
78 78
 	 */
79 79
 	public static function switch_spco_billing_form() {
80
-		EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' );
80
+		EED_Single_Page_Checkout::process_ajax_request('switch_payment_method');
81 81
 	}
82 82
 
83 83
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @throws \EE_Error
89 89
 	 */
90 90
 	public static function save_payer_details() {
91
-		EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' );
91
+		EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax');
92 92
 	}
93 93
 
94 94
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @throws \EE_Error
100 100
 	 */
101 101
 	public static function get_transaction_details() {
102
-		EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' );
102
+		EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways');
103 103
 	}
104 104
 
105 105
 
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
 	 * @access    public
127 127
 	 * @param    EE_Checkout $checkout
128 128
 	 */
129
-	public function __construct( EE_Checkout $checkout ) {
129
+	public function __construct(EE_Checkout $checkout) {
130 130
 		$this->_slug = 'payment_options';
131
-		$this->_name = __( 'Payment Options', 'event_espresso' );
132
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
131
+		$this->_name = __('Payment Options', 'event_espresso');
132
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
133 133
 		$this->checkout = $checkout;
134 134
 		$this->_reset_success_message();
135 135
 		$this->set_instructions(
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	/**
155 155
 	 * @param null $line_item_display
156 156
 	 */
157
-	public function set_line_item_display( $line_item_display ) {
157
+	public function set_line_item_display($line_item_display) {
158 158
 		$this->line_item_display = $line_item_display;
159 159
 	}
160 160
 
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	/**
173 173
 	 * @param boolean $handle_IPN_in_this_request
174 174
 	 */
175
-	public function set_handle_IPN_in_this_request( $handle_IPN_in_this_request ) {
176
-		$this->handle_IPN_in_this_request = filter_var( $handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN );
175
+	public function set_handle_IPN_in_this_request($handle_IPN_in_this_request) {
176
+		$this->handle_IPN_in_this_request = filter_var($handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN);
177 177
 	}
178 178
 
179 179
 
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
 	public function enqueue_styles_and_scripts() {
209 209
 		$transaction = $this->checkout->transaction;
210 210
 		//if the transaction isn't set or nothing is owed on it, don't enqueue any JS
211
-		if( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats( $transaction->remaining(), 0 ) ) {
211
+		if ( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats($transaction->remaining(), 0)) {
212 212
 			return;
213 213
 		}
214
-		foreach( EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ) as $payment_method ) {
214
+		foreach (EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart) as $payment_method) {
215 215
 			$type_obj = $payment_method->type_obj();
216
-			if( $type_obj instanceof EE_PMT_Base ) {
217
-				$billing_form = $type_obj->generate_new_billing_form( $transaction );
218
-				if( $billing_form instanceof EE_Form_Section_Proper ) {
216
+			if ($type_obj instanceof EE_PMT_Base) {
217
+				$billing_form = $type_obj->generate_new_billing_form($transaction);
218
+				if ($billing_form instanceof EE_Form_Section_Proper) {
219 219
 					$billing_form->enqueue_js();
220 220
 				}
221 221
 			}
@@ -240,20 +240,20 @@  discard block
 block discarded – undo
240 240
 			// 	$ 0.00 transactions (no payment required)
241 241
 			! $this->checkout->payment_required()
242 242
 			// but do NOT remove if current action being called belongs to this reg step
243
-			&& ! is_callable( array( $this, $this->checkout->action ) )
243
+			&& ! is_callable(array($this, $this->checkout->action))
244 244
 			&& ! $this->completed()
245 245
 		) {
246 246
 			// and if so, then we no longer need the Payment Options step
247
-			if ( $this->is_current_step() ) {
247
+			if ($this->is_current_step()) {
248 248
 				$this->checkout->generate_reg_form = false;
249 249
 			}
250
-			$this->checkout->remove_reg_step( $this->_slug );
250
+			$this->checkout->remove_reg_step($this->_slug);
251 251
 			// DEBUG LOG
252 252
 			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
253 253
 			return false;
254 254
 		}
255 255
 		// load EEM_Payment_Method
256
-		EE_Registry::instance()->load_model( 'Payment_Method' );
256
+		EE_Registry::instance()->load_model('Payment_Method');
257 257
 		// get all active payment methods
258 258
 		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
259 259
 			$this->checkout->transaction,
@@ -280,15 +280,15 @@  discard block
 block discarded – undo
280 280
 		$insufficient_spaces_available = array();
281 281
 		$reg_count = 0;
282 282
 		// loop thru registrations to gather info
283
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
283
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
284 284
 		$ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space(
285 285
 			$registrations,
286 286
 			$this->checkout->revisit
287 287
 		);
288
-		foreach ( $registrations as $REG_ID => $registration ) {
288
+		foreach ($registrations as $REG_ID => $registration) {
289 289
 			// has this registration lost it's space ?
290
-			if ( isset( $ejected_registrations[ $REG_ID ] ) ) {
291
-				$insufficient_spaces_available[ $registration->event()->ID() ] = $registration->event();
290
+			if (isset($ejected_registrations[$REG_ID])) {
291
+				$insufficient_spaces_available[$registration->event()->ID()] = $registration->event();
292 292
 				continue;
293 293
 			}
294 294
 			/** @var $registration EE_Registration */
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
 				&& $registration->status_ID() === EEM_Registration::status_id_approved
301 301
 			)
302 302
 			) {
303
-				if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true ) ) {
303
+				if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) {
304 304
 					// add event to list of events that are sold out
305
-					$sold_out_events[ $registration->event()->ID() ] = $registration->event();
305
+					$sold_out_events[$registration->event()->ID()] = $registration->event();
306 306
 					do_action(
307 307
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
308 308
 						$registration->event(),
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 					continue;
312 312
 				}
313 313
 				// event requires admin approval
314
-				if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) {
314
+				if ($registration->status_ID() === EEM_Registration::status_id_not_approved) {
315 315
 					// add event to list of events with pre-approval reg status
316
-					$registrations_requiring_pre_approval[ $REG_ID ] = $registration;
316
+					$registrations_requiring_pre_approval[$REG_ID] = $registration;
317 317
 					do_action(
318 318
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
319 319
 						$registration->event(),
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 				}
323 323
 			}
324 324
 			// are they allowed to pay now and is there monies owing?
325
-			if ( $registration->owes_monies_and_can_pay() ) {
326
-				$registrations_requiring_payment[ $REG_ID ] = $registration;
325
+			if ($registration->owes_monies_and_can_pay()) {
326
+				$registrations_requiring_payment[$REG_ID] = $registration;
327 327
 				do_action(
328 328
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
329 329
 					$registration->event(),
@@ -334,29 +334,29 @@  discard block
 block discarded – undo
334 334
 				&& $registration->status_ID() !== EEM_Registration::status_id_not_approved
335 335
 				&& $registration->ticket()->is_free()
336 336
 			) {
337
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
337
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
338 338
 			}
339 339
 		}
340 340
 		$subsections = array();
341 341
 		// now decide which template to load
342
-		if ( ! empty( $sold_out_events ) ) {
343
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
342
+		if ( ! empty($sold_out_events)) {
343
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
344 344
 		}
345
-		if ( ! empty( $insufficient_spaces_available ) ) {
345
+		if ( ! empty($insufficient_spaces_available)) {
346 346
 			$subsections['insufficient_space'] = $this->_insufficient_spaces_available(
347 347
 				$insufficient_spaces_available
348 348
 			);
349 349
 		}
350
-		if ( ! empty( $registrations_requiring_pre_approval ) ) {
350
+		if ( ! empty($registrations_requiring_pre_approval)) {
351 351
 			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval(
352 352
 				$registrations_requiring_pre_approval
353 353
 			);
354 354
 		}
355
-		if ( ! empty( $registrations_for_free_events ) ) {
356
-			$subsections['no_payment_required'] = $this->_no_payment_required( $registrations_for_free_events );
355
+		if ( ! empty($registrations_for_free_events)) {
356
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
357 357
 		}
358
-		if ( ! empty( $registrations_requiring_payment ) ) {
359
-			if ( $this->checkout->amount_owing > 0 ) {
358
+		if ( ! empty($registrations_requiring_payment)) {
359
+			if ($this->checkout->amount_owing > 0) {
360 360
 				// autoload Line_Item_Display classes
361 361
 				EEH_Autoloader::register_line_item_filter_autoloaders();
362 362
 				$line_item_filter_processor = new EE_Line_Item_Filter_Processor(
@@ -369,15 +369,15 @@  discard block
 block discarded – undo
369 369
 				/** @var EE_Line_Item $filtered_line_item_tree */
370 370
 				$filtered_line_item_tree = $line_item_filter_processor->process();
371 371
 				EEH_Autoloader::register_line_item_display_autoloaders();
372
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
372
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
373 373
 				$subsections['payment_options'] = $this->_display_payment_options(
374 374
 					$this->line_item_display->display_line_item(
375 375
 						$filtered_line_item_tree,
376
-						array( 'registrations' => $registrations )
376
+						array('registrations' => $registrations)
377 377
 					)
378 378
 				);
379 379
 				$this->checkout->amount_owing = $filtered_line_item_tree->total();
380
-				$this->_apply_registration_payments_to_amount_owing( $registrations );
380
+				$this->_apply_registration_payments_to_amount_owing($registrations);
381 381
 			}
382 382
 		} else {
383 383
 			$this->_hide_reg_step_submit_button_if_revisit();
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	 * @return \EE_Line_Item_Filter_Collection
409 409
 	 * @throws \EE_Error
410 410
 	 */
411
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
411
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
412 412
 		$line_item_filter_collection->add(
413 413
 			new EE_Billable_Line_Item_Filter(
414 414
 				EE_SPCO_Reg_Step_Payment_Options::remove_ejected_registrations(
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 				)
419 419
 			)
420 420
 		);
421
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
421
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
422 422
 		return $line_item_filter_collection;
423 423
 	}
424 424
 
@@ -434,15 +434,15 @@  discard block
 block discarded – undo
434 434
 	 * @return \EE_Registration[]
435 435
 	 * @throws \EE_Error
436 436
 	 */
437
-	public static function remove_ejected_registrations( array $registrations ) {
437
+	public static function remove_ejected_registrations(array $registrations) {
438 438
 		$ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space(
439 439
 			$registrations,
440 440
 			EE_Registry::instance()->SSN->checkout()->revisit
441 441
 		);
442
-		foreach ( $registrations as $REG_ID => $registration ) {
442
+		foreach ($registrations as $REG_ID => $registration) {
443 443
 			// has this registration lost it's space ?
444
-			if ( isset( $ejected_registrations[ $REG_ID ] ) ) {
445
-				unset( $registrations[ $REG_ID ] );
444
+			if (isset($ejected_registrations[$REG_ID])) {
445
+				unset($registrations[$REG_ID]);
446 446
 				continue;
447 447
 			}
448 448
 		}
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	 * @return array
466 466
 	 * @throws \EE_Error
467 467
 	 */
468
-	public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) {
468
+	public static function find_registrations_that_lost_their_space(array $registrations, $revisit = false) {
469 469
         // registrations per event
470 470
 		$event_reg_count = array();
471 471
 		// spaces left per event
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
         $tickets_remaining = array();
475 475
         // registrations that have lost their space
476 476
 		$ejected_registrations = array();
477
-		foreach ( $registrations as $REG_ID => $registration ) {
478
-			if ( $registration->status_ID() === EEM_Registration::status_id_approved ) {
477
+		foreach ($registrations as $REG_ID => $registration) {
478
+			if ($registration->status_ID() === EEM_Registration::status_id_approved) {
479 479
 				continue;
480 480
 			}
481 481
 			$EVT_ID = $registration->event_ID();
@@ -496,13 +496,13 @@  discard block
 block discarded – undo
496 496
 				$revisit
497 497
 				&& (
498 498
                     $tickets_remaining[$ticket->ID()] === 0
499
-				    || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
499
+				    || $event_reg_count[$EVT_ID] > $event_spaces_remaining[$EVT_ID]
500 500
                 )
501 501
 			) {
502
-				$ejected_registrations[ $REG_ID ] = $registration->event();
503
-				if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) {
502
+				$ejected_registrations[$REG_ID] = $registration->event();
503
+				if ($registration->status_ID() !== EEM_Registration::status_id_wait_list) {
504 504
 					/** @type EE_Registration_Processor $registration_processor */
505
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
505
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
506 506
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
507 507
 					$registration_processor->manually_update_registration_status(
508 508
 						$registration,
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
 	 * @return void
538 538
 	 */
539 539
 	protected function _hide_reg_step_submit_button_if_revisit() {
540
-		if ( $this->checkout->revisit ) {
541
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
540
+		if ($this->checkout->revisit) {
541
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
542 542
 		}
543 543
 	}
544 544
 
@@ -552,13 +552,13 @@  discard block
 block discarded – undo
552 552
 	 * @return \EE_Form_Section_Proper
553 553
 	 * @throws \EE_Error
554 554
 	 */
555
-	private function _sold_out_events( $sold_out_events_array = array() ) {
555
+	private function _sold_out_events($sold_out_events_array = array()) {
556 556
 		// set some defaults
557 557
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
558 558
 		$sold_out_events = '';
559
-		foreach ( $sold_out_events_array as $sold_out_event ) {
559
+		foreach ($sold_out_events_array as $sold_out_event) {
560 560
 			$sold_out_events .= EEH_HTML::li(
561
-				EEH_HTML::span( '  ' .$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )
561
+				EEH_HTML::span('  '.$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')
562 562
 			);
563 563
 		}
564 564
 		return new EE_Form_Section_Proper(
@@ -605,14 +605,14 @@  discard block
 block discarded – undo
605 605
 	 * @return \EE_Form_Section_Proper
606 606
 	 * @throws \EE_Error
607 607
 	 */
608
-	private function _insufficient_spaces_available( $insufficient_spaces_events_array = array() ) {
608
+	private function _insufficient_spaces_available($insufficient_spaces_events_array = array()) {
609 609
 		// set some defaults
610 610
 		$this->checkout->selected_method_of_payment = 'invoice';
611 611
 		$insufficient_space_events = '';
612
-		foreach ( $insufficient_spaces_events_array as $event ) {
613
-			if ( $event instanceof EE_Event ) {
612
+		foreach ($insufficient_spaces_events_array as $event) {
613
+			if ($event instanceof EE_Event) {
614 614
 				$insufficient_space_events .= EEH_HTML::li(
615
-					EEH_HTML::span( ' ' . $event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )
615
+					EEH_HTML::span(' '.$event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')
616 616
 				);
617 617
 			}
618 618
 		}
@@ -656,17 +656,17 @@  discard block
 block discarded – undo
656 656
 	 * @return \EE_Form_Section_Proper
657 657
 	 * @throws \EE_Error
658 658
 	 */
659
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array() ) {
659
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
660 660
 		$events_requiring_pre_approval = '';
661
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
662
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
663
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
661
+		foreach ($registrations_requiring_pre_approval as $registration) {
662
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
663
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
664 664
 					EEH_HTML::span(
665 665
 						'',
666 666
 						'',
667 667
 						'dashicons dashicons-marker ee-icon-size-16 orange-text'
668 668
 					)
669
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
669
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
670 670
 				);
671 671
 			}
672 672
 		}
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 						'template_args'        => apply_filters(
686 686
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
687 687
 							array(
688
-								'events_requiring_pre_approval'     => implode( '', $events_requiring_pre_approval ),
688
+								'events_requiring_pre_approval'     => implode('', $events_requiring_pre_approval),
689 689
 								'events_requiring_pre_approval_msg' => apply_filters(
690 690
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
691 691
 									__(
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 	 * @return \EE_Form_Section_Proper
711 711
 	 * @throws \EE_Error
712 712
 	 */
713
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
713
+	private function _no_payment_required($registrations_for_free_events = array()) {
714 714
 		// set some defaults
715 715
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
716 716
 		// generate no_payment_required form
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 								'ticket_count'                  => array(),
735 735
 								'registrations_for_free_events' => $registrations_for_free_events,
736 736
 								'no_payment_required_msg'       => EEH_HTML::p(
737
-									__( 'This is a free event, so no billing will occur.', 'event_espresso' )
737
+									__('This is a free event, so no billing will occur.', 'event_espresso')
738 738
 								)
739 739
 							)
740 740
 						),
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 	 * @return \EE_Form_Section_Proper
754 754
 	 * @throws \EE_Error
755 755
 	 */
756
-	private function _display_payment_options( $transaction_details = '' ) {
756
+	private function _display_payment_options($transaction_details = '') {
757 757
 		// has method_of_payment been set by no-js user?
758 758
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
759 759
 		// build payment options form
@@ -765,18 +765,18 @@  discard block
 block discarded – undo
765 765
 						'before_payment_options' => apply_filters(
766 766
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
767 767
 							new EE_Form_Section_Proper(
768
-								array( 'layout_strategy' => new EE_Div_Per_Section_Layout() )
768
+								array('layout_strategy' => new EE_Div_Per_Section_Layout())
769 769
 							)
770 770
 						),
771 771
 						'payment_options'        => $this->_setup_payment_options(),
772 772
 						'after_payment_options'  => apply_filters(
773 773
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
774 774
 							new EE_Form_Section_Proper(
775
-								array( 'layout_strategy' => new EE_Div_Per_Section_Layout() )
775
+								array('layout_strategy' => new EE_Div_Per_Section_Layout())
776 776
 							)
777 777
 						),
778 778
 						'default_hidden_inputs'  => $this->reg_step_hidden_inputs(),
779
-						'extra_hidden_inputs'    => $this->_extra_hidden_inputs( false )
779
+						'extra_hidden_inputs'    => $this->_extra_hidden_inputs(false)
780 780
 					),
781 781
 					'layout_strategy' => new EE_Template_Layout(
782 782
 						array(
@@ -805,10 +805,10 @@  discard block
 block discarded – undo
805 805
 	 * @return \EE_Form_Section_Proper
806 806
 	 * @throws \EE_Error
807 807
 	 */
808
-	private function _extra_hidden_inputs( $no_payment_required = true ) {
808
+	private function _extra_hidden_inputs($no_payment_required = true) {
809 809
 		return new EE_Form_Section_Proper(
810 810
 			array(
811
-				'html_id'         => 'ee-' . $this->slug() . '-extra-hidden-inputs',
811
+				'html_id'         => 'ee-'.$this->slug().'-extra-hidden-inputs',
812 812
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
813 813
 				'subsections'     => array(
814 814
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -840,16 +840,16 @@  discard block
 block discarded – undo
840 840
 	 * @access protected
841 841
 	 * @param array $registrations
842 842
 	 */
843
-	protected function _apply_registration_payments_to_amount_owing( array $registrations ) {
843
+	protected function _apply_registration_payments_to_amount_owing(array $registrations) {
844 844
 		$payments = array();
845
-		foreach ( $registrations as $registration ) {
846
-			if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
845
+		foreach ($registrations as $registration) {
846
+			if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
847 847
 				$payments += $registration->registration_payments();
848 848
 			}
849 849
 		}
850
-		if ( ! empty( $payments ) ) {
851
-			foreach ( $payments as $payment ) {
852
-				if ( $payment instanceof EE_Registration_Payment ) {
850
+		if ( ! empty($payments)) {
851
+			foreach ($payments as $payment) {
852
+				if ($payment instanceof EE_Registration_Payment) {
853 853
 					$this->checkout->amount_owing -= $payment->amount();
854 854
 				}
855 855
 			}
@@ -865,11 +865,11 @@  discard block
 block discarded – undo
865 865
 	 * @param    bool $force_reset
866 866
 	 * @return    void
867 867
 	 */
868
-	private function _reset_selected_method_of_payment( $force_reset = false ) {
868
+	private function _reset_selected_method_of_payment($force_reset = false) {
869 869
 		$reset_payment_method = $force_reset
870 870
 			? true
871
-			: sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', false ) );
872
-		if ( $reset_payment_method ) {
871
+			: sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', false));
872
+		if ($reset_payment_method) {
873 873
 			$this->checkout->selected_method_of_payment = null;
874 874
 			$this->checkout->payment_method = null;
875 875
 			$this->checkout->billing_form = null;
@@ -888,12 +888,12 @@  discard block
 block discarded – undo
888 888
 	 * @param string $selected_method_of_payment
889 889
 	 * @return  void
890 890
 	 */
891
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
892
-		$selected_method_of_payment = ! empty( $selected_method_of_payment )
891
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
892
+		$selected_method_of_payment = ! empty($selected_method_of_payment)
893 893
 			? $selected_method_of_payment
894 894
 			: $this->checkout->selected_method_of_payment;
895 895
 		EE_Registry::instance()->SSN->set_session_data(
896
-			array( 'selected_method_of_payment' => $selected_method_of_payment )
896
+			array('selected_method_of_payment' => $selected_method_of_payment)
897 897
 		);
898 898
 	}
899 899
 
@@ -909,19 +909,19 @@  discard block
 block discarded – undo
909 909
 		// load payment method classes
910 910
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
911 911
 		// switch up header depending on number of available payment methods
912
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
912
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
913 913
 			? apply_filters(
914 914
 				'FHEE__registration_page_payment_options__method_of_payment_hdr',
915
-				__( 'Please Select Your Method of Payment', 'event_espresso' )
915
+				__('Please Select Your Method of Payment', 'event_espresso')
916 916
 			)
917 917
 			: apply_filters(
918 918
 				'FHEE__registration_page_payment_options__method_of_payment_hdr',
919
-				__( 'Method of Payment', 'event_espresso' )
919
+				__('Method of Payment', 'event_espresso')
920 920
 			);
921 921
 		$available_payment_methods = array(
922 922
 			// display the "Payment Method" header
923 923
 			'payment_method_header' => new EE_Form_Section_HTML(
924
-				EEH_HTML::h4( $payment_method_header, 'method-of-payment-hdr' )
924
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
925 925
 			)
926 926
 		);
927 927
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
@@ -930,32 +930,32 @@  discard block
 block discarded – undo
930 930
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
931 931
 		$payment_methods_billing_info = array(
932 932
 			new EE_Form_Section_HTML(
933
-				EEH_HTML::div( '<br />', '', '', 'clear:both;' )
933
+				EEH_HTML::div('<br />', '', '', 'clear:both;')
934 934
 			)
935 935
 		);
936 936
 		// loop through payment methods
937
-		foreach ( $this->checkout->available_payment_methods as $payment_method ) {
938
-			if ( $payment_method instanceof EE_Payment_Method ) {
937
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
938
+			if ($payment_method instanceof EE_Payment_Method) {
939 939
 				$payment_method_button = EEH_HTML::img(
940 940
 					$payment_method->button_url(),
941 941
 					$payment_method->name(),
942
-					'spco-payment-method-' . $payment_method->slug() . '-btn-img',
942
+					'spco-payment-method-'.$payment_method->slug().'-btn-img',
943 943
 					'spco-payment-method-btn-img'
944 944
 				);
945 945
 				// check if any payment methods are set as default
946 946
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
947 947
 				if (
948
-					( $this->checkout->selected_method_of_payment === $payment_method->slug() )
949
-					|| ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )
948
+					($this->checkout->selected_method_of_payment === $payment_method->slug())
949
+					|| ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())
950 950
 				) {
951 951
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
952 952
 					$this->_save_selected_method_of_payment();
953
-					$default_payment_method_option[ $payment_method->slug() ] = $payment_method_button;
953
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
954 954
 				} else {
955
-					$available_payment_method_options[ $payment_method->slug() ] = $payment_method_button;
955
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
956 956
 				}
957
-				$payment_methods_billing_info[ $payment_method->slug()
958
-				                               . '-info' ] = $this->_payment_method_billing_info(
957
+				$payment_methods_billing_info[$payment_method->slug()
958
+				                               . '-info'] = $this->_payment_method_billing_info(
959 959
 					$payment_method
960 960
 				);
961 961
 			}
@@ -985,12 +985,12 @@  discard block
 block discarded – undo
985 985
 	 * @return EE_Payment_Method[]
986 986
 	 */
987 987
 	protected function _get_available_payment_methods() {
988
-		if ( ! empty( $this->checkout->available_payment_methods ) ) {
988
+		if ( ! empty($this->checkout->available_payment_methods)) {
989 989
 			return $this->checkout->available_payment_methods;
990 990
 		}
991 991
 		$available_payment_methods = array();
992 992
 		// load EEM_Payment_Method
993
-		EE_Registry::instance()->load_model( 'Payment_Method' );
993
+		EE_Registry::instance()->load_model('Payment_Method');
994 994
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
995 995
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
996 996
 		// get all active payment methods
@@ -998,9 +998,9 @@  discard block
 block discarded – undo
998 998
 			$this->checkout->transaction,
999 999
 			EEM_Payment_Method::scope_cart
1000 1000
 		);
1001
-		foreach ( $payment_methods as $payment_method ) {
1002
-			if ( $payment_method instanceof EE_Payment_Method ) {
1003
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
1001
+		foreach ($payment_methods as $payment_method) {
1002
+			if ($payment_method instanceof EE_Payment_Method) {
1003
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
1004 1004
 			}
1005 1005
 		}
1006 1006
 		return $available_payment_methods;
@@ -1015,14 +1015,14 @@  discard block
 block discarded – undo
1015 1015
 	 * @param    array $available_payment_method_options
1016 1016
 	 * @return    \EE_Form_Section_Proper
1017 1017
 	 */
1018
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
1018
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
1019 1019
 		// generate inputs
1020 1020
 		return new EE_Form_Section_Proper(
1021 1021
 			array(
1022 1022
 				'html_id'         => 'ee-available-payment-method-inputs',
1023 1023
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
1024 1024
 				'subsections'     => array(
1025
-					'' => new EE_Radio_Button_Input (
1025
+					'' => new EE_Radio_Button_Input(
1026 1026
 						$available_payment_method_options,
1027 1027
 						array(
1028 1028
 							'html_name'          => 'selected_method_of_payment',
@@ -1047,28 +1047,28 @@  discard block
 block discarded – undo
1047 1047
 	 * @return    \EE_Form_Section_Proper
1048 1048
 	 * @throws \EE_Error
1049 1049
 	 */
1050
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
1050
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
1051 1051
 		$currently_selected = $this->checkout->selected_method_of_payment === $payment_method->slug()
1052 1052
 			? true
1053 1053
 			: false;
1054 1054
 		// generate the billing form for payment method
1055 1055
 		$billing_form = $currently_selected
1056
-			? $this->_get_billing_form_for_payment_method( $payment_method )
1056
+			? $this->_get_billing_form_for_payment_method($payment_method)
1057 1057
 			: new EE_Form_Section_HTML();
1058 1058
 		$this->checkout->billing_form = $currently_selected
1059 1059
 			? $billing_form
1060 1060
 			: $this->checkout->billing_form;
1061 1061
 		// it's all in the details
1062 1062
 		$info_html = EEH_HTML::h3(
1063
-			__( 'Important information regarding your payment', 'event_espresso' ),
1063
+			__('Important information regarding your payment', 'event_espresso'),
1064 1064
 			'',
1065 1065
 			'spco-payment-method-hdr'
1066 1066
 		);
1067 1067
 		// add some info regarding the step, either from what's saved in the admin,
1068 1068
 		// or a default string depending on whether the PM has a billing form or not
1069
-		if ( $payment_method->description() ) {
1069
+		if ($payment_method->description()) {
1070 1070
 			$payment_method_info = $payment_method->description();
1071
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
1071
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
1072 1072
 			$payment_method_info = sprintf(
1073 1073
 				__(
1074 1074
 					'Please provide the following billing information, then click the "%1$s" button below in order to proceed.',
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 			);
1079 1079
 		} else {
1080 1080
 			$payment_method_info = sprintf(
1081
-				__( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ),
1081
+				__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'),
1082 1082
 				$this->submit_button_text()
1083 1083
 			);
1084 1084
 		}
@@ -1092,13 +1092,13 @@  discard block
 block discarded – undo
1092 1092
 		);
1093 1093
 		return new EE_Form_Section_Proper(
1094 1094
 			array(
1095
-				'html_id'         => 'spco-payment-method-info-' . $payment_method->slug(),
1095
+				'html_id'         => 'spco-payment-method-info-'.$payment_method->slug(),
1096 1096
 				'html_class'      => 'spco-payment-method-info-dv',
1097 1097
 				// only display the selected or default PM
1098 1098
 				'html_style'      => $currently_selected ? '' : 'display:none;',
1099 1099
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
1100 1100
 				'subsections'     => array(
1101
-					'info'         => new EE_Form_Section_HTML( $info_html ),
1101
+					'info'         => new EE_Form_Section_HTML($info_html),
1102 1102
 					'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML()
1103 1103
 				)
1104 1104
 			)
@@ -1116,15 +1116,15 @@  discard block
 block discarded – undo
1116 1116
 	 */
1117 1117
 	public function get_billing_form_html_for_payment_method() {
1118 1118
 		// how have they chosen to pay?
1119
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1119
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1120 1120
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
1121
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
1121
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
1122 1122
 			return false;
1123 1123
 		}
1124
-		if ( apply_filters(
1124
+		if (apply_filters(
1125 1125
 			'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1126 1126
 			false
1127
-		) ) {
1127
+		)) {
1128 1128
 			EE_Error::add_success(
1129 1129
 				apply_filters(
1130 1130
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 			);
1140 1140
 		}
1141 1141
 		// now generate billing form for selected method of payment
1142
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1142
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1143 1143
 		// fill form with attendee info if applicable
1144 1144
 		if (
1145 1145
 			$payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form
@@ -1161,10 +1161,10 @@  discard block
 block discarded – undo
1161 1161
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper
1162 1162
 			? $payment_method_billing_form->get_html()
1163 1163
 			: '';
1164
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ) );
1164
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
1165 1165
 		// localize validation rules for main form
1166 1166
 		$this->checkout->current_step->reg_form->localize_validation_rules();
1167
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
1167
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
1168 1168
 		return true;
1169 1169
 	}
1170 1170
 
@@ -1178,18 +1178,18 @@  discard block
 block discarded – undo
1178 1178
 	 * @return \EE_Billing_Info_Form|\EE_Form_Section_HTML
1179 1179
 	 * @throws \EE_Error
1180 1180
 	 */
1181
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
1181
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
1182 1182
 		$billing_form = $payment_method->type_obj()->billing_form(
1183 1183
 			$this->checkout->transaction,
1184
-			array( 'amount_owing' => $this->checkout->amount_owing )
1184
+			array('amount_owing' => $this->checkout->amount_owing)
1185 1185
 		);
1186
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
1186
+		if ($billing_form instanceof EE_Billing_Info_Form) {
1187 1187
 			if (
1188 1188
 				apply_filters(
1189 1189
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1190 1190
 					false
1191 1191
 				)
1192
-				&& EE_Registry::instance()->REQ->is_set( 'payment_method' )
1192
+				&& EE_Registry::instance()->REQ->is_set('payment_method')
1193 1193
 			) {
1194 1194
 				EE_Error::add_success(
1195 1195
 					apply_filters(
@@ -1231,15 +1231,15 @@  discard block
 block discarded – undo
1231 1231
 		$request_param = 'selected_method_of_payment'
1232 1232
 	) {
1233 1233
 		// is selected_method_of_payment set in the request ?
1234
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, false );
1235
-		if ( $selected_method_of_payment ) {
1234
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, false);
1235
+		if ($selected_method_of_payment) {
1236 1236
 			// sanitize it
1237
-			$selected_method_of_payment = is_array( $selected_method_of_payment )
1238
-				? array_shift( $selected_method_of_payment )
1237
+			$selected_method_of_payment = is_array($selected_method_of_payment)
1238
+				? array_shift($selected_method_of_payment)
1239 1239
 				: $selected_method_of_payment;
1240
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
1240
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
1241 1241
 			// store it in the session so that it's available for all subsequent requests including AJAX
1242
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
1242
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
1243 1243
 		} else {
1244 1244
 			// or is is set in the session ?
1245 1245
 			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data(
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
 			);
1248 1248
 		}
1249 1249
 		// do ya really really gotta have it?
1250
-		if ( empty( $selected_method_of_payment ) && $required ) {
1250
+		if (empty($selected_method_of_payment) && $required) {
1251 1251
 			EE_Error::add_error(
1252 1252
 				sprintf(
1253 1253
 					__(
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
 					),
1257 1257
 					'<br/>',
1258 1258
 					'<br/>',
1259
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1259
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1260 1260
 				),
1261 1261
 				__FILE__,
1262 1262
 				__FUNCTION__,
@@ -1283,13 +1283,13 @@  discard block
 block discarded – undo
1283 1283
 	 * @throws \EE_Error
1284 1284
 	 */
1285 1285
 	public function switch_payment_method() {
1286
-		if ( ! $this->_verify_payment_method_is_set() ) {
1286
+		if ( ! $this->_verify_payment_method_is_set()) {
1287 1287
 			return false;
1288 1288
 		}
1289
-		if ( apply_filters(
1289
+		if (apply_filters(
1290 1290
 			'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1291 1291
 			false
1292
-		) ) {
1292
+		)) {
1293 1293
 			EE_Error::add_success(
1294 1294
 				apply_filters(
1295 1295
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 			);
1305 1305
 		}
1306 1306
 		// generate billing form for selected method of payment if it hasn't been done already
1307
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1307
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
1308 1308
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1309 1309
 				$this->checkout->payment_method
1310 1310
 			);
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
 			);
1327 1327
 		}
1328 1328
 		// and debug content
1329
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form
1329
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form
1330 1330
 		     && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1331 1331
 		) {
1332 1332
 			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
@@ -1334,15 +1334,15 @@  discard block
 block discarded – undo
1334 1334
 			);
1335 1335
 		}
1336 1336
 		// get html and validation rules for form
1337
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
1337
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
1338 1338
 			$this->checkout->json_response->set_return_data(
1339
-				array( 'payment_method_info' => $this->checkout->billing_form->get_html() )
1339
+				array('payment_method_info' => $this->checkout->billing_form->get_html())
1340 1340
 			);
1341 1341
 			// localize validation rules for main form
1342
-			$this->checkout->billing_form->localize_validation_rules( true );
1343
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
1342
+			$this->checkout->billing_form->localize_validation_rules(true);
1343
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
1344 1344
 		} else {
1345
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ) );
1345
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
1346 1346
 		}
1347 1347
 		//prevents advancement to next step
1348 1348
 		$this->checkout->continue_reg = false;
@@ -1359,12 +1359,12 @@  discard block
 block discarded – undo
1359 1359
 	 */
1360 1360
 	protected function _verify_payment_method_is_set() {
1361 1361
 		// generate billing form for selected method of payment if it hasn't been done already
1362
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1362
+		if (empty($this->checkout->selected_method_of_payment)) {
1363 1363
 			// how have they chosen to pay?
1364
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1364
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1365 1365
 		}
1366 1366
 		// verify payment method
1367
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
1367
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
1368 1368
 			// get payment method for selected method of payment
1369 1369
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
1370 1370
 		}
@@ -1383,25 +1383,25 @@  discard block
 block discarded – undo
1383 1383
 	 * @throws \EE_Error
1384 1384
 	 */
1385 1385
 	public function save_payer_details_via_ajax() {
1386
-		if ( ! $this->_verify_payment_method_is_set() ) {
1386
+		if ( ! $this->_verify_payment_method_is_set()) {
1387 1387
 			return;
1388 1388
 		}
1389 1389
 		// generate billing form for selected method of payment if it hasn't been done already
1390
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1390
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
1391 1391
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1392 1392
 				$this->checkout->payment_method
1393 1393
 			);
1394 1394
 		}
1395 1395
 		// generate primary attendee from payer info if applicable
1396
-		if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1396
+		if ( ! $this->checkout->transaction_has_primary_registrant()) {
1397 1397
 			$attendee = $this->_create_attendee_from_request_data();
1398
-			if ( $attendee instanceof EE_Attendee ) {
1399
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
1400
-					if ( $registration->is_primary_registrant() ) {
1398
+			if ($attendee instanceof EE_Attendee) {
1399
+				foreach ($this->checkout->transaction->registrations() as $registration) {
1400
+					if ($registration->is_primary_registrant()) {
1401 1401
 						$this->checkout->primary_attendee_obj = $attendee;
1402
-						$registration->_add_relation_to( $attendee, 'Attendee' );
1403
-						$registration->set_attendee_id( $attendee->ID() );
1404
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
1402
+						$registration->_add_relation_to($attendee, 'Attendee');
1403
+						$registration->set_attendee_id($attendee->ID());
1404
+						$registration->update_cache_after_object_save('Attendee', $attendee);
1405 1405
 					}
1406 1406
 				}
1407 1407
 			}
@@ -1419,50 +1419,50 @@  discard block
 block discarded – undo
1419 1419
 	 */
1420 1420
 	protected function _create_attendee_from_request_data() {
1421 1421
 		// get State ID
1422
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
1423
-		if ( ! empty( $STA_ID ) ) {
1422
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
1423
+		if ( ! empty($STA_ID)) {
1424 1424
 			// can we get state object from name ?
1425
-			EE_Registry::instance()->load_model( 'State' );
1426
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1 ), 'STA_ID' );
1427
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
1425
+			EE_Registry::instance()->load_model('State');
1426
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
1427
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
1428 1428
 		}
1429 1429
 		// get Country ISO
1430
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
1431
-		if ( ! empty( $CNT_ISO ) ) {
1430
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
1431
+		if ( ! empty($CNT_ISO)) {
1432 1432
 			// can we get country object from name ?
1433
-			EE_Registry::instance()->load_model( 'Country' );
1433
+			EE_Registry::instance()->load_model('Country');
1434 1434
 			$country = EEM_Country::instance()->get_col(
1435
-				array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1 ),
1435
+				array(array('CNT_name' => $CNT_ISO), 'limit' => 1),
1436 1436
 				'CNT_ISO'
1437 1437
 			);
1438
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
1438
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
1439 1439
 		}
1440 1440
 		// grab attendee data
1441 1441
 		$attendee_data = array(
1442
-			'ATT_fname'    => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
1443
-			'ATT_lname'    => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
1444
-			'ATT_email'    => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1445
-			'ATT_address'  => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1446
-			'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1447
-			'ATT_city'     => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
1442
+			'ATT_fname'    => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
1443
+			'ATT_lname'    => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
1444
+			'ATT_email'    => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1445
+			'ATT_address'  => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1446
+			'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1447
+			'ATT_city'     => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1448 1448
 			'STA_ID'       => $STA_ID,
1449 1449
 			'CNT_ISO'      => $CNT_ISO,
1450
-			'ATT_zip'      => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1451
-			'ATT_phone'    => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1450
+			'ATT_zip'      => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1451
+			'ATT_phone'    => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1452 1452
 		);
1453 1453
 		// validate the email address since it is the most important piece of info
1454
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] !== $_REQUEST['email'] ) {
1454
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] !== $_REQUEST['email']) {
1455 1455
 			EE_Error::add_error(
1456
-				__( 'An invalid email address was submitted.', 'event_espresso' ),
1456
+				__('An invalid email address was submitted.', 'event_espresso'),
1457 1457
 				__FILE__,
1458 1458
 				__FUNCTION__,
1459 1459
 				__LINE__
1460 1460
 			);
1461 1461
 		}
1462 1462
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1463
-		if ( ! empty( $attendee_data['ATT_fname'] )
1464
-		     && ! empty( $attendee_data['ATT_lname'] )
1465
-		     && ! empty( $attendee_data['ATT_email'] )
1463
+		if ( ! empty($attendee_data['ATT_fname'])
1464
+		     && ! empty($attendee_data['ATT_lname'])
1465
+		     && ! empty($attendee_data['ATT_email'])
1466 1466
 		) {
1467 1467
 			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(
1468 1468
 				array(
@@ -1471,19 +1471,19 @@  discard block
 block discarded – undo
1471 1471
 					'ATT_email' => $attendee_data['ATT_email']
1472 1472
 				)
1473 1473
 			);
1474
-			if ( $existing_attendee instanceof EE_Attendee ) {
1474
+			if ($existing_attendee instanceof EE_Attendee) {
1475 1475
 				return $existing_attendee;
1476 1476
 			}
1477 1477
 		}
1478 1478
 		// no existing attendee? kk let's create a new one
1479 1479
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1480
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] )
1480
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname'])
1481 1481
 			? $attendee_data['ATT_fname']
1482 1482
 			: $attendee_data['ATT_email'];
1483
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] )
1483
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname'])
1484 1484
 			? $attendee_data['ATT_lname']
1485 1485
 			: $attendee_data['ATT_email'];
1486
-		return EE_Attendee::new_instance( $attendee_data );
1486
+		return EE_Attendee::new_instance($attendee_data);
1487 1487
 	}
1488 1488
 
1489 1489
 
@@ -1501,26 +1501,26 @@  discard block
 block discarded – undo
1501 1501
 		// how have they chosen to pay?
1502 1502
 		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free()
1503 1503
 			? 'no_payment_required'
1504
-			: $this->_get_selected_method_of_payment( true );
1504
+			: $this->_get_selected_method_of_payment(true);
1505 1505
 		// choose your own adventure based on method_of_payment
1506
-		switch ( $this->checkout->selected_method_of_payment ) {
1506
+		switch ($this->checkout->selected_method_of_payment) {
1507 1507
 
1508 1508
 			case 'events_sold_out' :
1509 1509
 				$this->checkout->redirect = true;
1510 1510
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1511
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1511
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1512 1512
 				// mark this reg step as completed
1513 1513
 				$this->set_completed();
1514 1514
 				return false;
1515 1515
 				break;
1516 1516
 
1517 1517
 			case 'payments_closed' :
1518
-				if ( apply_filters(
1518
+				if (apply_filters(
1519 1519
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success',
1520 1520
 					false
1521
-				) ) {
1521
+				)) {
1522 1522
 					EE_Error::add_success(
1523
-						__( 'no payment required at this time.', 'event_espresso' ),
1523
+						__('no payment required at this time.', 'event_espresso'),
1524 1524
 						__FILE__,
1525 1525
 						__FUNCTION__,
1526 1526
 						__LINE__
@@ -1532,12 +1532,12 @@  discard block
 block discarded – undo
1532 1532
 				break;
1533 1533
 
1534 1534
 			case 'no_payment_required' :
1535
-				if ( apply_filters(
1535
+				if (apply_filters(
1536 1536
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success',
1537 1537
 					false
1538
-				) ) {
1538
+				)) {
1539 1539
 					EE_Error::add_success(
1540
-						__( 'no payment required.', 'event_espresso' ),
1540
+						__('no payment required.', 'event_espresso'),
1541 1541
 						__FILE__,
1542 1542
 						__FUNCTION__,
1543 1543
 						__LINE__
@@ -1557,15 +1557,15 @@  discard block
 block discarded – undo
1557 1557
 					EE_Registry::instance()->SSN->checkout()->revisit
1558 1558
 				);
1559 1559
 				// calculate difference between the two arrays
1560
-				$registrations = array_diff( $registrations, $ejected_registrations );
1561
-				if ( empty( $registrations ) ) {
1560
+				$registrations = array_diff($registrations, $ejected_registrations);
1561
+				if (empty($registrations)) {
1562 1562
 					$this->_redirect_because_event_sold_out();
1563 1563
 					return false;
1564 1564
 				}
1565 1565
 				$payment_successful = $this->_process_payment();
1566
-				if ( $payment_successful ) {
1566
+				if ($payment_successful) {
1567 1567
 					$this->checkout->continue_reg = true;
1568
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1568
+					$this->_maybe_set_completed($this->checkout->payment_method);
1569 1569
 				} else {
1570 1570
 					$this->checkout->continue_reg = false;
1571 1571
 				}
@@ -1586,10 +1586,10 @@  discard block
 block discarded – undo
1586 1586
 		$this->checkout->continue_reg = false;
1587 1587
 		// set redirect URL
1588 1588
 		$this->checkout->redirect_url = add_query_arg(
1589
-			array( 'e_reg_url_link' => $this->checkout->reg_url_link ),
1589
+			array('e_reg_url_link' => $this->checkout->reg_url_link),
1590 1590
 			$this->checkout->current_step->reg_step_url()
1591 1591
 		);
1592
-		$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1592
+		$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1593 1593
 	}
1594 1594
 
1595 1595
 
@@ -1602,8 +1602,8 @@  discard block
 block discarded – undo
1602 1602
 	 * @return void
1603 1603
 	 * @throws \EE_Error
1604 1604
 	 */
1605
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1606
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1605
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1606
+		switch ($payment_method->type_obj()->payment_occurs()) {
1607 1607
 			case EE_PMT_Base::offsite :
1608 1608
 				break;
1609 1609
 			case EE_PMT_Base::onsite :
@@ -1626,7 +1626,7 @@  discard block
 block discarded – undo
1626 1626
 	public function update_reg_step() {
1627 1627
 		$success = true;
1628 1628
 		// if payment required
1629
-		if ( $this->checkout->transaction->total() > 0 ) {
1629
+		if ($this->checkout->transaction->total() > 0) {
1630 1630
 			do_action(
1631 1631
 				'AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway',
1632 1632
 				$this->checkout->transaction
@@ -1634,13 +1634,13 @@  discard block
 block discarded – undo
1634 1634
 			// attempt payment via payment method
1635 1635
 			$success = $this->process_reg_step();
1636 1636
 		}
1637
-		if ( $success && ! $this->checkout->redirect ) {
1637
+		if ($success && ! $this->checkout->redirect) {
1638 1638
 			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn(
1639 1639
 				$this->checkout->transaction->ID()
1640 1640
 			);
1641 1641
 			// set return URL
1642 1642
 			$this->checkout->redirect_url = add_query_arg(
1643
-				array( 'e_reg_url_link' => $this->checkout->reg_url_link ),
1643
+				array('e_reg_url_link' => $this->checkout->reg_url_link),
1644 1644
 				$this->checkout->thank_you_page_url
1645 1645
 			);
1646 1646
 		}
@@ -1660,28 +1660,28 @@  discard block
 block discarded – undo
1660 1660
 		// clear any previous errors related to not selecting a payment method
1661 1661
 //		EE_Error::overwrite_errors();
1662 1662
 		// ya gotta make a choice man
1663
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1663
+		if (empty($this->checkout->selected_method_of_payment)) {
1664 1664
 			$this->checkout->json_response->set_plz_select_method_of_payment(
1665
-				__( 'Please select a method of payment before proceeding.', 'event_espresso' )
1665
+				__('Please select a method of payment before proceeding.', 'event_espresso')
1666 1666
 			);
1667 1667
 			return false;
1668 1668
 		}
1669 1669
 		// get EE_Payment_Method object
1670
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1670
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1671 1671
 			return false;
1672 1672
 		}
1673 1673
 		// setup billing form
1674
-		if ( $this->checkout->payment_method->is_on_site() ) {
1674
+		if ($this->checkout->payment_method->is_on_site()) {
1675 1675
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1676 1676
 				$this->checkout->payment_method
1677 1677
 			);
1678 1678
 			// bad billing form ?
1679
-			if ( ! $this->_billing_form_is_valid() ) {
1679
+			if ( ! $this->_billing_form_is_valid()) {
1680 1680
 				return false;
1681 1681
 			}
1682 1682
 		}
1683 1683
 		// ensure primary registrant has been fully processed
1684
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1684
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1685 1685
 			return false;
1686 1686
 		}
1687 1687
 		/** @type EE_Transaction_Processor $transaction_processor */
@@ -1689,12 +1689,12 @@  discard block
 block discarded – undo
1689 1689
 		// 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
1690 1690
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1691 1691
 		// attempt payment
1692
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1692
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1693 1693
 		// process results
1694
-		$payment = $this->_validate_payment( $payment );
1695
-		$payment = $this->_post_payment_processing( $payment );
1694
+		$payment = $this->_validate_payment($payment);
1695
+		$payment = $this->_post_payment_processing($payment);
1696 1696
 		// verify payment
1697
-		if ( $payment instanceof EE_Payment ) {
1697
+		if ($payment instanceof EE_Payment) {
1698 1698
 			// store that for later
1699 1699
 			$this->checkout->payment = $payment;
1700 1700
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
 			} else {
1709 1709
 				return false;
1710 1710
 			}
1711
-		} else if ( $payment === true ) {
1711
+		} else if ($payment === true) {
1712 1712
 			// please note that offline payment methods will NOT make a payment,
1713 1713
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1714 1714
 			$this->checkout->payment = $payment;
@@ -1733,7 +1733,7 @@  discard block
 block discarded – undo
1733 1733
 		);
1734 1734
 		$html = $payment_method_billing_info->get_html();
1735 1735
 		$html .= $this->checkout->redirect_form;
1736
-		EE_Registry::instance()->REQ->add_output( $html );
1736
+		EE_Registry::instance()->REQ->add_output($html);
1737 1737
 		return true;
1738 1738
 	}
1739 1739
 
@@ -1747,28 +1747,28 @@  discard block
 block discarded – undo
1747 1747
 	 * @throws \EE_Error
1748 1748
 	 */
1749 1749
 	private function _billing_form_is_valid() {
1750
-		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1750
+		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) {
1751 1751
 			return true;
1752 1752
 		}
1753
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1754
-			if ( $this->checkout->billing_form->was_submitted() ) {
1753
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1754
+			if ($this->checkout->billing_form->was_submitted()) {
1755 1755
 				$this->checkout->billing_form->receive_form_submission();
1756
-				if ( $this->checkout->billing_form->is_valid() ) {
1756
+				if ($this->checkout->billing_form->is_valid()) {
1757 1757
 					return true;
1758 1758
 				}
1759 1759
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1760 1760
 				$error_strings = array();
1761
-				foreach ( $validation_errors as $validation_error ) {
1762
-					if ( $validation_error instanceof EE_Validation_Error ) {
1761
+				foreach ($validation_errors as $validation_error) {
1762
+					if ($validation_error instanceof EE_Validation_Error) {
1763 1763
 						$form_section = $validation_error->get_form_section();
1764
-						if ( $form_section instanceof EE_Form_Input_Base ) {
1764
+						if ($form_section instanceof EE_Form_Input_Base) {
1765 1765
 							$label = $form_section->html_label_text();
1766
-						} elseif ( $form_section instanceof EE_Form_Section_Base ) {
1766
+						} elseif ($form_section instanceof EE_Form_Section_Base) {
1767 1767
 							$label = $form_section->name();
1768 1768
 						} else {
1769
-							$label = __( 'Validation Error', 'event_espresso' );
1769
+							$label = __('Validation Error', 'event_espresso');
1770 1770
 						}
1771
-						$error_strings[] = sprintf( '%1$s: %2$s', $label, $validation_error->getMessage() );
1771
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1772 1772
 					}
1773 1773
 				}
1774 1774
 				EE_Error::add_error(
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
 							'event_espresso'
1779 1779
 						),
1780 1780
 						'<br/>',
1781
-						implode( '<br/>', $error_strings )
1781
+						implode('<br/>', $error_strings)
1782 1782
 					),
1783 1783
 					__FILE__,
1784 1784
 					__FUNCTION__,
@@ -1797,7 +1797,7 @@  discard block
 block discarded – undo
1797 1797
 			}
1798 1798
 		} else {
1799 1799
 			EE_Error::add_error(
1800
-				__( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ),
1800
+				__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'),
1801 1801
 				__FILE__,
1802 1802
 				__FUNCTION__,
1803 1803
 				__LINE__
@@ -1836,7 +1836,7 @@  discard block
 block discarded – undo
1836 1836
 		// save the TXN ( which clears cached copy of primary_registration)
1837 1837
 		$this->checkout->transaction->save();
1838 1838
 		// grab TXN ID and save it to the primary_registration
1839
-		$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1839
+		$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1840 1840
 		// save what we have so far
1841 1841
 		$primary_registration->save();
1842 1842
 		return true;
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
 	private function _capture_primary_registration_data_from_billing_form() {
1855 1855
 		// convert billing form data into an attendee
1856 1856
 		$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1857
-		if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1857
+		if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1858 1858
 			EE_Error::add_error(
1859 1859
 				sprintf(
1860 1860
 					__(
@@ -1862,7 +1862,7 @@  discard block
 block discarded – undo
1862 1862
 						'event_espresso'
1863 1863
 					),
1864 1864
 					'<br/>',
1865
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1865
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1866 1866
 				),
1867 1867
 				__FILE__,
1868 1868
 				__FUNCTION__,
@@ -1871,7 +1871,7 @@  discard block
 block discarded – undo
1871 1871
 			return false;
1872 1872
 		}
1873 1873
 		$primary_registration = $this->checkout->transaction->primary_registration();
1874
-		if ( ! $primary_registration instanceof EE_Registration ) {
1874
+		if ( ! $primary_registration instanceof EE_Registration) {
1875 1875
 			EE_Error::add_error(
1876 1876
 				sprintf(
1877 1877
 					__(
@@ -1879,7 +1879,7 @@  discard block
 block discarded – undo
1879 1879
 						'event_espresso'
1880 1880
 					),
1881 1881
 					'<br/>',
1882
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1882
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1883 1883
 				),
1884 1884
 				__FILE__,
1885 1885
 				__FUNCTION__,
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
 			);
1888 1888
 			return false;
1889 1889
 		}
1890
-		if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' )
1890
+		if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee')
1891 1891
 		       instanceof
1892 1892
 		       EE_Attendee
1893 1893
 		) {
@@ -1898,7 +1898,7 @@  discard block
 block discarded – undo
1898 1898
 						'event_espresso'
1899 1899
 					),
1900 1900
 					'<br/>',
1901
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1901
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1902 1902
 				),
1903 1903
 				__FILE__,
1904 1904
 				__FUNCTION__,
@@ -1907,9 +1907,9 @@  discard block
 block discarded – undo
1907 1907
 			return false;
1908 1908
 		}
1909 1909
 		/** @type EE_Registration_Processor $registration_processor */
1910
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1910
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1911 1911
 		// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1912
-		$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1912
+		$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1913 1913
 		return true;
1914 1914
 	}
1915 1915
 
@@ -1924,22 +1924,22 @@  discard block
 block discarded – undo
1924 1924
 	 * @throws \EE_Error
1925 1925
 	 */
1926 1926
 	private function _get_payment_method_for_selected_method_of_payment() {
1927
-		if ( $this->checkout->selected_method_of_payment === 'events_sold_out' ) {
1927
+		if ($this->checkout->selected_method_of_payment === 'events_sold_out') {
1928 1928
 			$this->_redirect_because_event_sold_out();
1929 1929
 			return null;
1930 1930
 		}
1931 1931
 		// get EE_Payment_Method object
1932
-		if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] ) ) {
1933
-			$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1932
+		if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1933
+			$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1934 1934
 		} else {
1935 1935
 			// load EEM_Payment_Method
1936
-			EE_Registry::instance()->load_model( 'Payment_Method' );
1936
+			EE_Registry::instance()->load_model('Payment_Method');
1937 1937
 			/** @type EEM_Payment_Method $EEM_Payment_Method */
1938 1938
 			$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1939
-			$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1939
+			$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1940 1940
 		}
1941 1941
 		// verify $payment_method
1942
-		if ( ! $payment_method instanceof EE_Payment_Method ) {
1942
+		if ( ! $payment_method instanceof EE_Payment_Method) {
1943 1943
 			// not a payment
1944 1944
 			EE_Error::add_error(
1945 1945
 				sprintf(
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
 						'event_espresso'
1949 1949
 					),
1950 1950
 					'<br/>',
1951
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1951
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1952 1952
 				),
1953 1953
 				__FILE__,
1954 1954
 				__FUNCTION__,
@@ -1957,7 +1957,7 @@  discard block
 block discarded – undo
1957 1957
 			return null;
1958 1958
 		}
1959 1959
 		// and verify it has a valid Payment_Method Type object
1960
-		if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1960
+		if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1961 1961
 			// not a payment
1962 1962
 			EE_Error::add_error(
1963 1963
 				sprintf(
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
 						'event_espresso'
1967 1967
 					),
1968 1968
 					'<br/>',
1969
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1969
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1970 1970
 				),
1971 1971
 				__FILE__,
1972 1972
 				__FUNCTION__,
@@ -1987,29 +1987,29 @@  discard block
 block discarded – undo
1987 1987
 	 * @return    mixed    EE_Payment | boolean
1988 1988
 	 * @throws \EE_Error
1989 1989
 	 */
1990
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1990
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1991 1991
 		$payment = null;
1992 1992
 		$this->checkout->transaction->save();
1993
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1994
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1993
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1994
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1995 1995
 			return false;
1996 1996
 		}
1997 1997
 		try {
1998
-			$payment_processor->set_revisit( $this->checkout->revisit );
1998
+			$payment_processor->set_revisit($this->checkout->revisit);
1999 1999
 			// generate payment object
2000 2000
 			$payment = $payment_processor->process_payment(
2001 2001
 				$payment_method,
2002 2002
 				$this->checkout->transaction,
2003 2003
 				$this->checkout->amount_owing,
2004 2004
 				$this->checkout->billing_form,
2005
-				$this->_get_return_url( $payment_method ),
2005
+				$this->_get_return_url($payment_method),
2006 2006
 				'CART',
2007 2007
 				$this->checkout->admin_request,
2008 2008
 				true,
2009 2009
 				$this->reg_step_url()
2010 2010
 			);
2011
-		} catch ( Exception $e ) {
2012
-			$this->_handle_payment_processor_exception( $e );
2011
+		} catch (Exception $e) {
2012
+			$this->_handle_payment_processor_exception($e);
2013 2013
 		}
2014 2014
 		return $payment;
2015 2015
 	}
@@ -2024,7 +2024,7 @@  discard block
 block discarded – undo
2024 2024
 	 * @return void
2025 2025
 	 * @throws \EE_Error
2026 2026
 	 */
2027
-	protected function _handle_payment_processor_exception( Exception $e ) {
2027
+	protected function _handle_payment_processor_exception(Exception $e) {
2028 2028
 		EE_Error::add_error(
2029 2029
 			sprintf(
2030 2030
 				__(
@@ -2032,7 +2032,7 @@  discard block
 block discarded – undo
2032 2032
 					'event_espresso'
2033 2033
 				),
2034 2034
 				'<br/>',
2035
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
2035
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
2036 2036
 				$e->getMessage(),
2037 2037
 				$e->getFile(),
2038 2038
 				$e->getLine()
@@ -2053,9 +2053,9 @@  discard block
 block discarded – undo
2053 2053
 	 * @return string
2054 2054
 	 * @throws \EE_Error
2055 2055
 	 */
2056
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
2056
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
2057 2057
 		$return_url = '';
2058
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
2058
+		switch ($payment_method->type_obj()->payment_occurs()) {
2059 2059
 			case EE_PMT_Base::offsite :
2060 2060
 				$return_url = add_query_arg(
2061 2061
 					array(
@@ -2084,12 +2084,12 @@  discard block
 block discarded – undo
2084 2084
 	 * @return EE_Payment | FALSE
2085 2085
 	 * @throws \EE_Error
2086 2086
 	 */
2087
-	private function _validate_payment( $payment = null ) {
2088
-		if ( $this->checkout->payment_method->is_off_line() ) {
2087
+	private function _validate_payment($payment = null) {
2088
+		if ($this->checkout->payment_method->is_off_line()) {
2089 2089
 			return true;
2090 2090
 		}
2091 2091
 		// verify payment object
2092
-		if ( ! $payment instanceof EE_Payment ) {
2092
+		if ( ! $payment instanceof EE_Payment) {
2093 2093
 			// not a payment
2094 2094
 			EE_Error::add_error(
2095 2095
 				sprintf(
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
 						'event_espresso'
2099 2099
 					),
2100 2100
 					'<br/>',
2101
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2101
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2102 2102
 				),
2103 2103
 				__FILE__,
2104 2104
 				__FUNCTION__,
@@ -2119,27 +2119,27 @@  discard block
 block discarded – undo
2119 2119
 	 * @return bool
2120 2120
 	 * @throws \EE_Error
2121 2121
 	 */
2122
-	private function _post_payment_processing( $payment = null ) {
2122
+	private function _post_payment_processing($payment = null) {
2123 2123
 		// Off-Line payment?
2124
-		if ( $payment === true ) {
2124
+		if ($payment === true) {
2125 2125
 			//$this->_setup_redirect_for_next_step();
2126 2126
 			return true;
2127 2127
 		// On-Site payment?
2128
-		} else if ( $this->checkout->payment_method->is_on_site() ) {
2129
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite ) ) {
2128
+		} else if ($this->checkout->payment_method->is_on_site()) {
2129
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
2130 2130
 				//$this->_setup_redirect_for_next_step();
2131 2131
 				$this->checkout->continue_reg = false;
2132 2132
 			}
2133 2133
 		// Off-Site payment?
2134
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
2134
+		} else if ($this->checkout->payment_method->is_off_site()) {
2135 2135
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
2136
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ) {
2137
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
2136
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
2137
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
2138 2138
 				$this->checkout->redirect = true;
2139 2139
 				$this->checkout->redirect_form = $payment->redirect_form();
2140
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
2140
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
2141 2141
 				// set JSON response
2142
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
2142
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
2143 2143
 				// set cron job for finalizing the TXN
2144 2144
 				// in case the user does not return from the off-site gateway
2145 2145
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -2147,7 +2147,7 @@  discard block
 block discarded – undo
2147 2147
 					$this->checkout->transaction->ID()
2148 2148
 				);
2149 2149
 				// and lastly, let's bump the payment status to pending
2150
-				$payment->set_status( EEM_Payment::status_id_pending );
2150
+				$payment->set_status(EEM_Payment::status_id_pending);
2151 2151
 				$payment->save();
2152 2152
 			} else {
2153 2153
 				// not a payment
@@ -2159,7 +2159,7 @@  discard block
 block discarded – undo
2159 2159
 							'event_espresso'
2160 2160
 						),
2161 2161
 						'<br/>',
2162
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2162
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
2163 2163
 					),
2164 2164
 					__FILE__,
2165 2165
 					__FUNCTION__,
@@ -2197,21 +2197,21 @@  discard block
 block discarded – undo
2197 2197
 	 * @return bool
2198 2198
 	 * @throws \EE_Error
2199 2199
 	 */
2200
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
2200
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
2201 2201
 		// off-line payment? carry on
2202
-		if ( $payment_occurs === EE_PMT_Base::offline ) {
2202
+		if ($payment_occurs === EE_PMT_Base::offline) {
2203 2203
 			return true;
2204 2204
 		}
2205 2205
 		// verify payment validity
2206
-		if ( $payment instanceof EE_Payment ) {
2207
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
2206
+		if ($payment instanceof EE_Payment) {
2207
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
2208 2208
 			$msg = $payment->gateway_response();
2209 2209
 			// check results
2210
-			switch ( $payment->status() ) {
2210
+			switch ($payment->status()) {
2211 2211
 				// good payment
2212 2212
 				case EEM_Payment::status_id_approved :
2213 2213
 					EE_Error::add_success(
2214
-						__( 'Your payment was processed successfully.', 'event_espresso' ),
2214
+						__('Your payment was processed successfully.', 'event_espresso'),
2215 2215
 						__FILE__,
2216 2216
 						__FUNCTION__,
2217 2217
 						__LINE__
@@ -2220,45 +2220,45 @@  discard block
 block discarded – undo
2220 2220
 					break;
2221 2221
 				// slow payment
2222 2222
 				case EEM_Payment::status_id_pending :
2223
-					if ( empty( $msg ) ) {
2223
+					if (empty($msg)) {
2224 2224
 						$msg = __(
2225 2225
 							'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.',
2226 2226
 							'event_espresso'
2227 2227
 						);
2228 2228
 					}
2229
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
2229
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
2230 2230
 					return true;
2231 2231
 					break;
2232 2232
 				// don't wanna payment
2233 2233
 				case EEM_Payment::status_id_cancelled :
2234
-					if ( empty( $msg ) ) {
2234
+					if (empty($msg)) {
2235 2235
 						$msg = _n(
2236 2236
 							'Payment cancelled. Please try again.',
2237 2237
 							'Payment cancelled. Please try again or select another method of payment.',
2238
-							count( $this->checkout->available_payment_methods ),
2238
+							count($this->checkout->available_payment_methods),
2239 2239
 							'event_espresso'
2240 2240
 						);
2241 2241
 					}
2242
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
2242
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
2243 2243
 					return false;
2244 2244
 					break;
2245 2245
 				// not enough payment
2246 2246
 				case EEM_Payment::status_id_declined :
2247
-					if ( empty( $msg ) ) {
2247
+					if (empty($msg)) {
2248 2248
 						$msg = _n(
2249 2249
 							'We\'re sorry but your payment was declined. Please try again.',
2250 2250
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
2251
-							count( $this->checkout->available_payment_methods ),
2251
+							count($this->checkout->available_payment_methods),
2252 2252
 							'event_espresso'
2253 2253
 						);
2254 2254
 					}
2255
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
2255
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
2256 2256
 					return false;
2257 2257
 					break;
2258 2258
 				// bad payment
2259 2259
 				case EEM_Payment::status_id_failed :
2260
-					if ( ! empty( $msg ) ) {
2261
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2260
+					if ( ! empty($msg)) {
2261
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2262 2262
 						return false;
2263 2263
 					}
2264 2264
 					// default to error below
@@ -2267,7 +2267,7 @@  discard block
 block discarded – undo
2267 2267
 		}
2268 2268
 		// off-site payment gateway responses are too unreliable, so let's just assume that
2269 2269
 		// the payment processing is just running slower than the registrant's request
2270
-		if ( $payment_occurs === EE_PMT_Base::offsite ) {
2270
+		if ($payment_occurs === EE_PMT_Base::offsite) {
2271 2271
 			return true;
2272 2272
 		}
2273 2273
 		EE_Error::add_error(
@@ -2277,7 +2277,7 @@  discard block
 block discarded – undo
2277 2277
 					'event_espresso'
2278 2278
 				),
2279 2279
 				'<br/>',
2280
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2280
+				EE_Registry::instance()->CFG->organization->get_pretty('email')
2281 2281
 			),
2282 2282
 			__FILE__,
2283 2283
 			__FUNCTION__,
@@ -2310,13 +2310,13 @@  discard block
 block discarded – undo
2310 2310
 	public function process_gateway_response() {
2311 2311
 		$payment = null;
2312 2312
 		// how have they chosen to pay?
2313
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
2313
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
2314 2314
 		// get EE_Payment_Method object
2315
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
2315
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
2316 2316
 			$this->checkout->continue_reg = false;
2317 2317
 			return false;
2318 2318
 		}
2319
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
2319
+		if ( ! $this->checkout->payment_method->is_off_site()) {
2320 2320
 			return false;
2321 2321
 		}
2322 2322
 		$this->_validate_offsite_return();
@@ -2330,23 +2330,23 @@  discard block
 block discarded – undo
2330 2330
 		//	true
2331 2331
 		//);
2332 2332
 		// verify TXN
2333
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
2333
+		if ($this->checkout->transaction instanceof EE_Transaction) {
2334 2334
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
2335
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
2335
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
2336 2336
 				$this->checkout->continue_reg = false;
2337 2337
 				return false;
2338 2338
 			}
2339
-			$payment = $this->_process_off_site_payment( $gateway );
2340
-			$payment = $this->_process_cancelled_payments( $payment );
2341
-			$payment = $this->_validate_payment( $payment );
2339
+			$payment = $this->_process_off_site_payment($gateway);
2340
+			$payment = $this->_process_cancelled_payments($payment);
2341
+			$payment = $this->_validate_payment($payment);
2342 2342
 			// if payment was not declined by the payment gateway or cancelled by the registrant
2343
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
2343
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
2344 2344
 				//$this->_setup_redirect_for_next_step();
2345 2345
 				// store that for later
2346 2346
 				$this->checkout->payment = $payment;
2347 2347
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
2348 2348
 				// because we will complete this step during the IPN processing then
2349
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request() ) {
2349
+				if ($gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request()) {
2350 2350
 					$this->set_completed();
2351 2351
 				}
2352 2352
 				return true;
@@ -2370,21 +2370,21 @@  discard block
 block discarded – undo
2370 2370
 	 * @throws \EE_Error
2371 2371
 	 */
2372 2372
 	private function _validate_offsite_return() {
2373
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
2374
-		if ( $TXN_ID !== $this->checkout->transaction->ID() ) {
2373
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
2374
+		if ($TXN_ID !== $this->checkout->transaction->ID()) {
2375 2375
 			// Houston... we might have a problem
2376 2376
 			$invalid_TXN = false;
2377 2377
 			// first gather some info
2378
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
2378
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
2379 2379
 			$primary_registrant = $valid_TXN instanceof EE_Transaction
2380 2380
 				? $valid_TXN->primary_registration()
2381 2381
 				: null;
2382 2382
 			// let's start by retrieving the cart for this TXN
2383
-			$cart = $this->checkout->get_cart_for_transaction( $this->checkout->transaction );
2384
-			if ( $cart instanceof EE_Cart ) {
2383
+			$cart = $this->checkout->get_cart_for_transaction($this->checkout->transaction);
2384
+			if ($cart instanceof EE_Cart) {
2385 2385
 				// verify that the current cart has tickets
2386 2386
 				$tickets = $cart->get_tickets();
2387
-				if ( empty( $tickets ) ) {
2387
+				if (empty($tickets)) {
2388 2388
 					$invalid_TXN = true;
2389 2389
 				}
2390 2390
 			} else {
@@ -2394,35 +2394,35 @@  discard block
 block discarded – undo
2394 2394
 				? $primary_registrant->session_ID()
2395 2395
 				: null;
2396 2396
 			// validate current Session ID and compare against valid TXN session ID
2397
-			if ( EE_Session::instance()->id() === null ) {
2397
+			if (EE_Session::instance()->id() === null) {
2398 2398
 				$invalid_TXN = true;
2399
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
2399
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
2400 2400
 				// WARNING !!!
2401 2401
 				// this could be PayPal sending back duplicate requests (ya they do that)
2402 2402
 				// or it **could** mean someone is simply registering AGAIN after having just done so
2403 2403
 				// so now we need to determine if this current TXN looks valid or not
2404 2404
 				// has this step even been started ?
2405
-				if ( $this->checkout->transaction->reg_step_completed( $this->slug() === false )
2405
+				if ($this->checkout->transaction->reg_step_completed($this->slug() === false)
2406 2406
 				) {
2407 2407
 					// really? you're half way through this reg step, but you never started it ?
2408 2408
 					$invalid_TXN = true;
2409 2409
 				}
2410 2410
 			}
2411
-			if ( $invalid_TXN ) {
2411
+			if ($invalid_TXN) {
2412 2412
 				// is the valid TXN completed ?
2413
-				if ( $valid_TXN instanceof EE_Transaction ) {
2413
+				if ($valid_TXN instanceof EE_Transaction) {
2414 2414
 					// has this step even been started ?
2415
-					$reg_step_completed = $valid_TXN->reg_step_completed( $this->slug() );
2416
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
2415
+					$reg_step_completed = $valid_TXN->reg_step_completed($this->slug());
2416
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
2417 2417
 						// so it **looks** like this is a double request from PayPal
2418 2418
 						// so let's try to pick up where we left off
2419 2419
 						$this->checkout->transaction = $valid_TXN;
2420
-						$this->checkout->refresh_all_entities( true );
2420
+						$this->checkout->refresh_all_entities(true);
2421 2421
 						return;
2422 2422
 					}
2423 2423
 				}
2424 2424
 				// you appear to be lost?
2425
-				$this->_redirect_wayward_request( $primary_registrant );
2425
+				$this->_redirect_wayward_request($primary_registrant);
2426 2426
 			}
2427 2427
 		}
2428 2428
 	}
@@ -2437,14 +2437,14 @@  discard block
 block discarded – undo
2437 2437
 	 * @return bool
2438 2438
 	 * @throws \EE_Error
2439 2439
 	 */
2440
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
2441
-		if ( ! $primary_registrant instanceof EE_Registration ) {
2440
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
2441
+		if ( ! $primary_registrant instanceof EE_Registration) {
2442 2442
 			// try redirecting based on the current TXN
2443 2443
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction
2444 2444
 				? $this->checkout->transaction->primary_registration()
2445 2445
 				: null;
2446 2446
 		}
2447
-		if ( ! $primary_registrant instanceof EE_Registration ) {
2447
+		if ( ! $primary_registrant instanceof EE_Registration) {
2448 2448
 			EE_Error::add_error(
2449 2449
 				sprintf(
2450 2450
 					__(
@@ -2452,7 +2452,7 @@  discard block
 block discarded – undo
2452 2452
 						'event_espresso'
2453 2453
 					),
2454 2454
 					'<br/>',
2455
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2455
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2456 2456
 				),
2457 2457
 				__FILE__,
2458 2458
 				__FUNCTION__,
@@ -2483,17 +2483,17 @@  discard block
 block discarded – undo
2483 2483
 	 * @return \EE_Payment
2484 2484
 	 * @throws \EE_Error
2485 2485
 	 */
2486
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
2486
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
2487 2487
 		try {
2488 2488
 			$request_data = \EE_Registry::instance()->REQ->params();
2489 2489
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
2490 2490
 			$this->set_handle_IPN_in_this_request(
2491
-				$gateway->handle_IPN_in_this_request( $request_data, false )
2491
+				$gateway->handle_IPN_in_this_request($request_data, false)
2492 2492
 			);
2493
-			if ( $this->handle_IPN_in_this_request() ) {
2493
+			if ($this->handle_IPN_in_this_request()) {
2494 2494
 				// get payment details and process results
2495 2495
 				/** @type EE_Payment_Processor $payment_processor */
2496
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
2496
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
2497 2497
 				$payment = $payment_processor->process_ipn(
2498 2498
 					$request_data,
2499 2499
 					$this->checkout->transaction,
@@ -2506,14 +2506,14 @@  discard block
 block discarded – undo
2506 2506
 				$payment = $this->checkout->transaction->last_payment();
2507 2507
 				//$payment_source = 'last_payment';
2508 2508
 			}
2509
-		} catch ( Exception $e ) {
2509
+		} catch (Exception $e) {
2510 2510
 			// let's just eat the exception and try to move on using any previously set payment info
2511 2511
 			$payment = $this->checkout->transaction->last_payment();
2512 2512
 			//$payment_source = 'last_payment after Exception';
2513 2513
 			// but if we STILL don't have a payment object
2514
-			if ( ! $payment instanceof EE_Payment ) {
2514
+			if ( ! $payment instanceof EE_Payment) {
2515 2515
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
2516
-				$this->_handle_payment_processor_exception( $e );
2516
+				$this->_handle_payment_processor_exception($e);
2517 2517
 			}
2518 2518
 		}
2519 2519
 		// DEBUG LOG
@@ -2538,13 +2538,13 @@  discard block
 block discarded – undo
2538 2538
 	 * @return EE_Payment | FALSE
2539 2539
 	 * @throws \EE_Error
2540 2540
 	 */
2541
-	private function _process_cancelled_payments( $payment = null ) {
2541
+	private function _process_cancelled_payments($payment = null) {
2542 2542
 		if (
2543 2543
 			$payment instanceof EE_Payment
2544
-			&& isset( $_REQUEST['ee_cancel_payment'] )
2544
+			&& isset($_REQUEST['ee_cancel_payment'])
2545 2545
 			&& $payment->status() === EEM_Payment::status_id_failed
2546 2546
 		) {
2547
-			$payment->set_status( EEM_Payment::status_id_cancelled );
2547
+			$payment->set_status(EEM_Payment::status_id_cancelled);
2548 2548
 		}
2549 2549
 		return $payment;
2550 2550
 	}
@@ -2561,14 +2561,14 @@  discard block
 block discarded – undo
2561 2561
 	public function get_transaction_details_for_gateways() {
2562 2562
 		$txn_details = array();
2563 2563
 		// ya gotta make a choice man
2564
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
2564
+		if (empty($this->checkout->selected_method_of_payment)) {
2565 2565
 			$txn_details = array(
2566
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
2566
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
2567 2567
 			);
2568 2568
 		}
2569 2569
 		// get EE_Payment_Method object
2570 2570
 		if (
2571
-			empty( $txn_details )
2571
+			empty($txn_details)
2572 2572
 			&&
2573 2573
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
2574 2574
 		) {
@@ -2580,8 +2580,8 @@  discard block
 block discarded – undo
2580 2580
 				)
2581 2581
 			);
2582 2582
 		}
2583
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
2584
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
2583
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
2584
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
2585 2585
 			$txn_details = array(
2586 2586
 				'TXN_ID'         => $this->checkout->transaction->ID(),
2587 2587
 				'TXN_timestamp'  => $this->checkout->transaction->datetime(),
@@ -2592,7 +2592,7 @@  discard block
 block discarded – undo
2592 2592
 				'PMD_ID'         => $this->checkout->transaction->payment_method_ID(),
2593 2593
 				'payment_amount' => $this->checkout->amount_owing,
2594 2594
 				'return_url'     => $return_url,
2595
-				'cancel_url'     => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
2595
+				'cancel_url'     => add_query_arg(array('ee_cancel_payment' => true), $return_url),
2596 2596
 				'notify_url'     => EE_Config::instance()->core->txn_page_url(
2597 2597
 					array(
2598 2598
 						'e_reg_url_link'    => $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -2601,7 +2601,7 @@  discard block
 block discarded – undo
2601 2601
 				)
2602 2602
 			);
2603 2603
 		}
2604
-		echo json_encode( $txn_details );
2604
+		echo json_encode($txn_details);
2605 2605
 		exit();
2606 2606
 	}
2607 2607
 
@@ -2618,7 +2618,7 @@  discard block
 block discarded – undo
2618 2618
     public function __sleep()
2619 2619
     {
2620 2620
         // remove the reg form and the checkout
2621
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'reg_form', 'checkout', 'line_item_display' ) );
2621
+        return array_diff(array_keys(get_object_vars($this)), array('reg_form', 'checkout', 'line_item_display'));
2622 2622
     }
2623 2623
 
2624 2624
 
Please login to merge, or discard this patch.
modules/invalid_checkout_access/EED_Invalid_Checkout_Access.module.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use EventEspresso\modules\invalid_checkout_access\InvalidCheckoutAccess;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 	public static function set_hooks_admin() {
37 37
 		add_action(
38 38
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
39
-			array( 'EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form' ),
39
+			array('EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form'),
40 40
 			15
41 41
 		);
42 42
 		add_filter(
43 43
 			'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
44
-			array( 'EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form' )
44
+			array('EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form')
45 45
 		);
46 46
 	}
47 47
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @var WP $WP
55 55
 	 */
56
-	public function run( $WP ) {
56
+	public function run($WP) {
57 57
 		// TODO: Implement run() method.
58 58
 	}
59 59
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return InvalidCheckoutAccess
64 64
 	 */
65 65
 	public static function getInvalidCheckoutAccess() {
66
-		if ( ! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess ) {
66
+		if ( ! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) {
67 67
 			self::$invalid_checkout_access_form = new InvalidCheckoutAccess();
68 68
 		}
69 69
 		return self::$invalid_checkout_access_form;
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 	 * @param \EE_Registration_Config $EE_Registration_Config
91 91
 	 * @return \EE_Registration_Config
92 92
 	 */
93
-	public static function process_invalid_checkout_access_form( \EE_Registration_Config $EE_Registration_Config ) {
93
+	public static function process_invalid_checkout_access_form(\EE_Registration_Config $EE_Registration_Config) {
94 94
 		$invalid_checkout_access_form = \EED_Invalid_Checkout_Access::getInvalidCheckoutAccess();
95
-		return $invalid_checkout_access_form->processForm( $EE_Registration_Config );
95
+		return $invalid_checkout_access_form->processForm($EE_Registration_Config);
96 96
 	}
97 97
 
98 98
 
Please login to merge, or discard this patch.
core/EE_Session.core.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -341,7 +341,7 @@
 block discarded – undo
341 341
 		}
342 342
 		 if ( ! empty( $key ))  {
343 343
 			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
344
-		}  else  {
344
+		} else  {
345 345
 			return $this->_session_data;
346 346
 		}
347 347
 	}
Please login to merge, or discard this patch.
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -163,18 +163,18 @@  discard block
 block discarded – undo
163 163
 				$this->{$var_name} = $session_setting;
164 164
 			}
165 165
 		}
166
-         // are we using encryption?
167
-         $this->_use_encryption = $encryption instanceof EE_Encryption && EE_Registry::instance()->CFG->admin->encode_session_data();
168
-         // \EEH_Debug_Tools::printr($this->_use_encryption, '$this->_use_encryption', __FILE__, __LINE__);
169
-        // encrypt data via: $this->encryption->encrypt();
170
-        $this->encryption = $encryption;
166
+		 // are we using encryption?
167
+		 $this->_use_encryption = $encryption instanceof EE_Encryption && EE_Registry::instance()->CFG->admin->encode_session_data();
168
+		 // \EEH_Debug_Tools::printr($this->_use_encryption, '$this->_use_encryption', __FILE__, __LINE__);
169
+		// encrypt data via: $this->encryption->encrypt();
170
+		$this->encryption = $encryption;
171 171
 		// filter hook allows outside functions/classes/plugins to change default empty cart
172 172
 		$extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() );
173 173
 		array_merge( $this->_default_session_vars, $extra_default_session_vars );
174 174
 		// apply default session vars
175 175
 		$this->_set_defaults();
176
-         add_action('AHEE__EE_System__initialize', array($this, 'open_session'));
177
-         // check request for 'clear_session' param
176
+		 add_action('AHEE__EE_System__initialize', array($this, 'open_session'));
177
+		 // check request for 'clear_session' param
178 178
 		add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' ));
179 179
 		// once everything is all said and done,
180 180
 		add_action( 'shutdown', array( $this, 'update' ), 100 );
@@ -184,18 +184,18 @@  discard block
 block discarded – undo
184 184
 
185 185
 
186 186
 
187
-     /**
188
-      * @return void
189
-      * @throws \EventEspresso\core\exceptions\InvalidSessionDataException
190
-      * @throws \EE_Error
191
-      */
187
+	 /**
188
+	  * @return void
189
+	  * @throws \EventEspresso\core\exceptions\InvalidSessionDataException
190
+	  * @throws \EE_Error
191
+	  */
192 192
 	 public function open_session() {
193
-         // check for existing session and retrieve it from db
194
-         if ( ! $this->_espresso_session()) {
195
-             // or just start a new one
196
-             $this->_create_espresso_session();
197
-         }
198
-     }
193
+		 // check for existing session and retrieve it from db
194
+		 if ( ! $this->_espresso_session()) {
195
+			 // or just start a new one
196
+			 $this->_create_espresso_session();
197
+		 }
198
+	 }
199 199
 
200 200
 
201 201
 	 /**
@@ -408,16 +408,16 @@  discard block
 block discarded – undo
408 408
 		// set the "user agent"
409 409
 		$this->_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE;
410 410
 		// now let's retrieve what's in the db
411
-        $session_data = $this->_retrieve_session_data();
412
-        if (! empty($session_data)) {
413
-            // get the current time in UTC
411
+		$session_data = $this->_retrieve_session_data();
412
+		if (! empty($session_data)) {
413
+			// get the current time in UTC
414 414
 			$this->_time = isset( $this->_time ) ? $this->_time : time();
415 415
 			// and reset the session expiration
416 416
 			$this->_expiration = isset( $session_data['expiration'] )
417 417
 				? $session_data['expiration']
418 418
 				: $this->_time + $this->_lifespan;
419 419
 		} else {
420
-            // set initial site access time and the session expiration
420
+			// set initial site access time and the session expiration
421 421
 			$this->_set_init_access_and_expiration();
422 422
 			// set referer
423 423
 			$this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] )
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 			// no previous session = go back and create one (on top of the data above)
427 427
 			return FALSE;
428 428
 		}
429
-        // now the user agent
429
+		// now the user agent
430 430
 		if ( $session_data['user_agent'] !== $this->_user_agent ) {
431 431
 			return FALSE;
432 432
 		}
@@ -444,95 +444,95 @@  discard block
 block discarded – undo
444 444
 
445 445
 
446 446
 
447
-     /**
448
-      * _get_session_data
449
-      * Retrieves the session data, and attempts to correct any encoding issues that can occur due to improperly setup databases
450
-      *
451
-      * @return array
452
-      * @throws \EventEspresso\core\exceptions\InvalidSessionDataException
453
-      */
454
-     protected function _retrieve_session_data()
455
-     {
456
-         $ssn_key = EE_Session::session_id_prefix . $this->_sid;
457
-         try {
458
-             // we're using WP's Transient API to store session data using the PHP session ID as the option name
459
-             $session_data = get_transient($ssn_key);
460
-	         if ($session_data === false) {
461
-		         return array();
462
-             }
463
-             if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
464
-                 $hash_check = get_transient(EE_Session::hash_check_prefix . $this->_sid);
465
-                 if ($hash_check && $hash_check !== md5($session_data)) {
466
-	                 EE_Error::add_error(
467
-                         sprintf(
468
-                             __('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
469
-                             EE_Session::session_id_prefix . $this->_sid
470
-                         ),
471
-                         __FILE__, __FUNCTION__, __LINE__
472
-                     );
473
-                 }
474
-             }
475
-         } catch (Exception $e) {
476
-             // let's just eat that error for now and attempt to correct any corrupted data
477
-             global $wpdb;
478
-             $row = $wpdb->get_row(
479
-                 $wpdb->prepare(
480
-                     "SELECT option_value FROM {$wpdb->options} WHERE option_name = %s LIMIT 1",
481
-                     '_transient_' . $ssn_key
482
-                 )
483
-             );
484
-             $session_data = is_object($row) ? $row->option_value : null;
485
-             if ($session_data) {
486
-                 $session_data = preg_replace_callback(
487
-                     '!s:(d+):"(.*?)";!',
488
-                     function ($match) {
489
-                         return $match[1] === strlen($match[2])
490
-                             ? $match[0]
491
-                             : 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
492
-                     },
493
-                     $session_data
494
-                 );
495
-             }
496
-	         $session_data = maybe_unserialize($session_data);
497
-         }
498
-	     // in case the data is encoded... try to decode it
499
-         $session_data = $this->encryption instanceof EE_Encryption
500
-             ? $this->encryption->base64_string_decode($session_data)
501
-             : $session_data;
502
-
503
-         if ( ! is_array($session_data)) {
504
-             try {
505
-	             $session_data = maybe_unserialize($session_data);
506
-             } catch (Exception $e) {
507
-                 $msg = esc_html__(
508
-                     'An error occurred while attempting to unserialize the session data.',
509
-                     'event_espresso'
510
-                 );
511
-                 $msg .= WP_DEBUG
512
-                     ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
513
-                     : '';
514
-                 throw new InvalidSessionDataException($msg, 0, $e);
515
-             }
516
-         }
517
-         // just a check to make sure the session array is indeed an array
518
-         if ( ! is_array($session_data)) {
519
-             // no?!?! then something is wrong
520
-             $msg = esc_html__(
521
-                 'The session data is missing, invalid, or corrupted.',
522
-                 'event_espresso'
523
-             );
524
-             $msg .= WP_DEBUG
525
-                 ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
526
-                 : '';
527
-	         throw new InvalidSessionDataException($msg);
528
-         }
529
-	     if ( isset( $this->_session_data['transaction'] ) && absint( $this->_session_data['transaction'] ) !== 0 ) {
530
-		     $this->_session_data['transaction'] = EEM_Transaction::instance()->get_one_by_ID(
531
-			     $this->_session_data['transaction']
532
-	         );
533
-	     }
534
-	     return $session_data;
535
-     }
447
+	 /**
448
+	  * _get_session_data
449
+	  * Retrieves the session data, and attempts to correct any encoding issues that can occur due to improperly setup databases
450
+	  *
451
+	  * @return array
452
+	  * @throws \EventEspresso\core\exceptions\InvalidSessionDataException
453
+	  */
454
+	 protected function _retrieve_session_data()
455
+	 {
456
+		 $ssn_key = EE_Session::session_id_prefix . $this->_sid;
457
+		 try {
458
+			 // we're using WP's Transient API to store session data using the PHP session ID as the option name
459
+			 $session_data = get_transient($ssn_key);
460
+			 if ($session_data === false) {
461
+				 return array();
462
+			 }
463
+			 if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
464
+				 $hash_check = get_transient(EE_Session::hash_check_prefix . $this->_sid);
465
+				 if ($hash_check && $hash_check !== md5($session_data)) {
466
+					 EE_Error::add_error(
467
+						 sprintf(
468
+							 __('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
469
+							 EE_Session::session_id_prefix . $this->_sid
470
+						 ),
471
+						 __FILE__, __FUNCTION__, __LINE__
472
+					 );
473
+				 }
474
+			 }
475
+		 } catch (Exception $e) {
476
+			 // let's just eat that error for now and attempt to correct any corrupted data
477
+			 global $wpdb;
478
+			 $row = $wpdb->get_row(
479
+				 $wpdb->prepare(
480
+					 "SELECT option_value FROM {$wpdb->options} WHERE option_name = %s LIMIT 1",
481
+					 '_transient_' . $ssn_key
482
+				 )
483
+			 );
484
+			 $session_data = is_object($row) ? $row->option_value : null;
485
+			 if ($session_data) {
486
+				 $session_data = preg_replace_callback(
487
+					 '!s:(d+):"(.*?)";!',
488
+					 function ($match) {
489
+						 return $match[1] === strlen($match[2])
490
+							 ? $match[0]
491
+							 : 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
492
+					 },
493
+					 $session_data
494
+				 );
495
+			 }
496
+			 $session_data = maybe_unserialize($session_data);
497
+		 }
498
+		 // in case the data is encoded... try to decode it
499
+		 $session_data = $this->encryption instanceof EE_Encryption
500
+			 ? $this->encryption->base64_string_decode($session_data)
501
+			 : $session_data;
502
+
503
+		 if ( ! is_array($session_data)) {
504
+			 try {
505
+				 $session_data = maybe_unserialize($session_data);
506
+			 } catch (Exception $e) {
507
+				 $msg = esc_html__(
508
+					 'An error occurred while attempting to unserialize the session data.',
509
+					 'event_espresso'
510
+				 );
511
+				 $msg .= WP_DEBUG
512
+					 ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
513
+					 : '';
514
+				 throw new InvalidSessionDataException($msg, 0, $e);
515
+			 }
516
+		 }
517
+		 // just a check to make sure the session array is indeed an array
518
+		 if ( ! is_array($session_data)) {
519
+			 // no?!?! then something is wrong
520
+			 $msg = esc_html__(
521
+				 'The session data is missing, invalid, or corrupted.',
522
+				 'event_espresso'
523
+			 );
524
+			 $msg .= WP_DEBUG
525
+				 ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
526
+				 : '';
527
+			 throw new InvalidSessionDataException($msg);
528
+		 }
529
+		 if ( isset( $this->_session_data['transaction'] ) && absint( $this->_session_data['transaction'] ) !== 0 ) {
530
+			 $this->_session_data['transaction'] = EEM_Transaction::instance()->get_one_by_ID(
531
+				 $this->_session_data['transaction']
532
+			 );
533
+		 }
534
+		 return $session_data;
535
+	 }
536 536
 
537 537
 
538 538
 
Please login to merge, or discard this patch.
Spacing   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\exceptions\InvalidSessionDataException;
2 2
 
3
-if (!defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
4 4
 /**
5 5
  *
6 6
  * EE_Session class
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	  * array for defining default session vars
92 92
 	  * @var array
93 93
 	  */
94
-	 private $_default_session_vars = array (
94
+	 private $_default_session_vars = array(
95 95
 		'id' => NULL,
96 96
 		'user_id' => NULL,
97 97
 		'ip_address' => NULL,
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 	  * @throws InvalidSessionDataException
112 112
 	  * @throws \EE_Error
113 113
 	  */
114
-	public static function instance( EE_Encryption $encryption = null ) {
114
+	public static function instance(EE_Encryption $encryption = null) {
115 115
 		// check if class object is instantiated
116 116
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via:
117 117
 		// add_filter( 'FHEE_load_EE_Session', '__return_false' );
118
-		if ( ! self::$_instance instanceof EE_Session && apply_filters( 'FHEE_load_EE_Session', true ) ) {
119
-			self::$_instance = new self( $encryption );
118
+		if ( ! self::$_instance instanceof EE_Session && apply_filters('FHEE_load_EE_Session', true)) {
119
+			self::$_instance = new self($encryption);
120 120
 		}
121 121
 		return self::$_instance;
122 122
 	}
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
 	  * @throws \EE_Error
133 133
 	  * @throws \EventEspresso\core\exceptions\InvalidSessionDataException
134 134
 	  */
135
-	 protected function __construct( EE_Encryption $encryption = null ) {
135
+	 protected function __construct(EE_Encryption $encryption = null) {
136 136
 
137 137
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
138
-		if ( ! apply_filters( 'FHEE_load_EE_Session', TRUE ) ) {
138
+		if ( ! apply_filters('FHEE_load_EE_Session', TRUE)) {
139 139
 			return;
140 140
 		}
141
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
142
-		if ( ! defined( 'ESPRESSO_SESSION' ) ) {
143
-			define( 'ESPRESSO_SESSION', true );
141
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
142
+		if ( ! defined('ESPRESSO_SESSION')) {
143
+			define('ESPRESSO_SESSION', true);
144 144
 		}
145 145
 		// default session lifespan in seconds
146 146
 		$this->_lifespan = apply_filters(
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
 		 * 		}
155 155
 		 */
156 156
 		// retrieve session options from db
157
-		$session_settings = (array) get_option( 'ee_session_settings', array() );
158
-		if ( ! empty( $session_settings )) {
157
+		$session_settings = (array) get_option('ee_session_settings', array());
158
+		if ( ! empty($session_settings)) {
159 159
 			// cycle though existing session options
160
-			foreach ( $session_settings as $var_name => $session_setting ) {
160
+			foreach ($session_settings as $var_name => $session_setting) {
161 161
 				// set values for class properties
162
-				$var_name = '_' . $var_name;
162
+				$var_name = '_'.$var_name;
163 163
 				$this->{$var_name} = $session_setting;
164 164
 			}
165 165
 		}
@@ -169,17 +169,17 @@  discard block
 block discarded – undo
169 169
         // encrypt data via: $this->encryption->encrypt();
170 170
         $this->encryption = $encryption;
171 171
 		// filter hook allows outside functions/classes/plugins to change default empty cart
172
-		$extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() );
173
-		array_merge( $this->_default_session_vars, $extra_default_session_vars );
172
+		$extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array());
173
+		array_merge($this->_default_session_vars, $extra_default_session_vars);
174 174
 		// apply default session vars
175 175
 		$this->_set_defaults();
176 176
          add_action('AHEE__EE_System__initialize', array($this, 'open_session'));
177 177
          // check request for 'clear_session' param
178
-		add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' ));
178
+		add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded'));
179 179
 		// once everything is all said and done,
180
-		add_action( 'shutdown', array( $this, 'update' ), 100 );
181
-		add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 );
182
-		add_filter( 'wp_redirect', array( $this, 'update_on_redirect' ), 100, 1 );
180
+		add_action('shutdown', array($this, 'update'), 100);
181
+		add_action('shutdown', array($this, 'garbage_collection'), 999);
182
+		add_filter('wp_redirect', array($this, 'update_on_redirect'), 100, 1);
183 183
 	}
184 184
 
185 185
 
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	 */
225 225
 	private function _set_defaults() {
226 226
 		// set some defaults
227
-		foreach ( $this->_default_session_vars as $key => $default_var ) {
228
-			if ( is_array( $default_var )) {
229
-				$this->_session_data[ $key ] = array();
227
+		foreach ($this->_default_session_vars as $key => $default_var) {
228
+			if (is_array($default_var)) {
229
+				$this->_session_data[$key] = array();
230 230
 			} else {
231
-				$this->_session_data[ $key ] = '';
231
+				$this->_session_data[$key] = '';
232 232
 			}
233 233
 		}
234 234
 	}
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	  * @param \EE_Cart $cart
251 251
 	  * @return bool
252 252
 	  */
253
-	 public function set_cart( EE_Cart $cart ) {
253
+	 public function set_cart(EE_Cart $cart) {
254 254
 		 $this->_session_data['cart'] = $cart;
255 255
 		 return TRUE;
256 256
 	 }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	  * @return \EE_Cart
271 271
 	  */
272 272
 	 public function cart() {
273
-		 return isset( $this->_session_data['cart'] ) ? $this->_session_data['cart'] : NULL;
273
+		 return isset($this->_session_data['cart']) ? $this->_session_data['cart'] : NULL;
274 274
 	 }
275 275
 
276 276
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	  * @param \EE_Checkout $checkout
280 280
 	  * @return bool
281 281
 	  */
282
-	 public function set_checkout( EE_Checkout $checkout ) {
282
+	 public function set_checkout(EE_Checkout $checkout) {
283 283
 		 $this->_session_data['checkout'] = $checkout;
284 284
 		 return TRUE;
285 285
 	 }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	  * @return \EE_Checkout
300 300
 	  */
301 301
 	 public function checkout() {
302
-		 return isset( $this->_session_data['checkout'] ) ? $this->_session_data['checkout'] : NULL;
302
+		 return isset($this->_session_data['checkout']) ? $this->_session_data['checkout'] : NULL;
303 303
 	 }
304 304
 
305 305
 
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
 	  * @return bool
310 310
 	  * @throws \EE_Error
311 311
 	  */
312
-	 public function set_transaction( EE_Transaction $transaction ) {
312
+	 public function set_transaction(EE_Transaction $transaction) {
313 313
 		 // first remove the session from the transaction before we save the transaction in the session
314
-		 $transaction->set_txn_session_data( NULL );
314
+		 $transaction->set_txn_session_data(NULL);
315 315
 		 $this->_session_data['transaction'] = $transaction;
316 316
 		 return TRUE;
317 317
 	 }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	  * @return \EE_Transaction
332 332
 	  */
333 333
 	 public function transaction() {
334
-		 return isset( $this->_session_data['transaction'] ) ? $this->_session_data['transaction'] : NULL;
334
+		 return isset($this->_session_data['transaction']) ? $this->_session_data['transaction'] : NULL;
335 335
 	 }
336 336
 
337 337
 
@@ -343,15 +343,15 @@  discard block
 block discarded – undo
343 343
 	  * @param bool $reset_cache
344 344
 	  * @return    array
345 345
 	  */
346
-	public function get_session_data( $key = NULL, $reset_cache = FALSE ) {
347
-		if ( $reset_cache ) {
346
+	public function get_session_data($key = NULL, $reset_cache = FALSE) {
347
+		if ($reset_cache) {
348 348
 			$this->reset_cart();
349 349
 			$this->reset_checkout();
350 350
 			$this->reset_transaction();
351 351
 		}
352
-		 if ( ! empty( $key ))  {
353
-			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
354
-		}  else  {
352
+		 if ( ! empty($key)) {
353
+			return  isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL;
354
+		} else {
355 355
 			return $this->_session_data;
356 356
 		}
357 357
 	}
@@ -364,20 +364,20 @@  discard block
 block discarded – undo
364 364
 	  * @param 	array $data
365 365
 	  * @return 	TRUE on success, FALSE on fail
366 366
 	  */
367
-	public function set_session_data( $data ) {
367
+	public function set_session_data($data) {
368 368
 
369 369
 		// nothing ??? bad data ??? go home!
370
-		if ( empty( $data ) || ! is_array( $data )) {
371
-			EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
370
+		if (empty($data) || ! is_array($data)) {
371
+			EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
372 372
 			return FALSE;
373 373
 		}
374 374
 
375
-		foreach ( $data as $key =>$value ) {
376
-			if ( isset( $this->_default_session_vars[ $key ] )) {
377
-				EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ );
375
+		foreach ($data as $key =>$value) {
376
+			if (isset($this->_default_session_vars[$key])) {
377
+				EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__);
378 378
 				return FALSE;
379 379
 			} else {
380
-				$this->_session_data[ $key ] = $value;
380
+				$this->_session_data[$key] = $value;
381 381
 			}
382 382
 		}
383 383
 
@@ -395,9 +395,9 @@  discard block
 block discarded – undo
395 395
 	  * @throws \EE_Error
396 396
 	  */
397 397
 	private function _espresso_session() {
398
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
398
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
399 399
 		// check that session has started
400
-		if ( session_id() === '' ) {
400
+		if (session_id() === '') {
401 401
 			//starts a new session if one doesn't already exist, or re-initiates an existing one
402 402
 			session_start();
403 403
 		}
@@ -406,38 +406,38 @@  discard block
 block discarded – undo
406 406
 		// and the visitors IP
407 407
 		$this->_ip_address = $this->_visitor_ip();
408 408
 		// set the "user agent"
409
-		$this->_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE;
409
+		$this->_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE;
410 410
 		// now let's retrieve what's in the db
411 411
         $session_data = $this->_retrieve_session_data();
412
-        if (! empty($session_data)) {
412
+        if ( ! empty($session_data)) {
413 413
             // get the current time in UTC
414
-			$this->_time = isset( $this->_time ) ? $this->_time : time();
414
+			$this->_time = isset($this->_time) ? $this->_time : time();
415 415
 			// and reset the session expiration
416
-			$this->_expiration = isset( $session_data['expiration'] )
416
+			$this->_expiration = isset($session_data['expiration'])
417 417
 				? $session_data['expiration']
418 418
 				: $this->_time + $this->_lifespan;
419 419
 		} else {
420 420
             // set initial site access time and the session expiration
421 421
 			$this->_set_init_access_and_expiration();
422 422
 			// set referer
423
-			$this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] )
424
-				? esc_attr( $_SERVER['HTTP_REFERER'] )
423
+			$this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER'])
424
+				? esc_attr($_SERVER['HTTP_REFERER'])
425 425
 				: '';
426 426
 			// no previous session = go back and create one (on top of the data above)
427 427
 			return FALSE;
428 428
 		}
429 429
         // now the user agent
430
-		if ( $session_data['user_agent'] !== $this->_user_agent ) {
430
+		if ($session_data['user_agent'] !== $this->_user_agent) {
431 431
 			return FALSE;
432 432
 		}
433 433
 		// wait a minute... how old are you?
434
-		if ( $this->_time > $this->_expiration ) {
434
+		if ($this->_time > $this->_expiration) {
435 435
 			// yer too old fer me!
436 436
 			// wipe out everything that isn't a default session datum
437
-			$this->clear_session( __CLASS__, __FUNCTION__ );
437
+			$this->clear_session(__CLASS__, __FUNCTION__);
438 438
 		}
439 439
 		// make event espresso session data available to plugin
440
-		$this->_session_data = array_merge( $this->_session_data, $session_data );
440
+		$this->_session_data = array_merge($this->_session_data, $session_data);
441 441
 		return TRUE;
442 442
 
443 443
 	}
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
       */
454 454
      protected function _retrieve_session_data()
455 455
      {
456
-         $ssn_key = EE_Session::session_id_prefix . $this->_sid;
456
+         $ssn_key = EE_Session::session_id_prefix.$this->_sid;
457 457
          try {
458 458
              // we're using WP's Transient API to store session data using the PHP session ID as the option name
459 459
              $session_data = get_transient($ssn_key);
@@ -461,12 +461,12 @@  discard block
 block discarded – undo
461 461
 		         return array();
462 462
              }
463 463
              if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
464
-                 $hash_check = get_transient(EE_Session::hash_check_prefix . $this->_sid);
464
+                 $hash_check = get_transient(EE_Session::hash_check_prefix.$this->_sid);
465 465
                  if ($hash_check && $hash_check !== md5($session_data)) {
466 466
 	                 EE_Error::add_error(
467 467
                          sprintf(
468 468
                              __('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
469
-                             EE_Session::session_id_prefix . $this->_sid
469
+                             EE_Session::session_id_prefix.$this->_sid
470 470
                          ),
471 471
                          __FILE__, __FUNCTION__, __LINE__
472 472
                      );
@@ -478,17 +478,17 @@  discard block
 block discarded – undo
478 478
              $row = $wpdb->get_row(
479 479
                  $wpdb->prepare(
480 480
                      "SELECT option_value FROM {$wpdb->options} WHERE option_name = %s LIMIT 1",
481
-                     '_transient_' . $ssn_key
481
+                     '_transient_'.$ssn_key
482 482
                  )
483 483
              );
484 484
              $session_data = is_object($row) ? $row->option_value : null;
485 485
              if ($session_data) {
486 486
                  $session_data = preg_replace_callback(
487 487
                      '!s:(d+):"(.*?)";!',
488
-                     function ($match) {
488
+                     function($match) {
489 489
                          return $match[1] === strlen($match[2])
490 490
                              ? $match[0]
491
-                             : 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
491
+                             : 's:'.strlen($match[2]).':"'.$match[2].'";';
492 492
                      },
493 493
                      $session_data
494 494
                  );
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
                      'event_espresso'
510 510
                  );
511 511
                  $msg .= WP_DEBUG
512
-                     ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
512
+                     ? '<br><pre>'.print_r($session_data, true).'</pre><br>'.$this->find_serialize_error($session_data)
513 513
                      : '';
514 514
                  throw new InvalidSessionDataException($msg, 0, $e);
515 515
              }
@@ -522,11 +522,11 @@  discard block
 block discarded – undo
522 522
                  'event_espresso'
523 523
              );
524 524
              $msg .= WP_DEBUG
525
-                 ? '<br><pre>' . print_r($session_data, true) . '</pre><br>' . $this->find_serialize_error($session_data)
525
+                 ? '<br><pre>'.print_r($session_data, true).'</pre><br>'.$this->find_serialize_error($session_data)
526 526
                  : '';
527 527
 	         throw new InvalidSessionDataException($msg);
528 528
          }
529
-	     if ( isset( $this->_session_data['transaction'] ) && absint( $this->_session_data['transaction'] ) !== 0 ) {
529
+	     if (isset($this->_session_data['transaction']) && absint($this->_session_data['transaction']) !== 0) {
530 530
 		     $this->_session_data['transaction'] = EEM_Transaction::instance()->get_one_by_ID(
531 531
 			     $this->_session_data['transaction']
532 532
 	         );
@@ -547,12 +547,12 @@  discard block
 block discarded – undo
547 547
 	  */
548 548
 	protected function _generate_session_id() {
549 549
 		// check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length
550
-		if ( isset( $_REQUEST[ 'EESID' ] ) ) {
551
-			$session_id = sanitize_text_field( $_REQUEST[ 'EESID' ] );
550
+		if (isset($_REQUEST['EESID'])) {
551
+			$session_id = sanitize_text_field($_REQUEST['EESID']);
552 552
 		} else {
553
-			$session_id = md5( session_id() . get_current_blog_id() . $this->_get_sid_salt() );
553
+			$session_id = md5(session_id().get_current_blog_id().$this->_get_sid_salt());
554 554
 		}
555
-		return apply_filters( 'FHEE__EE_Session___generate_session_id__session_id', $session_id );
555
+		return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id);
556 556
 	}
557 557
 
558 558
 
@@ -564,20 +564,20 @@  discard block
 block discarded – undo
564 564
 	  */
565 565
 	protected function _get_sid_salt() {
566 566
 		// was session id salt already saved to db ?
567
-		if ( empty( $this->_sid_salt ) ) {
567
+		if (empty($this->_sid_salt)) {
568 568
 			// no?  then maybe use WP defined constant
569
-			if ( defined( 'AUTH_SALT' ) ) {
569
+			if (defined('AUTH_SALT')) {
570 570
 				$this->_sid_salt = AUTH_SALT;
571 571
 			}
572 572
 			// if salt doesn't exist or is too short
573
-			if ( empty( $this->_sid_salt ) || strlen( $this->_sid_salt ) < 32 ) {
573
+			if (empty($this->_sid_salt) || strlen($this->_sid_salt) < 32) {
574 574
 				// create a new one
575
-				$this->_sid_salt = wp_generate_password( 64 );
575
+				$this->_sid_salt = wp_generate_password(64);
576 576
 			}
577 577
 			// and save it as a permanent session setting
578
-			$session_settings = get_option( 'ee_session_settings' );
579
-			$session_settings[ 'sid_salt' ] = $this->_sid_salt;
580
-			update_option( 'ee_session_settings', $session_settings );
578
+			$session_settings = get_option('ee_session_settings');
579
+			$session_settings['sid_salt'] = $this->_sid_salt;
580
+			update_option('ee_session_settings', $session_settings);
581 581
 		}
582 582
 		return $this->_sid_salt;
583 583
 	}
@@ -605,19 +605,19 @@  discard block
 block discarded – undo
605 605
 	  * @param bool $new_session
606 606
 	  * @return TRUE on success, FALSE on fail
607 607
 	  */
608
-	public function update( $new_session = FALSE ) {
609
-		$this->_session_data = isset( $this->_session_data )
610
-			&& is_array( $this->_session_data )
611
-			&& isset( $this->_session_data['id'])
608
+	public function update($new_session = FALSE) {
609
+		$this->_session_data = isset($this->_session_data)
610
+			&& is_array($this->_session_data)
611
+			&& isset($this->_session_data['id'])
612 612
 			? $this->_session_data
613 613
 			: array();
614
-		if ( empty( $this->_session_data )) {
614
+		if (empty($this->_session_data)) {
615 615
 			$this->_set_defaults();
616 616
 		}
617 617
 		$session_data = array();
618
-		foreach ( $this->_session_data as $key => $value ) {
618
+		foreach ($this->_session_data as $key => $value) {
619 619
 
620
-			switch( $key ) {
620
+			switch ($key) {
621 621
 
622 622
 				case 'id' :
623 623
 					// session ID
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 				break;
636 636
 
637 637
 				case 'init_access' :
638
-					$session_data['init_access'] = absint( $value );
638
+					$session_data['init_access'] = absint($value);
639 639
 				break;
640 640
 
641 641
 				case 'last_access' :
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 
646 646
 				case 'expiration' :
647 647
 					// when the session expires
648
-					$session_data['expiration'] = ! empty( $this->_expiration )
648
+					$session_data['expiration'] = ! empty($this->_expiration)
649 649
 						? $this->_expiration
650 650
 						: $session_data['init_access'] + $this->_lifespan;
651 651
 				break;
@@ -657,11 +657,11 @@  discard block
 block discarded – undo
657 657
 
658 658
 				case 'pages_visited' :
659 659
 					$page_visit = $this->_get_page_visit();
660
-					if ( $page_visit ) {
660
+					if ($page_visit) {
661 661
 						// set pages visited where the first will be the http referrer
662
-						$this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit;
662
+						$this->_session_data['pages_visited'][$this->_time] = $page_visit;
663 663
 						// we'll only save the last 10 page visits.
664
-						$session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 );
664
+						$session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
665 665
 					}
666 666
 				break;
667 667
 
@@ -675,9 +675,9 @@  discard block
 block discarded – undo
675 675
 
676 676
 		$this->_session_data = $session_data;
677 677
 		// creating a new session does not require saving to the db just yet
678
-		if ( ! $new_session ) {
678
+		if ( ! $new_session) {
679 679
 			// ready? let's save
680
-			if ( $this->_save_session_to_db() ) {
680
+			if ($this->_save_session_to_db()) {
681 681
 				return TRUE;
682 682
 			} else {
683 683
 				return FALSE;
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 	  * @param string $location
700 700
 	  * @return mixed
701 701
 	  */
702
-	 public function update_on_redirect( $location ) {
702
+	 public function update_on_redirect($location) {
703 703
 		 $this->update();
704 704
 		 return $location;
705 705
 	}
@@ -711,9 +711,9 @@  discard block
 block discarded – undo
711 711
 	 * 	@return bool
712 712
 	 */
713 713
 	private function _create_espresso_session( ) {
714
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, '' );
714
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, '');
715 715
 		// use the update function for now with $new_session arg set to TRUE
716
-		return  $this->update( TRUE ) ? TRUE : FALSE;
716
+		return  $this->update(TRUE) ? TRUE : FALSE;
717 717
 	}
718 718
 
719 719
 
@@ -739,15 +739,15 @@  discard block
 block discarded – undo
739 739
 				// OR an admin request that is NOT AJAX
740 740
 				|| (
741 741
 					is_admin()
742
-					&& ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
742
+					&& ! (defined('DOING_AJAX') && DOING_AJAX)
743 743
 				)
744 744
 			)
745 745
 		) {
746 746
 			return false;
747 747
 		}
748 748
 		$transaction = $this->_session_data['transaction'];
749
-		if ( $transaction instanceof EE_Transaction ) {
750
-			if ( ! $transaction->ID() ) {
749
+		if ($transaction instanceof EE_Transaction) {
750
+			if ( ! $transaction->ID()) {
751 751
 				$transaction->save();
752 752
 			}
753 753
 			$this->_session_data['transaction'] = $transaction->ID();
@@ -755,13 +755,13 @@  discard block
 block discarded – undo
755 755
 		// then serialize all of our session data
756 756
 		$session_data = serialize($this->_session_data);
757 757
 		// do we need to also encode it to avoid corrupted data when saved to the db?
758
-		$session_data = $this->_use_encryption ? $this->encryption->base64_string_encode( $session_data ) : $session_data;
758
+		$session_data = $this->_use_encryption ? $this->encryption->base64_string_encode($session_data) : $session_data;
759 759
 		// maybe save hash check
760
-		if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
761
-			set_transient( EE_Session::hash_check_prefix . $this->_sid, md5( $session_data ), $this->_lifespan );
760
+		if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
761
+			set_transient(EE_Session::hash_check_prefix.$this->_sid, md5($session_data), $this->_lifespan);
762 762
 		}
763 763
 		// we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient(  transient ID, data, expiry )
764
-		return set_transient( EE_Session::session_id_prefix . $this->_sid, $session_data, $this->_lifespan );
764
+		return set_transient(EE_Session::session_id_prefix.$this->_sid, $session_data, $this->_lifespan);
765 765
 	}
766 766
 
767 767
 
@@ -787,10 +787,10 @@  discard block
 block discarded – undo
787 787
 			'HTTP_FORWARDED',
788 788
 			'REMOTE_ADDR'
789 789
 		);
790
-		foreach ( $server_keys as $key ){
791
-			if ( isset( $_SERVER[ $key ] )) {
792
-				foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) {
793
-					if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) {
790
+		foreach ($server_keys as $key) {
791
+			if (isset($_SERVER[$key])) {
792
+				foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) {
793
+					if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) {
794 794
 						$visitor_ip = $ip;
795 795
 					}
796 796
 				}
@@ -809,32 +809,32 @@  discard block
 block discarded – undo
809 809
 	 *			@return string
810 810
 	 */
811 811
 	public function _get_page_visit() {
812
-		$page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
812
+		$page_visit = home_url('/').'wp-admin/admin-ajax.php';
813 813
 		// check for request url
814
-		if ( isset( $_SERVER['REQUEST_URI'] )) {
814
+		if (isset($_SERVER['REQUEST_URI'])) {
815 815
 			$http_host = '';
816 816
 			$page_id = '?';
817 817
 			$e_reg = '';
818
-			$request_uri = esc_url( $_SERVER['REQUEST_URI'] );
819
-			$ru_bits = explode( '?', $request_uri );
818
+			$request_uri = esc_url($_SERVER['REQUEST_URI']);
819
+			$ru_bits = explode('?', $request_uri);
820 820
 			$request_uri = $ru_bits[0];
821 821
 			// check for and grab host as well
822
-			if ( isset( $_SERVER['HTTP_HOST'] )) {
823
-				$http_host = esc_url( $_SERVER['HTTP_HOST'] );
822
+			if (isset($_SERVER['HTTP_HOST'])) {
823
+				$http_host = esc_url($_SERVER['HTTP_HOST']);
824 824
 			}
825 825
 			// check for page_id in SERVER REQUEST
826
-			if ( isset( $_REQUEST['page_id'] )) {
826
+			if (isset($_REQUEST['page_id'])) {
827 827
 				// rebuild $e_reg without any of the extra parameters
828
-				$page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&amp;';
828
+				$page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&amp;';
829 829
 			}
830 830
 			// check for $e_reg in SERVER REQUEST
831
-			if ( isset( $_REQUEST['ee'] )) {
831
+			if (isset($_REQUEST['ee'])) {
832 832
 				// rebuild $e_reg without any of the extra parameters
833
-				$e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] );
833
+				$e_reg = 'ee='.esc_attr($_REQUEST['ee']);
834 834
 			}
835
-			$page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' );
835
+			$page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?');
836 836
 		}
837
-		return $page_visit !== home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : '';
837
+		return $page_visit !== home_url('/wp-admin/admin-ajax.php') ? $page_visit : '';
838 838
 
839 839
 	}
840 840
 
@@ -863,14 +863,14 @@  discard block
 block discarded – undo
863 863
 	  * @param string $function
864 864
 	  * @return void
865 865
 	  */
866
-	public function clear_session( $class = '', $function = '' ) {
866
+	public function clear_session($class = '', $function = '') {
867 867
 		//echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '( ' . $class . '::' . $function . '() )</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span>    <b style="font-size:10px;">  ' . __LINE__ . ' </b></h3>';
868
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' .  $function . '()' );
868
+		do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()');
869 869
 		$this->reset_cart();
870 870
 		$this->reset_checkout();
871 871
 		$this->reset_transaction();
872 872
 		// wipe out everything that isn't a default session datum
873
-		$this->reset_data( array_keys( $this->_session_data ));
873
+		$this->reset_data(array_keys($this->_session_data));
874 874
 		// reset initial site access time and the session expiration
875 875
 		$this->_set_init_access_and_expiration();
876 876
 		$this->_save_session_to_db();
@@ -885,42 +885,42 @@  discard block
 block discarded – undo
885 885
 	  * @param bool  $show_all_notices
886 886
 	  * @return TRUE on success, FALSE on fail
887 887
 	  */
888
-	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
888
+	public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) {
889 889
 		// if $data_to_reset is not in an array, then put it in one
890
-		if ( ! is_array( $data_to_reset ) ) {
891
-			$data_to_reset = array ( $data_to_reset );
890
+		if ( ! is_array($data_to_reset)) {
891
+			$data_to_reset = array($data_to_reset);
892 892
 		}
893 893
 		// nothing ??? go home!
894
-		if ( empty( $data_to_reset )) {
895
-			EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
894
+		if (empty($data_to_reset)) {
895
+			EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
896 896
 			return FALSE;
897 897
 		}
898 898
 		$return_value = TRUE;
899 899
 		// since $data_to_reset is an array, cycle through the values
900
-		foreach ( $data_to_reset as $reset ) {
900
+		foreach ($data_to_reset as $reset) {
901 901
 
902 902
 			// first check to make sure it is a valid session var
903
-			if ( isset( $this->_session_data[ $reset ] )) {
903
+			if (isset($this->_session_data[$reset])) {
904 904
 				// then check to make sure it is not a default var
905
-				if ( ! array_key_exists( $reset, $this->_default_session_vars )) {
905
+				if ( ! array_key_exists($reset, $this->_default_session_vars)) {
906 906
 					// remove session var
907
-					unset( $this->_session_data[ $reset ] );
908
-					if ( $show_all_notices ) {
909
-						EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
907
+					unset($this->_session_data[$reset]);
908
+					if ($show_all_notices) {
909
+						EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
910 910
 					}
911
-					$return_value = !isset($return_value) ? TRUE : $return_value;
911
+					$return_value = ! isset($return_value) ? TRUE : $return_value;
912 912
 
913 913
 				} else {
914 914
 					// yeeeeeeeeerrrrrrrrrrr OUT !!!!
915
-					if ( $show_all_notices ) {
916
-						EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
915
+					if ($show_all_notices) {
916
+						EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
917 917
 					}
918 918
 					$return_value = FALSE;
919 919
 				}
920 920
 
921
-			} else if ( $show_all_notices ) {
921
+			} else if ($show_all_notices) {
922 922
 				// oops! that session var does not exist!
923
-				EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
923
+				EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
924 924
 				$return_value = FALSE;
925 925
 			}
926 926
 
@@ -940,8 +940,8 @@  discard block
 block discarded – undo
940 940
 	 *   @access public
941 941
 	 */
942 942
 	public function wp_loaded() {
943
-		if ( isset(  EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) {
944
-			$this->clear_session( __CLASS__, __FUNCTION__ );
943
+		if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) {
944
+			$this->clear_session(__CLASS__, __FUNCTION__);
945 945
 		}
946 946
 	}
947 947
 
@@ -966,24 +966,24 @@  discard block
 block discarded – undo
966 966
 	  */
967 967
 	 public function garbage_collection() {
968 968
 		 // only perform during regular requests
969
-		 if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) {
969
+		 if ( ! defined('DOING_AJAX') || ! DOING_AJAX) {
970 970
 			 /** @type WPDB $wpdb */
971 971
 			 global $wpdb;
972 972
 			 // since transient expiration timestamps are set in the future, we can compare against NOW
973 973
 			 $expiration = time();
974
-			 $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 );
974
+			 $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2);
975 975
 			 // filter the query limit. Set to 0 to turn off garbage collection
976
-			 $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 ));
976
+			 $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50));
977 977
 			 // non-zero LIMIT means take out the trash
978
-			 if ( $expired_session_transient_delete_query_limit ) {
978
+			 if ($expired_session_transient_delete_query_limit) {
979 979
 				 //array of transient keys that require garbage collection
980 980
 				 $session_keys = array(
981 981
 					 EE_Session::session_id_prefix,
982 982
 					 EE_Session::hash_check_prefix,
983 983
 				 );
984
-				 foreach ( $session_keys as $session_key ) {
985
-					 $session_key = str_replace( '_', '\_', $session_key );
986
-					 $session_key = '\_transient\_timeout\_' . $session_key . '%';
984
+				 foreach ($session_keys as $session_key) {
985
+					 $session_key = str_replace('_', '\_', $session_key);
986
+					 $session_key = '\_transient\_timeout\_'.$session_key.'%';
987 987
 					 $SQL = "
988 988
 					SELECT option_name
989 989
 					FROM {$wpdb->options}
@@ -993,25 +993,25 @@  discard block
 block discarded – undo
993 993
 					OR option_value > {$too_far_in_the_the_future} )
994 994
 					LIMIT {$expired_session_transient_delete_query_limit}
995 995
 				";
996
-					 $expired_sessions = $wpdb->get_col( $SQL );
996
+					 $expired_sessions = $wpdb->get_col($SQL);
997 997
 					 // valid results?
998
-					 if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions ) ) {
998
+					 if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) {
999 999
 						 // format array of results into something usable within the actual DELETE query's IN clause
1000 1000
 						 $expired = array();
1001
-						 foreach ( $expired_sessions as $expired_session ) {
1002
-							 $expired[ ] = "'" . $expired_session . "'";
1003
-							 $expired[ ] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'";
1001
+						 foreach ($expired_sessions as $expired_session) {
1002
+							 $expired[] = "'".$expired_session."'";
1003
+							 $expired[] = "'".str_replace('timeout_', '', $expired_session)."'";
1004 1004
 						 }
1005
-						 $expired = implode( ', ', $expired );
1005
+						 $expired = implode(', ', $expired);
1006 1006
 						 $SQL = "
1007 1007
 						DELETE FROM {$wpdb->options}
1008 1008
 						WHERE option_name
1009 1009
 						IN ( $expired );
1010 1010
 					 ";
1011
-						 $results = $wpdb->query( $SQL );
1011
+						 $results = $wpdb->query($SQL);
1012 1012
 						 // if something went wrong, then notify the admin
1013
-						 if ( $results instanceof WP_Error && is_admin() ) {
1014
-							 EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
1013
+						 if ($results instanceof WP_Error && is_admin()) {
1014
+							 EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
1015 1015
 						 }
1016 1016
 					 }
1017 1017
 				 }
@@ -1032,34 +1032,34 @@  discard block
 block discarded – undo
1032 1032
 	  * @param $data1
1033 1033
 	  * @return string
1034 1034
 	  */
1035
-	 private function find_serialize_error( $data1 ) {
1035
+	 private function find_serialize_error($data1) {
1036 1036
 		$error = "<pre>";
1037 1037
 		 $data2 = preg_replace_callback(
1038 1038
 			 '!s:(\d+):"(.*?)";!',
1039
-			 function ( $match ) {
1040
-				 return ( $match[1] === strlen( $match[2] ) )
1039
+			 function($match) {
1040
+				 return ($match[1] === strlen($match[2]))
1041 1041
 					 ? $match[0]
1042 1042
 					 : 's:'
1043
-					   . strlen( $match[2] )
1043
+					   . strlen($match[2])
1044 1044
 					   . ':"'
1045 1045
 					   . $match[2]
1046 1046
 					   . '";';
1047 1047
 			 },
1048 1048
 			 $data1
1049 1049
 		 );
1050
-		$max = ( strlen( $data1 ) > strlen( $data2 ) ) ? strlen( $data1 ) : strlen( $data2 );
1051
-		$error .= $data1 . PHP_EOL;
1052
-		$error .= $data2 . PHP_EOL;
1053
-		for ( $i = 0; $i < $max; $i++ ) {
1054
-			if ( @$data1[ $i ] !== @$data2[ $i ] ) {
1055
-				$error .= "Difference " . @$data1[ $i ] . " != " . @$data2[ $i ] . PHP_EOL;
1056
-				$error .= "\t-> ORD number " . ord( @$data1[ $i ] ) . " != " . ord( @$data2[ $i ] ) . PHP_EOL;
1057
-				$error .= "\t-> Line Number = $i" . PHP_EOL;
1058
-				$start = ( $i - 20 );
1059
-				$start = ( $start < 0 ) ? 0 : $start;
1050
+		$max = (strlen($data1) > strlen($data2)) ? strlen($data1) : strlen($data2);
1051
+		$error .= $data1.PHP_EOL;
1052
+		$error .= $data2.PHP_EOL;
1053
+		for ($i = 0; $i < $max; $i++) {
1054
+			if (@$data1[$i] !== @$data2[$i]) {
1055
+				$error .= "Difference ".@$data1[$i]." != ".@$data2[$i].PHP_EOL;
1056
+				$error .= "\t-> ORD number ".ord(@$data1[$i])." != ".ord(@$data2[$i]).PHP_EOL;
1057
+				$error .= "\t-> Line Number = $i".PHP_EOL;
1058
+				$start = ($i - 20);
1059
+				$start = ($start < 0) ? 0 : $start;
1060 1060
 				$length = 40;
1061 1061
 				$point = $max - $i;
1062
-				if ( $point < 20 ) {
1062
+				if ($point < 20) {
1063 1063
 					$rlength = 1;
1064 1064
 					$rpoint = -$point;
1065 1065
 				} else {
@@ -1068,16 +1068,16 @@  discard block
 block discarded – undo
1068 1068
 				}
1069 1069
 				$error .= "\t-> Section Data1  = ";
1070 1070
 				$error .= substr_replace(
1071
-					substr( $data1, $start, $length ),
1072
-					"<b style=\"color:green\">{$data1[ $i ]}</b>",
1071
+					substr($data1, $start, $length),
1072
+					"<b style=\"color:green\">{$data1[$i]}</b>",
1073 1073
 					$rpoint,
1074 1074
 					$rlength
1075 1075
 				);
1076 1076
 				$error .= PHP_EOL;
1077 1077
 				$error .= "\t-> Section Data2  = ";
1078 1078
 				$error .= substr_replace(
1079
-					substr( $data2, $start, $length ),
1080
-					"<b style=\"color:red\">{$data2[ $i ]}</b>",
1079
+					substr($data2, $start, $length),
1080
+					"<b style=\"color:red\">{$data2[$i]}</b>",
1081 1081
 					$rpoint,
1082 1082
 					$rlength
1083 1083
 				);
Please login to merge, or discard this patch.
core/exceptions/InvalidSessionDataException.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\exceptions;
3 3
 
4
-defined( 'ABSPATH' ) || exit;
4
+defined('ABSPATH') || exit;
5 5
 
6 6
 
7 7
 
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
 	 * @param int        $code
23 23
 	 * @param \Exception $previous
24 24
 	 */
25
-	public function __construct( $message = '', $code = 0, \Exception $previous = null ) {
26
-		if ( empty( $message ) ) {
27
-			$message = esc_html__( 'The session data is either missing or invalid.', 'event_espresso' );
25
+	public function __construct($message = '', $code = 0, \Exception $previous = null) {
26
+		if (empty($message)) {
27
+			$message = esc_html__('The session data is either missing or invalid.', 'event_espresso');
28 28
 		}
29
-		parent::__construct( $message, $code, $previous );
29
+		parent::__construct($message, $code, $previous);
30 30
 	}
31 31
 
32 32
 
Please login to merge, or discard this patch.
support/templates/support_admin_details_additional_information.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1 1
 <div class="padding">
2
-	<p><?php printf( esc_html__( 'Check out the %1$sroadmap for Event Espresso%2$s.', 'event_espresso' ), '<a href="https://trello.com/b/zg9DCIpe/event-espresso-public-roadmap" target="_blank">','</a>' ); ?></p>
2
+	<p><?php printf(esc_html__('Check out the %1$sroadmap for Event Espresso%2$s.', 'event_espresso'), '<a href="https://trello.com/b/zg9DCIpe/event-espresso-public-roadmap" target="_blank">', '</a>'); ?></p>
3 3
 </div>
4 4
\ No newline at end of file
Please login to merge, or discard this patch.
admin/extend/support/templates/support_admin_details_faq.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <div class="padding">
2
-	<h3><?php esc_html_e( 'Frequently Asked Questions about Event Espresso', 'event_espresso' ); ?></h3>
2
+	<h3><?php esc_html_e('Frequently Asked Questions about Event Espresso', 'event_espresso'); ?></h3>
3 3
 	
4
-	<h4><?php esc_html_e( 'New to Event Espresso?', 'event_espresso' ); ?></h4>
4
+	<h4><?php esc_html_e('New to Event Espresso?', 'event_espresso'); ?></h4>
5 5
 
6
-	<p><?php printf( esc_html__( 'Check out the %1$squick start guide for Event Espresso 4%2$s. It has recommendations, tips, and tutorials so you can get your project started %3$squicker%4$s.', 'event_espresso' ), '<a href="https://eventespresso.com/wiki/welcome-to-event-espresso/#event-espresso-4" target="_blank">','</a>','<em>','</em>' ); ?></p>
6
+	<p><?php printf(esc_html__('Check out the %1$squick start guide for Event Espresso 4%2$s. It has recommendations, tips, and tutorials so you can get your project started %3$squicker%4$s.', 'event_espresso'), '<a href="https://eventespresso.com/wiki/welcome-to-event-espresso/#event-espresso-4" target="_blank">', '</a>', '<em>', '</em>'); ?></p>
7 7
 </div>
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_events-details.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,33 +3,33 @@
 block discarded – undo
3 3
 global $post;
4 4
 ?>
5 5
 <div class="event-content">
6
-<?php if ( apply_filters( 'FHEE__content_espresso_events_details_template__display_entry_meta', TRUE )): ?>
6
+<?php if (apply_filters('FHEE__content_espresso_events_details_template__display_entry_meta', TRUE)): ?>
7 7
 	<div class="entry-meta">
8
-		<span class="tags-links"><?php espresso_event_categories( $post->ID, TRUE, TRUE ); ?></span>
8
+		<span class="tags-links"><?php espresso_event_categories($post->ID, TRUE, TRUE); ?></span>
9 9
 	<?php
10
-		if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
10
+		if ( ! post_password_required() && (comments_open() || get_comments_number())) :
11 11
 	?>
12
-	<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'event_espresso' ), __( '1 Comment', 'event_espresso' ), __( '% Comments', 'event_espresso' ) ); ?></span>
12
+	<span class="comments-link"><?php comments_popup_link(__('Leave a comment', 'event_espresso'), __('1 Comment', 'event_espresso'), __('% Comments', 'event_espresso')); ?></span>
13 13
 	<?php
14 14
 		endif;
15
-		edit_post_link( __( 'Edit', 'event_espresso' ), '<span class="edit-link">', '</span>' );
15
+		edit_post_link(__('Edit', 'event_espresso'), '<span class="edit-link">', '</span>');
16 16
 	?>
17 17
 	</div>
18 18
 <?php endif;
19
-	$event_phone = espresso_event_phone( $post->ID, FALSE );
20
-	if ( $event_phone != '' ) : ?>
19
+	$event_phone = espresso_event_phone($post->ID, FALSE);
20
+	if ($event_phone != '') : ?>
21 21
 	<p>
22
-		<span class="small-text"><strong><?php _e( 'Event Phone:', 'event_espresso' ); ?> </strong></span> <?php echo $event_phone; ?>
22
+		<span class="small-text"><strong><?php _e('Event Phone:', 'event_espresso'); ?> </strong></span> <?php echo $event_phone; ?>
23 23
 	</p>
24
-<?php endif;  ?>
24
+<?php endif; ?>
25 25
 <?php
26
-	if ( apply_filters( 'FHEE__content_espresso_events_details_template__display_the_content', true ) ) {
27
-		do_action( 'AHEE_event_details_before_the_content', $post );
26
+	if (apply_filters('FHEE__content_espresso_events_details_template__display_the_content', true)) {
27
+		do_action('AHEE_event_details_before_the_content', $post);
28 28
 		echo apply_filters(
29 29
 			'FHEE__content_espresso_events_details_template__the_content',
30
-			espresso_event_content_or_excerpt( 55, null, false ) 
30
+			espresso_event_content_or_excerpt(55, null, false) 
31 31
 		);
32
-		do_action( 'AHEE_event_details_after_the_content', $post );
32
+		do_action('AHEE_event_details_after_the_content', $post);
33 33
 	}
34 34
  ?>
35 35
 </div>
Please login to merge, or discard this patch.
admin_pages/general_settings/AdminOptionsSettings.php 2 patches
Indentation   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -30,224 +30,224 @@
 block discarded – undo
30 30
 class AdminOptionsSettings extends FormHandler
31 31
 {
32 32
 
33
-    protected $template_args = array();
34
-
35
-    /**
36
-     * Form constructor.
37
-     *
38
-     * @param \EE_Registry $registry
39
-     */
40
-    public function __construct(\EE_Registry $registry) {
41
-        parent::__construct(
42
-            esc_html__('Admin Options', 'event_espresso'),
43
-            esc_html__('Admin Options', 'event_espresso'),
44
-            'admin_option_settings',
45
-            '',
46
-            FormHandler::DO_NOT_SETUP_FORM,
47
-            $registry
48
-        );
49
-    }
50
-
51
-
52
-
53
-    /**
54
-     * @param array $template_args
55
-     */
56
-    public function setTemplateArgs(array $template_args)
57
-    {
58
-        $this->template_args = $template_args;
59
-    }
60
-
61
-
62
-
63
-    /**
64
-     * creates and returns the actual form
65
-     *
66
-     * @return EE_Form_Section_Proper
67
-     * @throws \EE_Error
68
-     */
69
-    public function generate()
70
-    {
71
-        $form = new \EE_Form_Section_Proper(
72
-            array(
73
-                'name'            => 'admin_option_settings',
74
-                'html_id'         => 'admin_option_settings',
75
-                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
76
-                'subsections'     => array(
77
-                    'help_tour_activation_hdr' => new EE_Form_Section_HTML(
78
-                        EEH_HTML::h2(
79
-                            esc_html__('Help Tour Global Activation', 'event_espresso')
80
-                            . ' '
81
-                            . EEH_HTML::span(
82
-                                EEH_Template::get_help_tab_link('help_tour_activation_info'),
83
-                                'help_tour_activation'
84
-                            ),
85
-                            '', 'ee-admin-settings-hdr'
86
-                        )
87
-                    ),
88
-                    'help_tour_activation' => new EE_Yes_No_Input(
89
-                        array(
90
-                            'html_label_text' => esc_html__('Activate Global Help Tours?', 'event_espresso'),
91
-                            'html_help_text'  => esc_html__(
92
-                                'This toggles whether the Event Espresso help tours are active globally or not.',
93
-                                'event_espresso'
94
-                            ),
95
-                            'default'         => isset($this->registry->CFG->admin->help_tour_activation)
96
-                                ? filter_var($this->registry->CFG->admin->help_tour_activation, FILTER_VALIDATE_BOOLEAN)
97
-                                : true,
98
-                            'required'        => false
99
-                        )
100
-                    ),
101
-                    'compatibility_hdr'   => new EE_Form_Section_HTML(
102
-                        EEH_HTML::h2(
103
-                            esc_html__('Compatibility Settings', 'event_espresso'),
104
-                            '', 'ee-admin-settings-hdr'
105
-                        )
106
-                    ),
107
-                    'encode_session_data' => new EE_Yes_No_Input(
108
-                        array(
109
-                            'html_label_text' => esc_html__('Encode Session Data?', 'event_espresso'),
110
-                            'html_help_text'  => sprintf(
111
-                                esc_html__(
112
-                                    'Some servers and database configurations can cause problems when saving the Event Espresso session data. Setting this option to "Yes" adds an extra layer of encoding to session data to prevent serialization errors, but can be incompatible with some server configurations.%1$sIf you receive "500 internal server" type errors during registration, try turning this option on.%1$sIf you get fatal PHP errors regarding missing base64 functions, then turn this option off.',
113
-                                    'event_espresso'
114
-                                ),
115
-                                '<br>'
116
-                            ),
117
-                            'default'         => $this->registry->CFG->admin->encode_session_data(),
118
-                            'required'        => false
119
-                        )
120
-                    ),
121
-                )
122
-            )
123
-        );
124
-        if (
125
-            $this->registry->CAP->current_user_can(
126
-                'manage_options',
127
-                'display_admin_settings_options_promote_and_affiliate'
128
-            )
129
-        ) {
130
-            $form->add_subsections(
131
-                array(
132
-                    'promote_ee_hdr'  => new EE_Form_Section_HTML(
133
-                        EEH_HTML::h2(
134
-                            esc_html__('Promote Event Espresso', 'event_espresso')
135
-                            . ' '
136
-                            . EEH_HTML::span(
137
-                                EEH_Template::get_help_tab_link('affiliate_info'),
138
-                                'affiliate_info'
139
-                            ),
140
-                            '', 'ee-admin-settings-hdr'
141
-                        )
142
-                    ),
143
-                    'show_reg_footer' => new EE_Yes_No_Input(
144
-                        array(
145
-                            'html_label_text' => esc_html__(
146
-                                                     'Link to Event Espresso in your Registration Page?',
147
-                                                     'event_espresso'
148
-                                                 )
149
-                                                 . EEH_Template::get_help_tab_link('email_validation_info'),
150
-                            'html_help_text'  => esc_html__(
151
-                                'adds an unobtrusive link to Event Espresso\'s website in the footer of your registration form. Get an affiliate link (see below) and make money if people click the link and purchase Event Espresso.',
152
-                                'event_espresso'
153
-                            ),
154
-                            'default'         => isset($this->registry->CFG->admin->show_reg_footer)
155
-                                ? filter_var($this->registry->CFG->admin->show_reg_footer, FILTER_VALIDATE_BOOLEAN)
156
-                                : true,
157
-                            'required'        => false
158
-                        )
159
-                    ),
160
-                    'affiliate_id'    => new EE_Text_Input(
161
-                        array(
162
-                            'html_label_text' => sprintf(
163
-                                esc_html__('Event Espresso %sAffiliate%s ID', 'event_espresso'),
164
-                                '<a href="http://eventespresso.com/affiliates/" target="_blank">',
165
-                                '</a>'
166
-                            ),
167
-                            'html_help_text'  => esc_html__(
168
-                                'Earn cash for promoting Event Espresso.',
169
-                                'event_espresso'
170
-                            ),
171
-                            'html_class'      => 'regular-text',
172
-                            'default'         => isset($this->registry->CFG->admin->affiliate_id)
173
-                                ? $this->registry->CFG->admin->get_pretty('affiliate_id')
174
-                                : '',
175
-                            'required'        => false
176
-                        )
177
-                    ),
178
-                ),
179
-                'help_tour_activation_hdr'
180
-            );
181
-        }
182
-        return $form;
183
-    }
184
-
185
-
186
-
187
-    /**
188
-     * takes the generated form and displays it along with ony other non-form HTML that may be required
189
-     * returns a string of HTML that can be directly echoed in a template
190
-     *
191
-     * @return string
192
-     * @throws LogicException
193
-     * @throws \EE_Error
194
-     */
195
-    public function display()
196
-    {
197
-        add_filter(
198
-            'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form',
199
-            array($this, 'handleOldAdminOptionsSettingsAction')
200
-        );
201
-        return parent::display();
202
-    }
203
-
204
-
205
-
206
-    /**
207
-     * @return string
208
-     */
209
-    public function handleOldAdminOptionsSettingsAction()
210
-    {
211
-        ob_start();
212
-        do_action('AHEE__admin_option_settings__template__before', $this->template_args);
213
-        return ob_get_clean();
214
-    }
215
-
216
-
217
-
218
-    /**
219
-     * handles processing the form submission
220
-     * returns true or false depending on whether the form was processed successfully or not
221
-     *
222
-     * @param array $form_data
223
-     * @return bool
224
-     * @throws InvalidFormSubmissionException
225
-     * @throws EE_Error
226
-     * @throws LogicException
227
-     * @throws InvalidArgumentException
228
-     * @throws InvalidDataTypeException
229
-     */
230
-    public function process($form_data = array())
231
-    {
232
-        // process form
233
-        $valid_data = (array)parent::process($form_data);
234
-        if (empty($valid_data)) {
235
-            return false;
236
-        }
237
-        $this->registry->CFG->admin->show_reg_footer = isset( $form_data['show_reg_footer'] )
238
-            ? absint( $form_data['show_reg_footer'] )
239
-            : $this->registry->CFG->admin->show_reg_footer;
240
-        $this->registry->CFG->admin->affiliate_id = isset( $form_data['affiliate_id'] )
241
-            ? sanitize_text_field( $form_data['affiliate_id'] )
242
-            : $this->registry->CFG->admin->affiliate_id;
243
-        $this->registry->CFG->admin->help_tour_activation = isset( $form_data['help_tour_activation'] )
244
-            ? absint( $form_data['help_tour_activation'])
245
-            : $this->registry->CFG->admin->help_tour_activation;
246
-        if (isset($form_data['encode_session_data'])) {
247
-            $this->registry->CFG->admin->set_encode_session_data($form_data['encode_session_data']);
248
-        }
249
-        return false;
250
-    }
33
+	protected $template_args = array();
34
+
35
+	/**
36
+	 * Form constructor.
37
+	 *
38
+	 * @param \EE_Registry $registry
39
+	 */
40
+	public function __construct(\EE_Registry $registry) {
41
+		parent::__construct(
42
+			esc_html__('Admin Options', 'event_espresso'),
43
+			esc_html__('Admin Options', 'event_espresso'),
44
+			'admin_option_settings',
45
+			'',
46
+			FormHandler::DO_NOT_SETUP_FORM,
47
+			$registry
48
+		);
49
+	}
50
+
51
+
52
+
53
+	/**
54
+	 * @param array $template_args
55
+	 */
56
+	public function setTemplateArgs(array $template_args)
57
+	{
58
+		$this->template_args = $template_args;
59
+	}
60
+
61
+
62
+
63
+	/**
64
+	 * creates and returns the actual form
65
+	 *
66
+	 * @return EE_Form_Section_Proper
67
+	 * @throws \EE_Error
68
+	 */
69
+	public function generate()
70
+	{
71
+		$form = new \EE_Form_Section_Proper(
72
+			array(
73
+				'name'            => 'admin_option_settings',
74
+				'html_id'         => 'admin_option_settings',
75
+				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
76
+				'subsections'     => array(
77
+					'help_tour_activation_hdr' => new EE_Form_Section_HTML(
78
+						EEH_HTML::h2(
79
+							esc_html__('Help Tour Global Activation', 'event_espresso')
80
+							. ' '
81
+							. EEH_HTML::span(
82
+								EEH_Template::get_help_tab_link('help_tour_activation_info'),
83
+								'help_tour_activation'
84
+							),
85
+							'', 'ee-admin-settings-hdr'
86
+						)
87
+					),
88
+					'help_tour_activation' => new EE_Yes_No_Input(
89
+						array(
90
+							'html_label_text' => esc_html__('Activate Global Help Tours?', 'event_espresso'),
91
+							'html_help_text'  => esc_html__(
92
+								'This toggles whether the Event Espresso help tours are active globally or not.',
93
+								'event_espresso'
94
+							),
95
+							'default'         => isset($this->registry->CFG->admin->help_tour_activation)
96
+								? filter_var($this->registry->CFG->admin->help_tour_activation, FILTER_VALIDATE_BOOLEAN)
97
+								: true,
98
+							'required'        => false
99
+						)
100
+					),
101
+					'compatibility_hdr'   => new EE_Form_Section_HTML(
102
+						EEH_HTML::h2(
103
+							esc_html__('Compatibility Settings', 'event_espresso'),
104
+							'', 'ee-admin-settings-hdr'
105
+						)
106
+					),
107
+					'encode_session_data' => new EE_Yes_No_Input(
108
+						array(
109
+							'html_label_text' => esc_html__('Encode Session Data?', 'event_espresso'),
110
+							'html_help_text'  => sprintf(
111
+								esc_html__(
112
+									'Some servers and database configurations can cause problems when saving the Event Espresso session data. Setting this option to "Yes" adds an extra layer of encoding to session data to prevent serialization errors, but can be incompatible with some server configurations.%1$sIf you receive "500 internal server" type errors during registration, try turning this option on.%1$sIf you get fatal PHP errors regarding missing base64 functions, then turn this option off.',
113
+									'event_espresso'
114
+								),
115
+								'<br>'
116
+							),
117
+							'default'         => $this->registry->CFG->admin->encode_session_data(),
118
+							'required'        => false
119
+						)
120
+					),
121
+				)
122
+			)
123
+		);
124
+		if (
125
+			$this->registry->CAP->current_user_can(
126
+				'manage_options',
127
+				'display_admin_settings_options_promote_and_affiliate'
128
+			)
129
+		) {
130
+			$form->add_subsections(
131
+				array(
132
+					'promote_ee_hdr'  => new EE_Form_Section_HTML(
133
+						EEH_HTML::h2(
134
+							esc_html__('Promote Event Espresso', 'event_espresso')
135
+							. ' '
136
+							. EEH_HTML::span(
137
+								EEH_Template::get_help_tab_link('affiliate_info'),
138
+								'affiliate_info'
139
+							),
140
+							'', 'ee-admin-settings-hdr'
141
+						)
142
+					),
143
+					'show_reg_footer' => new EE_Yes_No_Input(
144
+						array(
145
+							'html_label_text' => esc_html__(
146
+													 'Link to Event Espresso in your Registration Page?',
147
+													 'event_espresso'
148
+												 )
149
+												 . EEH_Template::get_help_tab_link('email_validation_info'),
150
+							'html_help_text'  => esc_html__(
151
+								'adds an unobtrusive link to Event Espresso\'s website in the footer of your registration form. Get an affiliate link (see below) and make money if people click the link and purchase Event Espresso.',
152
+								'event_espresso'
153
+							),
154
+							'default'         => isset($this->registry->CFG->admin->show_reg_footer)
155
+								? filter_var($this->registry->CFG->admin->show_reg_footer, FILTER_VALIDATE_BOOLEAN)
156
+								: true,
157
+							'required'        => false
158
+						)
159
+					),
160
+					'affiliate_id'    => new EE_Text_Input(
161
+						array(
162
+							'html_label_text' => sprintf(
163
+								esc_html__('Event Espresso %sAffiliate%s ID', 'event_espresso'),
164
+								'<a href="http://eventespresso.com/affiliates/" target="_blank">',
165
+								'</a>'
166
+							),
167
+							'html_help_text'  => esc_html__(
168
+								'Earn cash for promoting Event Espresso.',
169
+								'event_espresso'
170
+							),
171
+							'html_class'      => 'regular-text',
172
+							'default'         => isset($this->registry->CFG->admin->affiliate_id)
173
+								? $this->registry->CFG->admin->get_pretty('affiliate_id')
174
+								: '',
175
+							'required'        => false
176
+						)
177
+					),
178
+				),
179
+				'help_tour_activation_hdr'
180
+			);
181
+		}
182
+		return $form;
183
+	}
184
+
185
+
186
+
187
+	/**
188
+	 * takes the generated form and displays it along with ony other non-form HTML that may be required
189
+	 * returns a string of HTML that can be directly echoed in a template
190
+	 *
191
+	 * @return string
192
+	 * @throws LogicException
193
+	 * @throws \EE_Error
194
+	 */
195
+	public function display()
196
+	{
197
+		add_filter(
198
+			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form',
199
+			array($this, 'handleOldAdminOptionsSettingsAction')
200
+		);
201
+		return parent::display();
202
+	}
203
+
204
+
205
+
206
+	/**
207
+	 * @return string
208
+	 */
209
+	public function handleOldAdminOptionsSettingsAction()
210
+	{
211
+		ob_start();
212
+		do_action('AHEE__admin_option_settings__template__before', $this->template_args);
213
+		return ob_get_clean();
214
+	}
215
+
216
+
217
+
218
+	/**
219
+	 * handles processing the form submission
220
+	 * returns true or false depending on whether the form was processed successfully or not
221
+	 *
222
+	 * @param array $form_data
223
+	 * @return bool
224
+	 * @throws InvalidFormSubmissionException
225
+	 * @throws EE_Error
226
+	 * @throws LogicException
227
+	 * @throws InvalidArgumentException
228
+	 * @throws InvalidDataTypeException
229
+	 */
230
+	public function process($form_data = array())
231
+	{
232
+		// process form
233
+		$valid_data = (array)parent::process($form_data);
234
+		if (empty($valid_data)) {
235
+			return false;
236
+		}
237
+		$this->registry->CFG->admin->show_reg_footer = isset( $form_data['show_reg_footer'] )
238
+			? absint( $form_data['show_reg_footer'] )
239
+			: $this->registry->CFG->admin->show_reg_footer;
240
+		$this->registry->CFG->admin->affiliate_id = isset( $form_data['affiliate_id'] )
241
+			? sanitize_text_field( $form_data['affiliate_id'] )
242
+			: $this->registry->CFG->admin->affiliate_id;
243
+		$this->registry->CFG->admin->help_tour_activation = isset( $form_data['help_tour_activation'] )
244
+			? absint( $form_data['help_tour_activation'])
245
+			: $this->registry->CFG->admin->help_tour_activation;
246
+		if (isset($form_data['encode_session_data'])) {
247
+			$this->registry->CFG->admin->set_encode_session_data($form_data['encode_session_data']);
248
+		}
249
+		return false;
250
+	}
251 251
 
252 252
 }
253 253
 // End of file AdminOptionsSettings.php
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -230,18 +230,18 @@
 block discarded – undo
230 230
     public function process($form_data = array())
231 231
     {
232 232
         // process form
233
-        $valid_data = (array)parent::process($form_data);
233
+        $valid_data = (array) parent::process($form_data);
234 234
         if (empty($valid_data)) {
235 235
             return false;
236 236
         }
237
-        $this->registry->CFG->admin->show_reg_footer = isset( $form_data['show_reg_footer'] )
238
-            ? absint( $form_data['show_reg_footer'] )
237
+        $this->registry->CFG->admin->show_reg_footer = isset($form_data['show_reg_footer'])
238
+            ? absint($form_data['show_reg_footer'])
239 239
             : $this->registry->CFG->admin->show_reg_footer;
240
-        $this->registry->CFG->admin->affiliate_id = isset( $form_data['affiliate_id'] )
241
-            ? sanitize_text_field( $form_data['affiliate_id'] )
240
+        $this->registry->CFG->admin->affiliate_id = isset($form_data['affiliate_id'])
241
+            ? sanitize_text_field($form_data['affiliate_id'])
242 242
             : $this->registry->CFG->admin->affiliate_id;
243
-        $this->registry->CFG->admin->help_tour_activation = isset( $form_data['help_tour_activation'] )
244
-            ? absint( $form_data['help_tour_activation'])
243
+        $this->registry->CFG->admin->help_tour_activation = isset($form_data['help_tour_activation'])
244
+            ? absint($form_data['help_tour_activation'])
245 245
             : $this->registry->CFG->admin->help_tour_activation;
246 246
         if (isset($form_data['encode_session_data'])) {
247 247
             $this->registry->CFG->admin->set_encode_session_data($form_data['encode_session_data']);
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Text_Input.input.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,19 +8,19 @@  discard block
 block discarded – undo
8 8
  *
9 9
  * This input has a default validation strategy of plaintext (which can be removed after construction)
10 10
  */
11
-class EE_Text_Input extends EE_Form_Input_Base{
11
+class EE_Text_Input extends EE_Form_Input_Base {
12 12
 
13 13
 
14 14
 	/**
15 15
 	 * @param array $options
16 16
 	 */
17
-	public function __construct($options = array()){
17
+	public function __construct($options = array()) {
18 18
 		$this->_set_display_strategy(new EE_Text_Input_Display_Strategy());
19 19
 		$this->_set_normalization_strategy(new EE_Text_Normalization());
20 20
 		parent::__construct($options);
21 21
 		//if the input hasn't specifically mentioned a more lenient validation strategy,
22 22
 		//apply plaintext validation strategy
23
-		if( ! $this->has_validation_strategy(
23
+		if ( ! $this->has_validation_strategy(
24 24
 				array(
25 25
 					'EE_Full_HTML_Validation_Strategy',
26 26
 					'EE_Simple_HTML_Validation_Strategy'
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		) {
30 30
 			//by default we use the plaintext validation. If you want something else,
31 31
 			//just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy()
32
-			$this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy() );
32
+			$this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy());
33 33
 		}
34 34
 	}
35 35
 
Please login to merge, or discard this patch.