Completed
Branch BUG-8698-ticket-sellouts+8511 (f7aa07)
by
unknown
17:10 queued 18s
created
core/business/EE_Transaction_Payments.class.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@
 block discarded – undo
161 161
 	 * @param EE_Transaction $transaction
162 162
 	 * @param string         $payment_status One of EEM_Payment's statuses, like 'PAP' (Approved).
163 163
 	 *                                       By default, searches for approved payments
164
-	 * @return float|false   float on success, false on fail
164
+	 * @return double   float on success, false on fail
165 165
 	 * @throws \EE_Error
166 166
 	 */
167 167
 	public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) {
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 
4 4
 /**
5 5
  * Class EE_Transaction_Payments
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public static function instance() {
44 44
 		// check if class object is instantiated
45
-		if ( ! self::$_instance instanceof EE_Transaction_Payments ) {
45
+		if ( ! self::$_instance instanceof EE_Transaction_Payments) {
46 46
 			self::$_instance = new self();
47 47
 		}
48 48
 		return self::$_instance;
@@ -59,18 +59,18 @@  discard block
 block discarded – undo
59 59
 	 * @return bool true if TXN total was updated, false if not
60 60
 	 * @throws \EE_Error
61 61
 	 */
62
-	public function recalculate_transaction_total( EE_Transaction $transaction, $update_txn = true ) {
62
+	public function recalculate_transaction_total(EE_Transaction $transaction, $update_txn = true) {
63 63
 		$total_line_item = $transaction->total_line_item();
64
-		if ( ! $total_line_item instanceof EE_Line_Item ) {
64
+		if ( ! $total_line_item instanceof EE_Line_Item) {
65 65
 			EE_Error::add_error(
66
-				sprintf( __( 'The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso' ), $transaction->ID() ),
66
+				sprintf(__('The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso'), $transaction->ID()),
67 67
 				__FILE__, __FUNCTION__, __LINE__
68 68
 			);
69 69
 			return false;
70 70
 		}
71 71
 		$new_total = $total_line_item->recalculate_total_including_taxes();
72
-		$transaction->set_total( $new_total );
73
-		if ( $update_txn ) {
72
+		$transaction->set_total($new_total);
73
+		if ($update_txn) {
74 74
 			return $transaction->save() ? true : false;
75 75
 		}
76 76
 		return false;
@@ -93,20 +93,20 @@  discard block
 block discarded – undo
93 93
 	 * @return    boolean        whether the TXN was saved
94 94
 	 * @throws \EE_Error
95 95
 	 */
96
-	public function calculate_total_payments_and_update_status( EE_Transaction $transaction, $update_txn = true ){
96
+	public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) {
97 97
 		// verify transaction
98
-		if ( ! $transaction instanceof EE_Transaction ) {
99
-			EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
98
+		if ( ! $transaction instanceof EE_Transaction) {
99
+			EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
100 100
 			return false;
101 101
 		}
102 102
 		// calculate total paid
103
-		$total_paid = $this->recalculate_total_payments_for_transaction( $transaction );
103
+		$total_paid = $this->recalculate_total_payments_for_transaction($transaction);
104 104
 		// if total paid has changed
105
-		if ( $total_paid !== false && (float)$total_paid !== $transaction->paid() ) {
106
-			$transaction->set_paid( $total_paid );
105
+		if ($total_paid !== false && (float) $total_paid !== $transaction->paid()) {
106
+			$transaction->set_paid($total_paid);
107 107
 			// maybe update status, and make sure to save transaction if not done already
108
-			if ( ! $transaction->update_status_based_on_total_paid( $update_txn ) ) {
109
-				if ( $update_txn ) {
108
+			if ( ! $transaction->update_status_based_on_total_paid($update_txn)) {
109
+				if ($update_txn) {
110 110
 					return $transaction->save() ? true : false;
111 111
 				}
112 112
 			} else {
@@ -130,18 +130,18 @@  discard block
 block discarded – undo
130 130
 	 * @return float|false   float on success, false on fail
131 131
 	 * @throws \EE_Error
132 132
 	 */
133
-	public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) {
133
+	public function recalculate_total_payments_for_transaction(EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved) {
134 134
 		// verify transaction
135
-		if ( ! $transaction instanceof EE_Transaction ) {
136
-			EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
135
+		if ( ! $transaction instanceof EE_Transaction) {
136
+			EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
137 137
 			return false;
138 138
 		}
139 139
 		// ensure Payment model is loaded
140
-		EE_Registry::instance()->load_model( 'Payment' );
140
+		EE_Registry::instance()->load_model('Payment');
141 141
 		// calls EEM_Base::sum()
142 142
 		return EEM_Payment::instance()->sum(
143 143
 			// query params
144
-			array( array( 'TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status )),
144
+			array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)),
145 145
 			// field to sum
146 146
 			'PAY_amount'
147 147
 		);
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
 	 * @return boolean
160 160
 	 * @throws \EE_Error
161 161
 	 */
162
-	public function delete_payment_and_update_transaction( EE_Payment $payment ) {
162
+	public function delete_payment_and_update_transaction(EE_Payment $payment) {
163 163
 		// verify payment
164
-		if ( ! $payment instanceof EE_Payment ) {
165
-			EE_Error::add_error( __( 'A valid Payment object was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
164
+		if ( ! $payment instanceof EE_Payment) {
165
+			EE_Error::add_error(__('A valid Payment object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
166 166
 			return false;
167 167
 		}
168
-		if ( ! $this->delete_registration_payments_and_update_registrations( $payment ) ) {
168
+		if ( ! $this->delete_registration_payments_and_update_registrations($payment)) {
169 169
 			return false;
170 170
 		}
171
-		if ( ! $payment->delete() ) {
172
-			EE_Error::add_error( __( 'The payment could not be deleted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
171
+		if ( ! $payment->delete()) {
172
+			EE_Error::add_error(__('The payment could not be deleted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
173 173
 			return false;
174 174
 		}
175 175
 
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
 			|| $TXN_status === EEM_Transaction::failed_status_code
181 181
 			|| $payment->amount() === 0
182 182
 		) {
183
-			EE_Error::add_success( __( 'The Payment was successfully deleted.', 'event_espresso' ) );
183
+			EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso'));
184 184
 			return true;
185 185
 		}
186 186
 
187 187
 
188 188
 		//if this fails, that just means that the transaction didn't get its status changed and/or updated.
189 189
 		//however the payment was still deleted.
190
-		if ( ! $this->calculate_total_payments_and_update_status( $transaction ) ) {
190
+		if ( ! $this->calculate_total_payments_and_update_status($transaction)) {
191 191
 
192 192
 			EE_Error::add_attention(
193 193
 				__(
@@ -221,28 +221,28 @@  discard block
 block discarded – undo
221 221
 	 * @return bool
222 222
 	 * @throws \EE_Error
223 223
 	 */
224
-	public function delete_registration_payments_and_update_registrations( EE_Payment $payment, $reg_payment_query_params = array() ) {
224
+	public function delete_registration_payments_and_update_registrations(EE_Payment $payment, $reg_payment_query_params = array()) {
225 225
 		$save_payment = false;
226
-		$reg_payment_query_params = ! empty( $reg_payment_query_params ) ? $reg_payment_query_params : array( array( 'PAY_ID' => $payment->ID() ) );
227
-		$registration_payments = EEM_Registration_Payment::instance()->get_all( $reg_payment_query_params );
228
-		if ( ! empty( $registration_payments )) {
229
-			foreach ( $registration_payments as $registration_payment ) {
230
-				if ( $registration_payment instanceof EE_Registration_Payment ) {
226
+		$reg_payment_query_params = ! empty($reg_payment_query_params) ? $reg_payment_query_params : array(array('PAY_ID' => $payment->ID()));
227
+		$registration_payments = EEM_Registration_Payment::instance()->get_all($reg_payment_query_params);
228
+		if ( ! empty($registration_payments)) {
229
+			foreach ($registration_payments as $registration_payment) {
230
+				if ($registration_payment instanceof EE_Registration_Payment) {
231 231
 					$amount_paid = $registration_payment->amount();
232 232
 					$registration = $registration_payment->registration();
233
-					if ( $registration instanceof EE_Registration ) {
234
-						$registration->set_paid( $registration->paid() - $amount_paid );
235
-						if ( $registration->save() ) {
236
-							if ( $registration_payment->delete() ) {
237
-								$registration->_remove_relation_to( $payment, 'Payment' );
238
-								$payment->_remove_relation_to( $registration, 'Registration' );
233
+					if ($registration instanceof EE_Registration) {
234
+						$registration->set_paid($registration->paid() - $amount_paid);
235
+						if ($registration->save()) {
236
+							if ($registration_payment->delete()) {
237
+								$registration->_remove_relation_to($payment, 'Payment');
238
+								$payment->_remove_relation_to($registration, 'Registration');
239 239
 							}
240 240
 							$save_payment = true;
241 241
 						}
242 242
 					} else {
243 243
 						EE_Error::add_error(
244 244
 							sprintf(
245
-								__( 'An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso' ),
245
+								__('An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso'),
246 246
 								$registration_payment->ID()
247 247
 							),
248 248
 							__FILE__, __FUNCTION__, __LINE__
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 				} else {
253 253
 					EE_Error::add_error(
254 254
 						sprintf(
255
-							__( 'An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso' ),
255
+							__('An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso'),
256 256
 							$payment->ID()
257 257
 						),
258 258
 						__FILE__, __FUNCTION__, __LINE__
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 				}
262 262
 			}
263 263
 		}
264
-		if ( $save_payment ) {
264
+		if ($save_payment) {
265 265
 			$payment->save();
266 266
 		}
267 267
 		return true;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = true)
286 286
 	{
287 287
 		EE_Error::doing_it_wrong(
288
-			__CLASS__ . '::' . __FUNCTION__,
288
+			__CLASS__.'::'.__FUNCTION__,
289 289
 			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
290 290
 				'EE_Transaction::update_status_based_on_total_paid()'),
291 291
 			'4.9.1',
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 * @deprecated 4.9.12
328 328
 	 * @param string $old_txn_status
329 329
 	 */
330
-	public function set_old_txn_status( $old_txn_status ) {
330
+	public function set_old_txn_status($old_txn_status) {
331 331
 		EE_Error::doing_it_wrong(
332 332
 			__METHOD__,
333 333
 			esc_html__(
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 			'4.9.12'
338 338
 		);
339 339
 		// only set the first time
340
-		if ( $this->_old_txn_status === null ) {
340
+		if ($this->_old_txn_status === null) {
341 341
 			$this->_old_txn_status = $old_txn_status;
342 342
 		}
343 343
 	}
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 * @deprecated 4.9.12
367 367
 	 * @param string $new_txn_status
368 368
 	 */
369
-	public function set_new_txn_status( $new_txn_status ) {
369
+	public function set_new_txn_status($new_txn_status) {
370 370
 		EE_Error::doing_it_wrong(
371 371
 			__METHOD__,
372 372
 			esc_html__(
Please login to merge, or discard this patch.
core/EE_Cron_Tasks.core.php 2 patches
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @param int $PAY_ID
171 171
 	 */
172 172
 	public static function setup_update_for_transaction_with_payment( $TXN_ID = 0, $PAY_ID = 0 ) {
173
-            do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
173
+			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
174 174
 		if ( absint( $TXN_ID )) {
175 175
 			self::$_update_transactions_with_payment[ $TXN_ID ] = $PAY_ID;
176 176
 			add_action(
@@ -303,7 +303,6 @@  discard block
 block discarded – undo
303 303
 
304 304
 	/**
305 305
 	 * finalize_abandoned_transactions
306
-
307 306
 	 * loops through the self::$_abandoned_transactions array
308 307
 	 * and attempts to finalize any TXNs that have not been completed
309 308
 	 * but have had their sessions expired, most likely due to a user not
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @return EE_Cron_Tasks
29 29
 	 */
30 30
 	public static function instance() {
31
-		if ( ! self::$_instance instanceof EE_Cron_Tasks ) {
31
+		if ( ! self::$_instance instanceof EE_Cron_Tasks) {
32 32
 			self::$_instance = new self();
33 33
 		}
34 34
 		return self::$_instance;
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	 * @return EE_Cron_Tasks
42 42
 	 */
43 43
 	private function __construct() {
44
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
44
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
45 45
 		// verify that WP Cron is enabled
46
-		if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON && is_admin() ) {
46
+		if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON && is_admin()) {
47 47
 			EE_Error::add_persistent_admin_notice(
48 48
 				'wp_cron_disabled',
49 49
 				sprintf(
@@ -58,32 +58,32 @@  discard block
 block discarded – undo
58 58
 		// UPDATE TRANSACTION WITH PAYMENT
59 59
 		add_action(
60 60
 			'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
61
-			array( 'EE_Cron_Tasks', 'setup_update_for_transaction_with_payment' ),
61
+			array('EE_Cron_Tasks', 'setup_update_for_transaction_with_payment'),
62 62
 			10, 2
63 63
 		);
64 64
 		// FINALIZE ABANDONED TRANSACTIONS
65 65
 		add_action(
66 66
 			'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
67
-			array( 'EE_Cron_Tasks', 'check_for_abandoned_transactions' ),
67
+			array('EE_Cron_Tasks', 'check_for_abandoned_transactions'),
68 68
 			10, 1
69 69
 		);
70 70
 		// EXPIRED TRANSACTION CHECK
71 71
 		add_action(
72 72
 			'AHEE__EE_Cron_Tasks__expired_transaction_check',
73
-			array( 'EE_Cron_Tasks', 'expired_transaction_check' ),
73
+			array('EE_Cron_Tasks', 'expired_transaction_check'),
74 74
 			10, 1
75 75
 		);
76 76
 		// CLEAN OUT JUNK TRANSACTIONS AND RELATED DATA
77 77
 		add_action(
78 78
 				'AHEE__EE_Cron_Tasks__clean_up_junk_transactions',
79
-				array( 'EE_Cron_Tasks', 'clean_out_junk_transactions' )
79
+				array('EE_Cron_Tasks', 'clean_out_junk_transactions')
80 80
 		);
81 81
 		// logging
82 82
 		add_action(
83 83
 			'AHEE__EE_System__load_core_configuration__complete',
84
-			array( 'EE_Cron_Tasks', 'log_scheduled_ee_crons' )
84
+			array('EE_Cron_Tasks', 'log_scheduled_ee_crons')
85 85
 		);
86
-		EE_Registry::instance()->load_lib( 'Messages_Scheduler' );
86
+		EE_Registry::instance()->load_lib('Messages_Scheduler');
87 87
 	}
88 88
 
89 89
 
@@ -98,17 +98,17 @@  discard block
 block discarded – undo
98 98
 			'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
99 99
 			'AHEE__EE_Cron_Tasks__clean_up_junk_transactions',
100 100
 		);
101
-		$crons = get_option( 'cron' );
102
-		if ( ! is_array( $crons ) ) {
101
+		$crons = get_option('cron');
102
+		if ( ! is_array($crons)) {
103 103
 			return;
104 104
 		}
105
-		foreach ( $crons as $timestamp => $cron ) {
106
-			foreach ( $ee_crons as $ee_cron ) {
107
-				if ( isset( $cron[ $ee_cron ] ) ) {
108
-					do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $ee_cron, 'scheduled EE cron' );
109
-					foreach ( $cron[ $ee_cron ] as $ee_cron_details ) {
110
-						if ( ! empty( $ee_cron_details[ 'args' ] )) {
111
-							do_action( 'AHEE_log', __CLASS__, __FUNCTION__, print_r( $ee_cron_details[ 'args' ], true ), "$ee_cron args" );
105
+		foreach ($crons as $timestamp => $cron) {
106
+			foreach ($ee_crons as $ee_cron) {
107
+				if (isset($cron[$ee_cron])) {
108
+					do_action('AHEE_log', __CLASS__, __FUNCTION__, $ee_cron, 'scheduled EE cron');
109
+					foreach ($cron[$ee_cron] as $ee_cron_details) {
110
+						if ( ! empty($ee_cron_details['args'])) {
111
+							do_action('AHEE_log', __CLASS__, __FUNCTION__, print_r($ee_cron_details['args'], true), "$ee_cron args");
112 112
 						}
113 113
 					}
114 114
 				}
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
 	 * @param array  $TXN_IDs
128 128
 	 * @return bool
129 129
 	 */
130
-	public static function reschedule_cron_for_transactions_if_maintenance_mode( $cron_task, $TXN_IDs ) {
130
+	public static function reschedule_cron_for_transactions_if_maintenance_mode($cron_task, $TXN_IDs) {
131 131
 		// reschedule the cron if we can't hit the db right now
132
-		if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) {
133
-			foreach( $TXN_IDs as $TXN_ID => $some_unused_var ) {
132
+		if ( ! EE_Maintenance_Mode::instance()->models_can_query()) {
133
+			foreach ($TXN_IDs as $TXN_ID => $some_unused_var) {
134 134
 				// reset cron job for finalizing the TXN
135 135
 				EE_Cron_Tasks::$cron_task(
136
-					time() + ( 10 * MINUTE_IN_SECONDS ),
136
+					time() + (10 * MINUTE_IN_SECONDS),
137 137
 					$TXN_ID
138 138
 				);
139 139
 			}
@@ -171,15 +171,15 @@  discard block
 block discarded – undo
171 171
 		$TXN_ID,
172 172
 		$PAY_ID
173 173
 	) {
174
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
174
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
175 175
 		// validate $TXN_ID and $timestamp
176
-		$TXN_ID = absint( $TXN_ID );
177
-		$timestamp = absint( $timestamp );
178
-		if ( $TXN_ID && $timestamp ) {
176
+		$TXN_ID = absint($TXN_ID);
177
+		$timestamp = absint($timestamp);
178
+		if ($TXN_ID && $timestamp) {
179 179
 			wp_schedule_single_event(
180 180
 				$timestamp,
181 181
 				'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
182
-				array( $TXN_ID, $PAY_ID )
182
+				array($TXN_ID, $PAY_ID)
183 183
 			);
184 184
 		}
185 185
 	}
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
 	 * @param int  $TXN_ID
202 202
 	 * @param int $PAY_ID
203 203
 	 */
204
-	public static function setup_update_for_transaction_with_payment( $TXN_ID = 0, $PAY_ID = 0 ) {
205
-            do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
206
-		if ( absint( $TXN_ID )) {
207
-			self::$_update_transactions_with_payment[ $TXN_ID ] = $PAY_ID;
204
+	public static function setup_update_for_transaction_with_payment($TXN_ID = 0, $PAY_ID = 0) {
205
+            do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
206
+		if (absint($TXN_ID)) {
207
+			self::$_update_transactions_with_payment[$TXN_ID] = $PAY_ID;
208 208
 			add_action(
209 209
 				'shutdown',
210
-				array( 'EE_Cron_Tasks', 'update_transaction_with_payment' ),
210
+				array('EE_Cron_Tasks', 'update_transaction_with_payment'),
211 211
 				5
212 212
 			);
213 213
 		}
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
 		if (
231 231
 			// are there any TXNs that need cleaning up ?
232
-			! empty( self::$_update_transactions_with_payment ) &&
232
+			! empty(self::$_update_transactions_with_payment) &&
233 233
 			// reschedule the cron if we can't hit the db right now
234 234
 			! EE_Cron_Tasks::reschedule_cron_for_transactions_if_maintenance_mode(
235 235
 				'schedule_update_transaction_with_payment',
@@ -237,20 +237,20 @@  discard block
 block discarded – undo
237 237
 			)
238 238
 		) {
239 239
 			/** @type EE_Payment_Processor $payment_processor */
240
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
240
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
241 241
 			// set revisit flag for payment processor
242
-			$payment_processor->set_revisit( false );
242
+			$payment_processor->set_revisit(false);
243 243
 			// load EEM_Transaction
244
-			EE_Registry::instance()->load_model( 'Transaction' );
245
-			foreach ( self::$_update_transactions_with_payment as $TXN_ID => $PAY_ID ) {
246
-				$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
247
-				$payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID );
244
+			EE_Registry::instance()->load_model('Transaction');
245
+			foreach (self::$_update_transactions_with_payment as $TXN_ID => $PAY_ID) {
246
+				$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
247
+				$payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
248 248
 				// verify transaction
249
-				if ( $transaction instanceof EE_Transaction && $payment instanceof EE_Payment ) {
249
+				if ($transaction instanceof EE_Transaction && $payment instanceof EE_Payment) {
250 250
 					// now try to update the TXN with any payments
251
-					$payment_processor->update_txn_based_on_payment( $transaction, $payment, true, true );
251
+					$payment_processor->update_txn_based_on_payment($transaction, $payment, true, true);
252 252
 				}
253
-				unset( self::$_update_transactions_with_payment[ $TXN_ID ] );
253
+				unset(self::$_update_transactions_with_payment[$TXN_ID]);
254 254
 			}
255 255
 		}
256 256
 	}
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 		$TXN_ID
288 288
 	) {
289 289
 		// validate $TXN_ID and $timestamp
290
-		$TXN_ID = absint( $TXN_ID );
291
-		$timestamp = absint( $timestamp );
292
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
293
-		if ( $TXN_ID && $timestamp ) {
290
+		$TXN_ID = absint($TXN_ID);
291
+		$timestamp = absint($timestamp);
292
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
293
+		if ($TXN_ID && $timestamp) {
294 294
 			// DEBUG LOG
295 295
 			//EEH_Debug_Tools::log(
296 296
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 			wp_schedule_single_event(
301 301
 				$timestamp,
302 302
 				'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
303
-				array( $TXN_ID )
303
+				array($TXN_ID)
304 304
 			);
305 305
 		}
306 306
 	}
@@ -322,13 +322,13 @@  discard block
 block discarded – undo
322 322
 	 *
323 323
 	 * @param int $TXN_ID
324 324
 	 */
325
-	public static function check_for_abandoned_transactions(	$TXN_ID = 0 ) {
326
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
327
-		if ( absint( $TXN_ID )) {
328
-			self::$_abandoned_transactions[ $TXN_ID ]  = $TXN_ID;
325
+	public static function check_for_abandoned_transactions($TXN_ID = 0) {
326
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
327
+		if (absint($TXN_ID)) {
328
+			self::$_abandoned_transactions[$TXN_ID] = $TXN_ID;
329 329
 			add_action(
330 330
 				'shutdown',
331
-				array( 'EE_Cron_Tasks', 'finalize_abandoned_transactions' ),
331
+				array('EE_Cron_Tasks', 'finalize_abandoned_transactions'),
332 332
 				5
333 333
 			);
334 334
 		}
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	public static function finalize_abandoned_transactions() {
350 350
 		if (
351 351
 			// are there any TXNs that need cleaning up ?
352
-			! empty( self::$_abandoned_transactions ) &&
352
+			! empty(self::$_abandoned_transactions) &&
353 353
 			// reschedule the cron if we can't hit the db right now
354 354
 			! EE_Cron_Tasks::reschedule_cron_for_transactions_if_maintenance_mode(
355 355
 				'schedule_finalize_abandoned_transactions_check',
@@ -357,33 +357,33 @@  discard block
 block discarded – undo
357 357
 			)
358 358
 		) {
359 359
 			/** @type EE_Transaction_Processor $transaction_processor */
360
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
360
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
361 361
 			// set revisit flag for txn processor
362
-			$transaction_processor->set_revisit( false );
362
+			$transaction_processor->set_revisit(false);
363 363
 			/** @type EE_Payment_Processor $payment_processor */
364
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
364
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
365 365
 			// load EEM_Transaction
366
-			EE_Registry::instance()->load_model( 'Transaction' );
367
-			foreach ( self::$_abandoned_transactions as $TXN_ID ) {
366
+			EE_Registry::instance()->load_model('Transaction');
367
+			foreach (self::$_abandoned_transactions as $TXN_ID) {
368 368
 				// DEBUG LOG
369 369
 				//EEH_Debug_Tools::log(
370 370
 				//	__CLASS__, __FUNCTION__, __LINE__,
371 371
 				//	array( '$TXN_ID' => $TXN_ID ),
372 372
 				//	false, 'EE_Transaction: ' . $TXN_ID
373 373
 				//);
374
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
375
-				$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
374
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
375
+				$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
376 376
 				// verify transaction
377
-				if ( $transaction instanceof EE_Transaction ) {
377
+				if ($transaction instanceof EE_Transaction) {
378 378
 					// don't finalize the TXN if it has already been completed
379
-					if ( $transaction->all_reg_steps_completed() === true ) {
379
+					if ($transaction->all_reg_steps_completed() === true) {
380 380
 						continue;
381 381
 					}
382 382
 					// let's simulate an IPN here which will trigger any notifications that need to go out
383
-					$payment_processor->update_txn_based_on_payment( $transaction, $transaction->last_payment(), true, true );
384
-					do_action( 'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions__abandoned_transaction', $transaction );
383
+					$payment_processor->update_txn_based_on_payment($transaction, $transaction->last_payment(), true, true);
384
+					do_action('AHEE__EE_Cron_Tasks__finalize_abandoned_transactions__abandoned_transaction', $transaction);
385 385
 				}
386
-				unset( self::$_abandoned_transactions[ $TXN_ID ] );
386
+				unset(self::$_abandoned_transactions[$TXN_ID]);
387 387
 			}
388 388
 		}
389 389
 	}
@@ -417,13 +417,13 @@  discard block
 block discarded – undo
417 417
 		$TXN_ID
418 418
 	) {
419 419
 		// validate $TXN_ID and $timestamp
420
-		$TXN_ID = absint( $TXN_ID );
421
-		$timestamp = absint( $timestamp );
422
-		if ( $TXN_ID && $timestamp ) {
420
+		$TXN_ID = absint($TXN_ID);
421
+		$timestamp = absint($timestamp);
422
+		if ($TXN_ID && $timestamp) {
423 423
 			wp_schedule_single_event(
424 424
 				$timestamp,
425 425
 				'AHEE__EE_Cron_Tasks__expired_transaction_check',
426
-				array( $TXN_ID )
426
+				array($TXN_ID)
427 427
 			);
428 428
 		}
429 429
 	}
@@ -445,12 +445,12 @@  discard block
 block discarded – undo
445 445
 	 *
446 446
 	 * @param int $TXN_ID
447 447
 	 */
448
-	public static function expired_transaction_check(	$TXN_ID = 0 ) {
449
-		if ( absint( $TXN_ID )) {
450
-			self::$_expired_transactions[ $TXN_ID ]  = $TXN_ID;
448
+	public static function expired_transaction_check($TXN_ID = 0) {
449
+		if (absint($TXN_ID)) {
450
+			self::$_expired_transactions[$TXN_ID] = $TXN_ID;
451 451
 			add_action(
452 452
 				'shutdown',
453
-				array( 'EE_Cron_Tasks', 'process_expired_transactions' ),
453
+				array('EE_Cron_Tasks', 'process_expired_transactions'),
454 454
 				5
455 455
 			);
456 456
 		}
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	public static function process_expired_transactions() {
467 467
 		if (
468 468
 			// are there any TXNs that need cleaning up ?
469
-			! empty( self::$_expired_transactions ) &&
469
+			! empty(self::$_expired_transactions) &&
470 470
 			// reschedule the cron if we can't hit the db right now
471 471
 			! EE_Cron_Tasks::reschedule_cron_for_transactions_if_maintenance_mode(
472 472
 				'schedule_expired_transaction_check',
@@ -474,33 +474,33 @@  discard block
 block discarded – undo
474 474
 			)
475 475
 		) {
476 476
 			/** @type EE_Transaction_Processor $transaction_processor */
477
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
477
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
478 478
 			// set revisit flag for txn processor
479
-			$transaction_processor->set_revisit( false );
479
+			$transaction_processor->set_revisit(false);
480 480
 			 // load EEM_Transaction
481
-			EE_Registry::instance()->load_model( 'Transaction' );
482
-			foreach ( self::$_expired_transactions as $TXN_ID ) {
483
-				$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
481
+			EE_Registry::instance()->load_model('Transaction');
482
+			foreach (self::$_expired_transactions as $TXN_ID) {
483
+				$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
484 484
 				// verify transaction and whether it is failed or not
485
-				if ( $transaction instanceof EE_Transaction) {
486
-					switch( $transaction->status_ID() ) {
485
+				if ($transaction instanceof EE_Transaction) {
486
+					switch ($transaction->status_ID()) {
487 487
 						// Completed TXNs
488 488
 						case EEM_Transaction::complete_status_code :
489
-							do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__completed_transaction', $transaction );
489
+							do_action('AHEE__EE_Cron_Tasks__process_expired_transactions__completed_transaction', $transaction);
490 490
 							break;
491 491
 						// Overpaid TXNs
492 492
 						case EEM_Transaction::overpaid_status_code :
493
-							do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__overpaid_transaction', $transaction );
493
+							do_action('AHEE__EE_Cron_Tasks__process_expired_transactions__overpaid_transaction', $transaction);
494 494
 							break;
495 495
 						// Incomplete TXNs
496 496
 						case EEM_Transaction::incomplete_status_code :
497
-							do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__incomplete_transaction', $transaction );
497
+							do_action('AHEE__EE_Cron_Tasks__process_expired_transactions__incomplete_transaction', $transaction);
498 498
 							// todo : merge the finalize_abandoned_transactions cron into this one...
499 499
 							// todo : move business logic into EE_Transaction_Processor for finalizing abandoned transactions
500 500
 							break;
501 501
 						// Failed TXNs
502 502
 						case EEM_Transaction::failed_status_code :
503
-							do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__failed_transaction', $transaction );
503
+							do_action('AHEE__EE_Cron_Tasks__process_expired_transactions__failed_transaction', $transaction);
504 504
 							// todo : perform garbage collection here and remove clean_out_junk_transactions()
505 505
 							//$registrations = $transaction->registrations();
506 506
 							//if ( ! empty( $registrations ) ) {
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 					}
522 522
 
523 523
 				}
524
-				unset( self::$_expired_transactions[ $TXN_ID ] );
524
+				unset(self::$_expired_transactions[$TXN_ID]);
525 525
 			}
526 526
 		}
527 527
 	}
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	//when a transaction is initially made, schedule this check.
536 536
 	//if it has NO REG data by the time it has expired, forget about it
537 537
 	public static function clean_out_junk_transactions() {
538
-		if( EE_Maintenance_Mode::instance()->models_can_query() ) {
538
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
539 539
 			EEM_Transaction::instance('')->delete_junk_transactions();
540 540
 			EEM_Registration::instance('')->delete_registrations_with_no_transaction();
541 541
 			EEM_Line_Item::instance('')->delete_line_items_with_no_transaction();
Please login to merge, or discard this patch.
core/admin/templates/espresso_ratings_request_content.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <div class="padding">
2
-	<p><?php _e( 'We need your help to continue maintaining and providing this plugin for free. You can help by leaving a positive review in the WordPress plugin directory. 5 star ratings bring Event Espresso Decaf to the attention of more users which increases our support and features for this version of Event Espresso.', 'event_espresso' ); ?></p>
3
-	<p><?php _e( 'Rate it five stars today!', 'event_espresso' ); ?></p><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span>
4
-	<p><a class="button button-primary" href="https://events.codebasehq.com/redirect?https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Fview%2Fplugin-reviews%2Fevent-espresso-decaf%3Frate%3D5%23postform"><?php _e( 'Rate It!', 'event_espresso' ); ?></a></p>
2
+	<p><?php _e('We need your help to continue maintaining and providing this plugin for free. You can help by leaving a positive review in the WordPress plugin directory. 5 star ratings bring Event Espresso Decaf to the attention of more users which increases our support and features for this version of Event Espresso.', 'event_espresso'); ?></p>
3
+	<p><?php _e('Rate it five stars today!', 'event_espresso'); ?></p><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span>
4
+	<p><a class="button button-primary" href="https://events.codebasehq.com/redirect?https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Fview%2Fplugin-reviews%2Fevent-espresso-decaf%3Frate%3D5%23postform"><?php _e('Rate It!', 'event_espresso'); ?></a></p>
5 5
 </div>
6 6
\ No newline at end of file
Please login to merge, or discard this patch.
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 	 * _get_transaction_and_cart_for_previous_visit
691 691
 	 *
692 692
 	 * @access private
693
-	 * 	@return mixed EE_Transaction|NULL
693
+	 * 	@return EE_Transaction|null EE_Transaction|NULL
694 694
 	 */
695 695
 	private function _get_transaction_and_cart_for_previous_visit() {
696 696
 		/** @var $TXN_model EEM_Transaction */
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 	 * 	generates a new EE_Transaction object and adds it to the $_transaction property.
769 769
 	 *
770 770
 	 * 	@access private
771
-	 * 	@return mixed EE_Transaction|NULL
771
+	 * 	@return EE_Transaction|null EE_Transaction|NULL
772 772
 	 */
773 773
 	private function _initialize_transaction() {
774 774
 		try {
Please login to merge, or discard this patch.
Spacing   +275 added lines, -275 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\domain\services\capabilities\PublicCapabilities;
2 2
 use EventEspresso\core\exceptions\InvalidEntityException;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
5 5
 /**
6 6
  * Single Page Checkout (SPCO)
7 7
  *
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 	 * @return EED_Single_Page_Checkout
51 51
 	 */
52 52
 	public static function instance() {
53
-		add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' );
54
-		return parent::get_instance( __CLASS__ );
53
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
54
+		return parent::get_instance(__CLASS__);
55 55
 	}
56 56
 
57 57
 
@@ -96,22 +96,22 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public static function set_hooks_admin() {
98 98
 		EED_Single_Page_Checkout::set_definitions();
99
-		if ( defined( 'DOING_AJAX' )) {
99
+		if (defined('DOING_AJAX')) {
100 100
 			// going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
101 101
 			ob_start();
102 102
 			EED_Single_Page_Checkout::load_request_handler();
103 103
 			EED_Single_Page_Checkout::load_reg_steps();
104 104
 		} else {
105 105
 			// hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called
106
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
106
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
107 107
 		}
108 108
 		// set ajax hooks
109
-		add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
110
-		add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
111
-		add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
112
-		add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
113
-		add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
114
-		add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
109
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
110
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
111
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
112
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
113
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
114
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
115 115
 	}
116 116
 
117 117
 
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 * @param string $ajax_action
123 123
 	 * @throws \EE_Error
124 124
 	 */
125
-	public static function process_ajax_request( $ajax_action ) {
126
-		EE_Registry::instance()->REQ->set( 'action', $ajax_action );
125
+	public static function process_ajax_request($ajax_action) {
126
+		EE_Registry::instance()->REQ->set('action', $ajax_action);
127 127
 		EED_Single_Page_Checkout::instance()->_initialize();
128 128
 	}
129 129
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 * @throws \EE_Error
136 136
 	 */
137 137
 	public static function display_reg_step() {
138
-		EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' );
138
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
139 139
 	}
140 140
 
141 141
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @throws \EE_Error
147 147
 	 */
148 148
 	public static function process_reg_step() {
149
-		EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' );
149
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
150 150
 	}
151 151
 
152 152
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @throws \EE_Error
158 158
 	 */
159 159
 	public static function update_reg_step() {
160
-		EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' );
160
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
161 161
 	}
162 162
 
163 163
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @throws \EE_Error
171 171
 	 */
172 172
 	public static function update_checkout() {
173
-		EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' );
173
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
174 174
 	}
175 175
 
176 176
 
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public static function load_request_handler() {
185 185
 		// load core Request_Handler class
186
-		if ( ! isset( EE_Registry::instance()->REQ )) {
187
-			EE_Registry::instance()->load_core( 'Request_Handler' );
186
+		if ( ! isset(EE_Registry::instance()->REQ)) {
187
+			EE_Registry::instance()->load_core('Request_Handler');
188 188
 		}
189 189
 	}
190 190
 
@@ -198,21 +198,21 @@  discard block
 block discarded – undo
198 198
 	 * @throws \EE_Error
199 199
 	 */
200 200
 	public static function set_definitions() {
201
-		define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
202
-		define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS );
203
-		define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS );
204
-		define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS );
205
-		define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS );
206
-		define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS );
207
-		define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS );
208
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE );
209
-		EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ] = sprintf(
210
-			__( '%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ),
201
+		define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
202
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
203
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
204
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
205
+		define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
206
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
207
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
208
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE);
209
+		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
210
+			__('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'),
211 211
 			'<h4 class="important-notice">',
212 212
 			'</h4>',
213 213
 			'<br />',
214 214
 			'<p>',
215
-			'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
215
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
216 216
 			'">',
217 217
 			'</a>',
218 218
 			'</p>'
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	public static function load_reg_steps() {
233 233
 		static $reg_steps_loaded = FALSE;
234
-		if ( $reg_steps_loaded ) {
234
+		if ($reg_steps_loaded) {
235 235
 			return;
236 236
 		}
237 237
 		// filter list of reg_steps
@@ -240,24 +240,24 @@  discard block
 block discarded – undo
240 240
 			EED_Single_Page_Checkout::get_reg_steps()
241 241
 		);
242 242
 		// sort by key (order)
243
-		ksort( $reg_steps_to_load );
243
+		ksort($reg_steps_to_load);
244 244
 		// loop through folders
245
-		foreach ( $reg_steps_to_load as $order => $reg_step ) {
245
+		foreach ($reg_steps_to_load as $order => $reg_step) {
246 246
 			// we need a
247
-			if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
247
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
248 248
 				// copy over to the reg_steps_array
249
-				EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step;
249
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
250 250
 				// register custom key route for each reg step
251 251
 				// ie: step=>"slug" - this is the entire reason we load the reg steps array now
252
-				EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' );
252
+				EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
253 253
 				// add AJAX or other hooks
254
-				if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) {
254
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
255 255
 					// setup autoloaders if necessary
256
-					if ( ! class_exists( $reg_step['class_name'] )) {
257
-						EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE );
256
+					if ( ! class_exists($reg_step['class_name'])) {
257
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE);
258 258
 					}
259
-					if ( is_callable( $reg_step['class_name'], 'set_hooks' )) {
260
-						call_user_func( array( $reg_step['class_name'], 'set_hooks' ));
259
+					if (is_callable($reg_step['class_name'], 'set_hooks')) {
260
+						call_user_func(array($reg_step['class_name'], 'set_hooks'));
261 261
 					}
262 262
 				}
263 263
 			}
@@ -276,28 +276,28 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	public static function get_reg_steps() {
278 278
 		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
279
-		if ( empty( $reg_steps )) {
279
+		if (empty($reg_steps)) {
280 280
 			$reg_steps = array(
281 281
 				10 => array(
282
-					'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information',
282
+					'file_path' => SPCO_REG_STEPS_PATH.'attendee_information',
283 283
 					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
284 284
 					'slug' => 'attendee_information',
285 285
 					'has_hooks' => FALSE
286 286
 				),
287 287
 				20 => array(
288
-					'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation',
288
+					'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation',
289 289
 					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
290 290
 					'slug' => 'registration_confirmation',
291 291
 					'has_hooks' => FALSE
292 292
 				),
293 293
 				30 => array(
294
-					'file_path' => SPCO_REG_STEPS_PATH . 'payment_options',
294
+					'file_path' => SPCO_REG_STEPS_PATH.'payment_options',
295 295
 					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
296 296
 					'slug' => 'payment_options',
297 297
 					'has_hooks' => TRUE
298 298
 				),
299 299
 				999 => array(
300
-					'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration',
300
+					'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration',
301 301
 					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
302 302
 					'slug' => 'finalize_registration',
303 303
 					'has_hooks' => FALSE
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	public static function registration_checkout_for_admin() {
320 320
 		EED_Single_Page_Checkout::load_reg_steps();
321
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
322
-		EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' );
323
-		EE_Registry::instance()->REQ->set( 'process_form_submission', false );
321
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
322
+		EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
323
+		EE_Registry::instance()->REQ->set('process_form_submission', false);
324 324
 		EED_Single_Page_Checkout::instance()->_initialize();
325 325
 		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
326 326
 		return EE_Registry::instance()->REQ->get_output();
@@ -337,15 +337,15 @@  discard block
 block discarded – undo
337 337
 	 */
338 338
 	public static function process_registration_from_admin() {
339 339
 		EED_Single_Page_Checkout::load_reg_steps();
340
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
341
-		EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' );
342
-		EE_Registry::instance()->REQ->set( 'process_form_submission', true );
340
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
341
+		EE_Registry::instance()->REQ->set('action', 'process_reg_step');
342
+		EE_Registry::instance()->REQ->set('process_form_submission', true);
343 343
 		EED_Single_Page_Checkout::instance()->_initialize();
344
-		if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) {
345
-			$final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps );
346
-			if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
347
-				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step );
348
-				if ( $final_reg_step->process_reg_step() ) {
344
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
345
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
346
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
347
+				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step);
348
+				if ($final_reg_step->process_reg_step()) {
349 349
 					$final_reg_step->set_completed();
350 350
 					EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array();
351 351
 					return EED_Single_Page_Checkout::instance()->checkout->transaction;
@@ -365,11 +365,11 @@  discard block
 block discarded – undo
365 365
 	 * @return    void
366 366
 	 * @throws \EE_Error
367 367
 	 */
368
-	public function run( $WP_Query ) {
368
+	public function run($WP_Query) {
369 369
 		if (
370 370
 			$WP_Query instanceof WP_Query
371 371
 			&& $WP_Query->is_main_query()
372
-			&& apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )
372
+			&& apply_filters('FHEE__EED_Single_Page_Checkout__run', true)
373 373
 		) {
374 374
 			$this->_initialize();
375 375
 		}
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
 	 * @return    void
386 386
 	 * @throws \EE_Error
387 387
 	 */
388
-	public static function init( $WP_Query ) {
389
-		EED_Single_Page_Checkout::instance()->run( $WP_Query );
388
+	public static function init($WP_Query) {
389
+		EED_Single_Page_Checkout::instance()->run($WP_Query);
390 390
 	}
391 391
 
392 392
 
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 	 */
401 401
 	private function _initialize() {
402 402
 		// ensure SPCO doesn't run twice
403
-		if ( EED_Single_Page_Checkout::$_initialized ) {
403
+		if (EED_Single_Page_Checkout::$_initialized) {
404 404
 			return;
405 405
 		}
406 406
 		try {
@@ -408,22 +408,22 @@  discard block
 block discarded – undo
408 408
 			// setup the EE_Checkout object
409 409
 			$this->checkout = $this->_initialize_checkout();
410 410
 			// filter checkout
411
-			$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout );
411
+			$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
412 412
 			// get the $_GET
413 413
 			$this->_get_request_vars();
414 414
 			// filter continue_reg
415
-			$this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout );
415
+			$this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout);
416 416
 			// load the reg steps array
417
-			if ( ! $this->_load_and_instantiate_reg_steps() ) {
417
+			if ( ! $this->_load_and_instantiate_reg_steps()) {
418 418
 				EED_Single_Page_Checkout::$_initialized = true;
419 419
 				return;
420 420
 			}
421 421
 			// set the current step
422
-			$this->checkout->set_current_step( $this->checkout->step );
422
+			$this->checkout->set_current_step($this->checkout->step);
423 423
 			// and the next step
424 424
 			$this->checkout->set_next_step();
425 425
 			// verify that everything has been setup correctly
426
-			if ( ! ( $this->_verify_transaction_and_get_registrations() && $this->_final_verifications() ) ) {
426
+			if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) {
427 427
 				EED_Single_Page_Checkout::$_initialized = true;
428 428
 				return;
429 429
 			}
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
 			// set no cache headers and constants
449 449
 			EE_System::do_not_cache();
450 450
 			// add anchor
451
-			add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 );
451
+			add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
452 452
 			// remove transaction lock
453
-			add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 );
454
-		} catch ( Exception $e ) {
455
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
453
+			add_action('shutdown', array($this, 'unlock_transaction'), 1);
454
+		} catch (Exception $e) {
455
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
456 456
 		}
457 457
 	}
458 458
 
@@ -466,16 +466,16 @@  discard block
 block discarded – undo
466 466
 	 * @throws EE_Error
467 467
 	 */
468 468
 	private function _verify_session() {
469
-		if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) {
470
-			throw new EE_Error( __( 'The EE_Session class could not be loaded.', 'event_espresso' ) );
469
+		if ( ! EE_Registry::instance()->SSN instanceof EE_Session) {
470
+			throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso'));
471 471
 		}
472 472
 		// is session still valid ?
473
-		if ( EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) === '' ) {
473
+		if (EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '') {
474 474
 			$this->checkout = new EE_Checkout();
475 475
 			EE_Registry::instance()->SSN->reset_cart();
476 476
 			EE_Registry::instance()->SSN->reset_checkout();
477 477
 			EE_Registry::instance()->SSN->reset_transaction();
478
-			EE_Error::add_attention( EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ], __FILE__, __FUNCTION__, __LINE__ );
478
+			EE_Error::add_attention(EE_Registry::$i18n_js_strings['registration_expiration_notice'], __FILE__, __FUNCTION__, __LINE__);
479 479
 			EE_Registry::instance()->SSN->reset_expired();
480 480
 		}
481 481
 	}
@@ -495,20 +495,20 @@  discard block
 block discarded – undo
495 495
 		/** @type EE_Checkout $checkout */
496 496
 		$checkout = EE_Registry::instance()->SSN->checkout();
497 497
 		// verify
498
-		if ( ! $checkout instanceof EE_Checkout ) {
498
+		if ( ! $checkout instanceof EE_Checkout) {
499 499
 			// instantiate EE_Checkout object for handling the properties of the current checkout process
500
-			$checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE  );
500
+			$checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE);
501 501
 		} else {
502
-			if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true )  {
502
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
503 503
 				$this->unlock_transaction();
504
-				wp_safe_redirect( $checkout->redirect_url );
504
+				wp_safe_redirect($checkout->redirect_url);
505 505
 				exit();
506 506
 			}
507 507
 		}
508
-		$checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout );
508
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
509 509
 		// verify again
510
-		if ( ! $checkout instanceof EE_Checkout ) {
511
-			throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) );
510
+		if ( ! $checkout instanceof EE_Checkout) {
511
+			throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
512 512
 		}
513 513
 		// reset anything that needs a clean slate for each request
514 514
 		$checkout->reset_for_current_request();
@@ -528,24 +528,24 @@  discard block
 block discarded – undo
528 528
 		// load classes
529 529
 		EED_Single_Page_Checkout::load_request_handler();
530 530
 		//make sure this request is marked as belonging to EE
531
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
531
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
532 532
 		// which step is being requested ?
533
-		$this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() );
533
+		$this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
534 534
 		// which step is being edited ?
535
-		$this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' );
535
+		$this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
536 536
 		// and what we're doing on the current step
537
-		$this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' );
537
+		$this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
538 538
 		// returning to edit ?
539
-		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' );
539
+		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
540 540
 		// or some other kind of revisit ?
541
-		$this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE );
541
+		$this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE);
542 542
 		// and whether or not to generate a reg form for this request
543
-		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); 		// TRUE 	FALSE
543
+		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE 	FALSE
544 544
 		// and whether or not to process a reg form submission for this request
545
-		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); 		// TRUE 	FALSE
545
+		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE 	FALSE
546 546
 		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step'
547 547
 			? $this->checkout->process_form_submission
548
-			: FALSE; 		// TRUE 	FALSE
548
+			: FALSE; // TRUE 	FALSE
549 549
 		// $this->_display_request_vars();
550 550
 	}
551 551
 
@@ -558,17 +558,17 @@  discard block
 block discarded – undo
558 558
 	 * @return    void
559 559
 	 */
560 560
 	protected function _display_request_vars() {
561
-		if ( ! WP_DEBUG ) {
561
+		if ( ! WP_DEBUG) {
562 562
 			return;
563 563
 		}
564
-		EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
565
-		EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ );
566
-		EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ );
567
-		EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ );
568
-		EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ );
569
-		EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ );
570
-		EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ );
571
-		EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ );
564
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
565
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
566
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
567
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
568
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
569
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
570
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
571
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
572 572
 	}
573 573
 
574 574
 
@@ -582,8 +582,8 @@  discard block
 block discarded – undo
582 582
 	 * @return    array
583 583
 	 */
584 584
 	private function _get_first_step() {
585
-		$first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array );
586
-		return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information';
585
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
586
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
587 587
 	}
588 588
 
589 589
 
@@ -599,27 +599,27 @@  discard block
 block discarded – undo
599 599
 	private function _load_and_instantiate_reg_steps() {
600 600
 		// have reg_steps already been instantiated ?
601 601
 		if (
602
-			empty( $this->checkout->reg_steps ) ||
603
-			apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout )
602
+			empty($this->checkout->reg_steps) ||
603
+			apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
604 604
 		) {
605 605
 			// if not, then loop through raw reg steps array
606
-			foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) {
607
-				if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) {
606
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
607
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
608 608
 					return false;
609 609
 				}
610 610
 			}
611 611
 			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE;
612 612
 			EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE;
613 613
 			// skip the registration_confirmation page ?
614
-			if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) {
614
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
615 615
 				// just remove it from the reg steps array
616
-				$this->checkout->remove_reg_step( 'registration_confirmation', false );
616
+				$this->checkout->remove_reg_step('registration_confirmation', false);
617 617
 			} else if (
618
-				isset( $this->checkout->reg_steps['registration_confirmation'] )
618
+				isset($this->checkout->reg_steps['registration_confirmation'])
619 619
 				&& EE_Registry::instance()->CFG->registration->reg_confirmation_last
620 620
 			) {
621 621
 				// set the order to something big like 100
622
-				$this->checkout->set_reg_step_order( 'registration_confirmation', 100 );
622
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
623 623
 			}
624 624
 			// filter the array for good luck
625 625
 			$this->checkout->reg_steps = apply_filters(
@@ -629,13 +629,13 @@  discard block
 block discarded – undo
629 629
 			// finally re-sort based on the reg step class order properties
630 630
 			$this->checkout->sort_reg_steps();
631 631
 		} else {
632
-			foreach ( $this->checkout->reg_steps as $reg_step ) {
632
+			foreach ($this->checkout->reg_steps as $reg_step) {
633 633
 				// set all current step stati to FALSE
634
-				$reg_step->set_is_current_step( FALSE );
634
+				$reg_step->set_is_current_step(FALSE);
635 635
 			}
636 636
 		}
637
-		if ( empty( $this->checkout->reg_steps )) {
638
-			EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
637
+		if (empty($this->checkout->reg_steps)) {
638
+			EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
639 639
 			return false;
640 640
 		}
641 641
 			// make reg step details available to JS
@@ -653,10 +653,10 @@  discard block
 block discarded – undo
653 653
 	 * @param int   $order
654 654
 	 * @return bool
655 655
 	 */
656
-	private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) {
656
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) {
657 657
 
658 658
 		// we need a file_path, class_name, and slug to add a reg step
659
-		if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
659
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
660 660
 			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
661 661
 			if (
662 662
 				$this->checkout->reg_url_link
@@ -674,26 +674,26 @@  discard block
 block discarded – undo
674 674
 				FALSE
675 675
 			);
676 676
 			// did we gets the goods ?
677
-			if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) {
677
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
678 678
 				// set reg step order based on config
679
-				$reg_step_obj->set_order( $order );
679
+				$reg_step_obj->set_order($order);
680 680
 				// add instantiated reg step object to the master reg steps array
681
-				$this->checkout->add_reg_step( $reg_step_obj );
681
+				$this->checkout->add_reg_step($reg_step_obj);
682 682
 			} else {
683 683
 				EE_Error::add_error(
684
-					__( 'The current step could not be set.', 'event_espresso' ),
684
+					__('The current step could not be set.', 'event_espresso'),
685 685
 					__FILE__, __FUNCTION__, __LINE__
686 686
 				);
687 687
 				return false;
688 688
 			}
689 689
 		} else {
690
-			if ( WP_DEBUG ) {
690
+			if (WP_DEBUG) {
691 691
 				EE_Error::add_error(
692 692
 					sprintf(
693
-						__( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ),
694
-						isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '',
695
-						isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '',
696
-						isset( $reg_step['slug'] ) ? $reg_step['slug'] : '',
693
+						__('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'),
694
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
695
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
696
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
697 697
 						'<ul>',
698 698
 						'<li>',
699 699
 						'</li>',
@@ -717,15 +717,15 @@  discard block
 block discarded – undo
717 717
 	 */
718 718
 	private function _verify_transaction_and_get_registrations() {
719 719
 		// was there already a valid transaction in the checkout from the session ?
720
-		if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
720
+		if ( ! $this->checkout->transaction instanceof EE_Transaction) {
721 721
 			// get transaction from db or session
722 722
 			$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin()
723 723
 				? $this->_get_transaction_and_cart_for_previous_visit()
724 724
 				: $this->_get_cart_for_current_session_and_setup_new_transaction();
725 725
 
726
-			if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
726
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
727 727
 				EE_Error::add_error(
728
-					__( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ),
728
+					__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'),
729 729
 					__FILE__, __FUNCTION__, __LINE__
730 730
 				);
731 731
 				$this->checkout->transaction = EE_Transaction::new_instance();
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 				return false;
736 736
 			}
737 737
 			// and the registrations for the transaction
738
-			$this->_get_registrations( $this->checkout->transaction );
738
+			$this->_get_registrations($this->checkout->transaction);
739 739
 		}
740 740
 		return true;
741 741
 	}
@@ -750,16 +750,16 @@  discard block
 block discarded – undo
750 750
 	 */
751 751
 	private function _get_transaction_and_cart_for_previous_visit() {
752 752
 		/** @var $TXN_model EEM_Transaction */
753
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
753
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
754 754
 		// because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db
755
-		$transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link );
755
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
756 756
 		// verify transaction
757
-		if ( $transaction instanceof EE_Transaction ) {
757
+		if ($transaction instanceof EE_Transaction) {
758 758
 			// and get the cart that was used for that transaction
759
-			$this->checkout->cart = $this->_get_cart_for_transaction( $transaction );
759
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
760 760
 			return $transaction;
761 761
 		} else {
762
-			EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
762
+			EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
763 763
 			return NULL;
764 764
 		}
765 765
 	}
@@ -773,8 +773,8 @@  discard block
 block discarded – undo
773 773
 	 * @param EE_Transaction $transaction
774 774
 	 * @return EE_Cart
775 775
 	 */
776
-	private function _get_cart_for_transaction( $transaction ) {
777
-		return $this->checkout->get_cart_for_transaction( $transaction );
776
+	private function _get_cart_for_transaction($transaction) {
777
+		return $this->checkout->get_cart_for_transaction($transaction);
778 778
 	}
779 779
 
780 780
 
@@ -786,8 +786,8 @@  discard block
 block discarded – undo
786 786
 	 * @param EE_Transaction $transaction
787 787
 	 * @return EE_Cart
788 788
 	 */
789
-	public function get_cart_for_transaction( EE_Transaction $transaction ) {
790
-		return $this->checkout->get_cart_for_transaction( $transaction );
789
+	public function get_cart_for_transaction(EE_Transaction $transaction) {
790
+		return $this->checkout->get_cart_for_transaction($transaction);
791 791
 	}
792 792
 
793 793
 
@@ -803,15 +803,15 @@  discard block
 block discarded – undo
803 803
 	private function _get_cart_for_current_session_and_setup_new_transaction() {
804 804
 		//  if there's no transaction, then this is the FIRST visit to SPCO
805 805
 		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
806
-		$this->checkout->cart = $this->_get_cart_for_transaction( NULL );
806
+		$this->checkout->cart = $this->_get_cart_for_transaction(NULL);
807 807
 		// and then create a new transaction
808 808
 		$transaction = $this->_initialize_transaction();
809 809
 		// verify transaction
810
-		if ( $transaction instanceof EE_Transaction ) {
810
+		if ($transaction instanceof EE_Transaction) {
811 811
 			// and save TXN data to the cart
812
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() );
812
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
813 813
 		} else {
814
-			EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
814
+			EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
815 815
 		}
816 816
 		return $transaction;
817 817
 	}
@@ -847,8 +847,8 @@  discard block
 block discarded – undo
847 847
 				$transaction->ID()
848 848
 			);
849 849
 			return $transaction;
850
-		} catch( Exception $e ) {
851
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
850
+		} catch (Exception $e) {
851
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
852 852
 		}
853 853
 		return NULL;
854 854
 	}
@@ -863,38 +863,38 @@  discard block
 block discarded – undo
863 863
 	 * @return EE_Cart
864 864
 	 * @throws \EE_Error
865 865
 	 */
866
-	private function _get_registrations( EE_Transaction $transaction ) {
866
+	private function _get_registrations(EE_Transaction $transaction) {
867 867
 		// first step: grab the registrants  { : o
868
-		$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true );
868
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
869 869
 		// verify registrations have been set
870
-		if ( empty( $registrations )) {
870
+		if (empty($registrations)) {
871 871
 			// if no cached registrations, then check the db
872
-			$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false );
872
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
873 873
 			// still nothing ? well as long as this isn't a revisit
874
-			if ( empty( $registrations ) && ! $this->checkout->revisit ) {
874
+			if (empty($registrations) && ! $this->checkout->revisit) {
875 875
 				// generate new registrations from scratch
876
-				$registrations = $this->_initialize_registrations( $transaction );
876
+				$registrations = $this->_initialize_registrations($transaction);
877 877
 			}
878 878
 		}
879 879
 		// sort by their original registration order
880
-		usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' ));
880
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
881 881
 		// then loop thru the array
882
-		foreach ( $registrations as $registration ) {
882
+		foreach ($registrations as $registration) {
883 883
 			// verify each registration
884
-			if ( $registration instanceof EE_Registration ) {
884
+			if ($registration instanceof EE_Registration) {
885 885
 				// we display all attendee info for the primary registrant
886
-				if ( $this->checkout->reg_url_link === $registration->reg_url_link()
886
+				if ($this->checkout->reg_url_link === $registration->reg_url_link()
887 887
 				     && $registration->is_primary_registrant()
888 888
 				) {
889 889
 					$this->checkout->primary_revisit = true;
890 890
 					break;
891
-				} else if ( $this->checkout->revisit
891
+				} else if ($this->checkout->revisit
892 892
 				            && $this->checkout->reg_url_link !== $registration->reg_url_link()
893 893
 				) {
894 894
 					// but hide info if it doesn't belong to you
895
-					$transaction->clear_cache( 'Registration', $registration->ID() );
895
+					$transaction->clear_cache('Registration', $registration->ID());
896 896
 				}
897
-				$this->checkout->set_reg_status_updated( $registration->ID(), false );
897
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
898 898
 			}
899 899
 		}
900 900
 	}
@@ -909,17 +909,17 @@  discard block
 block discarded – undo
909 909
 	 * @return    array
910 910
 	 * @throws \EE_Error
911 911
 	 */
912
-	private function _initialize_registrations( EE_Transaction $transaction ) {
912
+	private function _initialize_registrations(EE_Transaction $transaction) {
913 913
 		$att_nmbr = 0;
914 914
 		$registrations = array();
915
-		if ( $transaction instanceof EE_Transaction ) {
915
+		if ($transaction instanceof EE_Transaction) {
916 916
 			/** @type EE_Registration_Processor $registration_processor */
917
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
917
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
918 918
 			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
919 919
 			// now let's add the cart items to the $transaction
920
-			foreach ( $this->checkout->cart->get_tickets() as $line_item ) {
920
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
921 921
 				//do the following for each ticket of this type they selected
922
-				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
922
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
923 923
 					$att_nmbr++;
924 924
                     /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */
925 925
                     $CreateRegistrationCommand = EE_Registry::instance()
@@ -935,17 +935,17 @@  discard block
 block discarded – undo
935 935
                     // override capabilities for frontend registrations
936 936
                     if ( ! is_admin()) {
937 937
                         $CreateRegistrationCommand->setCapCheck(
938
-	                        new PublicCapabilities( '', 'create_new_registration' )
938
+	                        new PublicCapabilities('', 'create_new_registration')
939 939
                         );
940 940
                     }
941
-					$registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand );
942
-					if ( ! $registration instanceof EE_Registration ) {
943
-						throw new InvalidEntityException( $registration, 'EE_Registration' );
941
+					$registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand);
942
+					if ( ! $registration instanceof EE_Registration) {
943
+						throw new InvalidEntityException($registration, 'EE_Registration');
944 944
 					}
945
-					$registrations[ $registration->ID() ] = $registration;
945
+					$registrations[$registration->ID()] = $registration;
946 946
 				}
947 947
 			}
948
-			$registration_processor->fix_reg_final_price_rounding_issue( $transaction );
948
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
949 949
 		}
950 950
 		return $registrations;
951 951
 	}
@@ -960,12 +960,12 @@  discard block
 block discarded – undo
960 960
 	 * @param EE_Registration $reg_B
961 961
 	 * @return int
962 962
 	 */
963
-	public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) {
963
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) {
964 964
 		// this shouldn't ever happen within the same TXN, but oh well
965
-		if ( $reg_A->count() === $reg_B->count() ) {
965
+		if ($reg_A->count() === $reg_B->count()) {
966 966
 			return 0;
967 967
 		}
968
-		return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1;
968
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
969 969
 	}
970 970
 
971 971
 
@@ -980,21 +980,21 @@  discard block
 block discarded – undo
980 980
 	 */
981 981
 	private function _final_verifications() {
982 982
 		// filter checkout
983
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout );
983
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
984 984
 		//verify that current step is still set correctly
985
-		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) {
986
-			EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
985
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
986
+			EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
987 987
 			return false;
988 988
 		}
989 989
 		// if returning to SPCO, then verify that primary registrant is set
990
-		if ( ! empty( $this->checkout->reg_url_link )) {
990
+		if ( ! empty($this->checkout->reg_url_link)) {
991 991
 			$valid_registrant = $this->checkout->transaction->primary_registration();
992
-			if ( ! $valid_registrant instanceof EE_Registration ) {
993
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
992
+			if ( ! $valid_registrant instanceof EE_Registration) {
993
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
994 994
 				return false;
995 995
 			}
996 996
 			$valid_registrant = null;
997
-			foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) {
997
+			foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
998 998
 				if (
999 999
 					$registration instanceof EE_Registration
1000 1000
 					&& $registration->reg_url_link() === $this->checkout->reg_url_link
@@ -1002,9 +1002,9 @@  discard block
 block discarded – undo
1002 1002
 					$valid_registrant = $registration;
1003 1003
 				}
1004 1004
 			}
1005
-			if ( ! $valid_registrant instanceof EE_Registration ) {
1005
+			if ( ! $valid_registrant instanceof EE_Registration) {
1006 1006
 				// hmmm... maybe we have the wrong session because the user is opening multiple tabs ?
1007
-				if ( EED_Single_Page_Checkout::$_checkout_verified ) {
1007
+				if (EED_Single_Page_Checkout::$_checkout_verified) {
1008 1008
 					// clear the session, mark the checkout as unverified, and try again
1009 1009
 					EE_Registry::instance()->SSN->clear_session();
1010 1010
 					EED_Single_Page_Checkout::$_initialized = false;
@@ -1013,13 +1013,13 @@  discard block
 block discarded – undo
1013 1013
 					EE_Error::reset_notices();
1014 1014
 					return false;
1015 1015
 				}
1016
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1016
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1017 1017
 				return false;
1018 1018
 			}
1019 1019
 		}
1020 1020
 		// now that things have been kinda sufficiently verified,
1021 1021
 		// let's add the checkout to the session so that's available other systems
1022
-		EE_Registry::instance()->SSN->set_checkout( $this->checkout );
1022
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
1023 1023
 		return true;
1024 1024
 	}
1025 1025
 
@@ -1034,15 +1034,15 @@  discard block
 block discarded – undo
1034 1034
 	 * @param bool $reinitializing
1035 1035
 	 * @throws \EE_Error
1036 1036
 	 */
1037
-	private function _initialize_reg_steps( $reinitializing = false ) {
1038
-		$this->checkout->set_reg_step_initiated( $this->checkout->current_step );
1037
+	private function _initialize_reg_steps($reinitializing = false) {
1038
+		$this->checkout->set_reg_step_initiated($this->checkout->current_step);
1039 1039
 		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
1040
-		foreach ( $this->checkout->reg_steps as $reg_step ) {
1041
-			if ( ! $reg_step->initialize_reg_step() ) {
1040
+		foreach ($this->checkout->reg_steps as $reg_step) {
1041
+			if ( ! $reg_step->initialize_reg_step()) {
1042 1042
 				// if not initialized then maybe this step is being removed...
1043
-				if ( ! $reinitializing && $reg_step->is_current_step() ) {
1043
+				if ( ! $reinitializing && $reg_step->is_current_step()) {
1044 1044
 					// if it was the current step, then we need to start over here
1045
-					$this->_initialize_reg_steps( true );
1045
+					$this->_initialize_reg_steps(true);
1046 1046
 					return;
1047 1047
 				}
1048 1048
 				continue;
@@ -1051,13 +1051,13 @@  discard block
 block discarded – undo
1051 1051
 			$reg_step->enqueue_styles_and_scripts();
1052 1052
 			// i18n
1053 1053
 			$reg_step->translate_js_strings();
1054
-			if ( $reg_step->is_current_step() ) {
1054
+			if ($reg_step->is_current_step()) {
1055 1055
 				// the text that appears on the reg step form submit button
1056 1056
 				$reg_step->set_submit_button_text();
1057 1057
 			}
1058 1058
 		}
1059 1059
 		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
1060
-		do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step );
1060
+		do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
1061 1061
 	}
1062 1062
 
1063 1063
 
@@ -1070,43 +1070,43 @@  discard block
 block discarded – undo
1070 1070
 	 */
1071 1071
 	private function _check_form_submission() {
1072 1072
 		//does this request require the reg form to be generated ?
1073
-		if ( $this->checkout->generate_reg_form ) {
1073
+		if ($this->checkout->generate_reg_form) {
1074 1074
 			// ever heard that song by Blue Rodeo ?
1075 1075
 			try {
1076 1076
 				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
1077 1077
 				// if not displaying a form, then check for form submission
1078
-				if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) {
1078
+				if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) {
1079 1079
 					// clear out any old data in case this step is being run again
1080
-					$this->checkout->current_step->set_valid_data( array() );
1080
+					$this->checkout->current_step->set_valid_data(array());
1081 1081
 					// capture submitted form data
1082 1082
 					$this->checkout->current_step->reg_form->receive_form_submission(
1083
-						apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout )
1083
+						apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout)
1084 1084
 					);
1085 1085
 					// validate submitted form data
1086
-					if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid() ) {
1086
+					if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid()) {
1087 1087
 						// thou shall not pass !!!
1088 1088
 						$this->checkout->continue_reg = FALSE;
1089 1089
 						// any form validation errors?
1090
-						if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) {
1090
+						if ($this->checkout->current_step->reg_form->submission_error_message() !== '') {
1091 1091
 							$submission_error_messages = array();
1092 1092
 							// bad, bad, bad registrant
1093
-							foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){
1094
-								if ( $validation_error instanceof EE_Validation_Error ) {
1093
+							foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
1094
+								if ($validation_error instanceof EE_Validation_Error) {
1095 1095
 									$submission_error_messages[] = sprintf(
1096
-										__( '%s : %s', 'event_espresso' ),
1096
+										__('%s : %s', 'event_espresso'),
1097 1097
 										$validation_error->get_form_section()->html_label_text(),
1098 1098
 										$validation_error->getMessage()
1099 1099
 									);
1100 1100
 								}
1101 1101
 							}
1102
-							EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1102
+							EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1103 1103
 						}
1104 1104
 						// well not really... what will happen is we'll just get redirected back to redo the current step
1105 1105
 						$this->go_to_next_step();
1106 1106
 						return;
1107 1107
 					}
1108 1108
 				}
1109
-			} catch( EE_Error $e ) {
1109
+			} catch (EE_Error $e) {
1110 1110
 				$e->get_error();
1111 1111
 			}
1112 1112
 		}
@@ -1123,22 +1123,22 @@  discard block
 block discarded – undo
1123 1123
 	 */
1124 1124
 	private function _process_form_action() {
1125 1125
 		// what cha wanna do?
1126
-		switch( $this->checkout->action ) {
1126
+		switch ($this->checkout->action) {
1127 1127
 			// AJAX next step reg form
1128 1128
 			case 'display_spco_reg_step' :
1129 1129
 				$this->checkout->redirect = FALSE;
1130
-				if ( EE_Registry::instance()->REQ->ajax ) {
1131
-					$this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() );
1130
+				if (EE_Registry::instance()->REQ->ajax) {
1131
+					$this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
1132 1132
 				}
1133 1133
 				break;
1134 1134
 
1135 1135
 			default :
1136 1136
 				// meh... do one of those other steps first
1137
-				if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) {
1137
+				if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
1138 1138
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
1139
-					do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
1139
+					do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1140 1140
 					// call action on current step
1141
-					if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) {
1141
+					if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
1142 1142
 						// good registrant, you get to proceed
1143 1143
 						if (
1144 1144
 							$this->checkout->current_step->success_message() !== ''
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 						) {
1150 1150
 								EE_Error::add_success(
1151 1151
 									$this->checkout->current_step->success_message()
1152
-									. '<br />' . $this->checkout->next_step->_instructions()
1152
+									. '<br />'.$this->checkout->next_step->_instructions()
1153 1153
 								);
1154 1154
 
1155 1155
 						}
@@ -1157,12 +1157,12 @@  discard block
 block discarded – undo
1157 1157
 						$this->_setup_redirect();
1158 1158
 					}
1159 1159
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
1160
-					do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
1160
+					do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1161 1161
 
1162 1162
 				} else {
1163 1163
 					EE_Error::add_error(
1164 1164
 						sprintf(
1165
-							__( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ),
1165
+							__('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1166 1166
 							$this->checkout->action,
1167 1167
 							$this->checkout->current_step->name()
1168 1168
 						),
@@ -1188,10 +1188,10 @@  discard block
 block discarded – undo
1188 1188
 	public function add_styles_and_scripts() {
1189 1189
 		// i18n
1190 1190
 		$this->translate_js_strings();
1191
-		if ( $this->checkout->admin_request ) {
1192
-			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 );
1191
+		if ($this->checkout->admin_request) {
1192
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1193 1193
 		} else {
1194
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 );
1194
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1195 1195
 		}
1196 1196
 	}
1197 1197
 
@@ -1207,50 +1207,50 @@  discard block
 block discarded – undo
1207 1207
 		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1208 1208
 		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1209 1209
 		EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1210
-		EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' );
1211
-		EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' );
1212
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' );
1210
+		EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1211
+		EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso');
1212
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso');
1213 1213
 		EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1214 1214
 		EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso');
1215 1215
 		EE_Registry::$i18n_js_strings['process_registration'] = sprintf(
1216
-			__( 'Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso' ),
1216
+			__('Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso'),
1217 1217
 			'<br/>'
1218 1218
 		);
1219
-		EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' );
1219
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1220 1220
 		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1221 1221
 		EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1222 1222
 		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1223
-		EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' );
1224
-		EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' );
1225
-		EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' );
1226
-		EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' );
1227
-		EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' );
1228
-		EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' );
1229
-		EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' );
1230
-		EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' );
1231
-		EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' );
1232
-		EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' );
1233
-		EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' );
1234
-		EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' );
1235
-		EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' );
1236
-		EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' );
1223
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1224
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1225
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1226
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1227
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1228
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1229
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1230
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1231
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1232
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1233
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1234
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1235
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1236
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1237 1237
 		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1238
-			__( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ),
1238
+			__('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'),
1239 1239
 			'<h4 class="important-notice">',
1240 1240
 			'</h4>',
1241 1241
 			'<br />',
1242 1242
 			'<p>',
1243
-			'<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="',
1243
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1244 1244
 			'">',
1245 1245
 			'</a>',
1246 1246
 			'</p>'
1247 1247
 		);
1248
-		EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true );
1249
-		EE_Registry::$i18n_js_strings[ 'session_extension' ] = absint(
1250
-			apply_filters( 'FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS )
1248
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1249
+		EE_Registry::$i18n_js_strings['session_extension'] = absint(
1250
+			apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS)
1251 1251
 		);
1252
-		EE_Registry::$i18n_js_strings[ 'session_expiration' ] = gmdate(
1253
-			'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS )
1252
+		EE_Registry::$i18n_js_strings['session_expiration'] = gmdate(
1253
+			'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)
1254 1254
 		);
1255 1255
 
1256 1256
 
@@ -1266,31 +1266,31 @@  discard block
 block discarded – undo
1266 1266
 	 */
1267 1267
 	public function enqueue_styles_and_scripts() {
1268 1268
 		// load css
1269
-		wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION );
1270
-		wp_enqueue_style( 'single_page_checkout' );
1269
+		wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1270
+		wp_enqueue_style('single_page_checkout');
1271 1271
 		// load JS
1272
-		wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array( 'jquery' ), '1.0.1', TRUE );
1273
-		wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE );
1272
+		wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery	.plugin.min.js', array('jquery'), '1.0.1', TRUE);
1273
+		wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE);
1274 1274
 		wp_register_script(
1275 1275
 			'single_page_checkout',
1276
-			SPCO_JS_URL . 'single_page_checkout.js',
1277
-			array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ),
1276
+			SPCO_JS_URL.'single_page_checkout.js',
1277
+			array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'),
1278 1278
 			EVENT_ESPRESSO_VERSION,
1279 1279
 			TRUE
1280 1280
 		);
1281
-		wp_enqueue_script( 'single_page_checkout' );
1281
+		wp_enqueue_script('single_page_checkout');
1282 1282
 
1283 1283
 		/**
1284 1284
 		 * global action hook for enqueueing styles and scripts with
1285 1285
 		 * spco calls.
1286 1286
 		 */
1287
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this );
1287
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1288 1288
 
1289 1289
 		/**
1290 1290
 		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1291 1291
 		 * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1292 1292
 		 */
1293
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this );
1293
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this);
1294 1294
 
1295 1295
 	}
1296 1296
 
@@ -1305,20 +1305,20 @@  discard block
 block discarded – undo
1305 1305
 	 */
1306 1306
 	private function _display_spco_reg_form() {
1307 1307
 		// if registering via the admin, just display the reg form for the current step
1308
-		if ( $this->checkout->admin_request ) {
1309
-			EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() );
1308
+		if ($this->checkout->admin_request) {
1309
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1310 1310
 		} else {
1311 1311
 			// add powered by EE msg
1312
-			add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' ));
1312
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1313 1313
 
1314
-			$empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false;
1315
-			EE_Registry::$i18n_js_strings[ 'empty_cart' ] = $empty_cart;
1314
+			$empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false;
1315
+			EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart;
1316 1316
 			$cookies_not_set_msg = '';
1317
-			if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) {
1317
+			if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) {
1318 1318
 				$cookies_not_set_msg = apply_filters(
1319 1319
 					'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1320 1320
 					sprintf(
1321
-						__( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ),
1321
+						__('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'),
1322 1322
 						'<div class="ee-attention">',
1323 1323
 						'</div>',
1324 1324
 						'<h6 class="important-notice">',
@@ -1338,7 +1338,7 @@  discard block
 block discarded – undo
1338 1338
 					'layout_strategy' =>
1339 1339
 						new EE_Template_Layout(
1340 1340
 							array(
1341
-								'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1341
+								'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1342 1342
 								'template_args' => array(
1343 1343
 									'empty_cart' 		=> $empty_cart,
1344 1344
 									'revisit' 			=> $this->checkout->revisit,
@@ -1350,8 +1350,8 @@  discard block
 block discarded – undo
1350 1350
 									'empty_msg' 		=> apply_filters(
1351 1351
 										'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1352 1352
 										sprintf(
1353
-											__( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ),
1354
-											'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
1353
+											__('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'),
1354
+											'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1355 1355
 											'">',
1356 1356
 											'</a>'
1357 1357
 										)
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 				)
1370 1370
 			);
1371 1371
 			// load template and add to output sent that gets filtered into the_content()
1372
-			EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() );
1372
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js());
1373 1373
 		}
1374 1374
 	}
1375 1375
 
@@ -1383,8 +1383,8 @@  discard block
 block discarded – undo
1383 1383
 	 * @internal  param string $label
1384 1384
 	 * @return        string
1385 1385
 	 */
1386
-	public function add_extra_finalize_registration_inputs( $next_step ) {
1387
-		if ( $next_step === 'finalize_registration' ) {
1386
+	public function add_extra_finalize_registration_inputs($next_step) {
1387
+		if ($next_step === 'finalize_registration') {
1388 1388
 			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1389 1389
 		}
1390 1390
 	}
@@ -1406,13 +1406,13 @@  discard block
 block discarded – undo
1406 1406
 		) {
1407 1407
 			add_filter(
1408 1408
 				'FHEE__EEH_Template__powered_by_event_espresso__url',
1409
-				function( $url) {
1410
-					return apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url );
1409
+				function($url) {
1410
+					return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1411 1411
 				}
1412 1412
 			);
1413 1413
 			echo apply_filters(
1414 1414
 				'FHEE__EE_Front_Controller__display_registration_footer',
1415
-				\EEH_Template::powered_by_event_espresso( '', 'espresso-registration-footer-dv' )
1415
+				\EEH_Template::powered_by_event_espresso('', 'espresso-registration-footer-dv')
1416 1416
 			);
1417 1417
 		}
1418 1418
 		return '';
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
 	 * @throws \EE_Error
1429 1429
 	 */
1430 1430
 	public function unlock_transaction() {
1431
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
1431
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1432 1432
 			$this->checkout->transaction->unlock();
1433 1433
 		}
1434 1434
 	}
@@ -1443,12 +1443,12 @@  discard block
 block discarded – undo
1443 1443
 	 * @return 	array
1444 1444
 	 */
1445 1445
 	private function _setup_redirect() {
1446
-		if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
1446
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1447 1447
 			$this->checkout->redirect = TRUE;
1448
-			if ( empty( $this->checkout->redirect_url )) {
1448
+			if (empty($this->checkout->redirect_url)) {
1449 1449
 				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1450 1450
 			}
1451
-			$this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout );
1451
+			$this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout);
1452 1452
 		}
1453 1453
 	}
1454 1454
 
@@ -1462,9 +1462,9 @@  discard block
 block discarded – undo
1462 1462
 	 * @throws \EE_Error
1463 1463
 	 */
1464 1464
 	public function go_to_next_step() {
1465
-		if ( EE_Registry::instance()->REQ->ajax ) {
1465
+		if (EE_Registry::instance()->REQ->ajax) {
1466 1466
 			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1467
-			$this->checkout->json_response->set_unexpected_errors( ob_get_clean() );
1467
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1468 1468
 		}
1469 1469
 		$this->unlock_transaction();
1470 1470
 		// just return for these conditions
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
 	 */
1494 1494
 	protected function _handle_json_response() {
1495 1495
 		// if this is an ajax request
1496
-		if ( EE_Registry::instance()->REQ->ajax ) {
1496
+		if (EE_Registry::instance()->REQ->ajax) {
1497 1497
 			// DEBUG LOG
1498 1498
 			//$this->checkout->log(
1499 1499
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
 			$this->checkout->json_response->set_registration_time_limit(
1507 1507
 				$this->checkout->get_registration_time_limit()
1508 1508
 			);
1509
-			$this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing );
1509
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1510 1510
 			// just send the ajax (
1511 1511
 			$json_response = apply_filters(
1512 1512
 				'FHEE__EE_Single_Page_Checkout__JSON_response',
@@ -1527,9 +1527,9 @@  discard block
 block discarded – undo
1527 1527
 	 */
1528 1528
 	protected function _handle_html_redirects() {
1529 1529
 		// going somewhere ?
1530
-		if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) {
1530
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1531 1531
 			// store notices in a transient
1532
-			EE_Error::get_notices( false, true, true );
1532
+			EE_Error::get_notices(false, true, true);
1533 1533
 			// DEBUG LOG
1534 1534
 			//$this->checkout->log(
1535 1535
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1539,7 +1539,7 @@  discard block
 block discarded – undo
1539 1539
 			//		'headers_list'    => headers_list(),
1540 1540
 			//	)
1541 1541
 			//);
1542
-			wp_safe_redirect( $this->checkout->redirect_url );
1542
+			wp_safe_redirect($this->checkout->redirect_url);
1543 1543
 			exit();
1544 1544
 		}
1545 1545
 	}
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_Checkout.class.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
 	/**
278 278
 	 * @param $REG_ID
279
-	 * @param $reg_status
279
+	 * @param boolean $reg_status
280 280
 	 */
281 281
 	public function set_reg_status_updated( $REG_ID, $reg_status ) {
282 282
 		$this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN );
@@ -1110,6 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 	 *
1111 1111
 	 * @param    string | int    $reg_cache_ID
1112 1112
 	 * @param    EE_Registration $registration
1113
+	 * @param integer $reg_cache_ID
1113 1114
 	 * @return void
1114 1115
 	 * @throws \EE_Error
1115 1116
 	 */
Please login to merge, or discard this patch.
Spacing   +199 added lines, -199 removed lines patch added patch discarded remove patch
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 		$this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url();
242 242
 		$this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url();
243 243
 		$this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url();
244
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE );
244
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE);
245 245
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax;
246
-		$this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' ));
246
+		$this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC'));
247 247
 	}
248 248
 
249 249
 
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 	 * @return boolean
255 255
 	 */
256 256
 	public function any_reg_status_updated() {
257
-		foreach ( $this->reg_status_updated as $reg_status ) {
258
-			if ( $reg_status ) {
257
+		foreach ($this->reg_status_updated as $reg_status) {
258
+			if ($reg_status) {
259 259
 				return true;
260 260
 			}
261 261
 		}
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
 	 * @param $REG_ID
269 269
 	 * @return boolean
270 270
 	 */
271
-	public function reg_status_updated( $REG_ID ) {
272
-		return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false;
271
+	public function reg_status_updated($REG_ID) {
272
+		return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false;
273 273
 	}
274 274
 
275 275
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 	 * @param $REG_ID
279 279
 	 * @param $reg_status
280 280
 	 */
281
-	public function set_reg_status_updated( $REG_ID, $reg_status ) {
282
-		$this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN );
281
+	public function set_reg_status_updated($REG_ID, $reg_status) {
282
+		$this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN);
283 283
 	}
284 284
 
285 285
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * can ONLY be set by the  Finalize_Registration reg step
301 301
 	 */
302 302
 	public function set_exit_spco() {
303
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
303
+		if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
304 304
 			$this->exit_spco = true;
305 305
 		}
306 306
 	}
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public function reset_for_current_request() {
319 319
 		$this->process_form_submission = FALSE;
320
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true );
320
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true);
321 321
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax;
322 322
 		$this->continue_reg = true;
323 323
 		$this->redirect = false;
324 324
 		// don't reset the cached redirect form if we're about to be asked to display it !!!
325
-		if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) {
325
+		if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') {
326 326
 			$this->redirect_form = '';
327 327
 		}
328 328
 		$this->redirect_url = '';
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
 	 * @param EE_SPCO_Reg_Step $reg_step_obj
340 340
 	 * @return    void
341 341
 	 */
342
-	public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) {
343
-		$this->reg_steps[ $reg_step_obj->slug()  ] = $reg_step_obj;
342
+	public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) {
343
+		$this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj;
344 344
 	}
345 345
 
346 346
 
@@ -356,22 +356,22 @@  discard block
 block discarded – undo
356 356
 	 * @return    void
357 357
 	 * @throws \EE_Error
358 358
 	 */
359
-	public function skip_reg_step( $reg_step_slug = '' ) {
360
-		$step_to_skip = $this->find_reg_step( $reg_step_slug );
361
-		if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) {
362
-			$step_to_skip->set_is_current_step( false );
359
+	public function skip_reg_step($reg_step_slug = '') {
360
+		$step_to_skip = $this->find_reg_step($reg_step_slug);
361
+		if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) {
362
+			$step_to_skip->set_is_current_step(false);
363 363
 			$step_to_skip->set_completed();
364 364
 			// advance to the next step
365
-			$this->set_current_step( $this->next_step->slug() );
365
+			$this->set_current_step($this->next_step->slug());
366 366
 			// also reset the step param in the request in case any other code references that directly
367
-			EE_Registry::instance()->REQ->set( 'step', $this->current_step->slug() );
367
+			EE_Registry::instance()->REQ->set('step', $this->current_step->slug());
368 368
 			// since we are skipping a step and setting the current step to be what was previously the next step,
369 369
 			// we need to check that the next step is now correct, and not still set to the current step.
370
-			if ( $this->current_step->slug() === $this->next_step->slug() ) {
370
+			if ($this->current_step->slug() === $this->next_step->slug()) {
371 371
 				// correctly setup the next step
372 372
 				$this->set_next_step();
373 373
 			}
374
-			$this->set_reg_step_initiated( $this->current_step );
374
+			$this->set_reg_step_initiated($this->current_step);
375 375
 		}
376 376
 	}
377 377
 
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
 	 * @param bool   $reset whether to reset reg steps after removal
386 386
 	 * @throws EE_Error
387 387
 	 */
388
-	public function remove_reg_step( $reg_step_slug = '', $reset = true ) {
389
-		unset( $this->reg_steps[ $reg_step_slug  ] );
390
-		if ( $this->transaction instanceof EE_Transaction ) {
388
+	public function remove_reg_step($reg_step_slug = '', $reset = true) {
389
+		unset($this->reg_steps[$reg_step_slug]);
390
+		if ($this->transaction instanceof EE_Transaction) {
391 391
 			// now remove reg step from TXN and save
392
-			$this->transaction->remove_reg_step( $reg_step_slug );
392
+			$this->transaction->remove_reg_step($reg_step_slug);
393 393
 			$this->transaction->save();
394 394
 		}
395
-		if ( $reset ) {
395
+		if ($reset) {
396 396
 			$this->reset_reg_steps();
397 397
 		}
398 398
 	}
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 	 * @param int    $order
408 408
 	 * @return    void
409 409
 	 */
410
-	public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) {
411
-		if ( isset( $this->reg_steps[ $reg_step_slug  ] )) {
412
-			$this->reg_steps[ $reg_step_slug ]->set_order( $order );
410
+	public function set_reg_step_order($reg_step_slug = '', $order = 100) {
411
+		if (isset($this->reg_steps[$reg_step_slug])) {
412
+			$this->reg_steps[$reg_step_slug]->set_order($order);
413 413
 		}
414 414
 	}
415 415
 
@@ -422,25 +422,25 @@  discard block
 block discarded – undo
422 422
 	 * @param string $current_step
423 423
 	 * @return    void
424 424
 	 */
425
-	public function set_current_step( $current_step ) {
425
+	public function set_current_step($current_step) {
426 426
 		// grab what step we're on
427
-		$this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps );
427
+		$this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps);
428 428
 		// verify instance
429
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step ) {
429
+		if ($this->current_step instanceof EE_SPCO_Reg_Step) {
430 430
 			// we don't want to repeat completed steps if this is the first time through SPCO
431
-			if ( $this->continue_reg && ! $this->revisit && $this->current_step->completed() ) {
431
+			if ($this->continue_reg && ! $this->revisit && $this->current_step->completed()) {
432 432
 				// so advance to the next step
433 433
 				$this->set_next_step();
434
-				if ( $this->next_step instanceof EE_SPCO_Reg_Step ) {
434
+				if ($this->next_step instanceof EE_SPCO_Reg_Step) {
435 435
 					// and attempt to set it as the current step
436
-					$this->set_current_step( $this->next_step->slug() );
436
+					$this->set_current_step($this->next_step->slug());
437 437
 				}
438 438
 				return;
439 439
 			}
440
-			$this->current_step->set_is_current_step( TRUE );
440
+			$this->current_step->set_is_current_step(TRUE);
441 441
 		} else {
442 442
 			EE_Error::add_error(
443
-				__( 'The current step could not be set.', 'event_espresso' ),
443
+				__('The current step could not be set.', 'event_espresso'),
444 444
 				__FILE__, __FUNCTION__, __LINE__
445 445
 			);
446 446
 		}
@@ -457,20 +457,20 @@  discard block
 block discarded – undo
457 457
 	 */
458 458
 	public function set_next_step() {
459 459
 		// set pointer to start of array
460
-		reset( $this->reg_steps );
460
+		reset($this->reg_steps);
461 461
 		// if there is more than one step
462
-		if ( count( $this->reg_steps ) > 1 ) {
462
+		if (count($this->reg_steps) > 1) {
463 463
 			// advance to the current step and set pointer
464
-			while ( key( $this->reg_steps ) !== $this->current_step->slug() && key( $this->reg_steps ) !== '' ) {
465
-				next( $this->reg_steps );
464
+			while (key($this->reg_steps) !== $this->current_step->slug() && key($this->reg_steps) !== '') {
465
+				next($this->reg_steps);
466 466
 			}
467 467
 		}
468 468
 		// advance one more spot ( if it exists )
469
-		$this->next_step = next( $this->reg_steps );
469
+		$this->next_step = next($this->reg_steps);
470 470
 		// verify instance
471
-		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step  : NULL;
471
+		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL;
472 472
 		// then back to current step to reset
473
-		prev( $this->reg_steps );
473
+		prev($this->reg_steps);
474 474
 	}
475 475
 
476 476
 
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	 *  @return 	EE_SPCO_Reg_Step | null
485 485
 	 */
486 486
 	public function get_next_reg_step() {
487
-		$next = next( $this->reg_steps );
488
-		prev( $this->reg_steps );
487
+		$next = next($this->reg_steps);
488
+		prev($this->reg_steps);
489 489
 		return $next instanceof EE_SPCO_Reg_Step ? $next : null;
490 490
 	}
491 491
 
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 	 *  @return 	EE_SPCO_Reg_Step | null
501 501
 	 */
502 502
 	public function get_prev_reg_step() {
503
-		$prev = prev( $this->reg_steps );
504
-		next( $this->reg_steps );
503
+		$prev = prev($this->reg_steps);
504
+		next($this->reg_steps);
505 505
 		return $prev instanceof EE_SPCO_Reg_Step ? $prev : null;
506 506
 	}
507 507
 
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 	 * @return void
515 515
 	 */
516 516
 	public function sort_reg_steps() {
517
-		$reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' );
518
-		uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback ));
517
+		$reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback');
518
+		uasort($this->reg_steps, array($this, $reg_step_sorting_callback));
519 519
 	}
520 520
 
521 521
 
@@ -528,19 +528,19 @@  discard block
 block discarded – undo
528 528
 	 * @param string $reg_step_slug
529 529
 	 * @return EE_SPCO_Reg_Step|null
530 530
 	 */
531
-	public function find_reg_step( $reg_step_slug = '' ) {
532
-		if ( ! empty( $reg_step_slug ) ) {
531
+	public function find_reg_step($reg_step_slug = '') {
532
+		if ( ! empty($reg_step_slug)) {
533 533
 			// copy reg step array
534 534
 			$reg_steps = $this->reg_steps;
535 535
 			// set pointer to start of array
536
-			reset( $reg_steps );
536
+			reset($reg_steps);
537 537
 			// if there is more than one step
538
-			if ( count( $reg_steps ) > 1 ) {
538
+			if (count($reg_steps) > 1) {
539 539
 				// advance to the current step and set pointer
540
-				while ( key( $reg_steps ) !== $reg_step_slug && key( $reg_steps ) !== '' ) {
541
-					next( $reg_steps );
540
+				while (key($reg_steps) !== $reg_step_slug && key($reg_steps) !== '') {
541
+					next($reg_steps);
542 542
 				}
543
-				return current( $reg_steps );
543
+				return current($reg_steps);
544 544
 			}
545 545
 		}
546 546
 		return null;
@@ -556,17 +556,17 @@  discard block
 block discarded – undo
556 556
 	 * @param EE_SPCO_Reg_Step $reg_step_B
557 557
 	 * @return int
558 558
 	 */
559
-	public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) {
559
+	public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) {
560 560
 		// send finalize_registration step to the end of the array
561
-		if ( $reg_step_A->slug() === 'finalize_registration' ) {
561
+		if ($reg_step_A->slug() === 'finalize_registration') {
562 562
 			return 1;
563
-		} else if ( $reg_step_B->slug() === 'finalize_registration' ) {
563
+		} else if ($reg_step_B->slug() === 'finalize_registration') {
564 564
 			return -1;
565 565
 		}
566
-		if ( $reg_step_A->order() === $reg_step_B->order() ) {
566
+		if ($reg_step_A->order() === $reg_step_B->order()) {
567 567
 			return 0;
568 568
 		}
569
-		return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1;
569
+		return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1;
570 570
 	}
571 571
 
572 572
 
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 	 * @param    EE_SPCO_Reg_Step $reg_step
579 579
 	 * @throws \EE_Error
580 580
 	 */
581
-	public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) {
581
+	public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) {
582 582
 		// call set_reg_step_initiated ???
583 583
 		if (
584 584
 			// first time visiting SPCO ?
@@ -591,11 +591,11 @@  discard block
 block discarded – undo
591 591
 			)
592 592
 		) {
593 593
 			// set the start time for this reg step
594
-			if ( ! $this->transaction->set_reg_step_initiated( $reg_step->slug() ) ) {
595
-				if ( WP_DEBUG ) {
594
+			if ( ! $this->transaction->set_reg_step_initiated($reg_step->slug())) {
595
+				if (WP_DEBUG) {
596 596
 					EE_Error::add_error(
597 597
 						sprintf(
598
-							__( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ),
598
+							__('The "%1$s" registration step was not initialized properly.', 'event_espresso'),
599 599
 							$reg_step->name()
600 600
 						),
601 601
 						__FILE__, __FUNCTION__, __LINE__
@@ -614,10 +614,10 @@  discard block
 block discarded – undo
614 614
 	 * 	@return 	void
615 615
 	 */
616 616
 	public function set_reg_step_JSON_info() {
617
-		EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array();
617
+		EE_Registry::$i18n_js_strings['reg_steps'] = array();
618 618
 		// pass basic reg step data to JS
619
-		foreach ( $this->reg_steps as $reg_step ) {
620
-			EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug();
619
+		foreach ($this->reg_steps as $reg_step) {
620
+			EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug();
621 621
 		}
622 622
 		// reset reg step html
623 623
 //		$this->json_response->set_reg_step_html( '' );
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 	 */
634 634
 	public function reset_reg_steps() {
635 635
 		$this->sort_reg_steps();
636
-		$this->set_current_step( EE_Registry::instance()->REQ->get( 'step' ));
636
+		$this->set_current_step(EE_Registry::instance()->REQ->get('step'));
637 637
 		$this->set_next_step();
638 638
 		// the text that appears on the reg step form submit button
639 639
 		$this->current_step->set_submit_button_text();
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 	 */
651 651
 	public function get_registration_time_limit() {
652 652
 
653
-		$registration_time_limit = (float)( EE_Registry::instance()	->SSN->expiration() - time() );
653
+		$registration_time_limit = (float) (EE_Registry::instance()	->SSN->expiration() - time());
654 654
 		$time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s';
655
-		$registration_time_limit = gmdate( $time_limit_format, $registration_time_limit );
655
+		$registration_time_limit = gmdate($time_limit_format, $registration_time_limit);
656 656
 		return apply_filters(
657 657
 			'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit',
658 658
 			$registration_time_limit
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 		//		overpaid TXN
673 673
 		//		free TXN ( total = 0.00 )
674 674
 		// then payment required is TRUE
675
-		return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE;
675
+		return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE;
676 676
 	}
677 677
 
678 678
 
@@ -684,12 +684,12 @@  discard block
 block discarded – undo
684 684
 	 * @param EE_Transaction $transaction
685 685
 	 * @return EE_Cart
686 686
 	 */
687
-	public function get_cart_for_transaction( $transaction ) {
688
-		$session = EE_Registry::instance()->load_core( 'Session' );
689
-		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction, $session ) : null;
687
+	public function get_cart_for_transaction($transaction) {
688
+		$session = EE_Registry::instance()->load_core('Session');
689
+		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction, $session) : null;
690 690
 		// verify cart
691
-		if ( ! $cart instanceof EE_Cart ) {
692
-			$cart = EE_Registry::instance()->load_core( 'Cart' );
691
+		if ( ! $cart instanceof EE_Cart) {
692
+			$cart = EE_Registry::instance()->load_core('Cart');
693 693
 		}
694 694
 
695 695
 		return $cart;
@@ -705,8 +705,8 @@  discard block
 block discarded – undo
705 705
 	 */
706 706
 	public function initialize_txn_reg_steps_array() {
707 707
 		$txn_reg_steps_array = array();
708
-		foreach ( $this->reg_steps as $reg_step ) {
709
-			$txn_reg_steps_array[ $reg_step->slug() ] = FALSE;
708
+		foreach ($this->reg_steps as $reg_step) {
709
+			$txn_reg_steps_array[$reg_step->slug()] = FALSE;
710 710
 		}
711 711
 		return $txn_reg_steps_array;
712 712
 	}
@@ -722,14 +722,14 @@  discard block
 block discarded – undo
722 722
 	 */
723 723
 	public function update_txn_reg_steps_array() {
724 724
 		$updated = false;
725
-		foreach ( $this->reg_steps as $reg_step ) {
726
-			if ( $reg_step->completed() ) {
727
-				$updated = $this->transaction->set_reg_step_completed( $reg_step->slug() )
725
+		foreach ($this->reg_steps as $reg_step) {
726
+			if ($reg_step->completed()) {
727
+				$updated = $this->transaction->set_reg_step_completed($reg_step->slug())
728 728
 					? true
729 729
 					: $updated;
730 730
 			}
731 731
 		}
732
-		if ( $updated ) {
732
+		if ($updated) {
733 733
 			$this->transaction->save();
734 734
 		}
735 735
 		return $updated;
@@ -745,14 +745,14 @@  discard block
 block discarded – undo
745 745
 	 * @throws \EE_Error
746 746
 	 */
747 747
 	public function stash_transaction_and_checkout() {
748
-		if ( ! $this->revisit ) {
748
+		if ( ! $this->revisit) {
749 749
 			$this->update_txn_reg_steps_array();
750 750
 		}
751 751
 		$this->track_transaction_and_registration_status_updates();
752 752
 		// save all data to the db, but suppress errors
753 753
 		//$this->save_all_data( FALSE );
754 754
 		// cache the checkout in the session
755
-		EE_Registry::instance()->SSN->set_checkout( $this );
755
+		EE_Registry::instance()->SSN->set_checkout($this);
756 756
 	}
757 757
 
758 758
 
@@ -767,15 +767,15 @@  discard block
 block discarded – undo
767 767
 	 */
768 768
 	public function track_transaction_and_registration_status_updates() {
769 769
 		// verify the transaction
770
-		if ( $this->transaction instanceof EE_Transaction ) {
770
+		if ($this->transaction instanceof EE_Transaction) {
771 771
 			// has there been a TXN status change during this checkout?
772 772
 			$this->txn_status_updated = $this->transaction->txn_status_updated();
773 773
 			/** @type EE_Registration_Processor $registration_processor */
774
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
774
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
775 775
 			// grab the saved registrations from the transaction
776
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) {
777
-				if ( $registration_processor->reg_status_updated( $registration->ID() ) ) {
778
-					$this->set_reg_status_updated( $registration->ID(), true );
776
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) {
777
+				if ($registration_processor->reg_status_updated($registration->ID())) {
778
+					$this->set_reg_status_updated($registration->ID(), true);
779 779
 				}
780 780
 			}
781 781
 		}
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 	 * @return    bool
797 797
 	 * @throws \EE_Error
798 798
 	 */
799
-	public function visit_allows_processing_of_this_registration( EE_Registration $registration ) {
799
+	public function visit_allows_processing_of_this_registration(EE_Registration $registration) {
800 800
 		return ! $this->revisit
801 801
 		       || $this->primary_revisit
802 802
 		       || (
@@ -829,18 +829,18 @@  discard block
 block discarded – undo
829 829
 	 * @return bool
830 830
 	 * @throws \EE_Error
831 831
 	 */
832
-	public function save_all_data( $show_errors = TRUE ) {
832
+	public function save_all_data($show_errors = TRUE) {
833 833
 		// verify the transaction
834
-		if ( $this->transaction instanceof EE_Transaction ) {
834
+		if ($this->transaction instanceof EE_Transaction) {
835 835
 			// save to ensure that TXN has ID
836 836
 			$this->transaction->save();
837 837
 			// grab the saved registrations from the transaction
838
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as  $registration ) {
839
-				$this->_save_registration( $registration, $show_errors );
838
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as  $registration) {
839
+				$this->_save_registration($registration, $show_errors);
840 840
 			}
841 841
 		} else {
842
-			if ( $show_errors ) {
843
-				EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
842
+			if ($show_errors) {
843
+				EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
844 844
 			}
845 845
 			return FALSE;
846 846
 		}
@@ -857,32 +857,32 @@  discard block
 block discarded – undo
857 857
 	 * @return void
858 858
 	 * @throws \EE_Error
859 859
 	 */
860
-	private function _save_registration( $registration, $show_errors = TRUE  ) {
860
+	private function _save_registration($registration, $show_errors = TRUE) {
861 861
 		// verify object
862
-		if ( $registration instanceof EE_Registration ) {
862
+		if ($registration instanceof EE_Registration) {
863 863
 			// should this registration be processed during this visit ?
864
-			if ( $this->visit_allows_processing_of_this_registration( $registration ) ) {
864
+			if ($this->visit_allows_processing_of_this_registration($registration)) {
865 865
 				//set TXN ID
866
-				if ( ! $registration->transaction_ID() ) {
867
-					$registration->set_transaction_id( $this->transaction->ID() );
866
+				if ( ! $registration->transaction_ID()) {
867
+					$registration->set_transaction_id($this->transaction->ID());
868 868
 				}
869 869
 				// verify and save the attendee
870
-				$this->_save_registration_attendee( $registration, $show_errors );
870
+				$this->_save_registration_attendee($registration, $show_errors);
871 871
 				// save answers to reg form questions
872
-				$this->_save_registration_answers( $registration, $show_errors );
872
+				$this->_save_registration_answers($registration, $show_errors);
873 873
 				// save changes
874 874
 				$registration->save();
875 875
 				// update txn cache
876
-				if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) {
877
-					if ( $show_errors ) {
878
-						EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
876
+				if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) {
877
+					if ($show_errors) {
878
+						EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
879 879
 					}
880 880
 				}
881 881
 			}
882 882
 		} else {
883
-			if ( $show_errors ) {
883
+			if ($show_errors) {
884 884
 				EE_Error::add_error(
885
-					__( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ),
885
+					__('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'),
886 886
 					__FILE__, __FUNCTION__, __LINE__
887 887
 				);
888 888
 			}
@@ -899,25 +899,25 @@  discard block
 block discarded – undo
899 899
 	 * @return void
900 900
 	 * @throws \EE_Error
901 901
 	 */
902
-	private function _save_registration_attendee( $registration, $show_errors = TRUE ) {
903
-		if ( $registration->attendee() instanceof EE_Attendee ) {
902
+	private function _save_registration_attendee($registration, $show_errors = TRUE) {
903
+		if ($registration->attendee() instanceof EE_Attendee) {
904 904
 			// save so that ATT has ID
905 905
 			$registration->attendee()->save();
906
-			if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() ) ) {
907
-				if ( $show_errors ) {
906
+			if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) {
907
+				if ($show_errors) {
908 908
 					EE_Error::add_error(
909
-						__( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ),
909
+						__('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'),
910 910
 						__FILE__, __FUNCTION__, __LINE__
911 911
 					);
912 912
 				}
913 913
 			}
914 914
 		} else {
915
-			if ( $show_errors ) {
915
+			if ($show_errors) {
916 916
 				EE_Error::add_error(
917 917
 					sprintf(
918 918
 						'%1$s||%1$s $attendee = %2$s',
919
-						__( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ),
920
-						var_export( $registration->attendee(), true )
919
+						__('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'),
920
+						var_export($registration->attendee(), true)
921 921
 					),
922 922
 					__FILE__, __FUNCTION__, __LINE__
923 923
 				);
@@ -935,25 +935,25 @@  discard block
 block discarded – undo
935 935
 	 * @return void
936 936
 	 * @throws \EE_Error
937 937
 	 */
938
-	private function _save_registration_answers( $registration, $show_errors = TRUE ) {
938
+	private function _save_registration_answers($registration, $show_errors = TRUE) {
939 939
 		// now save the answers
940
-		foreach ( $registration->answers() as $cache_key => $answer ) {
940
+		foreach ($registration->answers() as $cache_key => $answer) {
941 941
 			// verify object
942
-			if ( $answer instanceof EE_Answer ) {
943
-				$answer->set_registration( $registration->ID() );
942
+			if ($answer instanceof EE_Answer) {
943
+				$answer->set_registration($registration->ID());
944 944
 				$answer->save();
945
-				if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) {
946
-					if ( $show_errors ) {
945
+				if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) {
946
+					if ($show_errors) {
947 947
 						EE_Error::add_error(
948
-							__( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ),
948
+							__('The newly saved Answer object could not be cached on the registration.', 'event_espresso'),
949 949
 							__FILE__, __FUNCTION__, __LINE__
950 950
 						);
951 951
 					}
952 952
 				}
953 953
 			} else {
954
-				if ( $show_errors ) {
954
+				if ($show_errors) {
955 955
 					EE_Error::add_error(
956
-						__( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ),
956
+						__('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'),
957 957
 						__FILE__, __FUNCTION__, __LINE__
958 958
 					);
959 959
 				}
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 	 * @return bool
973 973
 	 * @throws \EE_Error
974 974
 	 */
975
-	public function refresh_all_entities( $from_db = false ) {
975
+	public function refresh_all_entities($from_db = false) {
976 976
 		$from_db = $this->current_step->is_final_step() || $this->action === 'process_gateway_response'
977 977
 			? true
978 978
 			: $from_db;
@@ -996,11 +996,11 @@  discard block
 block discarded – undo
996 996
 	 */
997 997
 	protected function refresh_from_db() {
998 998
 		// verify the transaction
999
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
999
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1000 1000
 			// pull fresh TXN data from the db
1001
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() );
1001
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID());
1002 1002
 			// update EE_Checkout's cached primary_attendee object
1003
-			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction );
1003
+			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction);
1004 1004
 			// update EE_Checkout's cached payment object
1005 1005
 			$payment = $this->transaction->last_payment();
1006 1006
 			$this->payment = $payment instanceof EE_Payment ? $payment : $this->payment;
@@ -1008,9 +1008,9 @@  discard block
 block discarded – undo
1008 1008
 			$payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null;
1009 1009
 			$this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method;
1010 1010
 			//now refresh the cart, based on the TXN
1011
-			$this->cart = $this->get_cart_for_transaction( $this->transaction );
1011
+			$this->cart = $this->get_cart_for_transaction($this->transaction);
1012 1012
 		} else {
1013
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
1013
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1014 1014
 			return FALSE;
1015 1015
 		}
1016 1016
 		return TRUE;
@@ -1025,21 +1025,21 @@  discard block
 block discarded – undo
1025 1025
 	 * @return  EE_Attendee | null
1026 1026
 	 * @throws \EE_Error
1027 1027
 	 */
1028
-	protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) {
1028
+	protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) {
1029 1029
 
1030 1030
 		$primary_attendee_obj = null;
1031 1031
 		// grab the saved registrations from the transaction
1032
-		foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) {
1032
+		foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) {
1033 1033
 			// verify object
1034
-			if ( $registration instanceof EE_Registration ) {
1034
+			if ($registration instanceof EE_Registration) {
1035 1035
 				$attendee = $registration->attendee();
1036 1036
 				// verify object && maybe cache primary_attendee_obj ?
1037
-				if ( $attendee instanceof EE_Attendee&& $registration->is_primary_registrant() ) {
1037
+				if ($attendee instanceof EE_Attendee && $registration->is_primary_registrant()) {
1038 1038
 					$primary_attendee_obj = $attendee;
1039 1039
 				}
1040 1040
 			} else {
1041 1041
 				EE_Error::add_error(
1042
-						__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1042
+						__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1043 1043
 						__FILE__, __FUNCTION__, __LINE__
1044 1044
 				);
1045 1045
 			}
@@ -1060,43 +1060,43 @@  discard block
 block discarded – undo
1060 1060
 	 */
1061 1061
 	protected function refresh_entity_map() {
1062 1062
 		// verify the transaction
1063
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1063
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1064 1064
 			// never cache payment info
1065
-			$this->transaction->clear_cache( 'Payment' );
1065
+			$this->transaction->clear_cache('Payment');
1066 1066
 			// is the Payment Options Reg Step completed ?
1067
-			if ( $this->transaction->reg_step_completed( 'payment_options' ) ) {
1067
+			if ($this->transaction->reg_step_completed('payment_options')) {
1068 1068
 				// then check for payments and update TXN accordingly
1069 1069
 				/** @type EE_Transaction_Payments $transaction_payments */
1070
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1071
-				$transaction_payments->calculate_total_payments_and_update_status( $this->transaction );
1070
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1071
+				$transaction_payments->calculate_total_payments_and_update_status($this->transaction);
1072 1072
 			}
1073 1073
 			// grab the saved registrations from the transaction
1074 1074
 			foreach (
1075
-				$this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration
1075
+				$this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration
1076 1076
 			) {
1077
-				$this->_refresh_registration( $reg_cache_ID, $registration );
1077
+				$this->_refresh_registration($reg_cache_ID, $registration);
1078 1078
 			}
1079 1079
 			// make sure our cached TXN is added to the model entity mapper
1080
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction );
1080
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction);
1081 1081
 
1082 1082
 		} else {
1083
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
1083
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1084 1084
 			return FALSE;
1085 1085
 		}
1086 1086
 		// verify and update the cart because inaccurate totals are not so much fun
1087
-		if ( $this->cart instanceof EE_Cart ) {
1087
+		if ($this->cart instanceof EE_Cart) {
1088 1088
 			$grand_total = $this->cart->get_grand_total();
1089
-			if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) {
1089
+			if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) {
1090 1090
 				$grand_total->recalculate_total_including_taxes();
1091 1091
 				$grand_total = $grand_total->get_model()->refresh_entity_map_with(
1092 1092
 					$this->cart->get_grand_total()->ID(),
1093 1093
 					$this->cart->get_grand_total()
1094 1094
 				);
1095 1095
 			}
1096
-			if ( $grand_total instanceof EE_Line_Item ) {
1097
-				$this->cart = EE_Cart::instance( $grand_total );
1096
+			if ($grand_total instanceof EE_Line_Item) {
1097
+				$this->cart = EE_Cart::instance($grand_total);
1098 1098
 			} else {
1099
-				EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1099
+				EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1100 1100
 				return false;
1101 1101
 			}
1102 1102
 		}
@@ -1113,19 +1113,19 @@  discard block
 block discarded – undo
1113 1113
 	 * @return void
1114 1114
 	 * @throws \EE_Error
1115 1115
 	 */
1116
-	protected function _refresh_registration( $reg_cache_ID, $registration ) {
1116
+	protected function _refresh_registration($reg_cache_ID, $registration) {
1117 1117
 
1118 1118
 		// verify object
1119
-		if ( $registration instanceof EE_Registration ) {
1119
+		if ($registration instanceof EE_Registration) {
1120 1120
 			// update the entity mapper attendee
1121
-			$this->_refresh_registration_attendee( $registration );
1121
+			$this->_refresh_registration_attendee($registration);
1122 1122
 			// update the entity mapper answers for reg form questions
1123
-			$this->_refresh_registration_answers( $registration );
1123
+			$this->_refresh_registration_answers($registration);
1124 1124
 			// make sure the cached registration is added to the model entity mapper
1125
-			$registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration );
1125
+			$registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration);
1126 1126
 		} else {
1127 1127
 			EE_Error::add_error(
1128
-				__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1128
+				__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1129 1129
 				__FILE__, __FUNCTION__, __LINE__
1130 1130
 			);
1131 1131
 		}
@@ -1140,15 +1140,15 @@  discard block
 block discarded – undo
1140 1140
 	 * @return void
1141 1141
 	 * @throws \EE_Error
1142 1142
 	 */
1143
-	protected function _refresh_registration_attendee( $registration ) {
1143
+	protected function _refresh_registration_attendee($registration) {
1144 1144
 
1145 1145
 		$attendee = $registration->attendee();
1146 1146
 		// verify object
1147
-		if ( $attendee instanceof EE_Attendee && $attendee->ID() ) {
1147
+		if ($attendee instanceof EE_Attendee && $attendee->ID()) {
1148 1148
 			// make sure the cached attendee is added to the model entity mapper
1149
-			$registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee );
1149
+			$registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee);
1150 1150
 			// maybe cache primary_attendee_obj ?
1151
-			if ( $registration->is_primary_registrant() ) {
1151
+			if ($registration->is_primary_registrant()) {
1152 1152
 				$this->primary_attendee_obj = $attendee;
1153 1153
 			}
1154 1154
 		}
@@ -1163,19 +1163,19 @@  discard block
 block discarded – undo
1163 1163
 	 * @return void
1164 1164
 	 * @throws \EE_Error
1165 1165
 	 */
1166
-	protected function _refresh_registration_answers( $registration ) {
1166
+	protected function _refresh_registration_answers($registration) {
1167 1167
 
1168 1168
 		// now update the answers
1169
-		foreach ( $registration->answers() as $cache_key => $answer ) {
1169
+		foreach ($registration->answers() as $cache_key => $answer) {
1170 1170
 			// verify object
1171
-			if ( $answer instanceof EE_Answer ) {
1172
-				if ( $answer->ID() ) {
1171
+			if ($answer instanceof EE_Answer) {
1172
+				if ($answer->ID()) {
1173 1173
 					// make sure the cached answer is added to the model entity mapper
1174
-					$answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer );
1174
+					$answer->get_model()->refresh_entity_map_with($answer->ID(), $answer);
1175 1175
 				}
1176 1176
 			} else {
1177 1177
 				EE_Error::add_error(
1178
-					__( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1178
+					__('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1179 1179
 					__FILE__, __FUNCTION__, __LINE__
1180 1180
 				);
1181 1181
 			}
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 	 * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object
1191 1191
 	 */
1192 1192
 	public function __wakeup() {
1193
-		foreach ( $this->reg_steps as $reg_step ) {
1193
+		foreach ($this->reg_steps as $reg_step) {
1194 1194
 			$reg_step->checkout = $this;
1195 1195
 		}
1196 1196
 	}
@@ -1207,12 +1207,12 @@  discard block
 block discarded – undo
1207 1207
 	 * @param bool   $display_request
1208 1208
 	 * @throws \EE_Error
1209 1209
 	 */
1210
-	public function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) {
1210
+	public function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) {
1211 1211
 		$disabled = true;
1212
-		if ( WP_DEBUG && ! $disabled ) {
1213
-			$debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() );
1212
+		if (WP_DEBUG && ! $disabled) {
1213
+			$debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array());
1214 1214
 			$default_data = array(
1215
-				$class 		=> $func . '() : ' . $line,
1215
+				$class 		=> $func.'() : '.$line,
1216 1216
 				'request->step' 		=> $this->step,
1217 1217
 				'request->action' 	=> $this->action,
1218 1218
 				'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ?
@@ -1224,24 +1224,24 @@  discard block
 block discarded – undo
1224 1224
 				'reg_url_link' => $this->reg_url_link,
1225 1225
 				'REQ' => $display_request ? $_REQUEST : '',
1226 1226
 			);
1227
-			if ( $this->transaction instanceof EE_Transaction ) {
1228
-				$default_data[ 'TXN_status' ] 		= $this->transaction->status_ID();
1229
-				$default_data[ 'TXN_reg_steps' ] 	= $this->transaction->reg_steps();
1230
-				foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) {
1231
-					$default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID();
1227
+			if ($this->transaction instanceof EE_Transaction) {
1228
+				$default_data['TXN_status'] = $this->transaction->status_ID();
1229
+				$default_data['TXN_reg_steps'] = $this->transaction->reg_steps();
1230
+				foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) {
1231
+					$default_data['registrations'][$REG_ID] = $registration->status_ID();
1232 1232
 				}
1233
-				if ( $this->transaction->ID() ) {
1234
-					$TXN_ID = 'EE_Transaction: ' . $this->transaction->ID();
1233
+				if ($this->transaction->ID()) {
1234
+					$TXN_ID = 'EE_Transaction: '.$this->transaction->ID();
1235 1235
 					// don't serialize objects
1236
-					$info = $this->_strip_objects( $info );
1237
-					if ( ! isset( $debug_data[ $TXN_ID ] ) ) {
1238
-						$debug_data[ $TXN_ID ] = array();
1236
+					$info = $this->_strip_objects($info);
1237
+					if ( ! isset($debug_data[$TXN_ID])) {
1238
+						$debug_data[$TXN_ID] = array();
1239 1239
 					}
1240
-					$debug_data[ $TXN_ID ][ microtime() ] = array_merge(
1240
+					$debug_data[$TXN_ID][microtime()] = array_merge(
1241 1241
 						$default_data,
1242 1242
 						$info
1243 1243
 					);
1244
-					update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data );
1244
+					update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data);
1245 1245
 				}
1246 1246
 			}
1247 1247
 		}
@@ -1254,23 +1254,23 @@  discard block
 block discarded – undo
1254 1254
 	 * @param array $info
1255 1255
 	 * @return array
1256 1256
 	 */
1257
-	public function _strip_objects( $info = array() ) {
1258
-		foreach ( (array)$info as $key => $value ) {
1259
-			if ( is_array( $value )) {
1260
-				$info[ $key ] = $this->_strip_objects( $value );
1261
-			} else if ( is_object( $value ) ) {
1262
-				$object_class = get_class( $value );
1263
-				$info[ $object_class ] = array();
1264
-				$info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0;
1265
-				if ( method_exists( $value, 'status' ) ) {
1266
-					$info[ $object_class ][ 'status' ] = $value->status();
1267
-				} else if ( method_exists( $value, 'status_ID' ) ) {
1268
-					$info[ $object_class ][ 'status' ] = $value->status_ID();
1257
+	public function _strip_objects($info = array()) {
1258
+		foreach ((array) $info as $key => $value) {
1259
+			if (is_array($value)) {
1260
+				$info[$key] = $this->_strip_objects($value);
1261
+			} else if (is_object($value)) {
1262
+				$object_class = get_class($value);
1263
+				$info[$object_class] = array();
1264
+				$info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0;
1265
+				if (method_exists($value, 'status')) {
1266
+					$info[$object_class]['status'] = $value->status();
1267
+				} else if (method_exists($value, 'status_ID')) {
1268
+					$info[$object_class]['status'] = $value->status_ID();
1269 1269
 				}
1270
-				unset( $info[ $key ] );
1270
+				unset($info[$key]);
1271 1271
 			}
1272 1272
 		}
1273
-		return (array)$info;
1273
+		return (array) $info;
1274 1274
 	}
1275 1275
 
1276 1276
 
Please login to merge, or discard this patch.
attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -91,6 +91,7 @@
 block discarded – undo
91 91
 	 * @param EE_Registration $registration
92 92
 	 * @param EE_Question     $question
93 93
 	 * @param mixed EE_Answer|NULL      $answer
94
+	 * @param EE_Answer $answer
94 95
 	 * @return EE_Form_Input_Base
95 96
 	 */
96 97
 	public function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
Please login to merge, or discard this patch.
Spacing   +229 added lines, -230 removed lines patch added patch discarded remove patch
@@ -41,21 +41,21 @@  discard block
 block discarded – undo
41 41
 	 * @access    public
42 42
 	 * @param    EE_Checkout $checkout
43 43
 	 */
44
-	public function __construct( EE_Checkout $checkout ) {
44
+	public function __construct(EE_Checkout $checkout) {
45 45
 		$this->_slug = 'attendee_information';
46 46
 		$this->_name = __('Attendee Information', 'event_espresso');
47
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php';
47
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php';
48 48
 		$this->checkout = $checkout;
49 49
 		$this->_reset_success_message();
50 50
 		$this->set_instructions(
51
-			__( 'Please answer the following registration questions before proceeding.', 'event_espresso' )
51
+			__('Please answer the following registration questions before proceeding.', 'event_espresso')
52 52
 		);
53 53
 	}
54 54
 
55 55
 
56 56
 
57 57
 	public function translate_js_strings() {
58
-		EE_Registry::$i18n_js_strings['required_field'] = __( ' is a required question.', 'event_espresso' );
58
+		EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso');
59 59
 		EE_Registry::$i18n_js_strings['required_multi_field'] = __(
60 60
 			' is a required question. Please enter a value for at least one of the options.',
61 61
 			'event_espresso'
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		// calculate taxes
116 116
 		$Line_Item_Display->display_line_item(
117 117
 			$this->checkout->cart->get_grand_total(),
118
-			array( 'set_tax_rate' => true )
118
+			array('set_tax_rate' => true)
119 119
 		);
120 120
 		/** @var $subsections EE_Form_Section_Proper[] */
121 121
 		$subsections = array(
@@ -127,51 +127,51 @@  discard block
 block discarded – undo
127 127
 			'ticket_count' 	=> array()
128 128
 		);
129 129
 		// grab the saved registrations from the transaction
130
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
131
-		if ( $registrations ) {
132
-			foreach ( $registrations as $registration ) {
130
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
131
+		if ($registrations) {
132
+			foreach ($registrations as $registration) {
133 133
 				// can this registration be processed during this visit ?
134 134
 				if (
135 135
 					$registration instanceof EE_Registration
136
-					&& $this->checkout->visit_allows_processing_of_this_registration( $registration )
136
+					&& $this->checkout->visit_allows_processing_of_this_registration($registration)
137 137
 				) {
138
-					$subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration );
139
-					if ( ! $this->checkout->admin_request ) {
140
-						$template_args['registrations'][ $registration->reg_url_link() ] = $registration;
141
-						$template_args['ticket_count'][ $registration->ticket()->ID() ] = isset(
142
-							$template_args['ticket_count'][ $registration->ticket()->ID() ]
138
+					$subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration);
139
+					if ( ! $this->checkout->admin_request) {
140
+						$template_args['registrations'][$registration->reg_url_link()] = $registration;
141
+						$template_args['ticket_count'][$registration->ticket()->ID()] = isset(
142
+							$template_args['ticket_count'][$registration->ticket()->ID()]
143 143
 						)
144
-							? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1
144
+							? $template_args['ticket_count'][$registration->ticket()->ID()] + 1
145 145
 							: 1;
146 146
 						$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs(
147 147
 							$this->checkout->cart->get_grand_total(),
148 148
 							'Ticket',
149
-							array( $registration->ticket()->ID() )
149
+							array($registration->ticket()->ID())
150 150
 						);
151
-						$ticket_line_item = is_array( $ticket_line_item )
152
-							? reset( $ticket_line_item )
151
+						$ticket_line_item = is_array($ticket_line_item)
152
+							? reset($ticket_line_item)
153 153
 							: $ticket_line_item;
154
-						$template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item(
154
+						$template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item(
155 155
 							$ticket_line_item
156 156
 						);
157 157
 					}
158
-					if ( $registration->is_primary_registrant() ) {
158
+					if ($registration->is_primary_registrant()) {
159 159
 						$primary_registrant = $registration->reg_url_link();
160 160
 					}
161 161
 				}
162 162
 			}
163 163
 			// print_copy_info ?
164
-			if ( $primary_registrant && ! $this->checkout->admin_request && count( $registrations ) > 1 ) {
164
+			if ($primary_registrant && ! $this->checkout->admin_request && count($registrations) > 1) {
165 165
 				// TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info
166 166
 				$copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info
167 167
 					? $this->_copy_attendee_info_form()
168 168
 					: $this->_auto_copy_attendee_info();
169 169
 				// generate hidden input
170 170
 				if (
171
-					isset( $subsections[ $primary_registrant ] )
172
-				     && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper
171
+					isset($subsections[$primary_registrant])
172
+				     && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper
173 173
 				) {
174
-					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
174
+					$subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false);
175 175
 				}
176 176
 			}
177 177
 
@@ -183,8 +183,7 @@  discard block
 block discarded – undo
183 183
 				'html_id' 					=> $this->reg_form_name(),
184 184
 				'subsections' 			=> $subsections,
185 185
 				'layout_strategy'		=> $this->checkout->admin_request ?
186
-					new EE_Div_Per_Section_Layout() :
187
-					new EE_Template_Layout(
186
+					new EE_Div_Per_Section_Layout() : new EE_Template_Layout(
188 187
 						array(
189 188
 							'layout_template_file' 	=> $this->_template, // layout_template
190 189
 							'template_args' 				=> $template_args
@@ -202,11 +201,11 @@  discard block
 block discarded – undo
202 201
 	 * @return EE_Form_Section_Proper
203 202
 	 * @throws \EE_Error
204 203
 	 */
205
-	private function _registrations_reg_form( EE_Registration $registration ) {
204
+	private function _registrations_reg_form(EE_Registration $registration) {
206 205
 		static $attendee_nmbr = 1;
207 206
 		// array of params to pass to parent constructor
208 207
 		$form_args = array(
209
-			'html_id'         => 'ee-registration-' . $registration->reg_url_link(),
208
+			'html_id'         => 'ee-registration-'.$registration->reg_url_link(),
210 209
 			'html_class'      => 'ee-reg-form-attendee-dv',
211 210
 			'html_style'      => $this->checkout->admin_request
212 211
 				? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'
@@ -215,24 +214,24 @@  discard block
 block discarded – undo
215 214
 			'layout_strategy' => new EE_Fieldset_Section_Layout(
216 215
 				array(
217 216
 					'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text',
218
-					'legend_text'  => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr )
217
+					'legend_text'  => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr)
219 218
 				)
220 219
 			)
221 220
 		);
222 221
 		// verify that registration has valid event
223
-		if ( $registration->event() instanceof EE_Event ) {
222
+		if ($registration->event() instanceof EE_Event) {
224 223
 			$query_params = array(
225 224
 				array(
226 225
 					'Event.EVT_ID' => $registration->event()->ID(),
227 226
 					'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false
228 227
 				),
229
-				'order_by'=>array( 'QSG_order'=>'ASC' )
228
+				'order_by'=>array('QSG_order'=>'ASC')
230 229
 			);
231
-			$question_groups = $registration->event()->question_groups( $query_params );
232
-			if ( $question_groups ) {
233
-				foreach ( $question_groups as $question_group ) {
234
-					if ( $question_group instanceof EE_Question_Group ) {
235
-						$form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form(
230
+			$question_groups = $registration->event()->question_groups($query_params);
231
+			if ($question_groups) {
232
+				foreach ($question_groups as $question_group) {
233
+					if ($question_group instanceof EE_Question_Group) {
234
+						$form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form(
236 235
 							$registration,
237 236
 							$question_group
238 237
 						);
@@ -245,10 +244,10 @@  discard block
 block discarded – undo
245 244
 				// if we have question groups for additional attendees, then display the copy options
246 245
 				$this->_print_copy_info = $attendee_nmbr > 1 ? true : $this->_print_copy_info;
247 246
 			} else {
248
-				$form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link(
249
-				) ] = new EE_Form_Section_HTML(
247
+				$form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link(
248
+				)] = new EE_Form_Section_HTML(
250 249
 					EEH_Template::locate_template(
251
-						SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php',
250
+						SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php',
252 251
 						apply_filters(
253 252
 							'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args',
254 253
 							array()
@@ -267,12 +266,12 @@  discard block
 block discarded – undo
267 266
 
268 267
 			}
269 268
 		}
270
-		if ( $registration->is_primary_registrant() ) {
269
+		if ($registration->is_primary_registrant()) {
271 270
 			// generate hidden input
272
-			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration );
271
+			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration);
273 272
 		}
274 273
 		$attendee_nmbr++;
275
-		return new EE_Form_Section_Proper( $form_args );
274
+		return new EE_Form_Section_Proper($form_args);
276 275
 	}
277 276
 
278 277
 
@@ -293,7 +292,7 @@  discard block
 block discarded – undo
293 292
 		// generate hidden input
294 293
 		return new EE_Hidden_Input(
295 294
 			array(
296
-				'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),
295
+				'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(),
297 296
 				'default' => $additional_attendee_reg_info
298 297
 			)
299 298
 		);
@@ -307,26 +306,26 @@  discard block
 block discarded – undo
307 306
 	 * @return EE_Form_Section_Proper
308 307
 	 * @throws \EE_Error
309 308
 	 */
310
-	private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){
309
+	private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) {
311 310
 		// array of params to pass to parent constructor
312 311
 		$form_args = array(
313
-			'html_id'         => 'ee-reg-form-qstn-grp-' . $question_group->identifier(),
312
+			'html_id'         => 'ee-reg-form-qstn-grp-'.$question_group->identifier(),
314 313
 			'html_class'      => $this->checkout->admin_request
315 314
 				? 'form-table ee-reg-form-qstn-grp-dv'
316 315
 				: 'ee-reg-form-qstn-grp-dv',
317
-			'html_label_id'   => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl',
316
+			'html_label_id'   => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl',
318 317
 			'subsections'     => array(
319
-				'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group )
318
+				'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group)
320 319
 			),
321 320
 			'layout_strategy' => $this->checkout->admin_request
322 321
 				? new EE_Admin_Two_Column_Layout()
323 322
 				: new EE_Div_Per_Section_Layout()
324 323
 		);
325 324
 		// where params
326
-		$query_params = array( 'QST_deleted' => 0 );
325
+		$query_params = array('QST_deleted' => 0);
327 326
 		// don't load admin only questions on the frontend
328
-		if ( ! $this->checkout->admin_request ) {
329
-			$query_params['QST_admin_only'] = array( '!=', true );
327
+		if ( ! $this->checkout->admin_request) {
328
+			$query_params['QST_admin_only'] = array('!=', true);
330 329
 		}
331 330
 		$questions = $question_group->get_many_related(
332 331
 			'Question',
@@ -348,10 +347,10 @@  discard block
 block discarded – undo
348 347
 			)
349 348
 		);
350 349
 		// loop thru questions
351
-		foreach ( $questions as $question ) {
352
-			if( $question instanceof EE_Question ){
350
+		foreach ($questions as $question) {
351
+			if ($question instanceof EE_Question) {
353 352
 				$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
354
-				$form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question );
353
+				$form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question);
355 354
 			}
356 355
 		}
357 356
 		$form_args['subsections'] = apply_filters(
@@ -372,7 +371,7 @@  discard block
 block discarded – undo
372 371
 			)
373 372
 		);
374 373
 //		d( $form_args );
375
-		$question_group_reg_form = new EE_Form_Section_Proper( $form_args );
374
+		$question_group_reg_form = new EE_Form_Section_Proper($form_args);
376 375
 		return apply_filters(
377 376
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',
378 377
 			$question_group_reg_form,
@@ -389,11 +388,11 @@  discard block
 block discarded – undo
389 388
 	 * @param EE_Question_Group $question_group
390 389
 	 * @return 	EE_Form_Section_HTML
391 390
 	 */
392
-	private function _question_group_header( EE_Question_Group $question_group ){
391
+	private function _question_group_header(EE_Question_Group $question_group) {
393 392
 		$html = '';
394 393
 		// group_name
395
-		if ( $question_group->show_group_name() && $question_group->name() !== '' ) {
396
-			if ( $this->checkout->admin_request ) {
394
+		if ($question_group->show_group_name() && $question_group->name() !== '') {
395
+			if ($this->checkout->admin_request) {
397 396
 				$html .= EEH_HTML::br();
398 397
 				$html .= EEH_HTML::h3(
399 398
 					$question_group->name(),
@@ -407,7 +406,7 @@  discard block
 block discarded – undo
407 406
 			}
408 407
 		}
409 408
 		// group_desc
410
-		if ( $question_group->show_group_desc() && $question_group->desc() !== '' ) {
409
+		if ($question_group->show_group_desc() && $question_group->desc() !== '') {
411 410
 			$html .= EEH_HTML::p(
412 411
 				$question_group->desc(),
413 412
 				'',
@@ -417,7 +416,7 @@  discard block
 block discarded – undo
417 416
 			);
418 417
 
419 418
 		}
420
-		return new EE_Form_Section_HTML( $html );
419
+		return new EE_Form_Section_HTML($html);
421 420
 	}
422 421
 
423 422
 
@@ -427,7 +426,7 @@  discard block
 block discarded – undo
427 426
 	 * @return    EE_Form_Section_Proper
428 427
 	 * @throws \EE_Error
429 428
 	 */
430
-	private function _copy_attendee_info_form(){
429
+	private function _copy_attendee_info_form() {
431 430
 		// array of params to pass to parent constructor
432 431
 		return new EE_Form_Section_Proper(
433 432
 			array(
@@ -456,7 +455,7 @@  discard block
 block discarded – undo
456 455
 	private function _auto_copy_attendee_info() {
457 456
 		return new EE_Form_Section_HTML(
458 457
 			EEH_Template::locate_template(
459
-				SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php',
458
+				SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php',
460 459
 				apply_filters(
461 460
 					'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args',
462 461
 					array()
@@ -480,32 +479,32 @@  discard block
 block discarded – undo
480 479
 		$copy_attendee_info_inputs = array();
481 480
 		$prev_ticket = NULL;
482 481
 		// grab the saved registrations from the transaction
483
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
484
-		foreach ( $registrations as $registration ) {
482
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
483
+		foreach ($registrations as $registration) {
485 484
 			// for all  attendees other than the primary attendee
486
-			if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) {
485
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
487 486
 				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
488
-				if ( $registration->ticket()->ID() !== $prev_ticket ) {
487
+				if ($registration->ticket()->ID() !== $prev_ticket) {
489 488
 					$item_name = $registration->ticket()->name();
490 489
 					$item_name .= $registration->ticket()->description() !== ''
491
-						? ' - ' . $registration->ticket()->description()
490
+						? ' - '.$registration->ticket()->description()
492 491
 						: '';
493
-					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML(
494
-						'<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
492
+					$copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML(
493
+						'<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
495 494
 					);
496 495
 					$prev_ticket = $registration->ticket()->ID();
497 496
 				}
498 497
 
499
-				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new
498
+				$copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new
500 499
 				EE_Checkbox_Multi_Input(
501 500
 					array(
502 501
 						$registration->ID() => sprintf(
503
-							__( 'Attendee #%s', 'event_espresso' ),
502
+							__('Attendee #%s', 'event_espresso'),
504 503
 							$registration->count()
505 504
 						)
506 505
 					),
507 506
 					array(
508
-						'html_id'                 => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
507
+						'html_id'                 => 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
509 508
 						'html_class'              => 'spco-copy-attendee-chk ee-do-not-validate',
510 509
 						'display_html_label_text' => false
511 510
 					)
@@ -525,7 +524,7 @@  discard block
 block discarded – undo
525 524
 	 * @return    EE_Form_Input_Base
526 525
 	 * @throws \EE_Error
527 526
 	 */
528
-	private function _additional_primary_registrant_inputs( EE_Registration $registration ){
527
+	private function _additional_primary_registrant_inputs(EE_Registration $registration) {
529 528
 		// generate hidden input
530 529
 		return new EE_Hidden_Input(
531 530
 			array(
@@ -544,7 +543,7 @@  discard block
 block discarded – undo
544 543
 	 * @return    EE_Form_Input_Base
545 544
 	 * @throws \EE_Error
546 545
 	 */
547
-	public function reg_form_question( EE_Registration $registration, EE_Question $question ){
546
+	public function reg_form_question(EE_Registration $registration, EE_Question $question) {
548 547
 
549 548
 		// if this question was for an attendee detail, then check for that answer
550 549
 		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value(
@@ -553,32 +552,32 @@  discard block
 block discarded – undo
553 552
 		);
554 553
 		$answer = $answer_value === null
555 554
 			? EEM_Answer::instance()->get_one(
556
-				array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) )
555
+				array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))
557 556
 			)
558 557
 			: null;
559 558
 		// if NOT returning to edit an existing registration
560 559
 		// OR if this question is for an attendee property
561 560
 		// OR we still don't have an EE_Answer object
562
-		if( $answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link() ) {
561
+		if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) {
563 562
 			// create an EE_Answer object for storing everything in
564
-			$answer = EE_Answer::new_instance ( array(
563
+			$answer = EE_Answer::new_instance(array(
565 564
 				'QST_ID'=> $question->ID(),
566 565
 				'REG_ID'=> $registration->ID()
567 566
 			));
568 567
 		}
569 568
 		// verify instance
570
-		if( $answer instanceof EE_Answer ){
571
-			if ( ! empty( $answer_value )) {
572
-				$answer->set( 'ANS_value', $answer_value );
569
+		if ($answer instanceof EE_Answer) {
570
+			if ( ! empty($answer_value)) {
571
+				$answer->set('ANS_value', $answer_value);
573 572
 			}
574
-			$answer->cache( 'Question', $question );
573
+			$answer->cache('Question', $question);
575 574
 			//remember system ID had a bug where sometimes it could be null
576
-			$answer_cache_id =$question->is_system_question()
577
-				? $question->system_ID() . '-' . $registration->reg_url_link()
578
-				: $question->ID() . '-' . $registration->reg_url_link();
579
-			$registration->cache( 'Answer', $answer, $answer_cache_id );
575
+			$answer_cache_id = $question->is_system_question()
576
+				? $question->system_ID().'-'.$registration->reg_url_link()
577
+				: $question->ID().'-'.$registration->reg_url_link();
578
+			$registration->cache('Answer', $answer, $answer_cache_id);
580 579
 		}
581
-		return $this->_generate_question_input( $registration, $question, $answer );
580
+		return $this->_generate_question_input($registration, $question, $answer);
582 581
 
583 582
 	}
584 583
 
@@ -591,46 +590,46 @@  discard block
 block discarded – undo
591 590
 	 * @return EE_Form_Input_Base
592 591
 	 * @throws \EE_Error
593 592
 	 */
594
-	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
593
+	private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) {
595 594
 		$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
596
-		$this->_required_questions[ $identifier ] = $question->required() ? true : false;
595
+		$this->_required_questions[$identifier] = $question->required() ? true : false;
597 596
 		add_filter(
598 597
 			'FHEE__EE_Question__generate_form_input__country_options',
599
-			array( $this, 'use_cached_countries_for_form_input' ),
598
+			array($this, 'use_cached_countries_for_form_input'),
600 599
 			10,
601 600
 			4
602 601
 		);
603 602
 		add_filter(
604 603
 			'FHEE__EE_Question__generate_form_input__state_options',
605
-			array( $this, 'use_cached_states_for_form_input' ),
604
+			array($this, 'use_cached_states_for_form_input'),
606 605
 			10,
607 606
 			4
608 607
 		);
609 608
 		$input_constructor_args = array(
610
-			'html_name'     => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
611
-			'html_id'       => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
612
-			'html_class'    => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
613
-			'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
609
+			'html_name'     => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
610
+			'html_id'       => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
611
+			'html_class'    => 'ee-reg-qstn ee-reg-qstn-'.$identifier,
612
+			'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
614 613
 			'html_label_class'	=> 'ee-reg-qstn',
615 614
 		);
616
-		$input_constructor_args['html_label_id'] 	.= '-lbl';
617
-		if ( $answer instanceof EE_Answer && $answer->ID() ) {
618
-			$input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']';
619
-			$input_constructor_args[ 'html_id' ] .= '-' . $answer->ID();
620
-			$input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID();
615
+		$input_constructor_args['html_label_id'] .= '-lbl';
616
+		if ($answer instanceof EE_Answer && $answer->ID()) {
617
+			$input_constructor_args['html_name'] .= '['.$answer->ID().']';
618
+			$input_constructor_args['html_id'] .= '-'.$answer->ID();
619
+			$input_constructor_args['html_label_id'] .= '-'.$answer->ID();
621 620
 		}
622
-		$form_input =  $question->generate_form_input(
621
+		$form_input = $question->generate_form_input(
623 622
 			$registration,
624 623
 			$answer,
625 624
 			$input_constructor_args
626 625
 		);
627 626
 		remove_filter(
628 627
 			'FHEE__EE_Question__generate_form_input__country_options',
629
-			array( $this, 'use_cached_countries_for_form_input' )
628
+			array($this, 'use_cached_countries_for_form_input')
630 629
 		);
631 630
 		remove_filter(
632 631
 			'FHEE__EE_Question__generate_form_input__state_options',
633
-			array( $this, 'use_cached_states_for_form_input' )
632
+			array($this, 'use_cached_states_for_form_input')
634 633
 		);
635 634
 		return $form_input;
636 635
 	}
@@ -652,22 +651,22 @@  discard block
 block discarded – undo
652 651
 		\EE_Registration $registration = null,
653 652
 		\EE_Answer $answer = null
654 653
 	) {
655
-		$country_options = array( '' => '' );
654
+		$country_options = array('' => '');
656 655
 		// get possibly cached list of countries
657 656
 		$countries = $this->checkout->action === 'process_reg_step'
658 657
 			? EEM_Country::instance()->get_all_countries()
659 658
 			: EEM_Country::instance()->get_all_active_countries();
660
-		if ( ! empty( $countries )) {
661
-			foreach( $countries as $country ){
662
-				if ( $country instanceof EE_Country ) {
663
-					$country_options[ $country->ID() ] = $country->name();
659
+		if ( ! empty($countries)) {
660
+			foreach ($countries as $country) {
661
+				if ($country instanceof EE_Country) {
662
+					$country_options[$country->ID()] = $country->name();
664 663
 				}
665 664
 			}
666 665
 		}
667
-		if( $question instanceof EE_Question
668
-			&& $registration instanceof EE_Registration ) {
666
+		if ($question instanceof EE_Question
667
+			&& $registration instanceof EE_Registration) {
669 668
 			$answer = EEM_Answer::instance()->get_one(
670
-				array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) )
669
+				array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))
671 670
 			);
672 671
 		} else {
673 672
 			$answer = EE_Answer::new_instance();
@@ -700,14 +699,14 @@  discard block
 block discarded – undo
700 699
 		\EE_Registration $registration = null,
701 700
 		\EE_Answer $answer = null
702 701
 	) {
703
-		$state_options = array( '' => array( '' => ''));
702
+		$state_options = array('' => array('' => ''));
704 703
 		$states = $this->checkout->action === 'process_reg_step'
705 704
 			? EEM_State::instance()->get_all_states()
706 705
 			: EEM_State::instance()->get_all_active_states();
707
-		if ( ! empty( $states )) {
708
-			foreach( $states as $state ){
709
-				if ( $state instanceof EE_State ) {
710
-					$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
706
+		if ( ! empty($states)) {
707
+			foreach ($states as $state) {
708
+				if ($state instanceof EE_State) {
709
+					$state_options[$state->country()->name()][$state->ID()] = $state->name();
711 710
 				}
712 711
 			}
713 712
 		}
@@ -735,24 +734,24 @@  discard block
 block discarded – undo
735 734
 	 * @throws \EE_Error
736 735
 	 */
737 736
 	public function process_reg_step() {
738
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
737
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
739 738
 		// grab validated data from form
740 739
 		$valid_data = $this->checkout->current_step->valid_data();
741 740
 		// EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
742 741
 		// EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );
743 742
 		// if we don't have any $valid_data then something went TERRIBLY WRONG !!!
744
-		if ( empty( $valid_data ))  {
743
+		if (empty($valid_data)) {
745 744
 			EE_Error::add_error(
746
-				__( 'No valid question responses were received.', 'event_espresso' ),
745
+				__('No valid question responses were received.', 'event_espresso'),
747 746
 				__FILE__,
748 747
 				__FUNCTION__,
749 748
 				__LINE__
750 749
 			);
751 750
 			return false;
752 751
 		}
753
-		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) {
752
+		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
754 753
 			EE_Error::add_error(
755
-				__( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ),
754
+				__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'),
756 755
 				__FILE__,
757 756
 				__FUNCTION__,
758 757
 				__LINE__
@@ -760,11 +759,11 @@  discard block
 block discarded – undo
760 759
 			return false;
761 760
 		}
762 761
 		// get cached registrations
763
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
762
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
764 763
 		// verify we got the goods
765
-		if ( empty( $registrations )) {
764
+		if (empty($registrations)) {
766 765
 			EE_Error::add_error(
767
-				__( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ),
766
+				__('Your form data could not be applied to any valid registrations.', 'event_espresso'),
768 767
 				__FILE__,
769 768
 				__FUNCTION__,
770 769
 				__LINE__
@@ -772,15 +771,15 @@  discard block
 block discarded – undo
772 771
 			return false;
773 772
 		}
774 773
 		// extract attendee info from form data and save to model objects
775
-		$registrations_processed = $this->_process_registrations( $registrations, $valid_data );
774
+		$registrations_processed = $this->_process_registrations($registrations, $valid_data);
776 775
 		// if first pass thru SPCO,
777 776
 		// then let's check processed registrations against the total number of tickets in the cart
778
-		if ( $registrations_processed === false ) {
777
+		if ($registrations_processed === false) {
779 778
 			// but return immediately if the previous step exited early due to errors
780 779
 			return false;
781
-		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) {
780
+		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
782 781
 			// generate a correctly translated string for all possible singular/plural combinations
783
-			if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) {
782
+			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
784 783
 				$error_msg = sprintf(
785 784
 					__(
786 785
 						'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed',
@@ -789,7 +788,7 @@  discard block
 block discarded – undo
789 788
 					$this->checkout->total_ticket_count,
790 789
 					$registrations_processed
791 790
 				);
792
-			} else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) {
791
+			} else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
793 792
 				$error_msg = sprintf(
794 793
 					__(
795 794
 						'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed',
@@ -808,17 +807,17 @@  discard block
 block discarded – undo
808 807
 					$registrations_processed
809 808
 				);
810 809
 			}
811
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
810
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
812 811
 			return false;
813 812
 		}
814 813
 		// mark this reg step as completed
815 814
 		$this->set_completed();
816 815
 		$this->_set_success_message(
817
-			__( 'The Attendee Information Step has been successfully completed.', 'event_espresso' )
816
+			__('The Attendee Information Step has been successfully completed.', 'event_espresso')
818 817
 		);
819 818
 		//do action in case a plugin wants to do something with the data submitted in step 1.
820 819
 		//passes EE_Single_Page_Checkout, and it's posted data
821
-		do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data );
820
+		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
822 821
 		return true;
823 822
 	}
824 823
 
@@ -832,9 +831,9 @@  discard block
 block discarded – undo
832 831
 	 * @return boolean | int
833 832
 	 * @throws \EE_Error
834 833
 	 */
835
-	private function _process_registrations( $registrations = array(), $valid_data = array() ) {
834
+	private function _process_registrations($registrations = array(), $valid_data = array()) {
836 835
 		// load resources and set some defaults
837
-		EE_Registry::instance()->load_model( 'Attendee' );
836
+		EE_Registry::instance()->load_model('Attendee');
838 837
 		// holder for primary registrant attendee object
839 838
 		$this->checkout->primary_attendee_obj = NULL;
840 839
 		// array for tracking reg form data for the primary registrant
@@ -851,9 +850,9 @@  discard block
 block discarded – undo
851 850
 		// attendee counter
852 851
 		$att_nmbr = 0;
853 852
 		// grab the saved registrations from the transaction
854
-		foreach ( $registrations  as $registration ) {
853
+		foreach ($registrations  as $registration) {
855 854
 			// verify EE_Registration object
856
-			if ( ! $registration instanceof EE_Registration ) {
855
+			if ( ! $registration instanceof EE_Registration) {
857 856
 				EE_Error::add_error(
858 857
 					__(
859 858
 						'An invalid Registration object was discovered when attempting to process your registration information.',
@@ -868,12 +867,12 @@  discard block
 block discarded – undo
868 867
 			/** @var string $reg_url_link */
869 868
 			$reg_url_link = $registration->reg_url_link();
870 869
 			// reg_url_link exists ?
871
-			if ( ! empty( $reg_url_link ) ) {
870
+			if ( ! empty($reg_url_link)) {
872 871
 				// should this registration be processed during this visit ?
873
-				if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
872
+				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
874 873
 					// if NOT revisiting, then let's save the registration now,
875 874
 					// so that we have a REG_ID to use when generating other objects
876
-					if ( ! $this->checkout->revisit ) {
875
+					if ( ! $this->checkout->revisit) {
877 876
 						$registration->save();
878 877
 					}
879 878
 					/**
@@ -883,7 +882,7 @@  discard block
 block discarded – undo
883 882
 					 * @var bool   if true is returned by the plugin then the
884 883
 					 *      		registration processing is halted.
885 884
 					 */
886
-					if ( apply_filters(
885
+					if (apply_filters(
887 886
 						'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process',
888 887
 						false,
889 888
 						$att_nmbr,
@@ -891,38 +890,38 @@  discard block
 block discarded – undo
891 890
 						$registrations,
892 891
 						$valid_data,
893 892
 						$this
894
-					) ) {
893
+					)) {
895 894
 						return false;
896 895
 					}
897 896
 
898 897
 					// Houston, we have a registration!
899 898
 					$att_nmbr++;
900
-					$this->_attendee_data[ $reg_url_link ] = array();
899
+					$this->_attendee_data[$reg_url_link] = array();
901 900
 					// grab any existing related answer objects
902 901
 					$this->_registration_answers = $registration->answers();
903 902
 					// unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
904
-					if ( isset( $valid_data[ $reg_url_link ] ) ) {
903
+					if (isset($valid_data[$reg_url_link])) {
905 904
 						// do we need to copy basic info from primary attendee ?
906
-						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] )
907
-						                && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0
905
+						$copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info'])
906
+						                && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0
908 907
 							? true
909 908
 							: false;
910 909
 						// filter form input data for this registration
911
-						$valid_data[ $reg_url_link ] = (array)apply_filters(
910
+						$valid_data[$reg_url_link] = (array) apply_filters(
912 911
 							'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',
913
-							$valid_data[ $reg_url_link ]
912
+							$valid_data[$reg_url_link]
914 913
 						);
915 914
 						// EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ );
916
-						if ( isset( $valid_data['primary_attendee'] )) {
917
-							$primary_registrant['line_item_id'] =  ! empty( $valid_data['primary_attendee'] )
915
+						if (isset($valid_data['primary_attendee'])) {
916
+							$primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee'])
918 917
 								? $valid_data['primary_attendee']
919 918
 								: false;
920
-							unset( $valid_data['primary_attendee'] );
919
+							unset($valid_data['primary_attendee']);
921 920
 						}
922 921
 						// now loop through our array of valid post data && process attendee reg forms
923
-						foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) {
924
-							if ( ! in_array( $form_section, $non_input_form_sections )) {
925
-								foreach ( $form_inputs as $form_input => $input_value ) {
922
+						foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) {
923
+							if ( ! in_array($form_section, $non_input_form_sections)) {
924
+								foreach ($form_inputs as $form_input => $input_value) {
926 925
 									// \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ );
927 926
 									// check for critical inputs
928 927
 									if (
@@ -936,16 +935,16 @@  discard block
 block discarded – undo
936 935
 									// store a bit of data about the primary attendee
937 936
 									if (
938 937
 										$att_nmbr === 1
939
-										&& ! empty( $input_value )
938
+										&& ! empty($input_value)
940 939
 										&& $reg_url_link === $primary_registrant['line_item_id']
941 940
 									) {
942
-										$primary_registrant[ $form_input ] = $input_value;
941
+										$primary_registrant[$form_input] = $input_value;
943 942
 									} else if (
944 943
 										$copy_primary
945 944
 										&& $input_value === null
946
-										&& isset( $primary_registrant[ $form_input ] )
945
+										&& isset($primary_registrant[$form_input])
947 946
 									) {
948
-										$input_value = $primary_registrant[ $form_input ];
947
+										$input_value = $primary_registrant[$form_input];
949 948
 									}
950 949
 									// now attempt to save the input data
951 950
 									if (
@@ -987,55 +986,55 @@  discard block
 block discarded – undo
987 986
 						// have we met before?
988 987
 						$attendee = $this->_find_existing_attendee(
989 988
 							$registration,
990
-							$this->_attendee_data[ $reg_url_link ]
989
+							$this->_attendee_data[$reg_url_link]
991 990
 						);
992 991
 						// did we find an already existing record for this attendee ?
993
-						if ( $attendee instanceof EE_Attendee ) {
992
+						if ($attendee instanceof EE_Attendee) {
994 993
 							$attendee = $this->_update_existing_attendee_data(
995 994
 								$attendee,
996
-								$this->_attendee_data[ $reg_url_link ]
995
+								$this->_attendee_data[$reg_url_link]
997 996
 							);
998 997
 						} else {
999 998
 							// ensure critical details are set for additional attendees
1000
-							$this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1
999
+							$this->_attendee_data[$reg_url_link] = $att_nmbr > 1
1001 1000
 								? $this->_copy_critical_attendee_details_from_primary_registrant(
1002
-									$this->_attendee_data[ $reg_url_link ]
1001
+									$this->_attendee_data[$reg_url_link]
1003 1002
 								)
1004
-								: $this->_attendee_data[ $reg_url_link ];
1003
+								: $this->_attendee_data[$reg_url_link];
1005 1004
 							$attendee = $this->_create_new_attendee(
1006 1005
 								$registration,
1007
-								$this->_attendee_data[ $reg_url_link ]
1006
+								$this->_attendee_data[$reg_url_link]
1008 1007
 							);
1009 1008
 						}
1010 1009
 						// who's #1 ?
1011
-						if ( $att_nmbr === 1 ) {
1010
+						if ($att_nmbr === 1) {
1012 1011
 							$this->checkout->primary_attendee_obj = $attendee;
1013 1012
 						}
1014 1013
 					}
1015 1014
 					// EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );
1016 1015
 					// add relation to registration, set attendee ID, and cache attendee
1017
-					$this->_associate_attendee_with_registration( $registration, $attendee );
1016
+					$this->_associate_attendee_with_registration($registration, $attendee);
1018 1017
 					// \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ );
1019
-					if ( ! $registration->attendee() instanceof EE_Attendee ) {
1020
-						EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ );
1018
+					if ( ! $registration->attendee() instanceof EE_Attendee) {
1019
+						EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__);
1021 1020
 						return false;
1022 1021
 					}
1023 1022
 					/** @type EE_Registration_Processor $registration_processor */
1024
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1023
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1025 1024
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1026
-					$registration_processor->toggle_incomplete_registration_status_to_default( $registration, false );
1025
+					$registration_processor->toggle_incomplete_registration_status_to_default($registration, false);
1027 1026
 					// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1028 1027
 					$this->checkout->transaction->toggle_failed_transaction_status();
1029 1028
 					// if we've gotten this far, then let's save what we have
1030 1029
 					$registration->save();
1031 1030
 					// add relation between TXN and registration
1032
-					$this->_associate_registration_with_transaction( $registration );
1031
+					$this->_associate_registration_with_transaction($registration);
1033 1032
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
1034 1033
 
1035
-			}  else {
1036
-				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1034
+			} else {
1035
+				EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1037 1036
 				// remove malformed data
1038
-				unset( $valid_data[ $reg_url_link ] );
1037
+				unset($valid_data[$reg_url_link]);
1039 1038
 				return false;
1040 1039
 			}
1041 1040
 
@@ -1064,26 +1063,26 @@  discard block
 block discarded – undo
1064 1063
 		// \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );
1065 1064
 		// allow for plugins to hook in and do their own processing of the form input.
1066 1065
 		// For plugins to bypass normal processing here, they just need to return a boolean value.
1067
-		if ( apply_filters(
1066
+		if (apply_filters(
1068 1067
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input',
1069 1068
 			false,
1070 1069
 			$registration,
1071 1070
 			$form_input,
1072 1071
 			$input_value,
1073 1072
 			$this
1074
-		) ) {
1073
+		)) {
1075 1074
 			return true;
1076 1075
 		}
1077 1076
 		// $answer_cache_id is the key used to find the EE_Answer we want
1078 1077
 		$answer_cache_id = $this->checkout->reg_url_link
1079 1078
 			? $form_input
1080
-			: $form_input . '-' . $registration->reg_url_link();
1081
-		$answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] )
1082
-		                 && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer
1079
+			: $form_input.'-'.$registration->reg_url_link();
1080
+		$answer_is_obj = isset($this->_registration_answers[$answer_cache_id])
1081
+		                 && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer
1083 1082
 			? true
1084 1083
 			: false;
1085 1084
 		//rename form_inputs if they are EE_Attendee properties
1086
-		switch( (string)$form_input ) {
1085
+		switch ((string) $form_input) {
1087 1086
 
1088 1087
 			case 'state' :
1089 1088
 			case 'STA_ID' :
@@ -1098,32 +1097,32 @@  discard block
 block discarded – undo
1098 1097
 				break;
1099 1098
 
1100 1099
 			default :
1101
-				$ATT_input = 'ATT_' . $form_input;
1100
+				$ATT_input = 'ATT_'.$form_input;
1102 1101
 				//EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );
1103
-				$attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? true : false;
1104
-				$form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;
1102
+				$attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false;
1103
+				$form_input = $attendee_property ? 'ATT_'.$form_input : $form_input;
1105 1104
 		}
1106 1105
 		// EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );
1107 1106
 		// EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );
1108 1107
 		// EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );
1109 1108
 		// if this form input has a corresponding attendee property
1110
-		if ( $attendee_property ) {
1111
-			$this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
1112
-			if ( $answer_is_obj ) {
1109
+		if ($attendee_property) {
1110
+			$this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;
1111
+			if ($answer_is_obj) {
1113 1112
 				// and delete the corresponding answer since we won't be storing this data in that object
1114
-				$registration->_remove_relation_to( $this->_registration_answers[ $answer_cache_id ], 'Answer' );
1115
-				$this->_registration_answers[ $answer_cache_id ]->delete_permanently();
1113
+				$registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer');
1114
+				$this->_registration_answers[$answer_cache_id]->delete_permanently();
1116 1115
 			}
1117 1116
 			return true;
1118
-		} elseif ( $answer_is_obj ) {
1117
+		} elseif ($answer_is_obj) {
1119 1118
 			// save this data to the answer object
1120
-			$this->_registration_answers[ $answer_cache_id ]->set_value( $input_value );
1121
-			$result = $this->_registration_answers[ $answer_cache_id ]->save();
1119
+			$this->_registration_answers[$answer_cache_id]->set_value($input_value);
1120
+			$result = $this->_registration_answers[$answer_cache_id]->save();
1122 1121
 			return $result !== false ? true : false;
1123 1122
 		} else {
1124
-			foreach ( $this->_registration_answers as $answer ) {
1125
-				if ( $answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id ) {
1126
-					$answer->set_value( $input_value );
1123
+			foreach ($this->_registration_answers as $answer) {
1124
+				if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) {
1125
+					$answer->set_value($input_value);
1127 1126
 					$result = $answer->save();
1128 1127
 					return $result !== false ? true : false;
1129 1128
 				}
@@ -1145,15 +1144,15 @@  discard block
 block discarded – undo
1145 1144
 		$form_input = '',
1146 1145
 		$input_value = ''
1147 1146
 	) {
1148
-		if ( empty( $input_value ) ) {
1147
+		if (empty($input_value)) {
1149 1148
 			// if the form input isn't marked as being required, then just return
1150
-			if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) {
1149
+			if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) {
1151 1150
 				return true;
1152 1151
 			}
1153
-			switch ( $form_input ) {
1152
+			switch ($form_input) {
1154 1153
 				case 'fname' :
1155 1154
 					EE_Error::add_error(
1156
-						__( 'First Name is a required value.', 'event_espresso' ),
1155
+						__('First Name is a required value.', 'event_espresso'),
1157 1156
 						__FILE__,
1158 1157
 						__FUNCTION__,
1159 1158
 						__LINE__
@@ -1162,7 +1161,7 @@  discard block
 block discarded – undo
1162 1161
 					break;
1163 1162
 				case 'lname' :
1164 1163
 					EE_Error::add_error(
1165
-						__( 'Last Name is a required value.', 'event_espresso' ),
1164
+						__('Last Name is a required value.', 'event_espresso'),
1166 1165
 						__FILE__,
1167 1166
 						__FUNCTION__,
1168 1167
 						__LINE__
@@ -1171,7 +1170,7 @@  discard block
 block discarded – undo
1171 1170
 					break;
1172 1171
 				case 'email' :
1173 1172
 					EE_Error::add_error(
1174
-						__( 'Please enter a valid email address.', 'event_espresso' ),
1173
+						__('Please enter a valid email address.', 'event_espresso'),
1175 1174
 						__FILE__,
1176 1175
 						__FUNCTION__,
1177 1176
 						__LINE__
@@ -1204,21 +1203,21 @@  discard block
 block discarded – undo
1204 1203
 	 * @param array           $attendee_data
1205 1204
 	 * @return boolean
1206 1205
 	 */
1207
-	private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) {
1206
+	private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) {
1208 1207
 		$existing_attendee = null;
1209 1208
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1210
-		$ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] )
1209
+		$ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname'])
1211 1210
 			? $attendee_data['ATT_fname']
1212 1211
 			: '';
1213
-		$ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] )
1212
+		$ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname'])
1214 1213
 			? $attendee_data['ATT_lname']
1215 1214
 			: '';
1216
-		$ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] )
1215
+		$ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email'])
1217 1216
 			? $attendee_data['ATT_email']
1218 1217
 			: '';
1219 1218
 		// but only if those have values
1220
-		if ( $ATT_fname && $ATT_lname && $ATT_email ) {
1221
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1219
+		if ($ATT_fname && $ATT_lname && $ATT_email) {
1220
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1222 1221
 				'ATT_fname' => $ATT_fname,
1223 1222
 				'ATT_lname' => $ATT_lname,
1224 1223
 				'ATT_email' => $ATT_email
@@ -1242,13 +1241,13 @@  discard block
 block discarded – undo
1242 1241
 	 * @return \EE_Attendee
1243 1242
 	 * @throws \EE_Error
1244 1243
 	 */
1245
-	private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) {
1244
+	private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) {
1246 1245
 		// first remove fname, lname, and email from attendee data
1247
-		$dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1246
+		$dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email');
1248 1247
 		// now loop thru what's left and add to attendee CPT
1249
-		foreach ( $attendee_data as $property_name => $property_value ) {
1250
-			if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) {
1251
-				$existing_attendee->set( $property_name, $property_value );
1248
+		foreach ($attendee_data as $property_name => $property_value) {
1249
+			if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) {
1250
+				$existing_attendee->set($property_name, $property_value);
1252 1251
 			}
1253 1252
 		}
1254 1253
 		// better save that now
@@ -1266,11 +1265,11 @@  discard block
 block discarded – undo
1266 1265
 	 * @return void
1267 1266
 	 * @throws \EE_Error
1268 1267
 	 */
1269
-	private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) {
1268
+	private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) {
1270 1269
 		// add relation to attendee
1271
-		$registration->_add_relation_to( $attendee, 'Attendee' );
1272
-		$registration->set_attendee_id( $attendee->ID() );
1273
-		$registration->update_cache_after_object_save( 'Attendee', $attendee );
1270
+		$registration->_add_relation_to($attendee, 'Attendee');
1271
+		$registration->set_attendee_id($attendee->ID());
1272
+		$registration->update_cache_after_object_save('Attendee', $attendee);
1274 1273
 	}
1275 1274
 
1276 1275
 
@@ -1282,10 +1281,10 @@  discard block
 block discarded – undo
1282 1281
 	 * @return void
1283 1282
 	 * @throws \EE_Error
1284 1283
 	 */
1285
-	private function _associate_registration_with_transaction( EE_Registration $registration ) {
1284
+	private function _associate_registration_with_transaction(EE_Registration $registration) {
1286 1285
 		// add relation to attendee
1287
-		$this->checkout->transaction->_add_relation_to( $registration, 'Registration' );
1288
-		$this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration );
1286
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
1287
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
1289 1288
 	}
1290 1289
 
1291 1290
 
@@ -1298,14 +1297,14 @@  discard block
 block discarded – undo
1298 1297
 	 * @return array
1299 1298
 	 * @throws \EE_Error
1300 1299
 	 */
1301
-	private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) {
1300
+	private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) {
1302 1301
 		// bare minimum critical details include first name, last name, email address
1303
-		$critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1302
+		$critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email');
1304 1303
 		// add address info to critical details?
1305
-		if ( apply_filters(
1304
+		if (apply_filters(
1306 1305
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details',
1307 1306
 			false
1308
-		) ) {
1307
+		)) {
1309 1308
 			$address_details = array(
1310 1309
 				'ATT_address',
1311 1310
 				'ATT_address2',
@@ -1315,13 +1314,13 @@  discard block
 block discarded – undo
1315 1314
 				'ATT_zip',
1316 1315
 				'ATT_phone'
1317 1316
 			);
1318
-			$critical_attendee_details = array_merge( $critical_attendee_details, $address_details );
1317
+			$critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1319 1318
 		}
1320
-		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1321
-			if ( ! isset( $attendee_data[ $critical_attendee_detail ] )
1322
-			     || empty( $attendee_data[ $critical_attendee_detail ] )
1319
+		foreach ($critical_attendee_details as $critical_attendee_detail) {
1320
+			if ( ! isset($attendee_data[$critical_attendee_detail])
1321
+			     || empty($attendee_data[$critical_attendee_detail])
1323 1322
 			) {
1324
-				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(
1323
+				$attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get(
1325 1324
 					$critical_attendee_detail
1326 1325
 				);
1327 1326
 			}
@@ -1339,11 +1338,11 @@  discard block
 block discarded – undo
1339 1338
 	 * @return \EE_Attendee
1340 1339
 	 * @throws \EE_Error
1341 1340
 	 */
1342
-	private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) {
1341
+	private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) {
1343 1342
 		// create new attendee object
1344
-		$new_attendee = EE_Attendee::new_instance( $attendee_data );
1343
+		$new_attendee = EE_Attendee::new_instance($attendee_data);
1345 1344
 		// set author to event creator
1346
-		$new_attendee->set( 'ATT_author', $registration->event()->wp_user() );
1345
+		$new_attendee->set('ATT_author', $registration->event()->wp_user());
1347 1346
 		$new_attendee->save();
1348 1347
 		return $new_attendee;
1349 1348
 	}
@@ -1360,7 +1359,7 @@  discard block
 block discarded – undo
1360 1359
 	 */
1361 1360
 	public function update_reg_step() {
1362 1361
 		// save everything
1363
-		if ( $this->process_reg_step() ) {
1362
+		if ($this->process_reg_step()) {
1364 1363
 			$this->checkout->redirect = true;
1365 1364
 			$this->checkout->redirect_url = add_query_arg(
1366 1365
 				array(
@@ -1369,7 +1368,7 @@  discard block
 block discarded – undo
1369 1368
 				),
1370 1369
 				$this->checkout->thank_you_page_url
1371 1370
 			);
1372
-			$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1371
+			$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1373 1372
 			return true;
1374 1373
 		}
1375 1374
 		return false;
Please login to merge, or discard this patch.
core/EE_Payment_Processor.core.php 1 patch
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 /**
4 4
  *
5 5
  * EE_Payment_Processor
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public static function instance() {
29 29
 		// check if class object is instantiated
30
-		if ( ! self::$_instance instanceof EE_Payment_Processor ) {
30
+		if ( ! self::$_instance instanceof EE_Payment_Processor) {
31 31
 			self::$_instance = new self();
32 32
 		}
33 33
 		return self::$_instance;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 *@access private
42 42
 	 */
43 43
 	private function __construct() {
44
-		do_action( 'AHEE__EE_Payment_Processor__construct' );
44
+		do_action('AHEE__EE_Payment_Processor__construct');
45 45
 	}
46 46
 
47 47
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		$update_txn = true,
81 81
 		$cancel_url = ''
82 82
 	) {
83
-		if( (float)$amount < 0 ) {
83
+		if ((float) $amount < 0) {
84 84
 			throw new EE_Error(
85 85
 				sprintf(
86 86
 					__(
@@ -93,33 +93,33 @@  discard block
 block discarded – undo
93 93
 			);
94 94
 		}
95 95
 		// verify payment method
96
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE );
96
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE);
97 97
 		// verify transaction
98
-		EEM_Transaction::instance()->ensure_is_obj( $transaction );
99
-		$transaction->set_payment_method_ID( $payment_method->ID() );
98
+		EEM_Transaction::instance()->ensure_is_obj($transaction);
99
+		$transaction->set_payment_method_ID($payment_method->ID());
100 100
 		// verify payment method type
101
-		if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
101
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
102 102
 			$payment = $payment_method->type_obj()->process_payment(
103 103
 				$transaction,
104
-				min( $amount, $transaction->remaining() ),//make sure we don't overcharge
104
+				min($amount, $transaction->remaining()), //make sure we don't overcharge
105 105
 				$billing_form,
106 106
 				$return_url,
107
-				add_query_arg( array( 'ee_cancel_payment' => true ), $cancel_url ),
107
+				add_query_arg(array('ee_cancel_payment' => true), $cancel_url),
108 108
 				$method,
109 109
 				$by_admin
110 110
 			);
111 111
 			// check if payment method uses an off-site gateway
112
-			if ( $payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite ) {
112
+			if ($payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite) {
113 113
 				// don't process payments for off-site gateways yet because no payment has occurred yet
114
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
114
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
115 115
 			}
116 116
 			return $payment;
117 117
 		} else {
118 118
 			EE_Error::add_error(
119 119
 				sprintf(
120
-					__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
120
+					__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
121 121
 					'<br/>',
122
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
122
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
123 123
 				), __FILE__, __FUNCTION__, __LINE__
124 124
 			);
125 125
 			return NULL;
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 	 * @throws EE_Error
136 136
 	 * @return string
137 137
 	 */
138
-	public function get_ipn_url_for_payment_method( $transaction, $payment_method ){
138
+	public function get_ipn_url_for_payment_method($transaction, $payment_method) {
139 139
 		/** @type \EE_Transaction $transaction */
140
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
140
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
141 141
 		$primary_reg = $transaction->primary_registration();
142
-		if( ! $primary_reg instanceof EE_Registration ){
142
+		if ( ! $primary_reg instanceof EE_Registration) {
143 143
 			throw new EE_Error(
144 144
 				sprintf(
145 145
 					__(
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 				)
151 151
 			);
152 152
 		}
153
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true);
153
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true);
154 154
 		$url = add_query_arg(
155 155
 			array(
156 156
 				'e_reg_url_link'=>$primary_reg->reg_url_link(),
@@ -187,92 +187,92 @@  discard block
 block discarded – undo
187 187
 		$update_txn = true,
188 188
 		$separate_IPN_request = true
189 189
 	) {
190
-		EE_Registry::instance()->load_model( 'Change_Log' );
191
-		$_req_data = $this->_remove_unusable_characters_from_array( (array)$_req_data );
192
-		EE_Processor_Base::set_IPN( $separate_IPN_request );
190
+		EE_Registry::instance()->load_model('Change_Log');
191
+		$_req_data = $this->_remove_unusable_characters_from_array((array) $_req_data);
192
+		EE_Processor_Base::set_IPN($separate_IPN_request);
193 193
 		$obj_for_log = null;
194
-		if( $transaction instanceof EE_Transaction ){
194
+		if ($transaction instanceof EE_Transaction) {
195 195
 			$obj_for_log = $transaction;
196
-			if( $payment_method instanceof EE_Payment_Method ) {
196
+			if ($payment_method instanceof EE_Payment_Method) {
197 197
 				$obj_for_log = EEM_Payment::instance()->get_one(
198 198
 					array(
199
-						array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ),
200
-						'order_by' => array( 'PAY_timestamp' => 'desc' )
199
+						array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()),
200
+						'order_by' => array('PAY_timestamp' => 'desc')
201 201
 					)
202 202
 				);
203 203
 			}
204
-		} else if( $payment_method instanceof EE_Payment ) {
204
+		} else if ($payment_method instanceof EE_Payment) {
205 205
 			$obj_for_log = $payment_method;
206 206
 		}
207 207
 		$log = EEM_Change_Log::instance()->log(
208 208
 			EEM_Change_Log::type_gateway,
209
-			array( 'IPN data received' => $_req_data ),
209
+			array('IPN data received' => $_req_data),
210 210
 			$obj_for_log
211 211
 		);
212
-		try{
212
+		try {
213 213
 			/**
214 214
 			 * @var EE_Payment $payment
215 215
 			 */
216 216
 			$payment = NULL;
217
-			if($transaction && $payment_method){
217
+			if ($transaction && $payment_method) {
218 218
 				/** @type EE_Transaction $transaction */
219 219
 				$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
220 220
 				/** @type EE_Payment_Method $payment_method */
221 221
 				$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method);
222
-				if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
223
-						$payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction );
222
+				if ($payment_method->type_obj() instanceof EE_PMT_Base) {
223
+						$payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
224 224
 						$log->set_object($payment);
225 225
 				} else {
226 226
 					// not a payment
227 227
 					EE_Error::add_error(
228 228
 						sprintf(
229
-							__( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ),
229
+							__('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'),
230 230
 							'<br/>',
231
-							EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
231
+							EE_Registry::instance()->CFG->organization->get_pretty('email')
232 232
 						),
233 233
 						__FILE__, __FUNCTION__, __LINE__
234 234
 					);
235 235
 				}
236
-			}else{
236
+			} else {
237 237
 				//that's actually pretty ok. The IPN just wasn't able
238 238
 				//to identify which transaction or payment method this was for
239 239
 				// give all active payment methods a chance to claim it
240 240
 				$active_payment_methods = EEM_Payment_Method::instance()->get_all_active();
241
-				foreach( $active_payment_methods as $active_payment_method ){
242
-					try{
243
-						$payment = $active_payment_method->type_obj()->handle_unclaimed_ipn( $_req_data );
241
+				foreach ($active_payment_methods as $active_payment_method) {
242
+					try {
243
+						$payment = $active_payment_method->type_obj()->handle_unclaimed_ipn($_req_data);
244 244
 						$payment_method = $active_payment_method;
245 245
 						EEM_Change_Log::instance()->log(
246 246
 							EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment
247 247
 						);
248 248
 						break;
249
-					} catch( EE_Error $e ) {
249
+					} catch (EE_Error $e) {
250 250
 						//that's fine- it apparently couldn't handle the IPN
251 251
 					}
252 252
 				}
253 253
 
254 254
 			}
255 255
 // 			EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method);
256
-			if( $payment instanceof EE_Payment){
256
+			if ($payment instanceof EE_Payment) {
257 257
 				$payment->save();
258 258
 				//  update the TXN
259
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
260
-			}else{
259
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request);
260
+			} else {
261 261
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
262
-				if($payment_method){
262
+				if ($payment_method) {
263 263
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
264
-				}elseif($transaction){
264
+				}elseif ($transaction) {
265 265
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
266 266
 				}
267 267
 			}
268 268
 			return $payment;
269 269
 
270
-		} catch( EE_Error $e ) {
270
+		} catch (EE_Error $e) {
271 271
 			do_action(
272 272
 				'AHEE__log', __FILE__, __FUNCTION__, sprintf(
273
-					__( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ),
274
-					print_r( $transaction, TRUE ),
275
-					print_r( $_req_data, TRUE ),
273
+					__('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'),
274
+					print_r($transaction, TRUE),
275
+					print_r($_req_data, TRUE),
276 276
 					$e->getMessage()
277 277
 				)
278 278
 			);
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 	 * @param  array $request_data
288 288
 	 * @return array
289 289
 	 */
290
-	protected function _remove_unusable_characters_from_array( array $request_data ) {
290
+	protected function _remove_unusable_characters_from_array(array $request_data) {
291 291
 		$return_data = array();
292
-		foreach( $request_data as $key => $value ) {
293
-			$return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value );
292
+		foreach ($request_data as $key => $value) {
293
+			$return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value);
294 294
 		}
295 295
 		return $return_data;
296 296
 	}
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 	 * @param string $request_data
303 303
 	 * @return string
304 304
 	 */
305
-	protected function _remove_unusable_characters( $request_data ) {
306
-		return preg_replace( '/[^[:print:]]/', '', $request_data );
305
+	protected function _remove_unusable_characters($request_data) {
306
+		return preg_replace('/[^[:print:]]/', '', $request_data);
307 307
 	}
308 308
 
309 309
 
@@ -325,13 +325,13 @@  discard block
 block discarded – undo
325 325
 	 * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO,
326 326
 	 *                                      to call handle_ipn() for offsite gateways that don't receive separate IPNs
327 327
 	 */
328
-	public function finalize_payment_for( $transaction, $update_txn = TRUE ){
328
+	public function finalize_payment_for($transaction, $update_txn = TRUE) {
329 329
 		/** @var $transaction EE_Transaction */
330
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
330
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
331 331
 		$last_payment_method = $transaction->payment_method();
332
-		if ( $last_payment_method instanceof EE_Payment_Method ) {
333
-			$payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction );
334
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
332
+		if ($last_payment_method instanceof EE_Payment_Method) {
333
+			$payment = $last_payment_method->type_obj()->finalize_payment_for($transaction);
334
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
335 335
 			return $payment;
336 336
 		} else {
337 337
 			return NULL;
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 		EE_Payment $payment_to_refund,
355 355
 		$refund_info = array()
356 356
 	) {
357
-		if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) {
358
-			$payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info );
359
-			$this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund );
357
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) {
358
+			$payment_method->type_obj()->process_refund($payment_to_refund, $refund_info);
359
+			$this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund);
360 360
 		}
361 361
 		return $payment_to_refund;
362 362
 	}
@@ -397,12 +397,12 @@  discard block
 block discarded – undo
397 397
 	 *                        TXN is locked before updating
398 398
 	 * @throws \EE_Error
399 399
 	 */
400
-	public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){
400
+	public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) {
401 401
 		$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful';
402 402
 		/** @type EE_Transaction $transaction */
403
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
403
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
404 404
 		// can we freely update the TXN at this moment?
405
-		if ( $IPN && $transaction->is_locked() ) {
405
+		if ($IPN && $transaction->is_locked()) {
406 406
 			// don't update the transaction at this exact moment
407 407
 			// because the TXN is active in another request
408 408
 			EE_Cron_Tasks::schedule_update_transaction_with_payment(
@@ -412,38 +412,38 @@  discard block
 block discarded – undo
412 412
 			);
413 413
 		} else {
414 414
 			// verify payment and that it has been saved
415
-			if ( $payment instanceof EE_Payment && $payment->ID() ) {
416
-				if(
415
+			if ($payment instanceof EE_Payment && $payment->ID()) {
416
+				if (
417 417
 					$payment->payment_method() instanceof EE_Payment_Method
418 418
 					&& $payment->payment_method()->type_obj() instanceof EE_PMT_Base
419
-				){
420
-					$payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment );
419
+				) {
420
+					$payment->payment_method()->type_obj()->update_txn_based_on_payment($payment);
421 421
 					// update TXN registrations with payment info
422
-					$this->process_registration_payments( $transaction, $payment );
422
+					$this->process_registration_payments($transaction, $payment);
423 423
 				}
424 424
 				$do_action = $payment->just_approved()
425 425
 					? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful'
426 426
 					: $do_action;
427 427
 			} else {
428 428
 				// send out notifications
429
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
429
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
430 430
 				$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made';
431 431
 			}
432
-			if ( $payment->status() !== EEM_Payment::status_id_failed ) {
432
+			if ($payment->status() !== EEM_Payment::status_id_failed) {
433 433
 				/** @type EE_Transaction_Payments $transaction_payments */
434
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
434
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
435 435
 				// set new value for total paid
436
-				$transaction_payments->calculate_total_payments_and_update_status( $transaction );
436
+				$transaction_payments->calculate_total_payments_and_update_status($transaction);
437 437
 				// call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ???
438
-				if ( $update_txn ) {
439
-					$this->_post_payment_processing( $transaction, $payment, $IPN );
438
+				if ($update_txn) {
439
+					$this->_post_payment_processing($transaction, $payment, $IPN);
440 440
 				}
441 441
 			}
442 442
 			// granular hook for others to use.
443
-			do_action( $do_action, $transaction, $payment );
444
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' );
443
+			do_action($do_action, $transaction, $payment);
444
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action');
445 445
 			//global hook for others to use.
446
-			do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment );
446
+			do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment);
447 447
 		}
448 448
 	}
449 449
 
@@ -463,25 +463,25 @@  discard block
 block discarded – undo
463 463
 		$registrations = array()
464 464
 	) {
465 465
 		// only process if payment was successful
466
-		if ( $payment->status() !== EEM_Payment::status_id_approved ) {
466
+		if ($payment->status() !== EEM_Payment::status_id_approved) {
467 467
 			return;
468 468
 		}
469 469
 		//EEM_Registration::instance()->show_next_x_db_queries();
470
-		if ( empty( $registrations )) {
470
+		if (empty($registrations)) {
471 471
 			// find registrations with monies owing that can receive a payment
472 472
 			$registrations = $transaction->registrations(
473 473
 				array(
474 474
 					array(
475 475
 						// only these reg statuses can receive payments
476
-						'STS_ID'           => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ),
477
-						'REG_final_price'  => array( '!=', 0 ),
478
-						'REG_final_price*' => array( '!=', 'REG_paid', true ),
476
+						'STS_ID'           => array('IN', EEM_Registration::reg_statuses_that_allow_payment()),
477
+						'REG_final_price'  => array('!=', 0),
478
+						'REG_final_price*' => array('!=', 'REG_paid', true),
479 479
 					)
480 480
 				)
481 481
 			);
482 482
 		}
483 483
 		// still nothing ??!??
484
-		if ( empty( $registrations )) {
484
+		if (empty($registrations)) {
485 485
 			return;
486 486
 		}
487 487
 		// todo: break out the following logic into a separate strategy class
@@ -493,28 +493,28 @@  discard block
 block discarded – undo
493 493
 
494 494
 		$refund = $payment->is_a_refund();
495 495
 		// how much is available to apply to registrations?
496
-		$available_payment_amount = abs( $payment->amount() );
497
-		foreach ( $registrations as $registration ) {
498
-			if ( $registration instanceof EE_Registration ) {
496
+		$available_payment_amount = abs($payment->amount());
497
+		foreach ($registrations as $registration) {
498
+			if ($registration instanceof EE_Registration) {
499 499
 				// nothing left?
500
-				if ( $available_payment_amount <= 0 ) {
500
+				if ($available_payment_amount <= 0) {
501 501
 					break;
502 502
 				}
503
-				if ( $refund ) {
504
-					$available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount );
503
+				if ($refund) {
504
+					$available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount);
505 505
 				} else {
506
-					$available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount );
506
+					$available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount);
507 507
 				}
508 508
 			}
509 509
 		}
510
-		if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) {
510
+		if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) {
511 511
 			EE_Error::add_attention(
512 512
 				sprintf(
513
-					__( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ),
514
-					EEH_Template::format_currency( $available_payment_amount ),
515
-					implode( ', ',  array_keys( $registrations ) ),
513
+					__('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'),
514
+					EEH_Template::format_currency($available_payment_amount),
515
+					implode(', ', array_keys($registrations)),
516 516
 					'<br/>',
517
-					EEH_Template::format_currency( $payment->amount() )
517
+					EEH_Template::format_currency($payment->amount())
518 518
 				),
519 519
 				__FILE__, __FUNCTION__, __LINE__
520 520
 			);
@@ -532,17 +532,17 @@  discard block
 block discarded – undo
532 532
 	 * @return float
533 533
 	 * @throws \EE_Error
534 534
 	 */
535
-	public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) {
535
+	public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) {
536 536
 		$owing = $registration->final_price() - $registration->paid();
537
-		if ( $owing > 0 ) {
537
+		if ($owing > 0) {
538 538
 			// don't allow payment amount to exceed the available payment amount, OR the amount owing
539
-			$payment_amount = min( $available_payment_amount, $owing );
539
+			$payment_amount = min($available_payment_amount, $owing);
540 540
 			// update $available_payment_amount
541 541
 			$available_payment_amount -= $payment_amount;
542 542
 			//calculate and set new REG_paid
543
-			$registration->set_paid( $registration->paid() + $payment_amount );
543
+			$registration->set_paid($registration->paid() + $payment_amount);
544 544
 			// now save it
545
-			$this->_apply_registration_payment( $registration, $payment, $payment_amount );
545
+			$this->_apply_registration_payment($registration, $payment, $payment_amount);
546 546
 		}
547 547
 		return $available_payment_amount;
548 548
 	}
@@ -558,19 +558,19 @@  discard block
 block discarded – undo
558 558
 	 * @return void
559 559
 	 * @throws \EE_Error
560 560
 	 */
561
-	protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) {
561
+	protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) {
562 562
 		// find any existing reg payment records for this registration and payment
563 563
 		$existing_reg_payment = EEM_Registration_Payment::instance()->get_one(
564
-			array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) )
564
+			array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID()))
565 565
 		);
566 566
 		// if existing registration payment exists
567
-		if ( $existing_reg_payment instanceof EE_Registration_Payment ) {
567
+		if ($existing_reg_payment instanceof EE_Registration_Payment) {
568 568
 			// then update that record
569
-			$existing_reg_payment->set_amount( $payment_amount );
569
+			$existing_reg_payment->set_amount($payment_amount);
570 570
 			$existing_reg_payment->save();
571 571
 		} else {
572 572
 			// or add new relation between registration and payment and set amount
573
-			$registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) );
573
+			$registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount));
574 574
 			// make it stick
575 575
 			$registration->save();
576 576
 		}
@@ -587,21 +587,21 @@  discard block
 block discarded – undo
587 587
 	 * @return float
588 588
 	 * @throws \EE_Error
589 589
 	 */
590
-	public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) {
590
+	public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) {
591 591
 		//EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ );
592
-		if ( $registration->paid() > 0 ) {
592
+		if ($registration->paid() > 0) {
593 593
 			// ensure $available_refund_amount is NOT negative
594
-			$available_refund_amount = (float)abs( $available_refund_amount );
594
+			$available_refund_amount = (float) abs($available_refund_amount);
595 595
 			// don't allow refund amount to exceed the available payment amount, OR the amount paid
596
-			$refund_amount = min( $available_refund_amount, (float)$registration->paid() );
596
+			$refund_amount = min($available_refund_amount, (float) $registration->paid());
597 597
 			// update $available_payment_amount
598 598
 			$available_refund_amount -= $refund_amount;
599 599
 			//calculate and set new REG_paid
600
-			$registration->set_paid( $registration->paid() - $refund_amount );
600
+			$registration->set_paid($registration->paid() - $refund_amount);
601 601
 			// convert payment amount back to a negative value for storage in the db
602
-			$refund_amount = (float)abs( $refund_amount ) * -1;
602
+			$refund_amount = (float) abs($refund_amount) * -1;
603 603
 			// now save it
604
-			$this->_apply_registration_payment( $registration, $payment, $refund_amount );
604
+			$this->_apply_registration_payment($registration, $payment, $refund_amount);
605 605
 		}
606 606
 		return $available_refund_amount;
607 607
 	}
@@ -620,53 +620,53 @@  discard block
 block discarded – undo
620 620
 	 * @param bool           $IPN
621 621
 	 * @throws \EE_Error
622 622
 	 */
623
-	protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) {
623
+	protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) {
624 624
 
625 625
 		/** @type EE_Transaction_Processor $transaction_processor */
626
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
626
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
627 627
 		// is the Payment Options Reg Step completed ?
628
-		$payment_options_step_completed = $transaction->reg_step_completed( 'payment_options' );
628
+		$payment_options_step_completed = $transaction->reg_step_completed('payment_options');
629 629
 		// if the Payment Options Reg Step is completed...
630 630
 		$revisit = $payment_options_step_completed === true ? true : false;
631 631
 		// then this is kinda sorta a revisit with regards to payments at least
632
-		$transaction_processor->set_revisit( $revisit );
632
+		$transaction_processor->set_revisit($revisit);
633 633
 		// if this is an IPN, let's consider the Payment Options Reg Step completed if not already
634 634
 		if (
635 635
 			$IPN &&
636 636
 			$payment_options_step_completed !== true &&
637
-			( $payment->is_approved() || $payment->is_pending() )
637
+			($payment->is_approved() || $payment->is_pending())
638 638
 		) {
639 639
 			$payment_options_step_completed = $transaction->set_reg_step_completed(
640 640
 				'payment_options'
641 641
 			);
642 642
 		}
643 643
 		// maybe update status, but don't save transaction just yet
644
-		$transaction->update_status_based_on_total_paid( false );
644
+		$transaction->update_status_based_on_total_paid(false);
645 645
 		// check if 'finalize_registration' step has been completed...
646
-		$finalized = $transaction->reg_step_completed( 'finalize_registration' );
646
+		$finalized = $transaction->reg_step_completed('finalize_registration');
647 647
 		//  if this is an IPN and the final step has not been initiated
648
-		if ( $IPN && $payment_options_step_completed && $finalized === false ) {
648
+		if ($IPN && $payment_options_step_completed && $finalized === false) {
649 649
 			// and if it hasn't already been set as being started...
650
-			$finalized = $transaction->set_reg_step_initiated( 'finalize_registration' );
650
+			$finalized = $transaction->set_reg_step_initiated('finalize_registration');
651 651
 		}
652 652
 		$transaction->save();
653 653
 		// because the above will return false if the final step was not fully completed, we need to check again...
654
-		if ( $IPN && $finalized !== false ) {
654
+		if ($IPN && $finalized !== false) {
655 655
 			// and if we are all good to go, then send out notifications
656
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
656
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
657 657
 			//ok, now process the transaction according to the payment
658
-			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment );
658
+			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment);
659 659
 		}
660 660
 		// DEBUG LOG
661 661
 		$payment_method = $payment->payment_method();
662
-		if ( $payment_method instanceof EE_Payment_Method ) {
662
+		if ($payment_method instanceof EE_Payment_Method) {
663 663
 			$payment_method_type_obj = $payment_method->type_obj();
664
-			if ( $payment_method_type_obj instanceof EE_PMT_Base ) {
664
+			if ($payment_method_type_obj instanceof EE_PMT_Base) {
665 665
 				$gateway = $payment_method_type_obj->get_gateway();
666
-				if ( $gateway instanceof EE_Gateway ){
666
+				if ($gateway instanceof EE_Gateway) {
667 667
 					$gateway->log(
668 668
 						array(
669
-							'message'               => __( 'Post Payment Transaction Details', 'event_espresso' ),
669
+							'message'               => __('Post Payment Transaction Details', 'event_espresso'),
670 670
 							'transaction'           => $transaction->model_field_array(),
671 671
 							'finalized'             => $finalized,
672 672
 							'IPN'                   => $IPN,
Please login to merge, or discard this patch.
core/business/EE_Transaction_Processor.class.php 1 patch
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 
4 4
 /**
5 5
  * Class EE_Transaction_Processor
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 	 * @param array $registration_query_params
51 51
 	 *@return EE_Transaction_Processor instance
52 52
 	 */
53
-	public static function instance( $registration_query_params = array() ) {
53
+	public static function instance($registration_query_params = array()) {
54 54
 		// check if class object is instantiated
55
-		if ( ! self::$_instance instanceof EE_Transaction_Processor ) {
56
-			self::$_instance = new self( $registration_query_params );
55
+		if ( ! self::$_instance instanceof EE_Transaction_Processor) {
56
+			self::$_instance = new self($registration_query_params);
57 57
 		}
58 58
 		return self::$_instance;
59 59
 	}
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	/**
64 64
 	 * @param array $registration_query_params
65 65
 	 */
66
-	private function __construct( $registration_query_params = array() ) {
66
+	private function __construct($registration_query_params = array()) {
67 67
 		// make sure some query params are set for retrieving registrations
68
-		$this->_set_registration_query_params( $registration_query_params );
68
+		$this->_set_registration_query_params($registration_query_params);
69 69
 	}
70 70
 
71 71
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 	 * @access private
75 75
 	 * @param array $registration_query_params
76 76
 	 */
77
-	private function _set_registration_query_params( $registration_query_params ) {
78
-		$this->_registration_query_params = ! empty( $registration_query_params ) ? $registration_query_params : array( 'order_by' => array( 'REG_count' => 'ASC' ));
77
+	private function _set_registration_query_params($registration_query_params) {
78
+		$this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params : array('order_by' => array('REG_count' => 'ASC'));
79 79
 	}
80 80
 
81 81
 
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 		);
105 105
 		// send messages
106 106
 		/** @type EE_Registration_Processor $registration_processor */
107
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
107
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
108 108
 		$registration_processor->trigger_registration_update_notifications(
109 109
 			$transaction->primary_registration(),
110
-			array( 'manually_updated' 	=> true )
110
+			array('manually_updated' 	=> true)
111 111
 		);
112 112
 		do_action(
113 113
 			'AHEE__EE_Transaction_Processor__manually_update_registration_statuses',
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
 		$registration_query_params = array()
195 195
 	) {
196 196
 		// make sure some query params are set for retrieving registrations
197
-		$this->_set_registration_query_params( $registration_query_params );
197
+		$this->_set_registration_query_params($registration_query_params);
198 198
 		// get final reg step status
199 199
 		$finalized = $transaction->final_reg_step_completed();
200 200
 		// if the 'finalize_registration' step has been initiated (has a timestamp)
201 201
 		// but has not yet been fully completed (TRUE)
202
-		if ( is_int( $finalized ) && $finalized !== false && $finalized !== true ) {
203
-			$transaction->set_reg_step_completed( 'finalize_registration' );
202
+		if (is_int($finalized) && $finalized !== false && $finalized !== true) {
203
+			$transaction->set_reg_step_completed('finalize_registration');
204 204
 			$finalized = true;
205 205
 		}
206 206
 		$transaction->save();
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 
224 224
 		// send messages
225 225
 		/** @type EE_Registration_Processor $registration_processor */
226
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
226
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
227 227
 		$registration_processor->trigger_registration_update_notifications(
228 228
 			$transaction->primary_registration(),
229 229
 			$update_params
@@ -254,22 +254,22 @@  discard block
 block discarded – undo
254 254
 		$update_txn = true
255 255
 	) {
256 256
 		// these reg statuses should not be considered in any calculations involving monies owing
257
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
258
-		if ( in_array( $registration->status_ID(), $closed_reg_statuses ) ) {
257
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
258
+		if (in_array($registration->status_ID(), $closed_reg_statuses)) {
259 259
 			return false;
260 260
 		}
261 261
 		try {
262
-			$transaction = $this->get_transaction_for_registration( $registration );
262
+			$transaction = $this->get_transaction_for_registration($registration);
263 263
 			$ticket_line_item = $this->get_ticket_line_item_for_transaction_registration(
264 264
 				$transaction,
265 265
 				$registration
266 266
 			);
267 267
 			// un-cancel the ticket
268
-			$success = EEH_Line_Item::reinstate_canceled_ticket_line_item( $ticket_line_item );
269
-		} catch ( EE_Error $e ) {
268
+			$success = EEH_Line_Item::reinstate_canceled_ticket_line_item($ticket_line_item);
269
+		} catch (EE_Error $e) {
270 270
 			EE_Error::add_error(
271 271
 				sprintf(
272
-					__( 'The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', 'event_espresso' ),
272
+					__('The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', 'event_espresso'),
273 273
 					$registration->ID(),
274 274
 					'<br />',
275 275
 					$e->getMessage()
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			);
279 279
 			return false;
280 280
 		}
281
-		if ( $update_txn ) {
281
+		if ($update_txn) {
282 282
 			return $transaction->save() ? $success : false;
283 283
 		}
284 284
 		return $success;
@@ -302,18 +302,18 @@  discard block
 block discarded – undo
302 302
 		$update_txn = true
303 303
 	) {
304 304
 		// these reg statuses should not be considered in any calculations involving monies owing
305
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
306
-		if ( ! in_array( $registration->status_ID(), $closed_reg_statuses ) ) {
305
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
306
+		if ( ! in_array($registration->status_ID(), $closed_reg_statuses)) {
307 307
 			return false;
308 308
 		}
309 309
 		try {
310
-			$transaction = $this->get_transaction_for_registration( $registration );
311
-			$ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( $transaction, $registration );
312
-			EEH_Line_Item::cancel_ticket_line_item( $ticket_line_item );
313
-		} catch ( EE_Error $e ) {
310
+			$transaction = $this->get_transaction_for_registration($registration);
311
+			$ticket_line_item = $this->get_ticket_line_item_for_transaction_registration($transaction, $registration);
312
+			EEH_Line_Item::cancel_ticket_line_item($ticket_line_item);
313
+		} catch (EE_Error $e) {
314 314
 			EE_Error::add_error(
315 315
 				sprintf(
316
-					__( 'The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', 'event_espresso' ),
316
+					__('The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', 'event_espresso'),
317 317
 					$registration->ID(),
318 318
 					'<br />',
319 319
 					$e->getMessage()
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 			);
323 323
 			return false;
324 324
 		}
325
-		if ( $update_txn ) {
325
+		if ($update_txn) {
326 326
 			return $transaction->save() ? true : false;
327 327
 		}
328 328
 		return true;
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
 	 * @return 	EE_Transaction
339 339
 	 * @throws 	EE_Error
340 340
 	 */
341
-	public function get_transaction_for_registration( EE_Registration $registration ) {
341
+	public function get_transaction_for_registration(EE_Registration $registration) {
342 342
 		$transaction = $registration->transaction();
343
-		if ( ! $transaction instanceof EE_Transaction ) {
343
+		if ( ! $transaction instanceof EE_Transaction) {
344 344
 			throw new EE_Error(
345 345
 				sprintf(
346
-					__( 'The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso' ),
346
+					__('The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso'),
347 347
 					$registration->ID()
348 348
 				)
349 349
 			);
@@ -366,16 +366,16 @@  discard block
 block discarded – undo
366 366
 		EE_Transaction $transaction,
367 367
 		EE_Registration $registration
368 368
 	) {
369
-		EE_Registry::instance()->load_helper( 'Line_Item' );
369
+		EE_Registry::instance()->load_helper('Line_Item');
370 370
 		$ticket_line_item = EEM_Line_Item::instance()->get_ticket_line_item_for_transaction(
371 371
 			$transaction->ID(),
372 372
 			$registration->ticket_ID()
373 373
 		);
374
-		if ( ! $ticket_line_item instanceof EE_Line_Item ) {
374
+		if ( ! $ticket_line_item instanceof EE_Line_Item) {
375 375
 			throw new EE_Error(
376 376
 				sprintf(
377
-					__( 'The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.',
378
-						'event_espresso' ),
377
+					__('The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.',
378
+						'event_espresso'),
379 379
 					$transaction->ID(),
380 380
 					$registration->ticket_ID()
381 381
 				)
@@ -408,22 +408,22 @@  discard block
 block discarded – undo
408 408
 		$update_txn = true
409 409
 	) {
410 410
 		// make sure some query params are set for retrieving registrations
411
-		$this->_set_registration_query_params( $registration_query_params );
411
+		$this->_set_registration_query_params($registration_query_params);
412 412
 		// these reg statuses should not be considered in any calculations involving monies owing
413
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
413
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
414 414
 		// loop through cached registrations
415
-		foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) {
415
+		foreach ($transaction->registrations($this->_registration_query_params) as $registration) {
416 416
 			if (
417 417
 				$registration instanceof EE_Registration
418
-				&& ! in_array( $registration->status_ID(), $closed_reg_statuses )
418
+				&& ! in_array($registration->status_ID(), $closed_reg_statuses)
419 419
 			) {
420 420
 				return false;
421 421
 			}
422 422
 		}
423
-		if ( in_array( $new_TXN_status, EEM_Transaction::txn_status_array() ) ) {
424
-			$transaction->set_status( $new_TXN_status );
423
+		if (in_array($new_TXN_status, EEM_Transaction::txn_status_array())) {
424
+			$transaction->set_status($new_TXN_status);
425 425
 		}
426
-		if ( $update_txn ) {
426
+		if ($update_txn) {
427 427
 			return $transaction->save() ? true : false;
428 428
 		}
429 429
 		return true;
@@ -452,22 +452,22 @@  discard block
 block discarded – undo
452 452
 	) {
453 453
 		$response = false;
454 454
 		/** @type EE_Registration_Processor $registration_processor */
455
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
455
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
456 456
 		// check that method exists
457
-		if ( ! method_exists( $registration_processor, $method_name )) {
458
-			throw new EE_Error( __( 'Method does not exist.', 'event_espresso' ));
457
+		if ( ! method_exists($registration_processor, $method_name)) {
458
+			throw new EE_Error(__('Method does not exist.', 'event_espresso'));
459 459
 		}
460 460
 		// make sure some query params are set for retrieving registrations
461
-		$this->_set_registration_query_params( $registration_query_params );
461
+		$this->_set_registration_query_params($registration_query_params);
462 462
 		// loop through cached registrations
463
-		foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) {
464
-			if ( $registration instanceof EE_Registration ) {
465
-				if ( $additional_param ) {
466
-					$response = $registration_processor->{$method_name}( $registration, $additional_param )
463
+		foreach ($transaction->registrations($this->_registration_query_params) as $registration) {
464
+			if ($registration instanceof EE_Registration) {
465
+				if ($additional_param) {
466
+					$response = $registration_processor->{$method_name}($registration, $additional_param)
467 467
 						? true
468 468
 						: $response;
469 469
 				} else {
470
-					$response = $registration_processor->{$method_name}( $registration )
470
+					$response = $registration_processor->{$method_name}($registration)
471 471
 						? true
472 472
 						: $response;
473 473
 				}
@@ -494,28 +494,28 @@  discard block
 block discarded – undo
494 494
 	public function set_transaction_payment_method_based_on_registration_statuses(
495 495
 		EE_Registration $edited_registration
496 496
 	) {
497
-		if ( $edited_registration instanceof EE_Registration ) {
497
+		if ($edited_registration instanceof EE_Registration) {
498 498
 			$transaction = $edited_registration->transaction();
499
-			if ( $transaction instanceof EE_Transaction ) {
499
+			if ($transaction instanceof EE_Transaction) {
500 500
 				$all_not_approved = true;
501
-				foreach ( $transaction->registrations() as $registration ) {
502
-					if ( $registration instanceof EE_Registration ) {
501
+				foreach ($transaction->registrations() as $registration) {
502
+					if ($registration instanceof EE_Registration) {
503 503
 						// if any REG != "Not Approved" then toggle to false
504 504
 						$all_not_approved = $registration->is_not_approved() ? $all_not_approved : false;
505 505
 					}
506 506
 				}
507 507
 				// if ALL Registrations are "Not Approved"
508
-				if ( $all_not_approved ) {
509
-					$transaction->set_payment_method_ID( null );
508
+				if ($all_not_approved) {
509
+					$transaction->set_payment_method_ID(null);
510 510
 					$transaction->save();
511 511
 				} else {
512 512
 					$available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
513 513
 						$transaction,
514 514
 						EEM_Payment_Method::scope_cart
515 515
 					);
516
-					if ( ! empty( $available_payment_methods ) ) {
516
+					if ( ! empty($available_payment_methods)) {
517 517
 						$PMD_ID = 0;
518
-						foreach ( $available_payment_methods as $available_payment_method ) {
518
+						foreach ($available_payment_methods as $available_payment_method) {
519 519
 							if (
520 520
 								$available_payment_method instanceof EE_Payment_Method
521 521
 							    && $available_payment_method->open_by_default()
@@ -524,22 +524,22 @@  discard block
 block discarded – undo
524 524
 								break;
525 525
 							}
526 526
 						}
527
-						if ( ! $PMD_ID ) {
528
-							$first_payment_method = reset( $available_payment_methods );
529
-							if ( $first_payment_method instanceof EE_Payment_Method ) {
527
+						if ( ! $PMD_ID) {
528
+							$first_payment_method = reset($available_payment_methods);
529
+							if ($first_payment_method instanceof EE_Payment_Method) {
530 530
 								$PMD_ID = $first_payment_method->ID();
531 531
 							} else {
532 532
 								EE_Error::add_error(
533
-									__( 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso' ),
533
+									__('A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso'),
534 534
 									__FILE__, __LINE__, __FUNCTION__
535 535
 								);
536 536
 							}
537 537
 						}
538
-						$transaction->set_payment_method_ID( $PMD_ID );
538
+						$transaction->set_payment_method_ID($PMD_ID);
539 539
 						$transaction->save();
540 540
 					} else {
541 541
 						EE_Error::add_error(
542
-							__( 'Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso' ),
542
+							__('Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso'),
543 543
 							__FILE__, __LINE__, __FUNCTION__
544 544
 						);
545 545
 					}
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	 * @deprecated 4.9.12
577 577
 	 * @param string $old_txn_status
578 578
 	 */
579
-	public function set_old_txn_status( $old_txn_status ) {
579
+	public function set_old_txn_status($old_txn_status) {
580 580
 		EE_Error::doing_it_wrong(
581 581
 			__METHOD__,
582 582
 			esc_html__(
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 			'4.9.12'
587 587
 		);
588 588
 		// only set the first time
589
-		if ( $this->_old_txn_status === null ) {
589
+		if ($this->_old_txn_status === null) {
590 590
 			$this->_old_txn_status = $old_txn_status;
591 591
 		}
592 592
 	}
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 * @deprecated 4.9.12
616 616
 	 * @param string $new_txn_status
617 617
 	 */
618
-	public function set_new_txn_status( $new_txn_status ) {
618
+	public function set_new_txn_status($new_txn_status) {
619 619
 		EE_Error::doing_it_wrong(
620 620
 			__METHOD__,
621 621
 			esc_html__(
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 	 * @param EE_Transaction $transaction
660 660
 	 * @return boolean
661 661
 	 */
662
-	public function all_reg_steps_completed( EE_Transaction $transaction ) {
662
+	public function all_reg_steps_completed(EE_Transaction $transaction) {
663 663
 		EE_Error::doing_it_wrong(
664 664
 			__METHOD__,
665 665
 			esc_html__(
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 	 * @param string         $exception
687 687
 	 * @return boolean
688 688
 	 */
689
-	public function all_reg_steps_completed_except( EE_Transaction $transaction, $exception = '' ) {
689
+	public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') {
690 690
 		EE_Error::doing_it_wrong(
691 691
 			__METHOD__,
692 692
 			esc_html__(
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 			'4.9.12',
697 697
 			'5.0.0'
698 698
 		);
699
-		return $transaction->all_reg_steps_completed_except( $exception );
699
+		return $transaction->all_reg_steps_completed_except($exception);
700 700
 	}
701 701
 
702 702
 
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 	 * @param EE_Transaction $transaction
713 713
 	 * @return boolean
714 714
 	 */
715
-	public function all_reg_steps_completed_except_final_step( EE_Transaction $transaction ) {
715
+	public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) {
716 716
 		EE_Error::doing_it_wrong(
717 717
 			__METHOD__,
718 718
 			esc_html__(
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 	 * @param string         $reg_step_slug
740 740
 	 * @return boolean | int
741 741
 	 */
742
-	public function reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) {
742
+	public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) {
743 743
 		EE_Error::doing_it_wrong(
744 744
 			__METHOD__,
745 745
 			esc_html__(
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 			'4.9.12',
750 750
 			'5.0.0'
751 751
 		);
752
-		return $transaction->reg_step_completed( $reg_step_slug );
752
+		return $transaction->reg_step_completed($reg_step_slug);
753 753
 	}
754 754
 
755 755
 
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 	 * @param EE_Transaction $transaction
766 766
 	 * @return boolean | int
767 767
 	 */
768
-	public function final_reg_step_completed( EE_Transaction $transaction ) {
768
+	public function final_reg_step_completed(EE_Transaction $transaction) {
769 769
 		EE_Error::doing_it_wrong(
770 770
 			__METHOD__,
771 771
 			esc_html__(
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	 * @return boolean
792 792
 	 * @throws \EE_Error
793 793
 	 */
794
-	public function set_reg_step_initiated( EE_Transaction $transaction, $reg_step_slug ) {
794
+	public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) {
795 795
 		EE_Error::doing_it_wrong(
796 796
 			__METHOD__,
797 797
 			esc_html__(
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 			'4.9.12',
802 802
 			'5.0.0'
803 803
 		);
804
-		return $transaction->set_reg_step_initiated( $reg_step_slug );
804
+		return $transaction->set_reg_step_initiated($reg_step_slug);
805 805
 	}
806 806
 
807 807
 
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 	 * @return boolean
818 818
 	 * @throws \EE_Error
819 819
 	 */
820
-	public function set_reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) {
820
+	public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) {
821 821
 		EE_Error::doing_it_wrong(
822 822
 			__METHOD__,
823 823
 			esc_html__(
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 			'4.9.12',
828 828
 			'5.0.0'
829 829
 		);
830
-		return $transaction->set_reg_step_completed( $reg_step_slug );
830
+		return $transaction->set_reg_step_completed($reg_step_slug);
831 831
 	}
832 832
 
833 833
 
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 	 * @return boolean
844 844
 	 * @throws \EE_Error
845 845
 	 */
846
-	public function set_reg_step_not_completed( EE_Transaction $transaction, $reg_step_slug ) {
846
+	public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) {
847 847
 		EE_Error::doing_it_wrong(
848 848
 			__METHOD__,
849 849
 			esc_html__(
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 			'4.9.12',
854 854
 			'5.0.0'
855 855
 		);
856
-		return $transaction->set_reg_step_not_completed( $reg_step_slug );
856
+		return $transaction->set_reg_step_not_completed($reg_step_slug);
857 857
 	}
858 858
 
859 859
 
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 	 * @param string          $reg_step_slug
871 871
 	 * @return void
872 872
 	 */
873
-	public function remove_reg_step( EE_Transaction $transaction, $reg_step_slug ) {
873
+	public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) {
874 874
 		EE_Error::doing_it_wrong(
875 875
 			__METHOD__,
876 876
 			esc_html__(
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 			'4.9.12',
881 881
 			'5.0.0'
882 882
 		);
883
-		$transaction->remove_reg_step( $reg_step_slug );
883
+		$transaction->remove_reg_step($reg_step_slug);
884 884
 	}
885 885
 
886 886
 
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 	 * @return    boolean
897 897
 	 * @throws \EE_Error
898 898
 	 */
899
-	public function toggle_failed_transaction_status( EE_Transaction $transaction ) {
899
+	public function toggle_failed_transaction_status(EE_Transaction $transaction) {
900 900
 		EE_Error::doing_it_wrong(
901 901
 			__METHOD__,
902 902
 			esc_html__(
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 	 * @param  EE_Transaction $transaction
921 921
 	 * @return boolean
922 922
 	 */
923
-	public function toggle_abandoned_transaction_status( EE_Transaction $transaction ) {
923
+	public function toggle_abandoned_transaction_status(EE_Transaction $transaction) {
924 924
 		EE_Error::doing_it_wrong(
925 925
 			__METHOD__,
926 926
 			esc_html__(
Please login to merge, or discard this patch.
core/db_classes/EE_Registration.class.php 1 patch
Spacing   +192 added lines, -192 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\exceptions\EntityNotFoundException;
2 2
 
3
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 /**
7 7
  * EE_Registration class
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	 *                             		    date_format and the second value is the time format
44 44
 	 * @return EE_Registration
45 45
 	 */
46
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
47
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
48
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
46
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
47
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
48
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
49 49
 	}
50 50
 
51 51
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 *                          		the website will be used.
57 57
 	 * @return EE_Registration
58 58
 	 */
59
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
60
-		return new self( $props_n_values, TRUE, $timezone );
59
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
60
+		return new self($props_n_values, TRUE, $timezone);
61 61
 	}
62 62
 
63 63
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @access        public
69 69
 	 * @param        int $EVT_ID Event ID
70 70
 	 */
71
-	public function set_event( $EVT_ID = 0 ) {
72
-		$this->set( 'EVT_ID', $EVT_ID );
71
+	public function set_event($EVT_ID = 0) {
72
+		$this->set('EVT_ID', $EVT_ID);
73 73
 	}
74 74
 
75 75
 
@@ -80,18 +80,18 @@  discard block
 block discarded – undo
80 80
 	 * @param mixed  $field_value
81 81
 	 * @param bool   $use_default
82 82
 	 */
83
-	public function set( $field_name, $field_value, $use_default = FALSE ) {
84
-		switch( $field_name ) {
83
+	public function set($field_name, $field_value, $use_default = FALSE) {
84
+		switch ($field_name) {
85 85
 			case 'REG_code' :
86
-				if ( ! empty( $field_value ) && $this->reg_code() == '' ) {
87
-					$this->set_reg_code( $field_value, $use_default );
86
+				if ( ! empty($field_value) && $this->reg_code() == '') {
87
+					$this->set_reg_code($field_value, $use_default);
88 88
 				}
89 89
 				break;
90 90
 			case 'STS_ID' :
91
-				$this->set_status( $field_value, $use_default );
91
+				$this->set_status($field_value, $use_default);
92 92
 				break;
93 93
 			default :
94
-				parent::set( $field_name, $field_value, $use_default );
94
+				parent::set($field_name, $field_value, $use_default);
95 95
 		}
96 96
 	}
97 97
 
@@ -109,42 +109,42 @@  discard block
 block discarded – undo
109 109
 	 * @return bool
110 110
 	 * @throws \EE_Error
111 111
 	 */
112
-	public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) {
112
+	public function set_status($new_STS_ID = NULL, $use_default = FALSE) {
113 113
 		// get current REG_Status
114 114
 		$old_STS_ID = $this->status_ID();
115 115
 		// if status has changed
116 116
 		if (
117 117
 			$this->ID() // ensure registration is in the db
118 118
 			&& $old_STS_ID != $new_STS_ID // and that status has actually changed
119
-			&& ! empty( $old_STS_ID ) // and that old status is actually set
120
-			&& ! empty( $new_STS_ID ) // as well as the new status
119
+			&& ! empty($old_STS_ID) // and that old status is actually set
120
+			&& ! empty($new_STS_ID) // as well as the new status
121 121
 		) {
122 122
 			// TO approved
123
-			if ( $new_STS_ID === EEM_Registration::status_id_approved ) {
123
+			if ($new_STS_ID === EEM_Registration::status_id_approved) {
124 124
 				// reserve a space by incrementing ticket and datetime sold values
125 125
 				$this->_reserve_registration_space();
126
-				do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID );
126
+				do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID);
127 127
 			// OR FROM  approved
128
-			} else if ( $old_STS_ID === EEM_Registration::status_id_approved ) {
128
+			} else if ($old_STS_ID === EEM_Registration::status_id_approved) {
129 129
 				// release a space by decrementing ticket and datetime sold values
130 130
 				$this->_release_registration_space();
131
-				do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID );
131
+				do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID);
132 132
 			}
133 133
 			// update status
134
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
134
+			parent::set('STS_ID', $new_STS_ID, $use_default);
135 135
 			/** @type EE_Registration_Processor $registration_processor */
136
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
136
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
137 137
 			/** @type EE_Transaction_Processor $transaction_processor */
138
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
138
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
139 139
 			/** @type EE_Transaction_Payments $transaction_payments */
140
-			$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
140
+			$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
141 141
 			// these reg statuses should not be considered in any calculations involving monies owing
142
-			$closed_reg_statuses = ! empty( $closed_reg_statuses )
142
+			$closed_reg_statuses = ! empty($closed_reg_statuses)
143 143
 				? $closed_reg_statuses
144 144
 				: EEM_Registration::closed_reg_statuses();
145 145
 			if (
146
-				in_array( $new_STS_ID, $closed_reg_statuses )
147
-				&& ! in_array( $old_STS_ID, $closed_reg_statuses )
146
+				in_array($new_STS_ID, $closed_reg_statuses)
147
+				&& ! in_array($old_STS_ID, $closed_reg_statuses)
148 148
 			) {
149 149
 				// cancelled or declined registration
150 150
 				$registration_processor->update_registration_after_being_canceled_or_declined(
@@ -157,24 +157,24 @@  discard block
 block discarded – undo
157 157
 					false
158 158
 				);
159 159
 			} else if (
160
-				in_array( $old_STS_ID, $closed_reg_statuses )
161
-				&& ! in_array( $new_STS_ID, $closed_reg_statuses )
160
+				in_array($old_STS_ID, $closed_reg_statuses)
161
+				&& ! in_array($new_STS_ID, $closed_reg_statuses)
162 162
 			) {
163 163
 				// reinstating cancelled or declined registration
164 164
 				$registration_processor->update_canceled_or_declined_registration_after_being_reinstated(
165 165
 					$this,
166 166
 					$closed_reg_statuses
167 167
 				);
168
-				$transaction_processor->update_transaction_after_reinstating_canceled_registration( $this );
168
+				$transaction_processor->update_transaction_after_reinstating_canceled_registration($this);
169 169
 			}
170
-			$transaction_payments->recalculate_transaction_total( $this->transaction(), false );
171
-			$this->transaction()->update_status_based_on_total_paid( true );
172
-			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
170
+			$transaction_payments->recalculate_transaction_total($this->transaction(), false);
171
+			$this->transaction()->update_status_based_on_total_paid(true);
172
+			do_action('AHEE__EE_Registration__set_status__after_update', $this);
173 173
 			return TRUE;
174 174
 		} else {
175 175
 			//even though the old value matches the new value, it's still good to
176 176
 			//allow the parent set method to have a say
177
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
177
+			parent::set('STS_ID', $new_STS_ID, $use_default);
178 178
 			return TRUE;
179 179
 		}
180 180
 	}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @access        public
187 187
 	 */
188 188
 	public function status_ID() {
189
-		return $this->get( 'STS_ID' );
189
+		return $this->get('STS_ID');
190 190
 	}
191 191
 
192 192
 
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
 	 * @param boolean $include_archived whether to include archived tickets or not.
212 212
 	 * @return EE_Ticket
213 213
 	 */
214
-	public function ticket( $include_archived = TRUE ) {
214
+	public function ticket($include_archived = TRUE) {
215 215
 		$query_params = array();
216
-		if ( $include_archived ) {
217
-			$query_params[ 'default_where_conditions' ] = 'none';
216
+		if ($include_archived) {
217
+			$query_params['default_where_conditions'] = 'none';
218 218
 		}
219
-		return $this->get_first_related( 'Ticket', $query_params );
219
+		return $this->get_first_related('Ticket', $query_params);
220 220
 	}
221 221
 
222 222
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	public function wp_user() {
246 246
 		$event = $this->event();
247
-		if ( $event instanceof EE_Event ) {
247
+		if ($event instanceof EE_Event) {
248 248
 			return $event->wp_user();
249 249
 		}
250 250
 		return 0;
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 * @access        public
271 271
 	 * @param        int $ATT_ID Attendee ID
272 272
 	 */
273
-	public function set_attendee_id( $ATT_ID = 0 ) {
274
-		$this->set( 'ATT_ID', $ATT_ID );
273
+	public function set_attendee_id($ATT_ID = 0) {
274
+		$this->set('ATT_ID', $ATT_ID);
275 275
 	}
276 276
 
277 277
 
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 	 * @access        public
283 283
 	 * @param        int $TXN_ID Transaction ID
284 284
 	 */
285
-	public function set_transaction_id( $TXN_ID = 0 ) {
286
-		$this->set( 'TXN_ID', $TXN_ID );
285
+	public function set_transaction_id($TXN_ID = 0) {
286
+		$this->set('TXN_ID', $TXN_ID);
287 287
 	}
288 288
 
289 289
 
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
 	 * @access    public
295 295
 	 * @param    string $REG_session PHP Session ID
296 296
 	 */
297
-	public function set_session( $REG_session = '' ) {
298
-		$this->set( 'REG_session', $REG_session );
297
+	public function set_session($REG_session = '') {
298
+		$this->set('REG_session', $REG_session);
299 299
 	}
300 300
 
301 301
 
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
 	 * @access    public
307 307
 	 * @param    string $REG_url_link Registration URL Link
308 308
 	 */
309
-	public function set_reg_url_link( $REG_url_link = '' ) {
310
-		$this->set( 'REG_url_link', $REG_url_link );
309
+	public function set_reg_url_link($REG_url_link = '') {
310
+		$this->set('REG_url_link', $REG_url_link);
311 311
 	}
312 312
 
313 313
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 	 * @access        public
319 319
 	 * @param        int $REG_count Primary Attendee
320 320
 	 */
321
-	public function set_count( $REG_count = 1 ) {
322
-		$this->set( 'REG_count', $REG_count );
321
+	public function set_count($REG_count = 1) {
322
+		$this->set('REG_count', $REG_count);
323 323
 	}
324 324
 
325 325
 
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 	 * @access        public
331 331
 	 * @param        boolean $REG_group_size Group Registration
332 332
 	 */
333
-	public function set_group_size( $REG_group_size = FALSE ) {
334
-		$this->set( 'REG_group_size', $REG_group_size );
333
+	public function set_group_size($REG_group_size = FALSE) {
334
+		$this->set('REG_group_size', $REG_group_size);
335 335
 	}
336 336
 
337 337
 
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 	 * @access        public
415 415
 	 * @param        mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date
416 416
 	 */
417
-	public function set_reg_date( $REG_date = FALSE ) {
418
-		$this->set( 'REG_date', $REG_date );
417
+	public function set_reg_date($REG_date = FALSE) {
418
+		$this->set('REG_date', $REG_date);
419 419
 	}
420 420
 
421 421
 
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 	 * @access    public
427 427
 	 * @param    float $REG_final_price
428 428
 	 */
429
-	public function set_final_price( $REG_final_price = 0.00 ) {
430
-		$this->set( 'REG_final_price', $REG_final_price );
429
+	public function set_final_price($REG_final_price = 0.00) {
430
+		$this->set('REG_final_price', $REG_final_price);
431 431
 	}
432 432
 
433 433
 
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 	 * @access    public
439 439
 	 * @param    float $REG_paid
440 440
 	 */
441
-	public function set_paid( $REG_paid = 0.00 ) {
442
-		$this->set( 'REG_paid', $REG_paid );
441
+	public function set_paid($REG_paid = 0.00) {
442
+		$this->set('REG_paid', $REG_paid);
443 443
 	}
444 444
 
445 445
 
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 	 * @access        public
451 451
 	 * @param        boolean $REG_att_is_going Attendee Is Going
452 452
 	 */
453
-	public function set_att_is_going( $REG_att_is_going = FALSE ) {
454
-		$this->set( 'REG_att_is_going', $REG_att_is_going );
453
+	public function set_att_is_going($REG_att_is_going = FALSE) {
454
+		$this->set('REG_att_is_going', $REG_att_is_going);
455 455
 	}
456 456
 
457 457
 
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	 * @return EE_Attendee
462 462
 	 */
463 463
 	public function attendee() {
464
-		return $this->get_first_related( 'Attendee' );
464
+		return $this->get_first_related('Attendee');
465 465
 	}
466 466
 
467 467
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 * @access        public
472 472
 	 */
473 473
 	public function event_ID() {
474
-		return $this->get( 'EVT_ID' );
474
+		return $this->get('EVT_ID');
475 475
 	}
476 476
 
477 477
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 	 */
483 483
 	public function event_name() {
484 484
 		$event = $this->event_obj();
485
-		if ( $event ) {
485
+		if ($event) {
486 486
 			return $event->name();
487 487
 		} else {
488 488
 			return NULL;
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 * @return EE_Event
497 497
 	 */
498 498
 	public function event_obj() {
499
-		return $this->get_first_related( 'Event' );
499
+		return $this->get_first_related('Event');
500 500
 	}
501 501
 
502 502
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 	 * @access        public
507 507
 	 */
508 508
 	public function attendee_ID() {
509
-		return $this->get( 'ATT_ID' );
509
+		return $this->get('ATT_ID');
510 510
 	}
511 511
 
512 512
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	 * @access        public
517 517
 	 */
518 518
 	public function session_ID() {
519
-		return $this->get( 'REG_session' );
519
+		return $this->get('REG_session');
520 520
 	}
521 521
 
522 522
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
527 527
 	 * @return string
528 528
 	 */
529
-	public function receipt_url( $messenger = 'html' ) {
529
+	public function receipt_url($messenger = 'html') {
530 530
 
531 531
 		/**
532 532
 		 * The below will be deprecated one version after this.  We check first if there is a custom receipt template already in use on old system.  If there is then we just return the standard url for it.
@@ -534,12 +534,12 @@  discard block
 block discarded – undo
534 534
 		 * @since 4.5.0
535 535
 		 */
536 536
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php';
537
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
537
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
538 538
 
539
-		if ( $has_custom ) {
540
-			return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) );
539
+		if ($has_custom) {
540
+			return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch'));
541 541
 		}
542
-		return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' );
542
+		return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt');
543 543
 	}
544 544
 
545 545
 
@@ -550,28 +550,28 @@  discard block
 block discarded – undo
550 550
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
551 551
 	 * @return string
552 552
 	 */
553
-	public function invoice_url( $messenger = 'html' ) {
553
+	public function invoice_url($messenger = 'html') {
554 554
 		/**
555 555
 		 * The below will be deprecated one version after this.  We check first if there is a custom invoice template already in use on old system.  If there is then we just return the standard url for it.
556 556
 		 *
557 557
 		 * @since 4.5.0
558 558
 		 */
559 559
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php';
560
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
560
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
561 561
 
562
-		if ( $has_custom ) {
563
-			if ( $messenger == 'html' ) {
564
-				return $this->invoice_url( 'launch' );
562
+		if ($has_custom) {
563
+			if ($messenger == 'html') {
564
+				return $this->invoice_url('launch');
565 565
 			}
566 566
 			$route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice';
567 567
 
568
-			$query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() );
569
-			if ( $messenger == 'html' ) {
568
+			$query_args = array('ee' => $route, 'id' => $this->reg_url_link());
569
+			if ($messenger == 'html') {
570 570
 				$query_args['html'] = TRUE;
571 571
 			}
572
-			return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) );
572
+			return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
573 573
 		}
574
-		return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' );
574
+		return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice');
575 575
 	}
576 576
 
577 577
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 	 * @throws \EE_Error
585 585
 	 */
586 586
 	public function reg_url_link() {
587
-		return (string)$this->get( 'REG_url_link' );
587
+		return (string) $this->get('REG_url_link');
588 588
 	}
589 589
 
590 590
 
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
 	 * @param string $type 'download','launch', or 'html' (default is 'launch')
595 595
 	 * @return void
596 596
 	 */
597
-	public function e_invoice_url( $type = 'launch' ) {
598
-		echo $this->invoice_url( $type );
597
+	public function e_invoice_url($type = 'launch') {
598
+		echo $this->invoice_url($type);
599 599
 	}
600 600
 
601 601
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 * @return string
616 616
 	 */
617 617
 	public function payment_overview_url() {
618
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
618
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
619 619
 	}
620 620
 
621 621
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 	 * @return string
627 627
 	 */
628 628
 	public function edit_attendee_information_url() {
629
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
629
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
630 630
 	}
631 631
 
632 632
 
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 	 * @return string
637 637
 	 */
638 638
 	public function get_admin_edit_url() {
639
-		return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) );
639
+		return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php'));
640 640
 	}
641 641
 
642 642
 
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	 * @access        public
647 647
 	 */
648 648
 	public function is_primary_registrant() {
649
-		return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE;
649
+		return $this->get('REG_count') == 1 ? TRUE : FALSE;
650 650
 	}
651 651
 
652 652
 
@@ -655,12 +655,12 @@  discard block
 block discarded – undo
655 655
 	 * This returns the primary registration object for this registration group (which may be this object).
656 656
 	 * @return EE_Registration
657 657
 	 */
658
-	public function get_primary_registration()  {
659
-		if ( $this->is_primary_registrant() )
658
+	public function get_primary_registration() {
659
+		if ($this->is_primary_registrant())
660 660
 			return $this;
661 661
 
662 662
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
663
-		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
663
+		$primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1)));
664 664
 		return $primary_registrant;
665 665
 	}
666 666
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	* 		@access		public
672 672
 	*/
673 673
 	public function count() {
674
-		return $this->get( 'REG_count' );
674
+		return $this->get('REG_count');
675 675
 	}
676 676
 
677 677
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	 * @access        public
682 682
 	 */
683 683
 	public function group_size() {
684
-		return $this->get( 'REG_group_size' );
684
+		return $this->get('REG_group_size');
685 685
 	}
686 686
 
687 687
 
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	 * @access        public
692 692
 	 */
693 693
 	public function date() {
694
-		return $this->get( 'REG_date' );
694
+		return $this->get('REG_date');
695 695
 	}
696 696
 
697 697
 
@@ -702,8 +702,8 @@  discard block
 block discarded – undo
702 702
 	 * @param string $time_format
703 703
 	 * @return string
704 704
 	 */
705
-	public function pretty_date( $date_format = NULL, $time_format = NULL ) {
706
-		return $this->get_datetime( 'REG_date', $date_format, $time_format );
705
+	public function pretty_date($date_format = NULL, $time_format = NULL) {
706
+		return $this->get_datetime('REG_date', $date_format, $time_format);
707 707
 	}
708 708
 
709 709
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 	 * @return    float
717 717
 	 */
718 718
 	public function final_price() {
719
-		return $this->get( 'REG_final_price' );
719
+		return $this->get('REG_final_price');
720 720
 	}
721 721
 
722 722
 
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 	 * @return string
728 728
 	 */
729 729
 	public function pretty_final_price() {
730
-		return $this->get_pretty( 'REG_final_price' );
730
+		return $this->get_pretty('REG_final_price');
731 731
 	}
732 732
 
733 733
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 	 * @return 	float
739 739
 	 */
740 740
 	public function paid() {
741
-		return $this->get( 'REG_paid' );
741
+		return $this->get('REG_paid');
742 742
 	}
743 743
 
744 744
 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	 * @return 	float
750 750
 	 */
751 751
 	public function pretty_paid() {
752
-		return $this->get_pretty( 'REG_paid' );
752
+		return $this->get_pretty('REG_paid');
753 753
 	}
754 754
 
755 755
 
@@ -761,11 +761,11 @@  discard block
 block discarded – undo
761 761
 	 * @param array $requires_payment
762 762
 	 * @return bool
763 763
 	 */
764
-	public function owes_monies_and_can_pay( $requires_payment = array()) {
764
+	public function owes_monies_and_can_pay($requires_payment = array()) {
765 765
 		// these reg statuses require payment (if event is not free)
766
-		$requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
766
+		$requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
767 767
 		if (
768
-			in_array( $this->status_ID(), $requires_payment ) &&
768
+			in_array($this->status_ID(), $requires_payment) &&
769 769
 			$this->final_price() != 0 &&
770 770
 			$this->final_price() != $this->paid()
771 771
 		) {
@@ -782,8 +782,8 @@  discard block
 block discarded – undo
782 782
 	 * @param bool $show_icons
783 783
 	 * @return void
784 784
 	 */
785
-	public function e_pretty_status( $show_icons = FALSE ) {
786
-		echo $this->pretty_status( $show_icons );
785
+	public function e_pretty_status($show_icons = FALSE) {
786
+		echo $this->pretty_status($show_icons);
787 787
 	}
788 788
 
789 789
 
@@ -794,10 +794,10 @@  discard block
 block discarded – undo
794 794
 	 * @param bool $show_icons
795 795
 	 * @return string
796 796
 	 */
797
-	public function pretty_status( $show_icons = FALSE ) {
798
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
797
+	public function pretty_status($show_icons = FALSE) {
798
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
799 799
 		$icon = '';
800
-		switch ( $this->status_ID() ) {
800
+		switch ($this->status_ID()) {
801 801
 			case EEM_Registration::status_id_approved:
802 802
 				$icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : '';
803 803
 				break;
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 				$icon = $show_icons ? '<span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>' : '';
821 821
 				break;
822 822
 		}
823
-		return $icon . $status[ $this->status_ID() ];
823
+		return $icon.$status[$this->status_ID()];
824 824
 	}
825 825
 
826 826
 
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 	 * @access        public
831 831
 	 */
832 832
 	public function att_is_going() {
833
-		return $this->get( 'REG_att_is_going' );
833
+		return $this->get('REG_att_is_going');
834 834
 	}
835 835
 
836 836
 
@@ -840,8 +840,8 @@  discard block
 block discarded – undo
840 840
 	 * @param array $query_params like EEM_Base::get_all
841 841
 	 * @return EE_Answer[]
842 842
 	 */
843
-	public function answers( $query_params = NULL ) {
844
-		return $this->get_many_related( 'Answer', $query_params );
843
+	public function answers($query_params = NULL) {
844
+		return $this->get_many_related('Answer', $query_params);
845 845
 	}
846 846
 
847 847
 
@@ -855,9 +855,9 @@  discard block
 block discarded – undo
855 855
 	 * (because the answer might be an array of answer values, so passing pretty_value=true
856 856
 	 * will convert it into some kind of string)
857 857
 	 */
858
-	public function answer_value_to_question( $question, $pretty_value=true ) {
858
+	public function answer_value_to_question($question, $pretty_value = true) {
859 859
 		$question_id = EEM_Question::instance()->ensure_is_ID($question);
860
-		return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value);
860
+		return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value);
861 861
 	}
862 862
 
863 863
 
@@ -870,13 +870,13 @@  discard block
 block discarded – undo
870 870
 	 */
871 871
 	public function question_groups() {
872 872
 		$question_groups = array();
873
-		if ( $this->event() instanceof EE_Event ) {
873
+		if ($this->event() instanceof EE_Event) {
874 874
 			$question_groups = $this->event()->question_groups(
875 875
 				array(
876 876
 					array(
877 877
 						'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false
878 878
 					),
879
-					'order_by' => array( 'QSG_order' => 'ASC' )
879
+					'order_by' => array('QSG_order' => 'ASC')
880 880
 				)
881 881
 			);
882 882
 		}
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 	 */
894 894
 	public function count_question_groups() {
895 895
 		$qg_count = 0;
896
-		if ( $this->event() instanceof EE_Event ) {
896
+		if ($this->event() instanceof EE_Event) {
897 897
 			$qg_count = $this->event()->count_related(
898 898
 				'Question_Group',
899 899
 				array(
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 	 * @return string
915 915
 	 */
916 916
 	public function reg_date() {
917
-		return $this->get_datetime( 'REG_date' );
917
+		return $this->get_datetime('REG_date');
918 918
 	}
919 919
 
920 920
 
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 	 * @return EE_Datetime_Ticket
927 927
 	 */
928 928
 	public function datetime_ticket() {
929
-		return $this->get_first_related( 'Datetime_Ticket' );
929
+		return $this->get_first_related('Datetime_Ticket');
930 930
 	}
931 931
 
932 932
 
@@ -936,15 +936,15 @@  discard block
 block discarded – undo
936 936
 	 * @param EE_Datetime_Ticket $datetime_ticket
937 937
 	 * @return EE_Datetime_Ticket
938 938
 	 */
939
-	public function set_datetime_ticket( $datetime_ticket ) {
940
-		return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' );
939
+	public function set_datetime_ticket($datetime_ticket) {
940
+		return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket');
941 941
 	}
942 942
 	/**
943 943
 	 * Gets deleted
944 944
 	 * @return boolean
945 945
 	 */
946 946
 	public function deleted() {
947
-		return $this->get( 'REG_deleted' );
947
+		return $this->get('REG_deleted');
948 948
 	}
949 949
 
950 950
 	/**
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
 	 * @return boolean
954 954
 	 */
955 955
 	public function set_deleted($deleted) {
956
-		$this->set( 'REG_deleted', $deleted );
956
+		$this->set('REG_deleted', $deleted);
957 957
 	}
958 958
 
959 959
 
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 	 * @return EE_Status
964 964
 	 */
965 965
 	public function status_obj() {
966
-		return $this->get_first_related( 'Status' );
966
+		return $this->get_first_related('Status');
967 967
 	}
968 968
 
969 969
 
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
 	 * @return int
975 975
 	 */
976 976
 	public function count_checkins() {
977
-		return $this->get_model()->count_related( $this, 'Checkin' );
977
+		return $this->get_model()->count_related($this, 'Checkin');
978 978
 	}
979 979
 
980 980
 
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 	 * @return int
985 985
 	 */
986 986
 	public function count_checkins_not_checkedout() {
987
-		return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) );
987
+		return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1)));
988 988
 	}
989 989
 
990 990
 
@@ -997,20 +997,20 @@  discard block
 block discarded – undo
997 997
 	 *
998 998
 	 * @return bool
999 999
 	 */
1000
-	public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) {
1001
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
1000
+	public function can_checkin($DTT_OR_ID, $check_approved = TRUE) {
1001
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
1002 1002
 
1003 1003
 		//first check registration status
1004
-		if (  ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) {
1004
+		if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) {
1005 1005
 			return false;
1006 1006
 		}
1007 1007
 		//is there a datetime ticket that matches this dtt_ID?
1008
-		if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) {
1008
+		if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) {
1009 1009
 			return false;
1010 1010
 		}
1011 1011
 
1012 1012
 		//final check is against TKT_uses
1013
-		return $this->verify_can_checkin_against_TKT_uses( $DTT_ID );
1013
+		return $this->verify_can_checkin_against_TKT_uses($DTT_ID);
1014 1014
 	}
1015 1015
 
1016 1016
 
@@ -1023,10 +1023,10 @@  discard block
 block discarded – undo
1023 1023
 	 * @param int | EE_Datetime  $DTT_OR_ID  The datetime the registration is being checked against
1024 1024
 	 * @return bool   true means can checkin.  false means cannot checkin.
1025 1025
 	 */
1026
-	public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) {
1027
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
1026
+	public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) {
1027
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
1028 1028
 
1029
-		if ( ! $DTT_ID ) {
1029
+		if ( ! $DTT_ID) {
1030 1030
 			return false;
1031 1031
 		}
1032 1032
 
@@ -1034,23 +1034,23 @@  discard block
 block discarded – undo
1034 1034
 
1035 1035
 		// if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in
1036 1036
 		// or not.
1037
-		if ( ! $max_uses || $max_uses === EE_INF ) {
1037
+		if ( ! $max_uses || $max_uses === EE_INF) {
1038 1038
 			return true;
1039 1039
 		}
1040 1040
 
1041 1041
 		//does this datetime have a checkin record?  If so, then the dtt count has already been verified so we can just
1042 1042
 		//go ahead and toggle.
1043
-		if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) {
1043
+		if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) {
1044 1044
 			return true;
1045 1045
 		}
1046 1046
 
1047 1047
 		//made it here so the last check is whether the number of checkins per unique datetime on this registration
1048 1048
 		//disallows further check-ins.
1049
-		$count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true );
1049
+		$count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true);
1050 1050
 		// checkins have already reached their max number of uses
1051 1051
 		// so registrant can NOT checkin
1052
-		if ( $count_unique_dtt_checkins >= $max_uses ) {
1053
-			EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1052
+		if ($count_unique_dtt_checkins >= $max_uses) {
1053
+			EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1054 1054
 			return false;
1055 1055
 		}
1056 1056
 		return true;
@@ -1071,15 +1071,15 @@  discard block
 block discarded – undo
1071 1071
 	 * @param  bool $verify  If true then can_checkin() is used to verify whether the person can be checked in or not.  Otherwise this forces change in checkin status.
1072 1072
 	 * @return int|BOOL            the chk_in status toggled to OR false if nothing got changed.
1073 1073
 	 */
1074
-	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
1075
-		if ( empty( $DTT_ID ) ) {
1074
+	public function toggle_checkin_status($DTT_ID = null, $verify = false) {
1075
+		if (empty($DTT_ID)) {
1076 1076
 			$datetime = $this->get_related_primary_datetime();
1077 1077
 			$DTT_ID = $datetime->ID();
1078 1078
 		// verify the registration can checkin for the given DTT_ID
1079
-		} elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) {
1079
+		} elseif ( ! $this->can_checkin($DTT_ID, $verify)) {
1080 1080
 			EE_Error::add_error(
1081 1081
 					sprintf(
1082
-						__( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1082
+						__('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1083 1083
 						$this->ID(),
1084 1084
 						$DTT_ID
1085 1085
 					),
@@ -1093,8 +1093,8 @@  discard block
 block discarded – undo
1093 1093
 			EE_Registration::checkin_status_out => EE_Registration::checkin_status_in
1094 1094
 		);
1095 1095
 		//start by getting the current status so we know what status we'll be changing to.
1096
-		$cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL );
1097
-		$status_to = $status_paths[ $cur_status ];
1096
+		$cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL);
1097
+		$status_to = $status_paths[$cur_status];
1098 1098
 		// database only records true for checked IN or false for checked OUT
1099 1099
 		// no record ( null ) means checked in NEVER, but we obviously don't save that
1100 1100
 		$new_status = $status_to == EE_Registration::checkin_status_in ? true : false;
@@ -1102,24 +1102,24 @@  discard block
 block discarded – undo
1102 1102
 		// because we are keeping track of Check-ins over time.
1103 1103
 		// Eventually we'll probably want to show a list table
1104 1104
 		// for the individual Check-ins so that they can be managed.
1105
-		$checkin = EE_Checkin::new_instance( array(
1105
+		$checkin = EE_Checkin::new_instance(array(
1106 1106
 				'REG_ID' => $this->ID(),
1107 1107
 				'DTT_ID' => $DTT_ID,
1108 1108
 				'CHK_in' => $new_status
1109
-		) );
1109
+		));
1110 1110
 		// if the record could not be saved then return false
1111
-		if ( $checkin->save() === 0 ) {
1112
-			if ( WP_DEBUG ) {
1111
+		if ($checkin->save() === 0) {
1112
+			if (WP_DEBUG) {
1113 1113
 				global $wpdb;
1114 1114
 				$error = sprintf(
1115
-					__( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ),
1115
+					__('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'),
1116 1116
 					'<br />',
1117 1117
 					$wpdb->last_error
1118 1118
 				);
1119 1119
 			} else {
1120
-				$error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' );
1120
+				$error = __('Registration check in update failed because of an unknown database error', 'event_espresso');
1121 1121
 			}
1122
-			EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
1122
+			EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
1123 1123
 			return false;
1124 1124
 		}
1125 1125
 		return $status_to;
@@ -1143,19 +1143,19 @@  discard block
 block discarded – undo
1143 1143
 	 * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1144 1144
 	 * @return int            Integer representing Check-in status.
1145 1145
 	 */
1146
-	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) {
1147
-		if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) {
1146
+	public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) {
1147
+		if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) {
1148 1148
 			$datetime = $this->get_related_primary_datetime();
1149
-			if ( ! $datetime instanceof EE_Datetime ) {
1149
+			if ( ! $datetime instanceof EE_Datetime) {
1150 1150
 				return 0;
1151 1151
 			}
1152 1152
 			$DTT_ID = $datetime->ID();
1153 1153
 		//verify the registration can checkin for the given DTT_ID
1154 1154
 		}
1155 1155
 		//get checkin object (if exists)
1156
-		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) );
1157
-		if ( $checkin instanceof EE_Checkin ) {
1158
-			if ( $checkin->get( 'CHK_in' ) ) {
1156
+		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC')));
1157
+		if ($checkin instanceof EE_Checkin) {
1158
+			if ($checkin->get('CHK_in')) {
1159 1159
 				return EE_Registration::checkin_status_in; //checked in
1160 1160
 			} else {
1161 1161
 				return EE_Registration::checkin_status_out; //had checked in but is now checked out.
@@ -1173,28 +1173,28 @@  discard block
 block discarded – undo
1173 1173
 	 * @param bool $error  This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name.
1174 1174
 	 * @return string         internationalized message
1175 1175
 	 */
1176
-	public function get_checkin_msg( $DTT_ID, $error = FALSE ) {
1176
+	public function get_checkin_msg($DTT_ID, $error = FALSE) {
1177 1177
 		//let's get the attendee first so we can include the name of the attendee
1178
-		$attendee = $this->get_first_related( 'Attendee' );
1179
-		if ( $attendee instanceof EE_Attendee ) {
1180
-			if ( $error ) {
1181
-				return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() );
1178
+		$attendee = $this->get_first_related('Attendee');
1179
+		if ($attendee instanceof EE_Attendee) {
1180
+			if ($error) {
1181
+				return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name());
1182 1182
 			}
1183
-			$cur_status = $this->check_in_status_for_datetime( $DTT_ID );
1183
+			$cur_status = $this->check_in_status_for_datetime($DTT_ID);
1184 1184
 			//what is the status message going to be?
1185
-			switch ( $cur_status ) {
1185
+			switch ($cur_status) {
1186 1186
 				case EE_Registration::checkin_status_never :
1187
-					return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() );
1187
+					return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name());
1188 1188
 					break;
1189 1189
 				case EE_Registration::checkin_status_in :
1190
-					return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() );
1190
+					return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name());
1191 1191
 					break;
1192 1192
 				case EE_Registration::checkin_status_out :
1193
-					return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() );
1193
+					return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name());
1194 1194
 					break;
1195 1195
 			}
1196 1196
 		}
1197
-		return __( "The check-in status could not be determined.", "event_espresso" );
1197
+		return __("The check-in status could not be determined.", "event_espresso");
1198 1198
 	}
1199 1199
 
1200 1200
 
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 	 * @access        public
1220 1220
 	 */
1221 1221
 	public function reg_code() {
1222
-		return $this->get( 'REG_code' );
1222
+		return $this->get('REG_code');
1223 1223
 	}
1224 1224
 
1225 1225
 
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 	 * @access        public
1230 1230
 	 */
1231 1231
 	public function transaction_ID() {
1232
-		return $this->get( 'TXN_ID' );
1232
+		return $this->get('TXN_ID');
1233 1233
 	}
1234 1234
 
1235 1235
 
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 	 * @return int
1239 1239
 	 */
1240 1240
 	public function ticket_ID() {
1241
-		return $this->get( 'TKT_ID' );
1241
+		return $this->get('TKT_ID');
1242 1242
 	}
1243 1243
 
1244 1244
 
@@ -1250,17 +1250,17 @@  discard block
 block discarded – undo
1250 1250
 	 * @param    string $REG_code Registration Code
1251 1251
 	 * @param	boolean $use_default
1252 1252
 	 */
1253
-	public function set_reg_code( $REG_code, $use_default = FALSE ) {
1254
-		if ( empty( $REG_code )) {
1255
-			EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1253
+	public function set_reg_code($REG_code, $use_default = FALSE) {
1254
+		if (empty($REG_code)) {
1255
+			EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1256 1256
 			return;
1257 1257
 		}
1258
-		if ( ! $this->reg_code() ) {
1259
-			parent::set( 'REG_code', $REG_code, $use_default );
1258
+		if ( ! $this->reg_code()) {
1259
+			parent::set('REG_code', $REG_code, $use_default);
1260 1260
 		} else {
1261 1261
 			EE_Error::doing_it_wrong(
1262
-				__CLASS__ . '::' . __FUNCTION__,
1263
-				__( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ),
1262
+				__CLASS__.'::'.__FUNCTION__,
1263
+				__('Can not change a registration REG_code once it has been set.', 'event_espresso'),
1264 1264
 				'4.6.0'
1265 1265
 			);
1266 1266
 		}
@@ -1280,17 +1280,17 @@  discard block
 block discarded – undo
1280 1280
 	 * @return EE_Registration[]  or empty array if this isn't a group registration.
1281 1281
 	 */
1282 1282
 	public function get_all_other_registrations_in_group() {
1283
-		if ( $this->group_size() < 2 ) {
1283
+		if ($this->group_size() < 2) {
1284 1284
 			return array();
1285 1285
 		}
1286 1286
 
1287 1287
 		$query[0] = array(
1288 1288
 			'TXN_ID' => $this->transaction_ID(),
1289
-			'REG_ID' => array( '!=', $this->ID() ),
1289
+			'REG_ID' => array('!=', $this->ID()),
1290 1290
 			'TKT_ID' => $this->ticket_ID()
1291 1291
 			);
1292 1292
 
1293
-		$registrations = $this->get_model()->get_all( $query );
1293
+		$registrations = $this->get_model()->get_all($query);
1294 1294
 		return $registrations;
1295 1295
 	}
1296 1296
 
@@ -1299,14 +1299,14 @@  discard block
 block discarded – undo
1299 1299
 	 * @return string
1300 1300
 	 */
1301 1301
 	public function get_admin_details_link() {
1302
-		EE_Registry::instance()->load_helper( 'URL' );
1302
+		EE_Registry::instance()->load_helper('URL');
1303 1303
 		return EEH_URL::add_query_args_and_nonce(
1304 1304
 			array(
1305 1305
 				'page' => 'espresso_registrations',
1306 1306
 				'action' => 'view_registration',
1307 1307
 				'_REG_ID' => $this->ID()
1308 1308
 			),
1309
-			admin_url( 'admin.php' )
1309
+			admin_url('admin.php')
1310 1310
 		);
1311 1311
 	}
1312 1312
 
@@ -1331,12 +1331,12 @@  discard block
 block discarded – undo
1331 1331
 	 * @return string
1332 1332
 	 */
1333 1333
 	public function get_admin_overview_link() {
1334
-		EE_Registry::instance()->load_helper( 'URL' );
1334
+		EE_Registry::instance()->load_helper('URL');
1335 1335
 		return EEH_URL::add_query_args_and_nonce(
1336 1336
 			array(
1337 1337
 				'page' => 'espresso_registrations'
1338 1338
 			),
1339
-			admin_url( 'admin.php' )
1339
+			admin_url('admin.php')
1340 1340
 		);
1341 1341
 	}
1342 1342
 
@@ -1347,8 +1347,8 @@  discard block
 block discarded – undo
1347 1347
 	 * @return \EE_Registration[]
1348 1348
 	 * @throws \EE_Error
1349 1349
 	 */
1350
-	public function payments( $query_params = array() ) {
1351
-		return $this->get_many_related( 'Payment', $query_params );
1350
+	public function payments($query_params = array()) {
1351
+		return $this->get_many_related('Payment', $query_params);
1352 1352
 	}
1353 1353
 
1354 1354
 
@@ -1358,8 +1358,8 @@  discard block
 block discarded – undo
1358 1358
 	 * @return \EE_Registration_Payment[]
1359 1359
 	 * @throws \EE_Error
1360 1360
 	 */
1361
-	public function registration_payments( $query_params = array() ) {
1362
-		return $this->get_many_related( 'Registration_Payment', $query_params );
1361
+	public function registration_payments($query_params = array()) {
1362
+		return $this->get_many_related('Registration_Payment', $query_params);
1363 1363
 	}
1364 1364
 
1365 1365
 
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
 	 * @return EE_Payment_Method|null
1373 1373
 	 */
1374 1374
 	public function payment_method() {
1375
-		return EEM_Payment_Method::instance()->get_last_used_for_registration( $this );
1375
+		return EEM_Payment_Method::instance()->get_last_used_for_registration($this);
1376 1376
 	}
1377 1377
 
1378 1378
 
Please login to merge, or discard this patch.