Completed
Branch BUG-10144-query-quotes (e5d611)
by
unknown
37:22 queued 18:36
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.
Spacing   +182 added lines, -182 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,36 +154,36 @@  discard block
 block discarded – undo
154 154
 		 * 		}
155 155
 		 */
156 156
 		// retrieve session options from db
157
-		$session_settings = get_option( 'ee_session_settings' );
158
-		if ( $session_settings !== FALSE ) {
157
+		$session_settings = get_option('ee_session_settings');
158
+		if ($session_settings !== FALSE) {
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
 		}
166 166
 		// are we using encryption?
167
-		if ( $this->_use_encryption && $encryption instanceof EE_Encryption ) {
167
+		if ($this->_use_encryption && $encryption instanceof EE_Encryption) {
168 168
 			// encrypt data via: $this->encryption->encrypt();
169 169
 			$this->encryption = $encryption;
170 170
 		}
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
 		// check for existing session and retrieve it from db
177
-		if ( ! $this->_espresso_session() ) {
177
+		if ( ! $this->_espresso_session()) {
178 178
 			// or just start a new one
179 179
 			$this->_create_espresso_session();
180 180
 		}
181 181
 		// check request for 'clear_session' param
182
-		add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' ));
182
+		add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded'));
183 183
 		// once everything is all said and done,
184
-		add_action( 'shutdown', array( $this, 'update' ), 100 );
185
-		add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 );
186
-		add_filter( 'wp_redirect', array( $this, 'update_on_redirect' ), 100, 1 );
184
+		add_action('shutdown', array($this, 'update'), 100);
185
+		add_action('shutdown', array($this, 'garbage_collection'), 999);
186
+		add_filter('wp_redirect', array($this, 'update_on_redirect'), 100, 1);
187 187
 	}
188 188
 
189 189
 
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	private function _set_defaults() {
216 216
 		// set some defaults
217
-		foreach ( $this->_default_session_vars as $key => $default_var ) {
218
-			if ( is_array( $default_var )) {
219
-				$this->_session_data[ $key ] = array();
217
+		foreach ($this->_default_session_vars as $key => $default_var) {
218
+			if (is_array($default_var)) {
219
+				$this->_session_data[$key] = array();
220 220
 			} else {
221
-				$this->_session_data[ $key ] = '';
221
+				$this->_session_data[$key] = '';
222 222
 			}
223 223
 		}
224 224
 	}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	  * @param \EE_Cart $cart
241 241
 	  * @return bool
242 242
 	  */
243
-	 public function set_cart( EE_Cart $cart ) {
243
+	 public function set_cart(EE_Cart $cart) {
244 244
 		 $this->_session_data['cart'] = $cart;
245 245
 		 return TRUE;
246 246
 	 }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	  * @return \EE_Cart
261 261
 	  */
262 262
 	 public function cart() {
263
-		 return isset( $this->_session_data['cart'] ) ? $this->_session_data['cart'] : NULL;
263
+		 return isset($this->_session_data['cart']) ? $this->_session_data['cart'] : NULL;
264 264
 	 }
265 265
 
266 266
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	  * @param \EE_Checkout $checkout
270 270
 	  * @return bool
271 271
 	  */
272
-	 public function set_checkout( EE_Checkout $checkout ) {
272
+	 public function set_checkout(EE_Checkout $checkout) {
273 273
 		 $this->_session_data['checkout'] = $checkout;
274 274
 		 return TRUE;
275 275
 	 }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	  * @return \EE_Checkout
290 290
 	  */
291 291
 	 public function checkout() {
292
-		 return isset( $this->_session_data['checkout'] ) ? $this->_session_data['checkout'] : NULL;
292
+		 return isset($this->_session_data['checkout']) ? $this->_session_data['checkout'] : NULL;
293 293
 	 }
294 294
 
295 295
 
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
 	  * @return bool
300 300
 	  * @throws \EE_Error
301 301
 	  */
302
-	 public function set_transaction( EE_Transaction $transaction ) {
302
+	 public function set_transaction(EE_Transaction $transaction) {
303 303
 		 // first remove the session from the transaction before we save the transaction in the session
304
-		 $transaction->set_txn_session_data( NULL );
304
+		 $transaction->set_txn_session_data(NULL);
305 305
 		 $this->_session_data['transaction'] = $transaction;
306 306
 		 return TRUE;
307 307
 	 }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 	  * @return \EE_Transaction
322 322
 	  */
323 323
 	 public function transaction() {
324
-		 return isset( $this->_session_data['transaction'] ) ? $this->_session_data['transaction'] : NULL;
324
+		 return isset($this->_session_data['transaction']) ? $this->_session_data['transaction'] : NULL;
325 325
 	 }
326 326
 
327 327
 
@@ -333,15 +333,15 @@  discard block
 block discarded – undo
333 333
 	  * @param bool $reset_cache
334 334
 	  * @return    array
335 335
 	  */
336
-	public function get_session_data( $key = NULL, $reset_cache = FALSE ) {
337
-		if ( $reset_cache ) {
336
+	public function get_session_data($key = NULL, $reset_cache = FALSE) {
337
+		if ($reset_cache) {
338 338
 			$this->reset_cart();
339 339
 			$this->reset_checkout();
340 340
 			$this->reset_transaction();
341 341
 		}
342
-		 if ( ! empty( $key ))  {
343
-			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
344
-		}  else  {
342
+		 if ( ! empty($key)) {
343
+			return  isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL;
344
+		} else {
345 345
 			return $this->_session_data;
346 346
 		}
347 347
 	}
@@ -354,20 +354,20 @@  discard block
 block discarded – undo
354 354
 	  * @param 	array $data
355 355
 	  * @return 	TRUE on success, FALSE on fail
356 356
 	  */
357
-	public function set_session_data( $data ) {
357
+	public function set_session_data($data) {
358 358
 
359 359
 		// nothing ??? bad data ??? go home!
360
-		if ( empty( $data ) || ! is_array( $data )) {
361
-			EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
360
+		if (empty($data) || ! is_array($data)) {
361
+			EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
362 362
 			return FALSE;
363 363
 		}
364 364
 
365
-		foreach ( $data as $key =>$value ) {
366
-			if ( isset( $this->_default_session_vars[ $key ] )) {
367
-				EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ );
365
+		foreach ($data as $key =>$value) {
366
+			if (isset($this->_default_session_vars[$key])) {
367
+				EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__);
368 368
 				return FALSE;
369 369
 			} else {
370
-				$this->_session_data[ $key ] = $value;
370
+				$this->_session_data[$key] = $value;
371 371
 			}
372 372
 		}
373 373
 
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
 	  * @throws \EE_Error
386 386
 	  */
387 387
 	private function _espresso_session() {
388
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
388
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
389 389
 		// check that session has started
390
-		if ( session_id() === '' ) {
390
+		if (session_id() === '') {
391 391
 			//starts a new session if one doesn't already exist, or re-initiates an existing one
392 392
 			session_start();
393 393
 		}
@@ -396,18 +396,18 @@  discard block
 block discarded – undo
396 396
 		// and the visitors IP
397 397
 		$this->_ip_address = $this->_visitor_ip();
398 398
 		// set the "user agent"
399
-		$this->_user_agent = ( isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE;
399
+		$this->_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE;
400 400
 		// now let's retrieve what's in the db
401 401
 		// we're using WP's Transient API to store session data using the PHP session ID as the option name
402
-		$session_data = get_transient( EE_Session::session_id_prefix . $this->_sid );
403
-		if ( $session_data ) {
404
-			if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
405
-				$hash_check = get_transient( EE_Session::hash_check_prefix . $this->_sid );
406
-				if ( $hash_check && $hash_check !== md5( $session_data ) ) {
402
+		$session_data = get_transient(EE_Session::session_id_prefix.$this->_sid);
403
+		if ($session_data) {
404
+			if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
405
+				$hash_check = get_transient(EE_Session::hash_check_prefix.$this->_sid);
406
+				if ($hash_check && $hash_check !== md5($session_data)) {
407 407
 					EE_Error::add_error(
408 408
 						sprintf(
409
-							__( 'The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso' ),
410
-							EE_Session::session_id_prefix . $this->_sid
409
+							__('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
410
+							EE_Session::session_id_prefix.$this->_sid
411 411
 						),
412 412
 						__FILE__, __FUNCTION__, __LINE__
413 413
 					);
@@ -418,33 +418,33 @@  discard block
 block discarded – undo
418 418
                 $session_data = $this->valid_base_64($session_data) ? base64_decode($session_data) : $session_data;
419 419
             }
420 420
 			// un-encrypt the data ?
421
-			$session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data;
422
-			if ( ! is_array( $session_data ) ) {
421
+			$session_data = $this->_use_encryption ? $this->encryption->decrypt($session_data) : $session_data;
422
+			if ( ! is_array($session_data)) {
423 423
 				try {
424
-					$session_data = maybe_unserialize( $session_data );
425
-				} catch ( Exception $e ) {
424
+					$session_data = maybe_unserialize($session_data);
425
+				} catch (Exception $e) {
426 426
 					$msg = esc_html__(
427 427
 						'An error occurred while attempting to unserialize the session data.',
428 428
 						'event_espresso'
429 429
 					);
430
-					$msg .= WP_DEBUG ? '<br>' . $this->find_serialize_error( $session_data ) : '';
431
-					throw new InvalidSessionDataException( $msg, 0, $e );
430
+					$msg .= WP_DEBUG ? '<br>'.$this->find_serialize_error($session_data) : '';
431
+					throw new InvalidSessionDataException($msg, 0, $e);
432 432
 				}
433 433
 			}
434 434
 			// just a check to make sure the session array is indeed an array
435
-			if ( ! is_array( $session_data ) ) {
435
+			if ( ! is_array($session_data)) {
436 436
 				// no?!?! then something is wrong
437 437
 				$msg = esc_html__(
438 438
 					'The session data is missing, invalid, or corrupted.',
439 439
 					'event_espresso'
440 440
 				);
441
-				$msg .= WP_DEBUG ? '<br>' . $this->find_serialize_error( $session_data ) : '';
442
-				throw new InvalidSessionDataException( $msg );
441
+				$msg .= WP_DEBUG ? '<br>'.$this->find_serialize_error($session_data) : '';
442
+				throw new InvalidSessionDataException($msg);
443 443
 			}
444 444
 			// get the current time in UTC
445
-			$this->_time = isset( $this->_time ) ? $this->_time : time();
445
+			$this->_time = isset($this->_time) ? $this->_time : time();
446 446
 			// and reset the session expiration
447
-			$this->_expiration = isset( $session_data['expiration'] )
447
+			$this->_expiration = isset($session_data['expiration'])
448 448
 				? $session_data['expiration']
449 449
 				: $this->_time + $this->_lifespan;
450 450
 
@@ -452,24 +452,24 @@  discard block
 block discarded – undo
452 452
 			// set initial site access time and the session expiration
453 453
 			$this->_set_init_access_and_expiration();
454 454
 			// set referer
455
-			$this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] )
456
-				? esc_attr( $_SERVER['HTTP_REFERER'] )
455
+			$this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER'])
456
+				? esc_attr($_SERVER['HTTP_REFERER'])
457 457
 				: '';
458 458
 			// no previous session = go back and create one (on top of the data above)
459 459
 			return FALSE;
460 460
 		}
461 461
 		// now the user agent
462
-		if ( $session_data['user_agent'] !== $this->_user_agent ) {
462
+		if ($session_data['user_agent'] !== $this->_user_agent) {
463 463
 			return FALSE;
464 464
 		}
465 465
 		// wait a minute... how old are you?
466
-		if ( $this->_time > $this->_expiration ) {
466
+		if ($this->_time > $this->_expiration) {
467 467
 			// yer too old fer me!
468 468
 			// wipe out everything that isn't a default session datum
469
-			$this->clear_session( __CLASS__, __FUNCTION__ );
469
+			$this->clear_session(__CLASS__, __FUNCTION__);
470 470
 		}
471 471
 		// make event espresso session data available to plugin
472
-		$this->_session_data = array_merge( $this->_session_data, $session_data );
472
+		$this->_session_data = array_merge($this->_session_data, $session_data);
473 473
 		return TRUE;
474 474
 
475 475
 	}
@@ -487,12 +487,12 @@  discard block
 block discarded – undo
487 487
 	  */
488 488
 	protected function _generate_session_id() {
489 489
 		// check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length
490
-		if ( isset( $_REQUEST[ 'EESID' ] ) ) {
491
-			$session_id = sanitize_text_field( $_REQUEST[ 'EESID' ] );
490
+		if (isset($_REQUEST['EESID'])) {
491
+			$session_id = sanitize_text_field($_REQUEST['EESID']);
492 492
 		} else {
493
-			$session_id = md5( session_id() . get_current_blog_id() . $this->_get_sid_salt() );
493
+			$session_id = md5(session_id().get_current_blog_id().$this->_get_sid_salt());
494 494
 		}
495
-		return apply_filters( 'FHEE__EE_Session___generate_session_id__session_id', $session_id );
495
+		return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id);
496 496
 	}
497 497
 
498 498
 
@@ -504,20 +504,20 @@  discard block
 block discarded – undo
504 504
 	  */
505 505
 	protected function _get_sid_salt() {
506 506
 		// was session id salt already saved to db ?
507
-		if ( empty( $this->_sid_salt ) ) {
507
+		if (empty($this->_sid_salt)) {
508 508
 			// no?  then maybe use WP defined constant
509
-			if ( defined( 'AUTH_SALT' ) ) {
509
+			if (defined('AUTH_SALT')) {
510 510
 				$this->_sid_salt = AUTH_SALT;
511 511
 			}
512 512
 			// if salt doesn't exist or is too short
513
-			if ( empty( $this->_sid_salt ) || strlen( $this->_sid_salt ) < 32 ) {
513
+			if (empty($this->_sid_salt) || strlen($this->_sid_salt) < 32) {
514 514
 				// create a new one
515
-				$this->_sid_salt = wp_generate_password( 64 );
515
+				$this->_sid_salt = wp_generate_password(64);
516 516
 			}
517 517
 			// and save it as a permanent session setting
518
-			$session_settings = get_option( 'ee_session_settings' );
519
-			$session_settings[ 'sid_salt' ] = $this->_sid_salt;
520
-			update_option( 'ee_session_settings', $session_settings );
518
+			$session_settings = get_option('ee_session_settings');
519
+			$session_settings['sid_salt'] = $this->_sid_salt;
520
+			update_option('ee_session_settings', $session_settings);
521 521
 		}
522 522
 		return $this->_sid_salt;
523 523
 	}
@@ -545,19 +545,19 @@  discard block
 block discarded – undo
545 545
 	  * @param bool $new_session
546 546
 	  * @return TRUE on success, FALSE on fail
547 547
 	  */
548
-	public function update( $new_session = FALSE ) {
549
-		$this->_session_data = isset( $this->_session_data )
550
-			&& is_array( $this->_session_data )
551
-			&& isset( $this->_session_data['id'])
548
+	public function update($new_session = FALSE) {
549
+		$this->_session_data = isset($this->_session_data)
550
+			&& is_array($this->_session_data)
551
+			&& isset($this->_session_data['id'])
552 552
 			? $this->_session_data
553 553
 			: NULL;
554
-		if ( empty( $this->_session_data )) {
554
+		if (empty($this->_session_data)) {
555 555
 			$this->_set_defaults();
556 556
 		}
557 557
 		$session_data = array();
558
-		foreach ( $this->_session_data as $key => $value ) {
558
+		foreach ($this->_session_data as $key => $value) {
559 559
 
560
-			switch( $key ) {
560
+			switch ($key) {
561 561
 
562 562
 				case 'id' :
563 563
 					// session ID
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 				break;
576 576
 
577 577
 				case 'init_access' :
578
-					$session_data['init_access'] = absint( $value );
578
+					$session_data['init_access'] = absint($value);
579 579
 				break;
580 580
 
581 581
 				case 'last_access' :
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 
586 586
 				case 'expiration' :
587 587
 					// when the session expires
588
-					$session_data['expiration'] = ! empty( $this->_expiration )
588
+					$session_data['expiration'] = ! empty($this->_expiration)
589 589
 						? $this->_expiration
590 590
 						: $session_data['init_access'] + $this->_lifespan;
591 591
 				break;
@@ -597,11 +597,11 @@  discard block
 block discarded – undo
597 597
 
598 598
 				case 'pages_visited' :
599 599
 					$page_visit = $this->_get_page_visit();
600
-					if ( $page_visit ) {
600
+					if ($page_visit) {
601 601
 						// set pages visited where the first will be the http referrer
602
-						$this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit;
602
+						$this->_session_data['pages_visited'][$this->_time] = $page_visit;
603 603
 						// we'll only save the last 10 page visits.
604
-						$session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 );
604
+						$session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
605 605
 					}
606 606
 				break;
607 607
 
@@ -615,9 +615,9 @@  discard block
 block discarded – undo
615 615
 
616 616
 		$this->_session_data = $session_data;
617 617
 		// creating a new session does not require saving to the db just yet
618
-		if ( ! $new_session ) {
618
+		if ( ! $new_session) {
619 619
 			// ready? let's save
620
-			if ( $this->_save_session_to_db() ) {
620
+			if ($this->_save_session_to_db()) {
621 621
 				return TRUE;
622 622
 			} else {
623 623
 				return FALSE;
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 	  * @param string $location
640 640
 	  * @return mixed
641 641
 	  */
642
-	 public function update_on_redirect( $location ) {
642
+	 public function update_on_redirect($location) {
643 643
 		 $this->update();
644 644
 		 return $location;
645 645
 	}
@@ -651,9 +651,9 @@  discard block
 block discarded – undo
651 651
 	 * 	@return bool
652 652
 	 */
653 653
 	private function _create_espresso_session( ) {
654
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, '' );
654
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, '');
655 655
 		// use the update function for now with $new_session arg set to TRUE
656
-		return  $this->update( TRUE ) ? TRUE : FALSE;
656
+		return  $this->update(TRUE) ? TRUE : FALSE;
657 657
 	}
658 658
 
659 659
 
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 				// OR an admin request that is NOT AJAX
681 681
 				|| (
682 682
 					is_admin()
683
-					&& ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
683
+					&& ! (defined('DOING_AJAX') && DOING_AJAX)
684 684
 				)
685 685
 			)
686 686
 		) {
@@ -693,13 +693,13 @@  discard block
 block discarded – undo
693 693
             $session_data = base64_encode($this->_session_data);
694 694
         }
695 695
 		// encrypt it if we are using encryption
696
-		$session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data;
696
+		$session_data = $this->_use_encryption ? $this->encryption->encrypt($session_data) : $session_data;
697 697
 		// maybe save hash check
698
-		if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
699
-			set_transient( EE_Session::hash_check_prefix . $this->_sid, md5( $session_data ), $this->_lifespan );
698
+		if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
699
+			set_transient(EE_Session::hash_check_prefix.$this->_sid, md5($session_data), $this->_lifespan);
700 700
 		}
701 701
 		// we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient(  transient ID, data, expiry )
702
-		return set_transient( EE_Session::session_id_prefix . $this->_sid, $session_data, $this->_lifespan );
702
+		return set_transient(EE_Session::session_id_prefix.$this->_sid, $session_data, $this->_lifespan);
703 703
 	}
704 704
 
705 705
 
@@ -725,10 +725,10 @@  discard block
 block discarded – undo
725 725
 			'HTTP_FORWARDED',
726 726
 			'REMOTE_ADDR'
727 727
 		);
728
-		foreach ( $server_keys as $key ){
729
-			if ( isset( $_SERVER[ $key ] )) {
730
-				foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) {
731
-					if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) {
728
+		foreach ($server_keys as $key) {
729
+			if (isset($_SERVER[$key])) {
730
+				foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) {
731
+					if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) {
732 732
 						$visitor_ip = $ip;
733 733
 					}
734 734
 				}
@@ -747,32 +747,32 @@  discard block
 block discarded – undo
747 747
 	 *			@return string
748 748
 	 */
749 749
 	public function _get_page_visit() {
750
-		$page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
750
+		$page_visit = home_url('/').'wp-admin/admin-ajax.php';
751 751
 		// check for request url
752
-		if ( isset( $_SERVER['REQUEST_URI'] )) {
752
+		if (isset($_SERVER['REQUEST_URI'])) {
753 753
 			$http_host = '';
754 754
 			$page_id = '?';
755 755
 			$e_reg = '';
756
-			$request_uri = esc_url( $_SERVER['REQUEST_URI'] );
757
-			$ru_bits = explode( '?', $request_uri );
756
+			$request_uri = esc_url($_SERVER['REQUEST_URI']);
757
+			$ru_bits = explode('?', $request_uri);
758 758
 			$request_uri = $ru_bits[0];
759 759
 			// check for and grab host as well
760
-			if ( isset( $_SERVER['HTTP_HOST'] )) {
761
-				$http_host = esc_url( $_SERVER['HTTP_HOST'] );
760
+			if (isset($_SERVER['HTTP_HOST'])) {
761
+				$http_host = esc_url($_SERVER['HTTP_HOST']);
762 762
 			}
763 763
 			// check for page_id in SERVER REQUEST
764
-			if ( isset( $_REQUEST['page_id'] )) {
764
+			if (isset($_REQUEST['page_id'])) {
765 765
 				// rebuild $e_reg without any of the extra parameters
766
-				$page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&amp;';
766
+				$page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&amp;';
767 767
 			}
768 768
 			// check for $e_reg in SERVER REQUEST
769
-			if ( isset( $_REQUEST['ee'] )) {
769
+			if (isset($_REQUEST['ee'])) {
770 770
 				// rebuild $e_reg without any of the extra parameters
771
-				$e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] );
771
+				$e_reg = 'ee='.esc_attr($_REQUEST['ee']);
772 772
 			}
773
-			$page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' );
773
+			$page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?');
774 774
 		}
775
-		return $page_visit !== home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : '';
775
+		return $page_visit !== home_url('/wp-admin/admin-ajax.php') ? $page_visit : '';
776 776
 
777 777
 	}
778 778
 
@@ -801,14 +801,14 @@  discard block
 block discarded – undo
801 801
 	  * @param string $function
802 802
 	  * @return void
803 803
 	  */
804
-	public function clear_session( $class = '', $function = '' ) {
804
+	public function clear_session($class = '', $function = '') {
805 805
 		//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>';
806
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' .  $function . '()' );
806
+		do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()');
807 807
 		$this->reset_cart();
808 808
 		$this->reset_checkout();
809 809
 		$this->reset_transaction();
810 810
 		// wipe out everything that isn't a default session datum
811
-		$this->reset_data( array_keys( $this->_session_data ));
811
+		$this->reset_data(array_keys($this->_session_data));
812 812
 		// reset initial site access time and the session expiration
813 813
 		$this->_set_init_access_and_expiration();
814 814
 		$this->_save_session_to_db();
@@ -823,42 +823,42 @@  discard block
 block discarded – undo
823 823
 	  * @param bool  $show_all_notices
824 824
 	  * @return TRUE on success, FALSE on fail
825 825
 	  */
826
-	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
826
+	public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) {
827 827
 		// if $data_to_reset is not in an array, then put it in one
828
-		if ( ! is_array( $data_to_reset ) ) {
829
-			$data_to_reset = array ( $data_to_reset );
828
+		if ( ! is_array($data_to_reset)) {
829
+			$data_to_reset = array($data_to_reset);
830 830
 		}
831 831
 		// nothing ??? go home!
832
-		if ( empty( $data_to_reset )) {
833
-			EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
832
+		if (empty($data_to_reset)) {
833
+			EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
834 834
 			return FALSE;
835 835
 		}
836 836
 		$return_value = TRUE;
837 837
 		// since $data_to_reset is an array, cycle through the values
838
-		foreach ( $data_to_reset as $reset ) {
838
+		foreach ($data_to_reset as $reset) {
839 839
 
840 840
 			// first check to make sure it is a valid session var
841
-			if ( isset( $this->_session_data[ $reset ] )) {
841
+			if (isset($this->_session_data[$reset])) {
842 842
 				// then check to make sure it is not a default var
843
-				if ( ! array_key_exists( $reset, $this->_default_session_vars )) {
843
+				if ( ! array_key_exists($reset, $this->_default_session_vars)) {
844 844
 					// remove session var
845
-					unset( $this->_session_data[ $reset ] );
846
-					if ( $show_all_notices ) {
847
-						EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
845
+					unset($this->_session_data[$reset]);
846
+					if ($show_all_notices) {
847
+						EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
848 848
 					}
849
-					$return_value = !isset($return_value) ? TRUE : $return_value;
849
+					$return_value = ! isset($return_value) ? TRUE : $return_value;
850 850
 
851 851
 				} else {
852 852
 					// yeeeeeeeeerrrrrrrrrrr OUT !!!!
853
-					if ( $show_all_notices ) {
854
-						EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
853
+					if ($show_all_notices) {
854
+						EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
855 855
 					}
856 856
 					$return_value = FALSE;
857 857
 				}
858 858
 
859
-			} else if ( $show_all_notices ) {
859
+			} else if ($show_all_notices) {
860 860
 				// oops! that session var does not exist!
861
-				EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
861
+				EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
862 862
 				$return_value = FALSE;
863 863
 			}
864 864
 
@@ -878,8 +878,8 @@  discard block
 block discarded – undo
878 878
 	 *   @access public
879 879
 	 */
880 880
 	public function wp_loaded() {
881
-		if ( isset(  EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) {
882
-			$this->clear_session( __CLASS__, __FUNCTION__ );
881
+		if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) {
882
+			$this->clear_session(__CLASS__, __FUNCTION__);
883 883
 		}
884 884
 	}
885 885
 
@@ -904,24 +904,24 @@  discard block
 block discarded – undo
904 904
 	  */
905 905
 	 public function garbage_collection() {
906 906
 		 // only perform during regular requests
907
-		 if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) {
907
+		 if ( ! defined('DOING_AJAX') || ! DOING_AJAX) {
908 908
 			 /** @type WPDB $wpdb */
909 909
 			 global $wpdb;
910 910
 			 // since transient expiration timestamps are set in the future, we can compare against NOW
911 911
 			 $expiration = time();
912
-			 $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 );
912
+			 $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2);
913 913
 			 // filter the query limit. Set to 0 to turn off garbage collection
914
-			 $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 ));
914
+			 $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50));
915 915
 			 // non-zero LIMIT means take out the trash
916
-			 if ( $expired_session_transient_delete_query_limit ) {
916
+			 if ($expired_session_transient_delete_query_limit) {
917 917
 				 //array of transient keys that require garbage collection
918 918
 				 $session_keys = array(
919 919
 					 EE_Session::session_id_prefix,
920 920
 					 EE_Session::hash_check_prefix,
921 921
 				 );
922
-				 foreach ( $session_keys as $session_key ) {
923
-					 $session_key = str_replace( '_', '\_', $session_key );
924
-					 $session_key = '\_transient\_timeout\_' . $session_key . '%';
922
+				 foreach ($session_keys as $session_key) {
923
+					 $session_key = str_replace('_', '\_', $session_key);
924
+					 $session_key = '\_transient\_timeout\_'.$session_key.'%';
925 925
 					 $SQL = "
926 926
 					SELECT option_name
927 927
 					FROM {$wpdb->options}
@@ -931,25 +931,25 @@  discard block
 block discarded – undo
931 931
 					OR option_value > {$too_far_in_the_the_future} )
932 932
 					LIMIT {$expired_session_transient_delete_query_limit}
933 933
 				";
934
-					 $expired_sessions = $wpdb->get_col( $SQL );
934
+					 $expired_sessions = $wpdb->get_col($SQL);
935 935
 					 // valid results?
936
-					 if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions ) ) {
936
+					 if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) {
937 937
 						 // format array of results into something usable within the actual DELETE query's IN clause
938 938
 						 $expired = array();
939
-						 foreach ( $expired_sessions as $expired_session ) {
940
-							 $expired[ ] = "'" . $expired_session . "'";
941
-							 $expired[ ] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'";
939
+						 foreach ($expired_sessions as $expired_session) {
940
+							 $expired[] = "'".$expired_session."'";
941
+							 $expired[] = "'".str_replace('timeout_', '', $expired_session)."'";
942 942
 						 }
943
-						 $expired = implode( ', ', $expired );
943
+						 $expired = implode(', ', $expired);
944 944
 						 $SQL = "
945 945
 						DELETE FROM {$wpdb->options}
946 946
 						WHERE option_name
947 947
 						IN ( $expired );
948 948
 					 ";
949
-						 $results = $wpdb->query( $SQL );
949
+						 $results = $wpdb->query($SQL);
950 950
 						 // if something went wrong, then notify the admin
951
-						 if ( $results instanceof WP_Error && is_admin() ) {
952
-							 EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
951
+						 if ($results instanceof WP_Error && is_admin()) {
952
+							 EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
953 953
 						 }
954 954
 					 }
955 955
 				 }
@@ -970,18 +970,18 @@  discard block
 block discarded – undo
970 970
 	  * @param $string
971 971
 	  * @return bool
972 972
 	  */
973
-	 private function valid_base_64( $string ) {
974
-		 $decoded = base64_decode( $string, true );
973
+	 private function valid_base_64($string) {
974
+		 $decoded = base64_decode($string, true);
975 975
 		 // Check if there is no invalid character in string
976
-		 if ( ! preg_match( '/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $string ) ) {
976
+		 if ( ! preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $string)) {
977 977
 			 return false;
978 978
 		 }
979 979
 		 // Decode the string in strict mode and send the response
980
-		 if ( ! base64_decode( $string, true ) ) {
980
+		 if ( ! base64_decode($string, true)) {
981 981
 			 return false;
982 982
 		 }
983 983
 		 // Encode and compare it to original one
984
-		 return base64_encode( $decoded ) === $string;
984
+		 return base64_encode($decoded) === $string;
985 985
 	 }
986 986
 
987 987
 
@@ -991,34 +991,34 @@  discard block
 block discarded – undo
991 991
 	  * @param $data1
992 992
 	  * @return string
993 993
 	  */
994
-	 private function find_serialize_error( $data1 ) {
994
+	 private function find_serialize_error($data1) {
995 995
 		$error = "<pre>";
996 996
 		 $data2 = preg_replace_callback(
997 997
 			 '!s:(\d+):"(.*?)";!',
998
-			 function ( $match ) {
999
-				 return ( $match[1] === strlen( $match[2] ) )
998
+			 function($match) {
999
+				 return ($match[1] === strlen($match[2]))
1000 1000
 					 ? $match[0]
1001 1001
 					 : 's:'
1002
-					   . strlen( $match[2] )
1002
+					   . strlen($match[2])
1003 1003
 					   . ':"'
1004 1004
 					   . $match[2]
1005 1005
 					   . '";';
1006 1006
 			 },
1007 1007
 			 $data1
1008 1008
 		 );
1009
-		$max = ( strlen( $data1 ) > strlen( $data2 ) ) ? strlen( $data1 ) : strlen( $data2 );
1010
-		$error .= $data1 . PHP_EOL;
1011
-		$error .= $data2 . PHP_EOL;
1012
-		for ( $i = 0; $i < $max; $i++ ) {
1013
-			if ( @$data1[ $i ] !== @$data2[ $i ] ) {
1014
-				$error .= "Difference " . @$data1[ $i ] . " != " . @$data2[ $i ] . PHP_EOL;
1015
-				$error .= "\t-> ORD number " . ord( @$data1[ $i ] ) . " != " . ord( @$data2[ $i ] ) . PHP_EOL;
1016
-				$error .= "\t-> Line Number = $i" . PHP_EOL;
1017
-				$start = ( $i - 20 );
1018
-				$start = ( $start < 0 ) ? 0 : $start;
1009
+		$max = (strlen($data1) > strlen($data2)) ? strlen($data1) : strlen($data2);
1010
+		$error .= $data1.PHP_EOL;
1011
+		$error .= $data2.PHP_EOL;
1012
+		for ($i = 0; $i < $max; $i++) {
1013
+			if (@$data1[$i] !== @$data2[$i]) {
1014
+				$error .= "Difference ".@$data1[$i]." != ".@$data2[$i].PHP_EOL;
1015
+				$error .= "\t-> ORD number ".ord(@$data1[$i])." != ".ord(@$data2[$i]).PHP_EOL;
1016
+				$error .= "\t-> Line Number = $i".PHP_EOL;
1017
+				$start = ($i - 20);
1018
+				$start = ($start < 0) ? 0 : $start;
1019 1019
 				$length = 40;
1020 1020
 				$point = $max - $i;
1021
-				if ( $point < 20 ) {
1021
+				if ($point < 20) {
1022 1022
 					$rlength = 1;
1023 1023
 					$rpoint = -$point;
1024 1024
 				} else {
@@ -1027,16 +1027,16 @@  discard block
 block discarded – undo
1027 1027
 				}
1028 1028
 				$error .= "\t-> Section Data1  = ";
1029 1029
 				$error .= substr_replace(
1030
-					substr( $data1, $start, $length ),
1031
-					"<b style=\"color:green\">{$data1[ $i ]}</b>",
1030
+					substr($data1, $start, $length),
1031
+					"<b style=\"color:green\">{$data1[$i]}</b>",
1032 1032
 					$rpoint,
1033 1033
 					$rlength
1034 1034
 				);
1035 1035
 				$error .= PHP_EOL;
1036 1036
 				$error .= "\t-> Section Data2  = ";
1037 1037
 				$error .= substr_replace(
1038
-					substr( $data2, $start, $length ),
1039
-					"<b style=\"color:red\">{$data2[ $i ]}</b>",
1038
+					substr($data2, $start, $length),
1039
+					"<b style=\"color:red\">{$data2[$i]}</b>",
1040 1040
 					$rpoint,
1041 1041
 					$rlength
1042 1042
 				);
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 				}
415 415
 			}
416 416
 			// decode the data ?
417
-            $session_data = $this->valid_base_64($session_data) ? base64_decode($session_data) : $session_data;
417
+			$session_data = $this->valid_base_64($session_data) ? base64_decode($session_data) : $session_data;
418 418
 			// un-encrypt the data ?
419 419
 			$session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data;
420 420
 			if ( ! is_array( $session_data ) ) {
@@ -684,12 +684,12 @@  discard block
 block discarded – undo
684 684
 		) {
685 685
 			return false;
686 686
 		}
687
-        // then serialize all of our session data
688
-        $session_data = serialize($this->_session_data);
689
-        // do we need to also encode it to avoid corrupted data when saved to the db?
690
-        if (EE_Registry::instance()->CFG->admin->encode_session_data()) {
691
-            $session_data = base64_encode($session_data);
692
-        }
687
+		// then serialize all of our session data
688
+		$session_data = serialize($this->_session_data);
689
+		// do we need to also encode it to avoid corrupted data when saved to the db?
690
+		if (EE_Registry::instance()->CFG->admin->encode_session_data()) {
691
+			$session_data = base64_encode($session_data);
692
+		}
693 693
 		// encrypt it if we are using encryption
694 694
 		$session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data;
695 695
 		// maybe save hash check
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/extend/general_settings/Extend_General_Settings_Admin_Page.core.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 
33 33
 
34 34
 
35
-	public function __construct( $routing = TRUE ) {
36
-		parent::__construct( $routing );
37
-		define( 'GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/' );
35
+	public function __construct($routing = TRUE) {
36
+		parent::__construct($routing);
37
+		define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'general_settings/templates/');
38 38
 	}
39 39
 
40 40
 
41 41
 
42 42
 	protected function _extend_page_config() {
43 43
 
44
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings';
44
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'general_settings';
45 45
 
46 46
 		//filters and action hooks here
47
-		add_action( 'AHEE__admin_option_settings__template__before', array( $this, 'debug_logging_options' ), 9 );
48
-		add_filter( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array( $this, 'update_debug_logging_options' ), 10, 1 );
47
+		add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9);
48
+		add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array($this, 'update_debug_logging_options'), 10, 1);
49 49
 
50 50
 	}
51 51
 
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
 	 * @param array $template_args
60 60
 	 * @return void
61 61
 	 */
62
-	public function debug_logging_options( $template_args = array() ) {
62
+	public function debug_logging_options($template_args = array()) {
63 63
 		$template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging;
64
-		$template_args['use_remote_logging'] = isset( EE_Registry::instance()->CFG->admin->use_remote_logging ) ? absint( EE_Registry::instance()->CFG->admin->use_remote_logging ) : FALSE;
65
-		$template_args['remote_logging_url'] = isset( EE_Registry::instance()->CFG->admin->remote_logging_url ) && ! empty( EE_Registry::instance()->CFG->admin->remote_logging_url ) ? stripslashes( EE_Registry::instance()->CFG->admin->remote_logging_url ) : '';
66
-		$template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php';
67
-		EEH_Template::display_template( $template, $template_args );
64
+		$template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : FALSE;
65
+		$template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : '';
66
+		$template = GEN_SET_CAF_TEMPLATE_PATH.'debug_log_settings.template.php';
67
+		EEH_Template::display_template($template, $template_args);
68 68
 	}
69 69
 
70 70
 
@@ -75,17 +75,17 @@  discard block
 block discarded – undo
75 75
 	 * @param array $admin_options
76 76
 	 * @return array
77 77
 	 */
78
-	public function update_debug_logging_options( $admin_options = array() ) {
79
-		$use_full_logging = isset( $this->_req_data['use_full_logging'] ) ? (bool)absint( $this->_req_data['use_full_logging'] ) : $admin_options->use_full_logging;
78
+	public function update_debug_logging_options($admin_options = array()) {
79
+		$use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging;
80 80
 		$admin_options->use_full_logging = $use_full_logging;
81 81
 
82
-		if ( $use_full_logging === FALSE ) {
83
-			EE_Error::get_notices( FALSE );
82
+		if ($use_full_logging === FALSE) {
83
+			EE_Error::get_notices(FALSE);
84 84
 			EE_Error::reset_notices();
85 85
 		}
86 86
 
87
-		$admin_options->use_remote_logging = isset( $this->_req_data['use_remote_logging'] ) ? absint( $this->_req_data['use_remote_logging'] ) : $admin_options->use_remote_logging;
88
-		$admin_options->remote_logging_url = isset( $this->_req_data['remote_logging_url'] ) ? esc_url_raw( $this->_req_data['remote_logging_url'] ) : $admin_options->remote_logging_url;
87
+		$admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging;
88
+		$admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url;
89 89
 		return $admin_options;
90 90
 	}
91 91
 
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.