Completed
Branch FET-8896-previous-event-status (75cf5a)
by
unknown
534:55 queued 520:36
created
registrations/templates/attendee_registrations_main_meta_box.template.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,42 +5,42 @@
 block discarded – undo
5 5
 		<table class="admin-primary-mbox-tbl">
6 6
 			<thead>
7 7
 				<tr>
8
-					<th class="jst-left"><?php _e( 'Event Name', 'event_espresso' );?></th>
9
-					<th class="jst-left"><?php _e( 'REG ID', 'event_espresso' );?></th>
10
-					<th class="jst-left"><?php _e( 'TXN ID', 'event_espresso' );?></th>
11
-					<th class="jst-left"><?php _e( 'Reg Code', 'event_espresso' );?></th>
12
-					<th class="jst-rght"><?php _e( 'Ticket Price', 'event_espresso' );?></th>
8
+					<th class="jst-left"><?php _e('Event Name', 'event_espresso'); ?></th>
9
+					<th class="jst-left"><?php _e('REG ID', 'event_espresso'); ?></th>
10
+					<th class="jst-left"><?php _e('TXN ID', 'event_espresso'); ?></th>
11
+					<th class="jst-left"><?php _e('Reg Code', 'event_espresso'); ?></th>
12
+					<th class="jst-rght"><?php _e('Ticket Price', 'event_espresso'); ?></th>
13 13
 				</tr>
14 14
 			</thead>
15 15
 			<tbody>
16
-			<?php foreach( $registrations as $registration ) : ?>
16
+			<?php foreach ($registrations as $registration) : ?>
17 17
 				<tr>
18 18
 					<td class="jst-left">
19 19
 					<?php
20
-						$event_url = add_query_arg( array( 'action' => 'edit', 'post' => $registration->event_ID() ), admin_url( 'admin.php?page=espresso_events' ));
21
-						echo EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $registration->event_ID() ) ?  '<a href="'. $event_url .'"  title="'. esc_attr__( 'Edit Event', 'event_espresso' ) .'">' . $registration->event_name() . '</a>' : $registration->event_name();
20
+						$event_url = add_query_arg(array('action' => 'edit', 'post' => $registration->event_ID()), admin_url('admin.php?page=espresso_events'));
21
+						echo EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $registration->event_ID()) ? '<a href="'.$event_url.'"  title="'.esc_attr__('Edit Event', 'event_espresso').'">'.$registration->event_name().'</a>' : $registration->event_name();
22 22
 					?>
23 23
 					</td>
24 24
 					<td class="jst-left">
25 25
 					<?php
26
-							$reg_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
27
-							echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? '
28
-							<a href="'.$reg_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . 
29
-								sprintf( __( 'View Registration ', 'event_espresso'), $registration->ID() ) .
26
+							$reg_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
27
+							echo EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? '
28
+							<a href="'.$reg_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'. 
29
+								sprintf(__('View Registration ', 'event_espresso'), $registration->ID()).
30 30
 							'</a>' : '';
31 31
 					?>
32 32
 					</td>
33 33
 					<td class="jst-left">
34 34
 					<?php
35
-						$txn_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID() ), TXN_ADMIN_URL );
36
-						echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '
37
-						<a href="'.$txn_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">
38
-							View Transaction ' . $registration->transaction_ID() . '
35
+						$txn_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID()), TXN_ADMIN_URL);
36
+						echo EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
37
+						<a href="'.$txn_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">
38
+							View Transaction ' . $registration->transaction_ID().'
39 39
 						</a>' : '';
40 40
 					?>
41 41
 					</td>
42
-					<td class="jst-left"><?php echo $registration->reg_code();?></td>
43
-					<td class="jst-rght"><?php echo EEH_Template::format_currency( $registration->final_price() );?></td>
42
+					<td class="jst-left"><?php echo $registration->reg_code(); ?></td>
43
+					<td class="jst-rght"><?php echo EEH_Template::format_currency($registration->final_price()); ?></td>
44 44
 				</tr>
45 45
 			<?php endforeach; ?>
46 46
 			</tbody>
Please login to merge, or discard this patch.
caffeinated/admin/extend/events/help_tabs/import_page.help_tab.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,18 +2,18 @@
 block discarded – undo
2 2
 <p>
3 3
 <?php _e('The importer can be used to import event information into Event Espresso using a CSV file.', 'event_espresso'); ?>
4 4
 </p>
5
-<h3><?php _e("Importing from other Event Espresso 4 Sites", 'event_espresso');?></h3>
5
+<h3><?php _e("Importing from other Event Espresso 4 Sites", 'event_espresso'); ?></h3>
6 6
 <p>
7 7
 <?php _e('To import Event Espresso data from another Event Espresso 4 install, export a CSV file from the admin Events overview page, or anywhere you can generate a CSV export file from. Then upload that file here (regardless of what type of information was exported).', 'event_espresso'); ?>
8 8
 </p>
9 9
 <p>
10 10
 <?php _e('Note: its possible that data from the other site have the same IDs as data in this site. The importer recognizes that this data is from a different database and inserts new items for each item in the CSV file, regardless of whether its ID matches that of an item in this site\'s database or not. However, the importer also remembers the mapping from the old site\'s database to this site\'s database, and on subsequent CSV importers from that site, the data in this database will be updated instead of re-inserting new items.', 'event_espresso'); ?>
11 11
 </p>
12
-<h3><?php _e("Importing from this Site", 'event_espresso');?></h3>
13
-<p><?php _e("You may want to export data from this site, modify it (or modify the database), and re-import it. When this is done, the importer recognizes that the data is from this site\'s database and updates the records (instead of inserting new items like it would have, had the CSV data been from a different site).", 'event_espresso');?></p>
12
+<h3><?php _e("Importing from this Site", 'event_espresso'); ?></h3>
13
+<p><?php _e("You may want to export data from this site, modify it (or modify the database), and re-import it. When this is done, the importer recognizes that the data is from this site\'s database and updates the records (instead of inserting new items like it would have, had the CSV data been from a different site).", 'event_espresso'); ?></p>
14 14
 
15
-	<h3><?php _e("Notes about Generating your own CSV Import Files", "event_espresso");?></h3>
16
-	<p><?php _e("If you think you could save time entering data into a CSV file, you can use the sample import file below. Note that creating your own CSV file is more complicated than in Event Espresso 3.1 because of the more advanced data structure, and so we recommend creating/editing your events using the normal web-interface.", "event_espresso");?></p>
17
-	<p><?php _e("The export file is just an export of an event, or if you do not have any events in your system, it will only contain column headers. Do not change those column headers. Add as many rows as you like. ", "event_espresso");?></p>
18
-	<p><?php _e("In the ID columns (columns ending in '_ID'), you should enter 'temporary IDs', which are unique numbers/words that identify that item, which can be used later when you want to refer to that item. (For example, if you assign an event's EVT_ID to be a temporary id of 'my-event-1', then use that same phrase 'my-event-1' to refer to that event in the Datetime model's EVT_ID column)", "event_espresso");?></p>
19
-	<p><?php _e("Also note, you do NOT have to enter info in for each model. (You can, for example, only enter in Term_Taxonomies and Term model data)", "event_espresso");?></p>
20 15
\ No newline at end of file
16
+	<h3><?php _e("Notes about Generating your own CSV Import Files", "event_espresso"); ?></h3>
17
+	<p><?php _e("If you think you could save time entering data into a CSV file, you can use the sample import file below. Note that creating your own CSV file is more complicated than in Event Espresso 3.1 because of the more advanced data structure, and so we recommend creating/editing your events using the normal web-interface.", "event_espresso"); ?></p>
18
+	<p><?php _e("The export file is just an export of an event, or if you do not have any events in your system, it will only contain column headers. Do not change those column headers. Add as many rows as you like. ", "event_espresso"); ?></p>
19
+	<p><?php _e("In the ID columns (columns ending in '_ID'), you should enter 'temporary IDs', which are unique numbers/words that identify that item, which can be used later when you want to refer to that item. (For example, if you assign an event's EVT_ID to be a temporary id of 'my-event-1', then use that same phrase 'my-event-1' to refer to that event in the Datetime model's EVT_ID column)", "event_espresso"); ?></p>
20
+	<p><?php _e("Also note, you do NOT have to enter info in for each model. (You can, for example, only enter in Term_Taxonomies and Term model data)", "event_espresso"); ?></p>
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
core/admin/EE_Admin_Hooks.core.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * constructor
210 210
 	 * @param EE_Admin_Page $admin_page the calling admin_page_object
211 211
 	 */
212
-	public function __construct( EE_Admin_Page $adminpage ) {
212
+	public function __construct(EE_Admin_Page $adminpage) {
213 213
 
214 214
 		$this->_adminpage_obj = $adminpage;
215 215
 		$this->_req_data = array_merge($_GET, $_POST);
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 		$this->_set_hooks_properties();
218 218
 
219 219
 		//first let's verify we're on the right page
220
-		if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) )
220
+		if ( ! isset($this->_req_data['page']) || (isset($this->_req_data['page']) && $this->_adminpage_obj->page_slug != $this->_req_data['page']))
221 221
 			return; //get out nothing more to be done here.
222 222
 
223 223
 		//allow for extends to modify properties
224
-		if ( method_exists( $this, '_extend_properties' ) )
224
+		if (method_exists($this, '_extend_properties'))
225 225
 			$this->_extend_properties();
226 226
 
227 227
 		$this->_set_page_object();
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 		$this->_load_custom_methods();
230 230
 		$this->_load_routed_hooks();
231 231
 
232
-		add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts_styles' ) );
233
-		add_action( 'admin_enqueue_scripts', array($this, 'add_metaboxes'), 20 );
234
-		add_action( 'admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15 );
232
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_styles'));
233
+		add_action('admin_enqueue_scripts', array($this, 'add_metaboxes'), 20);
234
+		add_action('admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15);
235 235
 
236 236
 		$this->_ajax_hooks();
237 237
 
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	public function enqueue_scripts_styles() {
274 274
 
275
-		if ( !empty( $this->_scripts_styles ) ) {
275
+		if ( ! empty($this->_scripts_styles)) {
276 276
 			//first let's do all the registrations
277
-			if ( !isset($this->_scripts_styles['registers'] ) ) {
277
+			if ( ! isset($this->_scripts_styles['registers'])) {
278 278
 				$msg[] = __('There is no "registers" index in the <code>$this->_scripts_styles</code> property.', 'event_espresso');
279
-				$msg[] = sprintf ( __('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>' . $this->caller . '</strong>' );
280
-				throw new EE_Error( implode( '||', $msg ) );
279
+				$msg[] = sprintf(__('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>'.$this->caller.'</strong>');
280
+				throw new EE_Error(implode('||', $msg));
281 281
 			}
282 282
 
283
-			foreach( $this->_scripts_styles['registers'] as $ref => $details ) {
283
+			foreach ($this->_scripts_styles['registers'] as $ref => $details) {
284 284
 				$defaults = array(
285 285
 					'type' => 'js',
286 286
 					'url' => '',
@@ -289,48 +289,48 @@  discard block
 block discarded – undo
289 289
 					'footer' => TRUE
290 290
 					);
291 291
 				$details = wp_parse_args($details, $defaults);
292
-				extract( $details );
292
+				extract($details);
293 293
 
294 294
 				//let's make sure that we set the 'registers' type if it's not set! We need it later to determine whhich enqueu we do
295 295
 				$this->_scripts_styles['registers'][$ref]['type'] = $type;
296 296
 
297 297
 				//let's make sure we're not missing any REQUIRED parameters
298
-				if ( empty($url) ) {
299
-					$msg[] = sprintf( __('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet' );
300
-					$msg[] = sprintf( __('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>' . $this->caller . '</strong>', $ref );
301
-					throw new EE_Error( implode( '||', $msg ) );
298
+				if (empty($url)) {
299
+					$msg[] = sprintf(__('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet');
300
+					$msg[] = sprintf(__('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>'.$this->caller.'</strong>', $ref);
301
+					throw new EE_Error(implode('||', $msg));
302 302
 				}
303 303
 				//made it here so let's do the appropriate registration
304
-				$type == 'js' ? wp_register_script( $ref, $url, $depends, $version, $footer ) : wp_register_style( $ref, $url, $depends, $version );
304
+				$type == 'js' ? wp_register_script($ref, $url, $depends, $version, $footer) : wp_register_style($ref, $url, $depends, $version);
305 305
 			}
306 306
 
307 307
 			//k now lets do the enqueues
308
-			if( !isset( $this->_scripts_styles['enqueues'] ) )
309
-				return;  //not sure if we should throw an error here or not.
310
-			foreach( $this->_scripts_styles['enqueues'] as $ref => $routes ) {
308
+			if ( ! isset($this->_scripts_styles['enqueues']))
309
+				return; //not sure if we should throw an error here or not.
310
+			foreach ($this->_scripts_styles['enqueues'] as $ref => $routes) {
311 311
 				//make sure $routes is an array
312 312
 				$routes = (array) $routes;
313 313
 
314
-				if ( in_array($this->_current_route, $routes ) ) {
314
+				if (in_array($this->_current_route, $routes)) {
315 315
 					$this->_scripts_styles['registers'][$ref]['type'] == 'js' ? wp_enqueue_script($ref) : wp_enqueue_style($ref);
316 316
 					//if we have a localization for the script let's do that too.
317
-					if ( isset( $this->_scripts_styles['localize'][$ref] ) ) {
318
-						foreach ( $this->_scripts_styles['localize'][$ref] as $object_name => $indexes ) {
319
-							wp_localize_script($ref, $object_name , $this->_scripts_styles['localize'][$ref][$object_name] );
317
+					if (isset($this->_scripts_styles['localize'][$ref])) {
318
+						foreach ($this->_scripts_styles['localize'][$ref] as $object_name => $indexes) {
319
+							wp_localize_script($ref, $object_name, $this->_scripts_styles['localize'][$ref][$object_name]);
320 320
 						}
321 321
 					}
322 322
 				}
323 323
 			}
324 324
 
325 325
 			//let's do the deregisters
326
-			if ( !isset( $this->_scripts_styles['deregisters'] ) )
326
+			if ( ! isset($this->_scripts_styles['deregisters']))
327 327
 				return;
328
-			foreach ( $this->_scripts_styles['deregisters'] as $ref => $details ) {
328
+			foreach ($this->_scripts_styles['deregisters'] as $ref => $details) {
329 329
 				$defaults = array(
330 330
 					'type' => 'js'
331 331
 					);
332
-				$details = wp_parse_args( $details, $defaults );
333
-				extract( $details );
332
+				$details = wp_parse_args($details, $defaults);
333
+				extract($details);
334 334
 
335 335
 				$type == 'js' ? wp_deregister_script($ref) : wp_deregister_style($ref);
336 336
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	 */
350 350
 	private function _set_defaults() {
351 351
 		$this->_ajax_func = $this->_init_func = $this->_metaboxes = $this->_scripts = $this->_styles = $this->_wp_action_filters_priority = array();
352
-		$this->_current_route = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default';
352
+		$this->_current_route = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default';
353 353
 		$this->caller = get_class($this);
354 354
 		$this->_extend = stripos($this->caller, 'Extend') ? TRUE : FALSE;
355 355
 	}
@@ -364,34 +364,34 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	protected function _set_page_object() {
366 366
 		//first make sure $this->_name is set
367
-		if ( empty( $this->_name ) ) {
367
+		if (empty($this->_name)) {
368 368
 			$msg[] = __('We can\'t load the page object', 'event_espresso');
369
-			$msg[] = sprintf( __("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller );
370
-			throw new EE_Error( implode( '||', $msg ) );
369
+			$msg[] = sprintf(__("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller);
370
+			throw new EE_Error(implode('||', $msg));
371 371
 		}
372 372
 
373
-		$ref = str_replace('_' , ' ', $this->_name); //take the_message -> the message
374
-		$ref = str_replace(' ', '_', ucwords($ref) ) . '_Admin_Page'; //take the message -> The_Message
373
+		$ref = str_replace('_', ' ', $this->_name); //take the_message -> the message
374
+		$ref = str_replace(' ', '_', ucwords($ref)).'_Admin_Page'; //take the message -> The_Message
375 375
 
376 376
 		//first default file (if exists)
377
-		$decaf_file = EE_ADMIN_PAGES . $this->_name . DS . $ref . '.core.php';
378
-		if ( is_readable( $decaf_file ) )
379
-		require_once( $decaf_file );
377
+		$decaf_file = EE_ADMIN_PAGES.$this->_name.DS.$ref.'.core.php';
378
+		if (is_readable($decaf_file))
379
+		require_once($decaf_file);
380 380
 
381 381
 		//now we have to do require for extended file (if needed)
382
-		if ( $this->_extend ) {
383
-			require_once( EE_CORE_CAF_ADMIN_EXTEND . $this->_name . DS . 'Extend_' . $ref . '.core.php' );
382
+		if ($this->_extend) {
383
+			require_once(EE_CORE_CAF_ADMIN_EXTEND.$this->_name.DS.'Extend_'.$ref.'.core.php');
384 384
 		}
385 385
 
386 386
 
387 387
 		//if we've got an extended class we use that!
388
-		$ref = $this->_extend ? 'Extend_' . $ref : $ref;
388
+		$ref = $this->_extend ? 'Extend_'.$ref : $ref;
389 389
 
390 390
 		//let's make sure the class exists
391
-		if ( !class_exists( $ref ) ) {
391
+		if ( ! class_exists($ref)) {
392 392
 			$msg[] = __('We can\'t load the page object', 'event_espresso');
393
-			$msg[] = sprintf( __('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref );
394
-			throw new EE_Error( implode( '||', $msg ) );
393
+			$msg[] = sprintf(__('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref);
394
+			throw new EE_Error(implode('||', $msg));
395 395
 		}
396 396
 
397 397
 		$a = new ReflectionClass($ref);
@@ -416,27 +416,27 @@  discard block
 block discarded – undo
416 416
 		$method_callback = $this->_current_route == 'default' ? 'default_callback' : $this->_current_route;
417 417
 
418 418
 		//these run before the Admin_Page route executes.
419
-		if ( method_exists( $this, $method_callback ) ) {
420
-			call_user_func( array( $this, $method_callback) );
419
+		if (method_exists($this, $method_callback)) {
420
+			call_user_func(array($this, $method_callback));
421 421
 		}
422 422
 
423 423
 
424 424
 		//these run via the _redirect_after_action method in EE_Admin_Page which usually happens after non_UI methods in EE_Admin_Page classes.  There are two redirect actions, the first fires before $query_args might be manipulated by "save and close" actions and the seond fires right before the actual redirect happens.
425 425
 		//first the actions
426 426
 		//note that these action hooks will have the $query_args value available.
427
-		$admin_class_name = get_class( $this->_adminpage_obj );
427
+		$admin_class_name = get_class($this->_adminpage_obj);
428 428
 
429
-		if ( method_exists( $this, '_redirect_action_early_' . $this->_current_route ) ) {
430
-			add_action( 'AHEE__' . $admin_class_name . '___redirect_after_action__before_redirect_modification_' . $this->_current_route, array( $this, '_redirect_action_early_' . $this->_current_route ), 10 );
429
+		if (method_exists($this, '_redirect_action_early_'.$this->_current_route)) {
430
+			add_action('AHEE__'.$admin_class_name.'___redirect_after_action__before_redirect_modification_'.$this->_current_route, array($this, '_redirect_action_early_'.$this->_current_route), 10);
431 431
 		}
432 432
 
433
-		if ( method_exists( $this, '_redirect_action_' . $this->_current_route ) ) {
434
-			add_action( 'AHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_action_' . $this->_current_route ), 10 );
433
+		if (method_exists($this, '_redirect_action_'.$this->_current_route)) {
434
+			add_action('AHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_action_'.$this->_current_route), 10);
435 435
 		}
436 436
 
437 437
 		//let's hook into the _redirect itself and allow for changing where the user goes after redirect.  This will have $query_args and $redirect_url available.
438
-		if ( method_exists( $this, '_redirect_filter_' . $this->_current_route ) ) {
439
-			add_filter( 'FHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_filter_' . $this->_current_route ), 10, 2 );
438
+		if (method_exists($this, '_redirect_filter_'.$this->_current_route)) {
439
+			add_filter('FHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_filter_'.$this->_current_route), 10, 2);
440 440
 		}
441 441
 
442 442
 	}
@@ -459,12 +459,12 @@  discard block
 block discarded – undo
459 459
 				'argnum' => 1,
460 460
 				'priority' => 10
461 461
 				),
462
-			'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug . '_' . $this->_current_route => array(
462
+			'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug.'_'.$this->_current_route => array(
463 463
 				'type' => 'filter',
464 464
 				'argnum' => 1,
465 465
 				'priority' => 10
466 466
 				),
467
-			'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug => array(
467
+			'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug => array(
468 468
 				'type' => 'filter',
469 469
 				'argnum' => 1,
470 470
 				'priority' => 10
@@ -483,14 +483,14 @@  discard block
 block discarded – undo
483 483
 
484 484
 
485 485
 
486
-		foreach ( $hook_filter_array as $hook => $args ) {
487
-			if ( method_exists( $this, $this->_current_route . '_' . $hook ) ) {
488
-				if ( isset( $this->_wp_action_filters_priority[$hook] ) )
486
+		foreach ($hook_filter_array as $hook => $args) {
487
+			if (method_exists($this, $this->_current_route.'_'.$hook)) {
488
+				if (isset($this->_wp_action_filters_priority[$hook]))
489 489
 					$args['priority'] = $this->_wp_action_filters_priority[$hook];
490
-				if ( $args['type'] == 'action' )
491
-					add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] );
490
+				if ($args['type'] == 'action')
491
+					add_action($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']);
492 492
 				else
493
-					add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] );
493
+					add_filter($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']);
494 494
 			}
495 495
 		}
496 496
 
@@ -503,18 +503,18 @@  discard block
 block discarded – undo
503 503
 	 */
504 504
 	private function _ajax_hooks() {
505 505
 
506
-		if ( empty( $this->_ajax_func) )
506
+		if (empty($this->_ajax_func))
507 507
 			return; //get out there's nothing to take care of.
508 508
 
509
-		foreach ( $this->_ajax_func as $action => $method ) {
509
+		foreach ($this->_ajax_func as $action => $method) {
510 510
 			//make sure method exists
511
-			if ( !method_exists($this, $method) ) {
512
-				$msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso') . '<br />';
513
-				$msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller );
514
-				throw new EE_Error( implode('||', $msg ) );
511
+			if ( ! method_exists($this, $method)) {
512
+				$msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso').'<br />';
513
+				$msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller);
514
+				throw new EE_Error(implode('||', $msg));
515 515
 			}
516 516
 
517
-			add_action('wp_ajax_' . $action, array( $this, $method ) );
517
+			add_action('wp_ajax_'.$action, array($this, $method));
518 518
 		}
519 519
 
520 520
 	}
@@ -527,21 +527,21 @@  discard block
 block discarded – undo
527 527
 	 * @return void
528 528
 	 */
529 529
 	protected function _init_hooks() {
530
-		if ( empty( $this->_init_func) )
530
+		if (empty($this->_init_func))
531 531
 			return; //get out there's nothing to take care of.
532 532
 
533 533
 		//We need to determine what page_route we are on!
534
-		$current_route = isset ( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default';
534
+		$current_route = isset ($_REQUEST['action']) ? $_REQUEST['action'] : 'default';
535 535
 
536
-		foreach ( $this->_init_func as $route => $method ) {
536
+		foreach ($this->_init_func as $route => $method) {
537 537
 			//make sure method exists
538
-			if ( !method_exists($this, $method) ) {
539
-				$msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso') . '<br />';
540
-				$msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller );
541
-				throw new EE_Error( implode('||', $msg ) );
538
+			if ( ! method_exists($this, $method)) {
539
+				$msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso').'<br />';
540
+				$msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller);
541
+				throw new EE_Error(implode('||', $msg));
542 542
 			}
543
-			if ( $route == $this->_current_route )
544
-				add_action('admin_init', array( $this, $method ) );
543
+			if ($route == $this->_current_route)
544
+				add_action('admin_init', array($this, $method));
545 545
 		}
546 546
 
547 547
 	}
@@ -556,28 +556,28 @@  discard block
 block discarded – undo
556 556
 	 * @return void
557 557
 	 */
558 558
 	public function add_metaboxes() {
559
-		if ( empty( $this->_metaboxes ) )
559
+		if (empty($this->_metaboxes))
560 560
 			return; //get out we don't have any metaboxes to set for this connection
561 561
 
562
-		$this->_handle_metabox_array( $this->_metaboxes );
562
+		$this->_handle_metabox_array($this->_metaboxes);
563 563
 
564 564
 	}
565 565
 
566 566
 
567 567
 
568
-	private function _handle_metabox_array( $boxes, $add = TRUE ) {
568
+	private function _handle_metabox_array($boxes, $add = TRUE) {
569 569
 
570
-		foreach ( $boxes as $box ) {
571
-			if ( !isset($box['page_route']) )
570
+		foreach ($boxes as $box) {
571
+			if ( ! isset($box['page_route']))
572 572
 				continue; //we dont' have a valid array
573 573
 
574 574
 			//let's make sure $box['page_route'] is an array so the "foreach" will work.
575 575
 			$box['page_route'] = (array) $box['page_route'];
576 576
 
577
-			foreach ( $box['page_route'] as $route ) {
578
-				if ( $route != $this->_current_route )
577
+			foreach ($box['page_route'] as $route) {
578
+				if ($route != $this->_current_route)
579 579
 					continue; //get out we only add metaboxes for set route.
580
-				if ( $add )
580
+				if ($add)
581 581
 					$this->_add_metabox($box);
582 582
 				else
583 583
 					$this->_remove_metabox($box);
@@ -595,10 +595,10 @@  discard block
 block discarded – undo
595 595
 	 */
596 596
 	public function remove_metaboxes() {
597 597
 
598
-		if ( empty( $this->_remove_metaboxes ) )
598
+		if (empty($this->_remove_metaboxes))
599 599
 			return; //get out there are no metaboxes to remove
600 600
 
601
-		$this->_handle_metabox_array( $this->_remove_metaboxes, FALSE );
601
+		$this->_handle_metabox_array($this->_remove_metaboxes, FALSE);
602 602
 	}
603 603
 
604 604
 
@@ -608,53 +608,53 @@  discard block
 block discarded – undo
608 608
 	 * @access private
609 609
 	 * @param array $args an array of args that have been set for this metabox by the child class
610 610
 	 */
611
-	private function _add_metabox( $args ) {
611
+	private function _add_metabox($args) {
612 612
 		$current_screen = get_current_screen();
613
-		$screen_id = is_object( $current_screen ) ? $current_screen->id : NULL;
614
-		$func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback';
613
+		$screen_id = is_object($current_screen) ? $current_screen->id : NULL;
614
+		$func = isset($args['func']) ? $args['func'] : 'some_invalid_callback';
615 615
 
616 616
 		//set defaults
617 617
 		$defaults = array(
618 618
 			'func' => $func,
619
-			'id' => $this->caller . '_' . $func . '_metabox',
619
+			'id' => $this->caller.'_'.$func.'_metabox',
620 620
 			'priority' => 'default',
621 621
 			'label' => $this->caller,
622 622
 			'context' => 'advanced',
623 623
 			'callback_args' => array(),
624
-			'page' => isset( $args['page'] ) ? $args['page'] : $screen_id
624
+			'page' => isset($args['page']) ? $args['page'] : $screen_id
625 625
 			);
626 626
 
627
-		$args = wp_parse_args( $args, $defaults );
627
+		$args = wp_parse_args($args, $defaults);
628 628
 		extract($args);
629 629
 
630 630
 
631 631
 		//make sure method exists
632
-		if ( !method_exists($this, $func) ) {
633
-			$msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso') . '<br />';
634
-			$msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $func, $this->caller );
635
-			throw new EE_Error( implode('||', $msg ) );
632
+		if ( ! method_exists($this, $func)) {
633
+			$msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso').'<br />';
634
+			$msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $func, $this->caller);
635
+			throw new EE_Error(implode('||', $msg));
636 636
 		}
637 637
 
638 638
 		//everything checks out so lets add the metabox
639
-		add_meta_box( $id, $label, array( $this, $func ), $page, $context, $priority, $callback_args);
639
+		add_meta_box($id, $label, array($this, $func), $page, $context, $priority, $callback_args);
640 640
 	}
641 641
 
642 642
 
643 643
 
644
-	private function _remove_metabox( $args ) {
644
+	private function _remove_metabox($args) {
645 645
 		$current_screen = get_current_screen();
646
-		$screen_id = is_object( $current_screen ) ? $current_screen->id : NULL;
647
-		$func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback';
646
+		$screen_id = is_object($current_screen) ? $current_screen->id : NULL;
647
+		$func = isset($args['func']) ? $args['func'] : 'some_invalid_callback';
648 648
 
649 649
 		//set defaults
650 650
 		$defaults = array(
651
-			'id' => isset( $args['id'] ) ? $args['id'] : $this->_current_route . '_' . $this->caller . '_' . $func . '_metabox',
651
+			'id' => isset($args['id']) ? $args['id'] : $this->_current_route.'_'.$this->caller.'_'.$func.'_metabox',
652 652
 			'context' => 'default',
653
-			'screen' => isset( $args['screen'] ) ? $args['screen'] : $screen_id
653
+			'screen' => isset($args['screen']) ? $args['screen'] : $screen_id
654 654
 		);
655 655
 
656
-		$args = wp_parse_args( $args, $defaults );
657
-		extract( $args );
656
+		$args = wp_parse_args($args, $defaults);
657
+		extract($args);
658 658
 
659 659
 		//everything checks out so lets remove the box!
660 660
 		remove_meta_box($id, $screen, $context);
Please login to merge, or discard this patch.
core/business/EE_Transaction_Processor.class.php 1 patch
Spacing   +106 added lines, -106 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
 	}
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 	 * @param array $registration_query_params
65 65
 	 * @return EE_Transaction_Processor
66 66
 	 */
67
-	private function __construct( $registration_query_params = array() ) {
67
+	private function __construct($registration_query_params = array()) {
68 68
 		// make sure some query params are set for retrieving registrations
69
-		$this->_set_registration_query_params( $registration_query_params );
69
+		$this->_set_registration_query_params($registration_query_params);
70 70
 	}
71 71
 
72 72
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 * @access private
76 76
 	 * @param array $registration_query_params
77 77
 	 */
78
-	private function _set_registration_query_params( $registration_query_params ) {
79
-		$this->_registration_query_params = ! empty( $registration_query_params ) ? $registration_query_params : array( 'order_by' => array( 'REG_count' => 'ASC' ));
78
+	private function _set_registration_query_params($registration_query_params) {
79
+		$this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params : array('order_by' => array('REG_count' => 'ASC'));
80 80
 	}
81 81
 
82 82
 
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 	/**
94 94
 	 * @param string $old_txn_status
95 95
 	 */
96
-	public function set_old_txn_status( $old_txn_status ) {
96
+	public function set_old_txn_status($old_txn_status) {
97 97
 		// only set the first time
98
-		if ( $this->_old_txn_status === null ) {
98
+		if ($this->_old_txn_status === null) {
99 99
 			$this->_old_txn_status = $old_txn_status;
100 100
 		}
101 101
 	}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * @param string $new_txn_status
116 116
 	 */
117
-	public function set_new_txn_status( $new_txn_status ) {
117
+	public function set_new_txn_status($new_txn_status) {
118 118
 		$this->_new_txn_status = $new_txn_status;
119 119
 	}
120 120
 
@@ -145,17 +145,17 @@  discard block
 block discarded – undo
145 145
 	 * @param bool   $check_all
146 146
 	 * @return boolean | int
147 147
 	 */
148
-	private function _reg_steps_completed( EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE ) {
148
+	private function _reg_steps_completed(EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE) {
149 149
 		$reg_steps = $transaction->reg_steps();
150
-		if ( ! is_array( $reg_steps ) || empty( $reg_steps )) {
150
+		if ( ! is_array($reg_steps) || empty($reg_steps)) {
151 151
 			return false;
152 152
 		}
153 153
 		// loop thru reg steps array)
154
-		foreach ( $reg_steps as $slug => $reg_step_completed ) {
154
+		foreach ($reg_steps as $slug => $reg_step_completed) {
155 155
 			// if NOT checking ALL steps (only checking one step)
156
-			if ( ! $check_all ) {
156
+			if ( ! $check_all) {
157 157
 				// and this is the one
158
-				if ( $slug == $reg_step_slug ) {
158
+				if ($slug == $reg_step_slug) {
159 159
 					return $reg_step_completed;
160 160
 				} else {
161 161
 					// skip to next reg step in loop
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 				}
164 164
 			}
165 165
 			// if any reg step is NOT completed (ignoring any specific steps), then just leave
166
-			if ( $reg_step_completed !== true && $slug != $reg_step_slug ) {
166
+			if ($reg_step_completed !== true && $slug != $reg_step_slug) {
167 167
 				return false;
168
-			} else if ( $slug == $reg_step_slug ) {
168
+			} else if ($slug == $reg_step_slug) {
169 169
 				// if we reach this point, then we are testing either:
170 170
 				// all_reg_steps_completed_except() or
171 171
 				// all_reg_steps_completed_except_final_step(),
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 	 * @param EE_Transaction $transaction
191 191
 	 * @return boolean
192 192
 	 */
193
-	public function all_reg_steps_completed( EE_Transaction $transaction ) {
194
-		return $this->_reg_steps_completed( $transaction );
193
+	public function all_reg_steps_completed(EE_Transaction $transaction) {
194
+		return $this->_reg_steps_completed($transaction);
195 195
 	}
196 196
 
197 197
 
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	 * @param string $exception
209 209
 	 * @return boolean
210 210
 	 */
211
-	public function all_reg_steps_completed_except( EE_Transaction $transaction, $exception = '' ) {
212
-		return $this->_reg_steps_completed( $transaction, $exception );
211
+	public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') {
212
+		return $this->_reg_steps_completed($transaction, $exception);
213 213
 	}
214 214
 
215 215
 
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 	 * @param EE_Transaction $transaction
226 226
 	 * @return boolean
227 227
 	 */
228
-	public function all_reg_steps_completed_except_final_step( EE_Transaction $transaction ) {
229
-		return $this->_reg_steps_completed( $transaction, 'finalize_registration' );
228
+	public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) {
229
+		return $this->_reg_steps_completed($transaction, 'finalize_registration');
230 230
 	}
231 231
 
232 232
 
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 	 * @param string $reg_step_slug
244 244
 	 * @return boolean | int
245 245
 	 */
246
-	public function reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) {
247
-		return $this->_reg_steps_completed( $transaction, $reg_step_slug, FALSE );
246
+	public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) {
247
+		return $this->_reg_steps_completed($transaction, $reg_step_slug, FALSE);
248 248
 	}
249 249
 
250 250
 
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 	 * @param EE_Transaction $transaction
261 261
 	 * @return boolean | int
262 262
 	 */
263
-	public function final_reg_step_completed( EE_Transaction $transaction ) {
264
-		return $this->_reg_steps_completed( $transaction, 'finalize_registration', FALSE );
263
+	public function final_reg_step_completed(EE_Transaction $transaction) {
264
+		return $this->_reg_steps_completed($transaction, 'finalize_registration', FALSE);
265 265
 	}
266 266
 
267 267
 
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 	 * @param string          $reg_step_slug
276 276
 	 * @return boolean
277 277
 	 */
278
-	public function set_reg_step_initiated( EE_Transaction $transaction, $reg_step_slug ) {
278
+	public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) {
279 279
 		$current_time = time();
280
-		return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, $current_time );
280
+		return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, $current_time);
281 281
 	}
282 282
 
283 283
 
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
 	 * @param string          $reg_step_slug
292 292
 	 * @return boolean
293 293
 	 */
294
-	public function set_reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) {
295
-		return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, TRUE );
294
+	public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) {
295
+		return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, TRUE);
296 296
 	}
297 297
 
298 298
 
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
 	 * @param string          $reg_step_slug
307 307
 	 * @return boolean
308 308
 	 */
309
-	public function set_reg_step_not_completed( EE_Transaction $transaction, $reg_step_slug ) {
310
-		return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, FALSE );
309
+	public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) {
310
+		return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, FALSE);
311 311
 	}
312 312
 
313 313
 
@@ -323,36 +323,36 @@  discard block
 block discarded – undo
323 323
 	 * @param boolean | int $status
324 324
 	 * @return boolean
325 325
 	 */
326
-	private function _set_reg_step_completed_status( EE_Transaction $transaction, $reg_step_slug, $status ) {
326
+	private function _set_reg_step_completed_status(EE_Transaction $transaction, $reg_step_slug, $status) {
327 327
 		// validate status
328
-		$status = is_bool( $status ) || is_numeric( $status ) ? $status : false;
328
+		$status = is_bool($status) || is_numeric($status) ? $status : false;
329 329
 		// get reg steps array
330 330
 		$txn_reg_steps = $transaction->reg_steps();
331 331
 		// if reg step does NOT exist
332
-		if ( ! isset( $txn_reg_steps[ $reg_step_slug ] )) {
332
+		if ( ! isset($txn_reg_steps[$reg_step_slug])) {
333 333
 			return false;
334 334
 		}
335 335
 		// if  we're trying to complete a step that is already completed
336
-		if ( $txn_reg_steps[ $reg_step_slug ] === true ) {
336
+		if ($txn_reg_steps[$reg_step_slug] === true) {
337 337
 			return true;
338 338
 		}
339 339
 		// if  we're trying to complete a step that hasn't even started
340
-		if ( $status === true && $txn_reg_steps[ $reg_step_slug ] === false ) {
340
+		if ($status === true && $txn_reg_steps[$reg_step_slug] === false) {
341 341
 			return false;
342 342
 		}
343 343
 		// if current status value matches the incoming value (no change)
344
-		if ( $txn_reg_steps[ $reg_step_slug ] === $status ) {
344
+		if ($txn_reg_steps[$reg_step_slug] === $status) {
345 345
 			// this will happen in cases where multiple AJAX requests occur during the same step
346 346
 			return true;
347 347
 		}
348 348
 		// if we're trying to set a start time
349
-		if ( is_numeric( $status ) && is_numeric( $txn_reg_steps[ $reg_step_slug ] )) {
349
+		if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) {
350 350
 			// skip the update below, but don't return FALSE so that errors won't be displayed
351 351
 			return true;
352 352
 		}
353 353
 		// update completed status
354
-		$txn_reg_steps[ $reg_step_slug ] = $status;
355
-		$transaction->set_reg_steps( $txn_reg_steps );
354
+		$txn_reg_steps[$reg_step_slug] = $status;
355
+		$transaction->set_reg_steps($txn_reg_steps);
356 356
 		$transaction->save();
357 357
 		// DEBUG LOG
358 358
 		//$this->log(
@@ -378,11 +378,11 @@  discard block
 block discarded – undo
378 378
 	 * @param string $reg_step_slug
379 379
 	 * @return void
380 380
 	 */
381
-	public function remove_reg_step( EE_Transaction $transaction, $reg_step_slug ) {
381
+	public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) {
382 382
 		// get reg steps array
383 383
 		$txn_reg_steps = $transaction->reg_steps();
384
-		unset( $txn_reg_steps[ $reg_step_slug ] );
385
-		$transaction->set_reg_steps( $txn_reg_steps );
384
+		unset($txn_reg_steps[$reg_step_slug]);
385
+		$transaction->set_reg_steps($txn_reg_steps);
386 386
 	}
387 387
 
388 388
 
@@ -396,14 +396,14 @@  discard block
 block discarded – undo
396 396
 	 * @param EE_Transaction $transaction
397 397
 	 * 	@return 	boolean
398 398
 	 */
399
-	public function toggle_failed_transaction_status( EE_Transaction $transaction ) {
399
+	public function toggle_failed_transaction_status(EE_Transaction $transaction) {
400 400
 		// set incoming TXN_Status
401
-		$this->set_old_txn_status( $transaction->status_ID() );
401
+		$this->set_old_txn_status($transaction->status_ID());
402 402
 		// if TXN status is still set as "failed"...
403
-		if ( $transaction->status_ID() == EEM_Transaction::failed_status_code ) {
403
+		if ($transaction->status_ID() == EEM_Transaction::failed_status_code) {
404 404
 			// set incoming TXN_Status
405
-			$this->set_new_txn_status( EEM_Transaction::abandoned_status_code );
406
-			$transaction->set_status( EEM_Transaction::abandoned_status_code );
405
+			$this->set_new_txn_status(EEM_Transaction::abandoned_status_code);
406
+			$transaction->set_status(EEM_Transaction::abandoned_status_code);
407 407
 			return TRUE;
408 408
 		}
409 409
 		return FALSE;
@@ -419,20 +419,20 @@  discard block
 block discarded – undo
419 419
 	 * @param EE_Transaction $transaction
420 420
 	 * 	@return 	boolean
421 421
 	 */
422
-	public function toggle_abandoned_transaction_status( EE_Transaction $transaction ) {
422
+	public function toggle_abandoned_transaction_status(EE_Transaction $transaction) {
423 423
 		// set incoming TXN_Status
424
-		$this->set_old_txn_status( $transaction->status_ID() );
424
+		$this->set_old_txn_status($transaction->status_ID());
425 425
 		// if TXN status has not been updated already due to a payment, and is still set as "failed" or "abandoned"...
426
-		if ( $transaction->status_ID() == EEM_Transaction::failed_status_code || $transaction->status_ID() == EEM_Transaction::abandoned_status_code ) {
427
-			$this->set_new_txn_status( EEM_Transaction::incomplete_status_code );
426
+		if ($transaction->status_ID() == EEM_Transaction::failed_status_code || $transaction->status_ID() == EEM_Transaction::abandoned_status_code) {
427
+			$this->set_new_txn_status(EEM_Transaction::incomplete_status_code);
428 428
 			// if a contact record for the primary registrant has been created
429
-			if ( $transaction->primary_registration() instanceof EE_Registration && $transaction->primary_registration()->attendee() instanceof EE_Attendee ) {
430
-				$transaction->set_status( EEM_Transaction::incomplete_status_code );
431
-				$this->set_new_txn_status( EEM_Transaction::incomplete_status_code );
429
+			if ($transaction->primary_registration() instanceof EE_Registration && $transaction->primary_registration()->attendee() instanceof EE_Attendee) {
430
+				$transaction->set_status(EEM_Transaction::incomplete_status_code);
431
+				$this->set_new_txn_status(EEM_Transaction::incomplete_status_code);
432 432
 			} else {
433 433
 				// no contact record? yer abandoned!
434
-				$transaction->set_status( EEM_Transaction::abandoned_status_code );
435
-				$this->set_new_txn_status( EEM_Transaction::abandoned_status_code );
434
+				$transaction->set_status(EEM_Transaction::abandoned_status_code);
435
+				$this->set_new_txn_status(EEM_Transaction::abandoned_status_code);
436 436
 			}
437 437
 			return TRUE;
438 438
 		}
@@ -450,16 +450,16 @@  discard block
 block discarded – undo
450 450
 	 * @param array 	$registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction
451 451
 	 * 	@return 	boolean
452 452
 	 */
453
-	public function manually_update_registration_statuses( EE_Transaction $transaction, $new_reg_status = '', $registration_query_params = array() ) {
454
-		$status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'manually_update_registration_status', $transaction, $registration_query_params, $new_reg_status );
453
+	public function manually_update_registration_statuses(EE_Transaction $transaction, $new_reg_status = '', $registration_query_params = array()) {
454
+		$status_updates = $this->_call_method_on_registrations_via_Registration_Processor('manually_update_registration_status', $transaction, $registration_query_params, $new_reg_status);
455 455
 		// send messages
456 456
 		/** @type EE_Registration_Processor $registration_processor */
457
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
457
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
458 458
 		$registration_processor->trigger_registration_update_notifications(
459 459
 			$transaction->primary_registration(),
460
-			array( 'manually_updated' 	=> true )
460
+			array('manually_updated' 	=> true)
461 461
 		);
462
-		do_action( 'AHEE__EE_Transaction_Processor__manually_update_registration_statuses', $transaction, $status_updates );
462
+		do_action('AHEE__EE_Transaction_Processor__manually_update_registration_statuses', $transaction, $status_updates);
463 463
 		return $status_updates;
464 464
 	}
465 465
 
@@ -473,9 +473,9 @@  discard block
 block discarded – undo
473 473
 	 * @param array 	$registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction
474 474
 	 * 	@return 	boolean
475 475
 	 */
476
-	public function toggle_registration_statuses_for_default_approved_events( EE_Transaction $transaction, $registration_query_params = array() ) {
477
-		$status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'toggle_registration_status_for_default_approved_events', $transaction, $registration_query_params );
478
-		do_action( 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', $transaction, $status_updates );
476
+	public function toggle_registration_statuses_for_default_approved_events(EE_Transaction $transaction, $registration_query_params = array()) {
477
+		$status_updates = $this->_call_method_on_registrations_via_Registration_Processor('toggle_registration_status_for_default_approved_events', $transaction, $registration_query_params);
478
+		do_action('AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', $transaction, $status_updates);
479 479
 		return $status_updates;
480 480
 	}
481 481
 
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
 	 * @param array 	$registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction
490 490
 	 * 	@return 	boolean
491 491
 	 */
492
-	public function toggle_registration_statuses_if_no_monies_owing( EE_Transaction $transaction, $registration_query_params = array() ) {
493
-		$status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'toggle_registration_status_if_no_monies_owing', $transaction, $registration_query_params );
494
-		do_action( 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', $transaction, $status_updates );
492
+	public function toggle_registration_statuses_if_no_monies_owing(EE_Transaction $transaction, $registration_query_params = array()) {
493
+		$status_updates = $this->_call_method_on_registrations_via_Registration_Processor('toggle_registration_status_if_no_monies_owing', $transaction, $registration_query_params);
494
+		do_action('AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', $transaction, $status_updates);
495 495
 		return $status_updates;
496 496
 	}
497 497
 
@@ -507,17 +507,17 @@  discard block
 block discarded – undo
507 507
 	 * @throws \EE_Error
508 508
 	 * @return array
509 509
 	 */
510
-	public function update_transaction_and_registrations_after_checkout_or_payment( EE_Transaction $transaction, $payment = NULL, $registration_query_params = array() ) {
510
+	public function update_transaction_and_registrations_after_checkout_or_payment(EE_Transaction $transaction, $payment = NULL, $registration_query_params = array()) {
511 511
 		// set incoming TXN_Status, and consider it new since old status should have been set
512
-		$this->set_new_txn_status( $transaction->status_ID() );
513
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()' );
512
+		$this->set_new_txn_status($transaction->status_ID());
513
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()');
514 514
 		// make sure some query params are set for retrieving registrations
515
-		$this->_set_registration_query_params( $registration_query_params );
515
+		$this->_set_registration_query_params($registration_query_params);
516 516
 		// get final reg step status
517
-		$finalized = $this->final_reg_step_completed( $transaction );
517
+		$finalized = $this->final_reg_step_completed($transaction);
518 518
 		// if the 'finalize_registration' step has been initiated (has a timestamp) but has not yet been fully completed (TRUE)
519
-		if ( is_numeric( $finalized ) && $finalized !== true ) {
520
-			$this->set_reg_step_completed( $transaction, 'finalize_registration' );
519
+		if (is_numeric($finalized) && $finalized !== true) {
520
+			$this->set_reg_step_completed($transaction, 'finalize_registration');
521 521
 			$finalized = true;
522 522
 		}
523 523
 		$transaction->save();
@@ -540,13 +540,13 @@  discard block
 block discarded – undo
540 540
 
541 541
 		// send messages
542 542
 		/** @type EE_Registration_Processor $registration_processor */
543
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
543
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
544 544
 		$registration_processor->trigger_registration_update_notifications(
545 545
 			$transaction->primary_registration(),
546 546
 			$update_params
547 547
 		);
548 548
 
549
-		do_action( 'AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', $transaction, $update_params );
549
+		do_action('AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', $transaction, $update_params);
550 550
 		return $update_params;
551 551
 	}
552 552
 
@@ -564,23 +564,23 @@  discard block
 block discarded – undo
564 564
 	 * @throws \EE_Error
565 565
 	 * @return boolean
566 566
 	 */
567
-	private function _call_method_on_registrations_via_Registration_Processor( $method_name,  EE_Transaction $transaction, $registration_query_params = array(), $additional_param = NULL ) {
567
+	private function _call_method_on_registrations_via_Registration_Processor($method_name, EE_Transaction $transaction, $registration_query_params = array(), $additional_param = NULL) {
568 568
 		$response = FALSE;
569 569
 		/** @type EE_Registration_Processor $registration_processor */
570
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
570
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
571 571
 		// check that method exists
572
-		if ( ! method_exists( $registration_processor, $method_name )) {
573
-			throw new EE_Error( __( 'Method does not exist.', 'event_espresso' ));
572
+		if ( ! method_exists($registration_processor, $method_name)) {
573
+			throw new EE_Error(__('Method does not exist.', 'event_espresso'));
574 574
 		}
575 575
 		// make sure some query params are set for retrieving registrations
576
-		$this->_set_registration_query_params( $registration_query_params );
576
+		$this->_set_registration_query_params($registration_query_params);
577 577
 		// loop through cached registrations
578
-		foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) {
579
-			if ( $registration instanceof EE_Registration ) {
580
-				if ( $additional_param ) {
581
-					$response = $registration_processor->$method_name( $registration, $additional_param ) ? TRUE : $response;
578
+		foreach ($transaction->registrations($this->_registration_query_params) as $registration) {
579
+			if ($registration instanceof EE_Registration) {
580
+				if ($additional_param) {
581
+					$response = $registration_processor->$method_name($registration, $additional_param) ? TRUE : $response;
582 582
 				} else {
583
-					$response = $registration_processor->$method_name( $registration ) ? TRUE : $response;
583
+					$response = $registration_processor->$method_name($registration) ? TRUE : $response;
584 584
 				}
585 585
 			}
586 586
 		}
@@ -605,46 +605,46 @@  discard block
 block discarded – undo
605 605
 	public function set_transaction_payment_method_based_on_registration_statuses(
606 606
 		EE_Registration $edited_registration
607 607
 	) {
608
-		if ( $edited_registration instanceof EE_Registration ) {
608
+		if ($edited_registration instanceof EE_Registration) {
609 609
 			$transaction = $edited_registration->transaction();
610
-			if ( $transaction instanceof EE_Transaction ) {
610
+			if ($transaction instanceof EE_Transaction) {
611 611
 				$all_not_approved = true;
612
-				foreach ( $transaction->registrations() as $registration ) {
613
-					if ( $registration instanceof EE_Registration ) {
612
+				foreach ($transaction->registrations() as $registration) {
613
+					if ($registration instanceof EE_Registration) {
614 614
 						// if any REG != "Not Approved" then toggle to false
615 615
 						$all_not_approved = $registration->is_not_approved() ? $all_not_approved : false;
616 616
 					}
617 617
 				}
618 618
 				// if ALL Registrations are "Not Approved"
619
-				if ( $all_not_approved ) {
620
-					$transaction->set_payment_method_ID( null );
619
+				if ($all_not_approved) {
620
+					$transaction->set_payment_method_ID(null);
621 621
 					$transaction->save();
622 622
 				} else {
623
-					$available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart );
624
-					if ( ! empty( $available_payment_methods ) ) {
623
+					$available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart);
624
+					if ( ! empty($available_payment_methods)) {
625 625
 						$PMD_ID = 0;
626
-						foreach ( $available_payment_methods as $available_payment_method ) {
627
-							if ( $available_payment_method instanceof EE_Payment_Method && $available_payment_method->open_by_default() ) {
626
+						foreach ($available_payment_methods as $available_payment_method) {
627
+							if ($available_payment_method instanceof EE_Payment_Method && $available_payment_method->open_by_default()) {
628 628
 								$PMD_ID = $available_payment_method->ID();
629 629
 								break;
630 630
 							}
631 631
 						}
632
-						if ( ! $PMD_ID ) {
633
-							$first_payment_method = reset( $available_payment_methods );
634
-							if ( $first_payment_method instanceof EE_Payment_Method ) {
632
+						if ( ! $PMD_ID) {
633
+							$first_payment_method = reset($available_payment_methods);
634
+							if ($first_payment_method instanceof EE_Payment_Method) {
635 635
 								$PMD_ID = $first_payment_method->ID();
636 636
 							} else {
637 637
 								EE_Error::add_error(
638
-									__( 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso' ),
638
+									__('A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso'),
639 639
 									__FILE__, __LINE__, __FUNCTION__
640 640
 								);
641 641
 							}
642 642
 						}
643
-						$transaction->set_payment_method_ID( $PMD_ID );
643
+						$transaction->set_payment_method_ID($PMD_ID);
644 644
 						$transaction->save();
645 645
 					} else {
646 646
 						EE_Error::add_error(
647
-							__( 'Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso' ),
647
+							__('Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso'),
648 648
 							__FILE__, __LINE__, __FUNCTION__
649 649
 						);
650 650
 					}
Please login to merge, or discard this patch.
core/db_classes/EE_Registration.class.php 1 patch
Spacing   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * EE_Registration class
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	 *                             		    date_format and the second value is the time format
42 42
 	 * @return EE_Registration
43 43
 	 */
44
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
45
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
46
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
44
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
45
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
46
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
47 47
 	}
48 48
 
49 49
 
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 *                          		the website will be used.
55 55
 	 * @return EE_Registration
56 56
 	 */
57
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
58
-		return new self( $props_n_values, TRUE, $timezone );
57
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
58
+		return new self($props_n_values, TRUE, $timezone);
59 59
 	}
60 60
 
61 61
 
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	 * @access        public
67 67
 	 * @param        int $EVT_ID Event ID
68 68
 	 */
69
-	public function set_event( $EVT_ID = 0 ) {
70
-		$this->set( 'EVT_ID', $EVT_ID );
69
+	public function set_event($EVT_ID = 0) {
70
+		$this->set('EVT_ID', $EVT_ID);
71 71
 	}
72 72
 
73 73
 
@@ -78,18 +78,18 @@  discard block
 block discarded – undo
78 78
 	 * @param mixed  $field_value
79 79
 	 * @param bool   $use_default
80 80
 	 */
81
-	public function set( $field_name, $field_value, $use_default = FALSE ) {
82
-		switch( $field_name ) {
81
+	public function set($field_name, $field_value, $use_default = FALSE) {
82
+		switch ($field_name) {
83 83
 			case 'REG_code' :
84
-				if ( ! empty( $field_value ) && $this->reg_code() == '' ) {
85
-					$this->set_reg_code( $field_value, $use_default );
84
+				if ( ! empty($field_value) && $this->reg_code() == '') {
85
+					$this->set_reg_code($field_value, $use_default);
86 86
 				}
87 87
 				break;
88 88
 			case 'STS_ID' :
89
-				$this->set_status( $field_value, $use_default );
89
+				$this->set_status($field_value, $use_default);
90 90
 				break;
91 91
 			default :
92
-				parent::set( $field_name, $field_value, $use_default );
92
+				parent::set($field_name, $field_value, $use_default);
93 93
 		}
94 94
 	}
95 95
 
@@ -106,30 +106,30 @@  discard block
 block discarded – undo
106 106
 	 * @param boolean $use_default
107 107
 	 * @return bool
108 108
 	 */
109
-	public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) {
109
+	public function set_status($new_STS_ID = NULL, $use_default = FALSE) {
110 110
 		// get current REG_Status
111 111
 		$old_STS_ID = $this->status_ID();
112 112
 		// if status has changed
113
-		if ( $old_STS_ID != $new_STS_ID  ) {
113
+		if ($old_STS_ID != $new_STS_ID) {
114 114
 			// TO approved
115
-			if ( $new_STS_ID == EEM_Registration::status_id_approved ) {
115
+			if ($new_STS_ID == EEM_Registration::status_id_approved) {
116 116
 				// reserve a space by incrementing ticket and datetime sold values
117 117
 				$this->_reserve_registration_space();
118
-				do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID );
118
+				do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID);
119 119
 			// OR FROM  approved
120
-			} else if ( $old_STS_ID == EEM_Registration::status_id_approved ) {
120
+			} else if ($old_STS_ID == EEM_Registration::status_id_approved) {
121 121
 				// release a space by decrementing ticket and datetime sold values
122 122
 				$this->_release_registration_space();
123
-				do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID );
123
+				do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID);
124 124
 			}
125 125
 			// update status
126
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
127
-			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
126
+			parent::set('STS_ID', $new_STS_ID, $use_default);
127
+			do_action('AHEE__EE_Registration__set_status__after_update', $this);
128 128
 			return TRUE;
129
-		}else{
129
+		} else {
130 130
 			//even though the old value matches the new value, it's still good to
131 131
 			//allow the parent set method to have a say
132
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
132
+			parent::set('STS_ID', $new_STS_ID, $use_default);
133 133
 			return TRUE;
134 134
 		}
135 135
 	}
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @access        public
142 142
 	 */
143 143
 	public function status_ID() {
144
-		return $this->get( 'STS_ID' );
144
+		return $this->get('STS_ID');
145 145
 	}
146 146
 
147 147
 
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
 	 * @param boolean $include_archived whether to include archived tickets or not.
167 167
 	 * @return EE_Ticket
168 168
 	 */
169
-	public function ticket( $include_archived = TRUE ) {
169
+	public function ticket($include_archived = TRUE) {
170 170
 		$query_params = array();
171
-		if ( $include_archived ) {
172
-			$query_params[ 'default_where_conditions' ] = 'none';
171
+		if ($include_archived) {
172
+			$query_params['default_where_conditions'] = 'none';
173 173
 		}
174
-		return $this->get_first_related( 'Ticket', $query_params );
174
+		return $this->get_first_related('Ticket', $query_params);
175 175
 	}
176 176
 
177 177
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @return EE_Event
182 182
 	 */
183 183
 	public function event() {
184
-		return $this->get_first_related( 'Event' );
184
+		return $this->get_first_related('Event');
185 185
 	}
186 186
 
187 187
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	public function wp_user() {
197 197
 		$event = $this->event();
198
-		if ( $event instanceof EE_Event ) {
198
+		if ($event instanceof EE_Event) {
199 199
 			return $event->wp_user();
200 200
 		}
201 201
 		return 0;
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 * @access        public
222 222
 	 * @param        int $ATT_ID Attendee ID
223 223
 	 */
224
-	public function set_attendee_id( $ATT_ID = 0 ) {
225
-		$this->set( 'ATT_ID', $ATT_ID );
224
+	public function set_attendee_id($ATT_ID = 0) {
225
+		$this->set('ATT_ID', $ATT_ID);
226 226
 	}
227 227
 
228 228
 
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @access        public
234 234
 	 * @param        int $TXN_ID Transaction ID
235 235
 	 */
236
-	public function set_transaction_id( $TXN_ID = 0 ) {
237
-		$this->set( 'TXN_ID', $TXN_ID );
236
+	public function set_transaction_id($TXN_ID = 0) {
237
+		$this->set('TXN_ID', $TXN_ID);
238 238
 	}
239 239
 
240 240
 
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
 	 * @access    public
246 246
 	 * @param    string $REG_session PHP Session ID
247 247
 	 */
248
-	public function set_session( $REG_session = '' ) {
249
-		$this->set( 'REG_session', $REG_session );
248
+	public function set_session($REG_session = '') {
249
+		$this->set('REG_session', $REG_session);
250 250
 	}
251 251
 
252 252
 
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 	 * @access    public
258 258
 	 * @param    string $REG_url_link Registration URL Link
259 259
 	 */
260
-	public function set_reg_url_link( $REG_url_link = '' ) {
261
-		$this->set( 'REG_url_link', $REG_url_link );
260
+	public function set_reg_url_link($REG_url_link = '') {
261
+		$this->set('REG_url_link', $REG_url_link);
262 262
 	}
263 263
 
264 264
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	 * @access        public
270 270
 	 * @param        int $REG_count Primary Attendee
271 271
 	 */
272
-	public function set_count( $REG_count = 1 ) {
273
-		$this->set( 'REG_count', $REG_count );
272
+	public function set_count($REG_count = 1) {
273
+		$this->set('REG_count', $REG_count);
274 274
 	}
275 275
 
276 276
 
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 	 * @access        public
282 282
 	 * @param        boolean $REG_group_size Group Registration
283 283
 	 */
284
-	public function set_group_size( $REG_group_size = FALSE ) {
285
-		$this->set( 'REG_group_size', $REG_group_size );
284
+	public function set_group_size($REG_group_size = FALSE) {
285
+		$this->set('REG_group_size', $REG_group_size);
286 286
 	}
287 287
 
288 288
 
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 	 * @access        public
366 366
 	 * @param        mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date
367 367
 	 */
368
-	public function set_reg_date( $REG_date = FALSE ) {
369
-		$this->set( 'REG_date', $REG_date );
368
+	public function set_reg_date($REG_date = FALSE) {
369
+		$this->set('REG_date', $REG_date);
370 370
 	}
371 371
 
372 372
 
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	 * @access    public
378 378
 	 * @param    float $REG_final_price
379 379
 	 */
380
-	public function set_final_price( $REG_final_price = 0.00 ) {
381
-		$this->set( 'REG_final_price', $REG_final_price );
380
+	public function set_final_price($REG_final_price = 0.00) {
381
+		$this->set('REG_final_price', $REG_final_price);
382 382
 	}
383 383
 
384 384
 
@@ -389,8 +389,8 @@  discard block
 block discarded – undo
389 389
 	 * @access    public
390 390
 	 * @param    float $REG_paid
391 391
 	 */
392
-	public function set_paid( $REG_paid = 0.00 ) {
393
-		$this->set( 'REG_paid', $REG_paid );
392
+	public function set_paid($REG_paid = 0.00) {
393
+		$this->set('REG_paid', $REG_paid);
394 394
 	}
395 395
 
396 396
 
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
 	 * @access        public
402 402
 	 * @param        boolean $REG_att_is_going Attendee Is Going
403 403
 	 */
404
-	public function set_att_is_going( $REG_att_is_going = FALSE ) {
405
-		$this->set( 'REG_att_is_going', $REG_att_is_going );
404
+	public function set_att_is_going($REG_att_is_going = FALSE) {
405
+		$this->set('REG_att_is_going', $REG_att_is_going);
406 406
 	}
407 407
 
408 408
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * @return EE_Attendee
413 413
 	 */
414 414
 	public function attendee() {
415
-		return $this->get_first_related( 'Attendee' );
415
+		return $this->get_first_related('Attendee');
416 416
 	}
417 417
 
418 418
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 * @access        public
423 423
 	 */
424 424
 	public function event_ID() {
425
-		return $this->get( 'EVT_ID' );
425
+		return $this->get('EVT_ID');
426 426
 	}
427 427
 
428 428
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	 */
434 434
 	public function event_name() {
435 435
 		$event = $this->event_obj();
436
-		if ( $event ) {
436
+		if ($event) {
437 437
 			return $event->name();
438 438
 		} else {
439 439
 			return NULL;
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 * @return EE_Event
448 448
 	 */
449 449
 	public function event_obj() {
450
-		return $this->get_first_related( 'Event' );
450
+		return $this->get_first_related('Event');
451 451
 	}
452 452
 
453 453
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 * @access        public
458 458
 	 */
459 459
 	public function attendee_ID() {
460
-		return $this->get( 'ATT_ID' );
460
+		return $this->get('ATT_ID');
461 461
 	}
462 462
 
463 463
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 	 * @access        public
468 468
 	 */
469 469
 	public function session_ID() {
470
-		return $this->get( 'REG_session' );
470
+		return $this->get('REG_session');
471 471
 	}
472 472
 
473 473
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
478 478
 	 * @return string
479 479
 	 */
480
-	public function receipt_url( $messenger = 'html' ) {
480
+	public function receipt_url($messenger = 'html') {
481 481
 
482 482
 		/**
483 483
 		 * 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.
@@ -486,12 +486,12 @@  discard block
 block discarded – undo
486 486
 		 */
487 487
 		EE_Registry::instance()->load_helper('Template');
488 488
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php';
489
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
489
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
490 490
 
491
-		if ( $has_custom ) {
492
-			return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) );
491
+		if ($has_custom) {
492
+			return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch'));
493 493
 		}
494
-		return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' );
494
+		return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt');
495 495
 	}
496 496
 
497 497
 
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
503 503
 	 * @return string
504 504
 	 */
505
-	public function invoice_url( $messenger = 'html' ) {
505
+	public function invoice_url($messenger = 'html') {
506 506
 		/**
507 507
 		 * 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.
508 508
 		 *
@@ -510,21 +510,21 @@  discard block
 block discarded – undo
510 510
 		 */
511 511
 		EE_Registry::instance()->load_helper('Template');
512 512
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php';
513
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
513
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
514 514
 
515
-		if ( $has_custom ) {
516
-			if ( $messenger == 'html' ) {
517
-				return $this->invoice_url( 'launch' );
515
+		if ($has_custom) {
516
+			if ($messenger == 'html') {
517
+				return $this->invoice_url('launch');
518 518
 			}
519 519
 			$route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice';
520 520
 
521
-			$query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() );
522
-			if ( $messenger == 'html' ) {
521
+			$query_args = array('ee' => $route, 'id' => $this->reg_url_link());
522
+			if ($messenger == 'html') {
523 523
 				$query_args['html'] = TRUE;
524 524
 			}
525
-			return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) );
525
+			return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
526 526
 		}
527
-		return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' );
527
+		return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice');
528 528
 	}
529 529
 
530 530
 
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 	 * @access        public
535 535
 	 */
536 536
 	public function reg_url_link() {
537
-		return $this->get( 'REG_url_link' );
537
+		return $this->get('REG_url_link');
538 538
 	}
539 539
 
540 540
 
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	 * @param string $type 'download','launch', or 'html' (default is 'launch')
545 545
 	 * @return void
546 546
 	 */
547
-	public function e_invoice_url( $type = 'launch' ) {
548
-		echo $this->invoice_url( $type );
547
+	public function e_invoice_url($type = 'launch') {
548
+		echo $this->invoice_url($type);
549 549
 	}
550 550
 
551 551
 
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 	 * @return string
566 566
 	 */
567 567
 	public function payment_overview_url() {
568
-		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() );
568
+		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());
569 569
 	}
570 570
 
571 571
 
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	 * @return string
577 577
 	 */
578 578
 	public function edit_attendee_information_url() {
579
-		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() );
579
+		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());
580 580
 	}
581 581
 
582 582
 
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
 	 * @return string
587 587
 	 */
588 588
 	public function get_admin_edit_url() {
589
-		EE_Registry::instance()->load_helper( 'URL' );
590
-		return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) );
589
+		EE_Registry::instance()->load_helper('URL');
590
+		return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php'));
591 591
 	}
592 592
 
593 593
 
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 	 * @access        public
598 598
 	 */
599 599
 	public function is_primary_registrant() {
600
-		return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE;
600
+		return $this->get('REG_count') == 1 ? TRUE : FALSE;
601 601
 	}
602 602
 
603 603
 
@@ -606,12 +606,12 @@  discard block
 block discarded – undo
606 606
 	 * This returns the primary registration object for this registration group (which may be this object).
607 607
 	 * @return EE_Registration
608 608
 	 */
609
-	public function get_primary_registration()  {
610
-		if ( $this->is_primary_registrant() )
609
+	public function get_primary_registration() {
610
+		if ($this->is_primary_registrant())
611 611
 			return $this;
612 612
 
613 613
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
614
-		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
614
+		$primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1)));
615 615
 		return $primary_registrant;
616 616
 	}
617 617
 
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	* 		@access		public
623 623
 	*/
624 624
 	public function count() {
625
-		return $this->get( 'REG_count' );
625
+		return $this->get('REG_count');
626 626
 	}
627 627
 
628 628
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 	 * @access        public
633 633
 	 */
634 634
 	public function group_size() {
635
-		return $this->get( 'REG_group_size' );
635
+		return $this->get('REG_group_size');
636 636
 	}
637 637
 
638 638
 
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 	 * @access        public
643 643
 	 */
644 644
 	public function date() {
645
-		return $this->get( 'REG_date' );
645
+		return $this->get('REG_date');
646 646
 	}
647 647
 
648 648
 
@@ -653,8 +653,8 @@  discard block
 block discarded – undo
653 653
 	 * @param string $time_format
654 654
 	 * @return string
655 655
 	 */
656
-	public function pretty_date( $date_format = NULL, $time_format = NULL ) {
657
-		return $this->get_datetime( 'REG_date', $date_format, $time_format );
656
+	public function pretty_date($date_format = NULL, $time_format = NULL) {
657
+		return $this->get_datetime('REG_date', $date_format, $time_format);
658 658
 	}
659 659
 
660 660
 
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 	 * @return    float
668 668
 	 */
669 669
 	public function final_price() {
670
-		return $this->get( 'REG_final_price' );
670
+		return $this->get('REG_final_price');
671 671
 	}
672 672
 
673 673
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 	 * @return string
679 679
 	 */
680 680
 	public function pretty_final_price() {
681
-		return $this->get_pretty( 'REG_final_price' );
681
+		return $this->get_pretty('REG_final_price');
682 682
 	}
683 683
 
684 684
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 	 * @return 	float
690 690
 	 */
691 691
 	public function paid() {
692
-		return $this->get( 'REG_paid' );
692
+		return $this->get('REG_paid');
693 693
 	}
694 694
 
695 695
 
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 	 * @return 	float
701 701
 	 */
702 702
 	public function pretty_paid() {
703
-		return $this->get_pretty( 'REG_paid' );
703
+		return $this->get_pretty('REG_paid');
704 704
 	}
705 705
 
706 706
 
@@ -712,11 +712,11 @@  discard block
 block discarded – undo
712 712
 	 * @param array $requires_payment
713 713
 	 * @return bool
714 714
 	 */
715
-	public function owes_monies_and_can_pay( $requires_payment = array()) {
715
+	public function owes_monies_and_can_pay($requires_payment = array()) {
716 716
 		// these reg statuses require payment (if event is not free)
717
-		$requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
717
+		$requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
718 718
 		if (
719
-			in_array( $this->status_ID(), $requires_payment ) &&
719
+			in_array($this->status_ID(), $requires_payment) &&
720 720
 			$this->final_price() != 0 &&
721 721
 			$this->final_price() != $this->paid()
722 722
 		) {
@@ -733,8 +733,8 @@  discard block
 block discarded – undo
733 733
 	 * @param bool $show_icons
734 734
 	 * @return void
735 735
 	 */
736
-	public function e_pretty_status( $show_icons = FALSE ) {
737
-		echo $this->pretty_status( $show_icons );
736
+	public function e_pretty_status($show_icons = FALSE) {
737
+		echo $this->pretty_status($show_icons);
738 738
 	}
739 739
 
740 740
 
@@ -745,10 +745,10 @@  discard block
 block discarded – undo
745 745
 	 * @param bool $show_icons
746 746
 	 * @return string
747 747
 	 */
748
-	public function pretty_status( $show_icons = FALSE ) {
749
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
748
+	public function pretty_status($show_icons = FALSE) {
749
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
750 750
 		$icon = '';
751
-		switch ( $this->status_ID() ) {
751
+		switch ($this->status_ID()) {
752 752
 			case EEM_Registration::status_id_approved:
753 753
 				$icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : '';
754 754
 				break;
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 				$icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : '';
769 769
 				break;
770 770
 		}
771
-		return $icon . $status[ $this->status_ID() ];
771
+		return $icon.$status[$this->status_ID()];
772 772
 	}
773 773
 
774 774
 
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 	 * @access        public
779 779
 	 */
780 780
 	public function att_is_going() {
781
-		return $this->get( 'REG_att_is_going' );
781
+		return $this->get('REG_att_is_going');
782 782
 	}
783 783
 
784 784
 
@@ -788,8 +788,8 @@  discard block
 block discarded – undo
788 788
 	 * @param array $query_params like EEM_Base::get_all
789 789
 	 * @return EE_Answer[]
790 790
 	 */
791
-	public function answers( $query_params = NULL ) {
792
-		return $this->get_many_related( 'Answer', $query_params );
791
+	public function answers($query_params = NULL) {
792
+		return $this->get_many_related('Answer', $query_params);
793 793
 	}
794 794
 
795 795
 
@@ -803,9 +803,9 @@  discard block
 block discarded – undo
803 803
 	 * (because the answer might be an array of answer values, so passing pretty_value=true
804 804
 	 * will convert it into some kind of string)
805 805
 	 */
806
-	public function answer_value_to_question( $question, $pretty_value=true ) {
806
+	public function answer_value_to_question($question, $pretty_value = true) {
807 807
 		$question_id = EEM_Question::instance()->ensure_is_ID($question);
808
-		return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value);
808
+		return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value);
809 809
 	}
810 810
 
811 811
 
@@ -818,13 +818,13 @@  discard block
 block discarded – undo
818 818
 	 */
819 819
 	public function question_groups() {
820 820
 		$question_groups = array();
821
-		if ( $this->event() instanceof EE_Event ) {
821
+		if ($this->event() instanceof EE_Event) {
822 822
 			$question_groups = $this->event()->question_groups(
823 823
 				array(
824 824
 					array(
825 825
 						'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false
826 826
 					),
827
-					'order_by' => array( 'QSG_order' => 'ASC' )
827
+					'order_by' => array('QSG_order' => 'ASC')
828 828
 				)
829 829
 			);
830 830
 		}
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 	 */
842 842
 	public function count_question_groups() {
843 843
 		$qg_count = 0;
844
-		if ( $this->event() instanceof EE_Event ) {
844
+		if ($this->event() instanceof EE_Event) {
845 845
 			$qg_count = $this->event()->count_related(
846 846
 				'Question_Group',
847 847
 				array(
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 	 * @return string
863 863
 	 */
864 864
 	public function reg_date() {
865
-		return $this->get_datetime( 'REG_date' );
865
+		return $this->get_datetime('REG_date');
866 866
 	}
867 867
 
868 868
 
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 	 * @return EE_Datetime_Ticket
875 875
 	 */
876 876
 	public function datetime_ticket() {
877
-		return $this->get_first_related( 'Datetime_Ticket' );
877
+		return $this->get_first_related('Datetime_Ticket');
878 878
 	}
879 879
 
880 880
 
@@ -884,15 +884,15 @@  discard block
 block discarded – undo
884 884
 	 * @param EE_Datetime_Ticket $datetime_ticket
885 885
 	 * @return EE_Datetime_Ticket
886 886
 	 */
887
-	public function set_datetime_ticket( $datetime_ticket ) {
888
-		return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' );
887
+	public function set_datetime_ticket($datetime_ticket) {
888
+		return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket');
889 889
 	}
890 890
 	/**
891 891
 	 * Gets deleted
892 892
 	 * @return boolean
893 893
 	 */
894 894
 	public function deleted() {
895
-		return $this->get( 'REG_deleted' );
895
+		return $this->get('REG_deleted');
896 896
 	}
897 897
 
898 898
 	/**
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 	 * @return boolean
902 902
 	 */
903 903
 	public function set_deleted($deleted) {
904
-		$this->set( 'REG_deleted', $deleted );
904
+		$this->set('REG_deleted', $deleted);
905 905
 	}
906 906
 
907 907
 
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
 	 * @return EE_Status
912 912
 	 */
913 913
 	public function status_obj() {
914
-		return $this->get_first_related( 'Status' );
914
+		return $this->get_first_related('Status');
915 915
 	}
916 916
 
917 917
 
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 	 * @return int
923 923
 	 */
924 924
 	public function count_checkins() {
925
-		return $this->get_model()->count_related( $this, 'Checkin' );
925
+		return $this->get_model()->count_related($this, 'Checkin');
926 926
 	}
927 927
 
928 928
 
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 	 * @return int
933 933
 	 */
934 934
 	public function count_checkins_not_checkedout() {
935
-		return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) );
935
+		return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1)));
936 936
 	}
937 937
 
938 938
 
@@ -945,20 +945,20 @@  discard block
 block discarded – undo
945 945
 	 *
946 946
 	 * @return bool
947 947
 	 */
948
-	public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) {
949
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
948
+	public function can_checkin($DTT_OR_ID, $check_approved = TRUE) {
949
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
950 950
 
951 951
 		//first check registration status
952
-		if (  ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) {
952
+		if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) {
953 953
 			return false;
954 954
 		}
955 955
 		//is there a datetime ticket that matches this dtt_ID?
956
-		if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) {
956
+		if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) {
957 957
 			return false;
958 958
 		}
959 959
 
960 960
 		//final check is against TKT_uses
961
-		return $this->verify_can_checkin_against_TKT_uses( $DTT_ID );
961
+		return $this->verify_can_checkin_against_TKT_uses($DTT_ID);
962 962
 	}
963 963
 
964 964
 
@@ -971,10 +971,10 @@  discard block
 block discarded – undo
971 971
 	 * @param int | EE_Datetime  $DTT_OR_ID  The datetime the registration is being checked against
972 972
 	 * @return bool   true means can checkin.  false means cannot checkin.
973 973
 	 */
974
-	public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) {
975
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
974
+	public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) {
975
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
976 976
 
977
-		if ( ! $DTT_ID ) {
977
+		if ( ! $DTT_ID) {
978 978
 			return false;
979 979
 		}
980 980
 
@@ -982,23 +982,23 @@  discard block
 block discarded – undo
982 982
 
983 983
 		// if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in
984 984
 		// or not.
985
-		if ( ! $max_uses || $max_uses === EE_INF ) {
985
+		if ( ! $max_uses || $max_uses === EE_INF) {
986 986
 			return true;
987 987
 		}
988 988
 
989 989
 		//does this datetime have a checkin record?  If so, then the dtt count has already been verified so we can just
990 990
 		//go ahead and toggle.
991
-		if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) {
991
+		if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) {
992 992
 			return true;
993 993
 		}
994 994
 
995 995
 		//made it here so the last check is whether the number of checkins per unique datetime on this registration
996 996
 		//disallows further check-ins.
997
-		$count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true );
997
+		$count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true);
998 998
 		// checkins have already reached their max number of uses
999 999
 		// so registrant can NOT checkin
1000
-		if ( $count_unique_dtt_checkins >= $max_uses ) {
1001
-			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__ );
1000
+		if ($count_unique_dtt_checkins >= $max_uses) {
1001
+			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__);
1002 1002
 			return false;
1003 1003
 		}
1004 1004
 		return true;
@@ -1019,15 +1019,15 @@  discard block
 block discarded – undo
1019 1019
 	 * @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.
1020 1020
 	 * @return int|BOOL            the chk_in status toggled to OR false if nothing got changed.
1021 1021
 	 */
1022
-	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
1023
-		if ( empty( $DTT_ID ) ) {
1022
+	public function toggle_checkin_status($DTT_ID = null, $verify = false) {
1023
+		if (empty($DTT_ID)) {
1024 1024
 			$datetime = $this->get_related_primary_datetime();
1025 1025
 			$DTT_ID = $datetime->ID();
1026 1026
 		// verify the registration can checkin for the given DTT_ID
1027
-		} elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) {
1027
+		} elseif ( ! $this->can_checkin($DTT_ID, $verify)) {
1028 1028
 			EE_Error::add_error(
1029 1029
 					sprintf(
1030
-						__( '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'),
1030
+						__('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'),
1031 1031
 						$this->ID(),
1032 1032
 						$DTT_ID
1033 1033
 					),
@@ -1041,8 +1041,8 @@  discard block
 block discarded – undo
1041 1041
 			EE_Registration::checkin_status_out => EE_Registration::checkin_status_in
1042 1042
 		);
1043 1043
 		//start by getting the current status so we know what status we'll be changing to.
1044
-		$cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL );
1045
-		$status_to = $status_paths[ $cur_status ];
1044
+		$cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL);
1045
+		$status_to = $status_paths[$cur_status];
1046 1046
 		// database only records true for checked IN or false for checked OUT
1047 1047
 		// no record ( null ) means checked in NEVER, but we obviously don't save that
1048 1048
 		$new_status = $status_to == EE_Registration::checkin_status_in ? true : false;
@@ -1050,24 +1050,24 @@  discard block
 block discarded – undo
1050 1050
 		// because we are keeping track of Check-ins over time.
1051 1051
 		// Eventually we'll probably want to show a list table
1052 1052
 		// for the individual Check-ins so that they can be managed.
1053
-		$checkin = EE_Checkin::new_instance( array(
1053
+		$checkin = EE_Checkin::new_instance(array(
1054 1054
 				'REG_ID' => $this->ID(),
1055 1055
 				'DTT_ID' => $DTT_ID,
1056 1056
 				'CHK_in' => $new_status
1057
-		) );
1057
+		));
1058 1058
 		// if the record could not be saved then return false
1059
-		if ( $checkin->save() === 0 ) {
1060
-			if ( WP_DEBUG ) {
1059
+		if ($checkin->save() === 0) {
1060
+			if (WP_DEBUG) {
1061 1061
 				global $wpdb;
1062 1062
 				$error = sprintf(
1063
-					__( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ),
1063
+					__('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'),
1064 1064
 					'<br />',
1065 1065
 					$wpdb->last_error
1066 1066
 				);
1067 1067
 			} else {
1068
-				$error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' );
1068
+				$error = __('Registration check in update failed because of an unknown database error', 'event_espresso');
1069 1069
 			}
1070
-			EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
1070
+			EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
1071 1071
 			return false;
1072 1072
 		}
1073 1073
 		return $status_to;
@@ -1091,19 +1091,19 @@  discard block
 block discarded – undo
1091 1091
 	 * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1092 1092
 	 * @return int            Integer representing Check-in status.
1093 1093
 	 */
1094
-	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) {
1095
-		if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) {
1094
+	public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) {
1095
+		if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) {
1096 1096
 			$datetime = $this->get_related_primary_datetime();
1097
-			if ( ! $datetime instanceof EE_Datetime ) {
1097
+			if ( ! $datetime instanceof EE_Datetime) {
1098 1098
 				return 0;
1099 1099
 			}
1100 1100
 			$DTT_ID = $datetime->ID();
1101 1101
 		//verify the registration can checkin for the given DTT_ID
1102 1102
 		}
1103 1103
 		//get checkin object (if exists)
1104
-		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) );
1105
-		if ( $checkin instanceof EE_Checkin ) {
1106
-			if ( $checkin->get( 'CHK_in' ) ) {
1104
+		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC')));
1105
+		if ($checkin instanceof EE_Checkin) {
1106
+			if ($checkin->get('CHK_in')) {
1107 1107
 				return EE_Registration::checkin_status_in; //checked in
1108 1108
 			} else {
1109 1109
 				return EE_Registration::checkin_status_out; //had checked in but is now checked out.
@@ -1121,28 +1121,28 @@  discard block
 block discarded – undo
1121 1121
 	 * @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.
1122 1122
 	 * @return string         internationalized message
1123 1123
 	 */
1124
-	public function get_checkin_msg( $DTT_ID, $error = FALSE ) {
1124
+	public function get_checkin_msg($DTT_ID, $error = FALSE) {
1125 1125
 		//let's get the attendee first so we can include the name of the attendee
1126
-		$attendee = $this->get_first_related( 'Attendee' );
1127
-		if ( $attendee instanceof EE_Attendee ) {
1128
-			if ( $error ) {
1129
-				return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() );
1126
+		$attendee = $this->get_first_related('Attendee');
1127
+		if ($attendee instanceof EE_Attendee) {
1128
+			if ($error) {
1129
+				return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name());
1130 1130
 			}
1131
-			$cur_status = $this->check_in_status_for_datetime( $DTT_ID );
1131
+			$cur_status = $this->check_in_status_for_datetime($DTT_ID);
1132 1132
 			//what is the status message going to be?
1133
-			switch ( $cur_status ) {
1133
+			switch ($cur_status) {
1134 1134
 				case EE_Registration::checkin_status_never :
1135
-					return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() );
1135
+					return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name());
1136 1136
 					break;
1137 1137
 				case EE_Registration::checkin_status_in :
1138
-					return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() );
1138
+					return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name());
1139 1139
 					break;
1140 1140
 				case EE_Registration::checkin_status_out :
1141
-					return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() );
1141
+					return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name());
1142 1142
 					break;
1143 1143
 			}
1144 1144
 		}
1145
-		return __( "The check-in status could not be determined.", "event_espresso" );
1145
+		return __("The check-in status could not be determined.", "event_espresso");
1146 1146
 	}
1147 1147
 
1148 1148
 
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 	 * @return EE_Transaction
1153 1153
 	 */
1154 1154
 	public function transaction() {
1155
-		return $this->get_first_related( 'Transaction' );
1155
+		return $this->get_first_related('Transaction');
1156 1156
 	}
1157 1157
 
1158 1158
 
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
 	 * @access        public
1164 1164
 	 */
1165 1165
 	public function reg_code() {
1166
-		return $this->get( 'REG_code' );
1166
+		return $this->get('REG_code');
1167 1167
 	}
1168 1168
 
1169 1169
 
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
 	 * @access        public
1174 1174
 	 */
1175 1175
 	public function transaction_ID() {
1176
-		return $this->get( 'TXN_ID' );
1176
+		return $this->get('TXN_ID');
1177 1177
 	}
1178 1178
 
1179 1179
 
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 	 * @return int
1183 1183
 	 */
1184 1184
 	public function ticket_ID() {
1185
-		return $this->get( 'TKT_ID' );
1185
+		return $this->get('TKT_ID');
1186 1186
 	}
1187 1187
 
1188 1188
 
@@ -1194,17 +1194,17 @@  discard block
 block discarded – undo
1194 1194
 	 * @param    string $REG_code Registration Code
1195 1195
 	 * @param	boolean $use_default
1196 1196
 	 */
1197
-	public function set_reg_code( $REG_code, $use_default = FALSE ) {
1198
-		if ( empty( $REG_code )) {
1199
-			EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1197
+	public function set_reg_code($REG_code, $use_default = FALSE) {
1198
+		if (empty($REG_code)) {
1199
+			EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1200 1200
 			return;
1201 1201
 		}
1202
-		if ( ! $this->reg_code() ) {
1203
-			parent::set( 'REG_code', $REG_code, $use_default );
1202
+		if ( ! $this->reg_code()) {
1203
+			parent::set('REG_code', $REG_code, $use_default);
1204 1204
 		} else {
1205 1205
 			EE_Error::doing_it_wrong(
1206
-				__CLASS__ . '::' . __FUNCTION__,
1207
-				__( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ),
1206
+				__CLASS__.'::'.__FUNCTION__,
1207
+				__('Can not change a registration REG_code once it has been set.', 'event_espresso'),
1208 1208
 				'4.6.0'
1209 1209
 			);
1210 1210
 		}
@@ -1224,17 +1224,17 @@  discard block
 block discarded – undo
1224 1224
 	 * @return EE_Registration[]  or empty array if this isn't a group registration.
1225 1225
 	 */
1226 1226
 	public function get_all_other_registrations_in_group() {
1227
-		if ( $this->group_size() < 2 ) {
1227
+		if ($this->group_size() < 2) {
1228 1228
 			return array();
1229 1229
 		}
1230 1230
 
1231 1231
 		$query[0] = array(
1232 1232
 			'TXN_ID' => $this->transaction_ID(),
1233
-			'REG_ID' => array( '!=', $this->ID() ),
1233
+			'REG_ID' => array('!=', $this->ID()),
1234 1234
 			'TKT_ID' => $this->ticket_ID()
1235 1235
 			);
1236 1236
 
1237
-		$registrations = $this->get_model()->get_all( $query );
1237
+		$registrations = $this->get_model()->get_all($query);
1238 1238
 		return $registrations;
1239 1239
 	}
1240 1240
 
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
 	 * @access 	public
1247 1247
 	 */
1248 1248
 	public function price_paid() {
1249
-		EE_Error::doing_it_wrong( 'EE_Registration::price_paid()', __( 'This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso' ), '4.7.0' );
1249
+		EE_Error::doing_it_wrong('EE_Registration::price_paid()', __('This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso'), '4.7.0');
1250 1250
 		return $this->final_price();
1251 1251
 	}
1252 1252
 
@@ -1258,9 +1258,9 @@  discard block
 block discarded – undo
1258 1258
 	 * @access    public
1259 1259
 	 * @param    float $REG_final_price
1260 1260
 	 */
1261
-	public function set_price_paid( $REG_final_price = 0.00 ) {
1262
-		EE_Error::doing_it_wrong( 'EE_Registration::set_price_paid()', __( 'This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso' ), '4.7.0' );
1263
-		$this->set_final_price( $REG_final_price );
1261
+	public function set_price_paid($REG_final_price = 0.00) {
1262
+		EE_Error::doing_it_wrong('EE_Registration::set_price_paid()', __('This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso'), '4.7.0');
1263
+		$this->set_final_price($REG_final_price);
1264 1264
 	}
1265 1265
 
1266 1266
 
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
 	 * @return string
1272 1272
 	 */
1273 1273
 	public function pretty_price_paid() {
1274
-		EE_Error::doing_it_wrong( 'EE_Registration::pretty_price_paid()', __( 'This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso' ), '4.7.0' );
1274
+		EE_Error::doing_it_wrong('EE_Registration::pretty_price_paid()', __('This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso'), '4.7.0');
1275 1275
 		return $this->pretty_final_price();
1276 1276
 	}
1277 1277
 
Please login to merge, or discard this patch.
modules/add_new_state/EED_Add_New_State.module.php 1 patch
Spacing   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	 * @return EED_Add_New_State
17 17
 	 */
18 18
 	public static function instance() {
19
-		return parent::get_instance( __CLASS__ );
19
+		return parent::get_instance(__CLASS__);
20 20
 	}
21 21
 
22 22
 
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 	 *  	@return 		void
28 28
 	 */
29 29
 	public static function set_hooks() {
30
-		add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 );
31
-		add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'translate_js_strings' ), 0 );
32
-		add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'wp_enqueue_scripts' ), 10 );
33
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
34
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
35
-		add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 );
36
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 );
37
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 );
38
-		add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 );
39
-		add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 );
30
+		add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2);
31
+		add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 0);
32
+		add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10);
33
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
34
+		add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
35
+		add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1);
36
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5);
37
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5);
38
+		add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1);
39
+		add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1);
40 40
 	}
41 41
 
42 42
 	/**
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
 	 *  	@return 		void
47 47
 	 */
48 48
 	public static function set_hooks_admin() {
49
-		add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 );
50
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
51
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
52
-		add_action( 'wp_ajax_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' ));
53
-		add_action( 'wp_ajax_nopriv_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' ));
54
-		add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 );
55
-		add_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 );
56
-		add_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 );
57
-		add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 );
58
-		add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 );
59
-		add_filter( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', array( 'EED_Add_New_State', 'filter_checkout_request_params' ), 10, 1 );
60
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 );
61
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 );
49
+		add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2);
50
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
51
+		add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
52
+		add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state'));
53
+		add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state'));
54
+		add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1);
55
+		add_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array('EED_Add_New_State', 'update_country_settings'), 10, 3);
56
+		add_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array('EED_Add_New_State', 'update_country_settings'), 10, 3);
57
+		add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1);
58
+		add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1);
59
+		add_filter('FHEE__Single_Page_Checkout___check_form_submission__request_params', array('EED_Add_New_State', 'filter_checkout_request_params'), 10, 1);
60
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5);
61
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5);
62 62
 	}
63 63
 
64 64
 
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	 *  	@return 		void
71 71
 	 */
72 72
 	public static function set_definitions() {
73
-		define( 'ANS_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
74
-		define( 'ANS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
73
+		define('ANS_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
74
+		define('ANS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
75 75
 	}
76 76
 
77 77
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param \WP $WP
84 84
 	 * @return        void
85 85
 	 */
86
-	public function run( $WP ) {
86
+	public function run($WP) {
87 87
 	}
88 88
 
89 89
 
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 	 * 	@return 		void
112 112
 	 */
113 113
 	public static function wp_enqueue_scripts() {
114
-		if ( apply_filters( 'EED_Single_Page_Checkout__SPCO_active', false ) ) {
115
-			wp_register_script( 'add_new_state', ANS_ASSETS_URL . 'add_new_state.js', array( 'espresso_core', 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, true );
116
-			wp_enqueue_script( 'add_new_state' );
114
+		if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) {
115
+			wp_register_script('add_new_state', ANS_ASSETS_URL.'add_new_state.js', array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, true);
116
+			wp_enqueue_script('add_new_state');
117 117
 		}
118 118
 	}
119 119
 
@@ -127,30 +127,30 @@  discard block
 block discarded – undo
127 127
 	 * @return 	string
128 128
 	 */
129 129
 //	public static function display_add_new_state_micro_form( $html, EE_Form_Input_With_Options_Base $input ){
130
-	public static function display_add_new_state_micro_form( EE_Form_Section_Proper $question_group_reg_form ){
130
+	public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form) {
131 131
 		// only add the 'new_state_micro_form' when displaying reg forms,
132 132
 		// not during processing since we process the 'new_state_micro_form' in it's own AJAX request
133
-		$action = EE_Registry::instance()->REQ->get( 'action', '' );
134
-		if ( $action === 'process_reg_step' || $action === 'update_reg_step' ) {
133
+		$action = EE_Registry::instance()->REQ->get('action', '');
134
+		if ($action === 'process_reg_step' || $action === 'update_reg_step') {
135 135
 			return $question_group_reg_form;
136 136
 		}
137 137
 		// is the "state" question in this form section?
138
-		$input = $question_group_reg_form->get_subsection( 'state' );
138
+		$input = $question_group_reg_form->get_subsection('state');
139 139
 		// we're only doing this for state select inputs
140
-		if ( $input instanceof EE_State_Select_Input ) {
140
+		if ($input instanceof EE_State_Select_Input) {
141 141
 			// load helpers
142
-			EE_Registry::instance()->load_helper( 'HTML' );
142
+			EE_Registry::instance()->load_helper('HTML');
143 143
 			// grab any set values from the request
144
-			$country_name = str_replace( 'state', 'new_state_country', $input->html_name() );
145
-			$state_name = str_replace( 'state', 'new_state_name', $input->html_name() );
146
-			$abbrv_name = str_replace( 'state', 'new_state_abbrv', $input->html_name() );
147
-			$new_state_submit_id = str_replace( 'state', 'new_state', $input->html_id() );
144
+			$country_name = str_replace('state', 'new_state_country', $input->html_name());
145
+			$state_name = str_replace('state', 'new_state_name', $input->html_name());
146
+			$abbrv_name = str_replace('state', 'new_state_abbrv', $input->html_name());
147
+			$new_state_submit_id = str_replace('state', 'new_state', $input->html_id());
148 148
 			$country_options = array();
149 149
 			$countries = EEM_Country::instance()->get_all_countries();
150
-			if ( ! empty( $countries )) {
151
-				foreach( $countries as $country ){
152
-					if ( $country instanceof EE_Country ) {
153
-						$country_options[ $country->ID() ] = $country->name();
150
+			if ( ! empty($countries)) {
151
+				foreach ($countries as $country) {
152
+					if ($country instanceof EE_Country) {
153
+						$country_options[$country->ID()] = $country->name();
154 154
 					}
155 155
 				}
156 156
 			}
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 						// add hidden input to indicate that a new state is being added
164 164
 						'add_new_state' 	=> new EE_Hidden_Input(
165 165
 							array(
166
-								'html_name' 	=> str_replace( 'state', 'add_new_state', $input->html_name() ),
167
-								'html_id' 			=> str_replace( 'state', 'add_new_state', $input->html_id() ),
166
+								'html_name' 	=> str_replace('state', 'add_new_state', $input->html_name()),
167
+								'html_id' 			=> str_replace('state', 'add_new_state', $input->html_id()),
168 168
 								'default'			=> 0
169 169
 							)
170 170
 						),
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 									'',
177 177
 									__('click here to add a new state/province', 'event_espresso'),
178 178
 									'',
179
-									'display-' . $input->html_id(),
179
+									'display-'.$input->html_id(),
180 180
 									'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js',
181 181
 									'',
182
-									'rel="' . $input->html_id() . '"'
182
+									'rel="'.$input->html_id().'"'
183 183
 								)
184 184
 							)
185 185
 						),
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
 						'add_new_state_micro_form' =>new EE_Form_Section_HTML(
188 188
 							apply_filters(
189 189
 								'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form',
190
-								EEH_HTML::div( '', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', 'display: none;' ) .
191
-								EEH_HTML::h6( __('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')) .
192
-								EEH_HTML::ul() .
193
-								EEH_HTML::li( __('first select the Country that your State/Province belongs to', 'event_espresso') ) .
194
-								EEH_HTML::li( __('enter the name of your State/Province', 'event_espresso') ) .
195
-								EEH_HTML::li( __('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso') ) .
196
-								EEH_HTML::li( __('click the ADD button', 'event_espresso') ) .
190
+								EEH_HTML::div('', $input->html_id().'-dv', 'ee-form-add-new-state-dv', 'display: none;').
191
+								EEH_HTML::h6(__('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')).
192
+								EEH_HTML::ul().
193
+								EEH_HTML::li(__('first select the Country that your State/Province belongs to', 'event_espresso')).
194
+								EEH_HTML::li(__('enter the name of your State/Province', 'event_espresso')).
195
+								EEH_HTML::li(__('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso')).
196
+								EEH_HTML::li(__('click the ADD button', 'event_espresso')).
197 197
 								EEH_HTML::ulx()
198 198
 							)
199 199
 						),
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 							$country_options,
203 203
 							array(
204 204
 								'html_name' 			=> $country_name,
205
-								'html_id' 					=> str_replace( 'state', 'new_state_country', $input->html_id() ),
206
-								'html_class' 			=> $input->html_class() . ' new-state-country',
205
+								'html_id' 					=> str_replace('state', 'new_state_country', $input->html_id()),
206
+								'html_class' 			=> $input->html_class().' new-state-country',
207 207
 								'html_label_text'		=> __('New State/Province Country', 'event_espresso'),
208
-								'default'					=> EE_Registry::instance()->REQ->get( $country_name, '' ),
208
+								'default'					=> EE_Registry::instance()->REQ->get($country_name, ''),
209 209
 								'required' 				=> false
210 210
 							)
211 211
 						),
@@ -213,23 +213,23 @@  discard block
 block discarded – undo
213 213
 						'new_state_name' => new EE_Text_Input(
214 214
 							array(
215 215
 								'html_name' 			=> $state_name,
216
-								'html_id' 					=> str_replace( 'state', 'new_state_name', $input->html_id() ),
217
-								'html_class' 			=> $input->html_class() . ' new-state-state',
216
+								'html_id' 					=> str_replace('state', 'new_state_name', $input->html_id()),
217
+								'html_class' 			=> $input->html_class().' new-state-state',
218 218
 								'html_label_text'		=> __('New State/Province Name', 'event_espresso'),
219
-								'default'					=> EE_Registry::instance()->REQ->get( $state_name, '' ),
219
+								'default'					=> EE_Registry::instance()->REQ->get($state_name, ''),
220 220
 								'required' 				=> false
221 221
 							)
222 222
 						),
223
-						'spacer' => new EE_Form_Section_HTML( EEH_HTML::br() ),
223
+						'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()),
224 224
 						// NEW STATE NAME
225 225
 						'new_state_abbrv' => new EE_Text_Input(
226 226
 							array(
227 227
 								'html_name' 					=> $abbrv_name,
228
-								'html_id' 							=> str_replace( 'state', 'new_state_abbrv', $input->html_id() ),
229
-								'html_class' 					=> $input->html_class() . ' new-state-abbrv',
228
+								'html_id' 							=> str_replace('state', 'new_state_abbrv', $input->html_id()),
229
+								'html_class' 					=> $input->html_class().' new-state-abbrv',
230 230
 								'html_label_text'				=> __('New State/Province Abbreviation', 'event_espresso'),
231 231
 								'html_other_attributes'	=> 'size="24"',
232
-								'default'							=> EE_Registry::instance()->REQ->get( $abbrv_name, '' ),
232
+								'default'							=> EE_Registry::instance()->REQ->get($abbrv_name, ''),
233 233
 								'required' 						=> false
234 234
 							)
235 235
 						),
@@ -237,26 +237,26 @@  discard block
 block discarded – undo
237 237
 						'add_new_state_submit_button' => new EE_Form_Section_HTML(
238 238
 							apply_filters(
239 239
 								'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button',
240
-								EEH_HTML::nbsp(3) .
241
-								EEH_HTML::link( '', __('ADD', 'event_espresso'), '', 'submit-' . $new_state_submit_id, 'ee-form-add-new-state-submit button button-secondary', '', 'rel="' . $new_state_submit_id . '"' )
240
+								EEH_HTML::nbsp(3).
241
+								EEH_HTML::link('', __('ADD', 'event_espresso'), '', 'submit-'.$new_state_submit_id, 'ee-form-add-new-state-submit button button-secondary', '', 'rel="'.$new_state_submit_id.'"')
242 242
 							)
243 243
 						),
244 244
 						// extra info
245 245
 						'add_new_state_extra' => new EE_Form_Section_HTML(
246 246
 							apply_filters(
247 247
 								'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra',
248
-								EEH_HTML::br(2) .
249
-								EEH_HTML::div( '', '', 'small-text' ) .
250
-								EEH_HTML::strong( __('Don\'t know your State/Province Abbreviation?', 'event_espresso') ) .
251
-								EEH_HTML::br() .
248
+								EEH_HTML::br(2).
249
+								EEH_HTML::div('', '', 'small-text').
250
+								EEH_HTML::strong(__('Don\'t know your State/Province Abbreviation?', 'event_espresso')).
251
+								EEH_HTML::br().
252 252
 								sprintf(
253 253
 									__('You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', 'event_espresso'),
254
-									EEH_HTML::link( 'http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk' )
255
-								) .
256
-								EEH_HTML::divx() .
257
-								EEH_HTML::br() .
258
-								EEH_HTML::link( '', __('cancel new state/province', 'event_espresso'), '', 'hide-' . $input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'rel="' . $input->html_id() . '"' ) .
259
-								EEH_HTML::divx() .
254
+									EEH_HTML::link('http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk')
255
+								).
256
+								EEH_HTML::divx().
257
+								EEH_HTML::br().
258
+								EEH_HTML::link('', __('cancel new state/province', 'event_espresso'), '', 'hide-'.$input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'rel="'.$input->html_id().'"').
259
+								EEH_HTML::divx().
260 260
 								EEH_HTML::br()
261 261
 							)
262 262
 						)
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 					)
265 265
 				)
266 266
 			);
267
-			$question_group_reg_form->add_subsections( array( 'new_state_micro_form' => $new_state_micro_form ), 'state', false );
267
+			$question_group_reg_form->add_subsections(array('new_state_micro_form' => $new_state_micro_form), 'state', false);
268 268
 		}
269 269
 		return $question_group_reg_form;
270 270
 	}
@@ -281,41 +281,41 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public static function add_new_state() {
283 283
 		$REQ = EE_Registry::instance()->load_core('Request_Handler');
284
-		if ( $REQ->is_set( 'add_new_state' ) && $REQ->get( 'add_new_state' ) == 1 ) {
284
+		if ($REQ->is_set('add_new_state') && $REQ->get('add_new_state') == 1) {
285 285
 			EE_Registry::instance()->load_model('State');
286 286
 			// grab country ISO code, new state name, and new state abbreviation
287
-			$state_country = $REQ->is_set( 'new_state_country' ) ? sanitize_text_field( $REQ->get( 'new_state_country' )) : FALSE;
288
-			$state_name = $REQ->is_set( 'new_state_name' ) ? sanitize_text_field( $REQ->get( 'new_state_name' )) : FALSE;
289
-			$state_abbr = $REQ->is_set( 'new_state_abbrv' ) ? sanitize_text_field( $REQ->get( 'new_state_abbrv' )) : FALSE;
287
+			$state_country = $REQ->is_set('new_state_country') ? sanitize_text_field($REQ->get('new_state_country')) : FALSE;
288
+			$state_name = $REQ->is_set('new_state_name') ? sanitize_text_field($REQ->get('new_state_name')) : FALSE;
289
+			$state_abbr = $REQ->is_set('new_state_abbrv') ? sanitize_text_field($REQ->get('new_state_abbrv')) : FALSE;
290 290
 
291 291
 //echo '<h4>$state_country : ' . $state_country . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
292 292
 //echo '<h4>$state_name : ' . $state_name . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
293 293
 //echo '<h4>$state_abbr : ' . $state_abbr . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
294 294
 
295
-			if ( $state_country && $state_name && $state_abbr ) {
296
-				$new_state = EED_Add_New_State::save_new_state_to_db( array(
297
-					'CNT_ISO'=> strtoupper( $state_country ),
298
-					'STA_abbrev' => strtoupper( $state_abbr ),
299
-					'STA_name' => ucwords( $state_name ),
295
+			if ($state_country && $state_name && $state_abbr) {
296
+				$new_state = EED_Add_New_State::save_new_state_to_db(array(
297
+					'CNT_ISO'=> strtoupper($state_country),
298
+					'STA_abbrev' => strtoupper($state_abbr),
299
+					'STA_name' => ucwords($state_name),
300 300
 					'STA_active' => FALSE
301 301
 				));
302 302
 
303
-				if ( $new_state instanceof EE_State ) {
303
+				if ($new_state instanceof EE_State) {
304 304
 					// clean house
305
-					EE_Registry::instance()->REQ->un_set( 'add_new_state' );
306
-					EE_Registry::instance()->REQ->un_set( 'new_state_country' );
307
-					EE_Registry::instance()->REQ->un_set( 'new_state_name' );
308
-					EE_Registry::instance()->REQ->un_set( 'new_state_abbrv' );
305
+					EE_Registry::instance()->REQ->un_set('add_new_state');
306
+					EE_Registry::instance()->REQ->un_set('new_state_country');
307
+					EE_Registry::instance()->REQ->un_set('new_state_name');
308
+					EE_Registry::instance()->REQ->un_set('new_state_abbrv');
309 309
 
310 310
 					// get any existing new states
311 311
 					$new_states = EE_Registry::instance()->SSN->get_session_data(
312 312
 						'new_states'
313 313
 					);
314
-					$new_states[ $new_state->ID() ] = $new_state;
315
-					EE_Registry::instance()->SSN->set_session_data( array( 'new_states' => $new_states ));
314
+					$new_states[$new_state->ID()] = $new_state;
315
+					EE_Registry::instance()->SSN->set_session_data(array('new_states' => $new_states));
316 316
 
317
-					if ( EE_Registry::instance()->REQ->ajax ) {
318
-						echo json_encode( array(
317
+					if (EE_Registry::instance()->REQ->ajax) {
318
+						echo json_encode(array(
319 319
 							'success' => TRUE,
320 320
 							'id' => $new_state->ID(),
321 321
 							'name' => $new_state->name(),
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 				}
331 331
 
332 332
 			} else {
333
-				$error = __( 'A new State/Province could not be added because invalid or missing data was received.', 'event_espresso' );
334
-				if ( EE_Registry::instance()->REQ->ajax ) {
335
-					echo json_encode( array( 'error' => $error ));
333
+				$error = __('A new State/Province could not be added because invalid or missing data was received.', 'event_espresso');
334
+				if (EE_Registry::instance()->REQ->ajax) {
335
+					echo json_encode(array('error' => $error));
336 336
 					exit();
337 337
 				} else {
338
-					EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
338
+					EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
339 339
 				}
340 340
 			}
341 341
 		}
@@ -353,11 +353,11 @@  discard block
 block discarded – undo
353 353
 	 * @param array $request_params
354 354
 	 * @return array
355 355
 	 */
356
-	public static function filter_checkout_request_params ( $request_params ) {
357
-		foreach ( $request_params as $form_section ) {
358
-			if ( is_array( $form_section )) {
359
-				EED_Add_New_State::unset_new_state_request_params( $form_section );
360
-				EED_Add_New_State::filter_checkout_request_params( $form_section );
356
+	public static function filter_checkout_request_params($request_params) {
357
+		foreach ($request_params as $form_section) {
358
+			if (is_array($form_section)) {
359
+				EED_Add_New_State::unset_new_state_request_params($form_section);
360
+				EED_Add_New_State::filter_checkout_request_params($form_section);
361 361
 			}
362 362
 		}
363 363
 		return $request_params;
@@ -372,12 +372,12 @@  discard block
 block discarded – undo
372 372
 	 * @param array $request_params
373 373
 	 * @return        boolean
374 374
 	 */
375
-	public static function unset_new_state_request_params ( $request_params ) {
376
-		unset( $request_params[ 'new_state_micro_form' ] );
377
-		unset( $request_params[ 'add_new_state' ] );
378
-		unset( $request_params[ 'new_state_country' ] );
379
-		unset( $request_params[ 'new_state_name' ] );
380
-		unset( $request_params[ 'new_state_abbrv' ] );
375
+	public static function unset_new_state_request_params($request_params) {
376
+		unset($request_params['new_state_micro_form']);
377
+		unset($request_params['add_new_state']);
378
+		unset($request_params['new_state_country']);
379
+		unset($request_params['new_state_name']);
380
+		unset($request_params['new_state_abbrv']);
381 381
 		return $request_params;
382 382
 	}
383 383
 
@@ -390,25 +390,25 @@  discard block
 block discarded – undo
390 390
 	 * @param array $props_n_values
391 391
 	 * @return        boolean
392 392
 	 */
393
-	public static function save_new_state_to_db ( $props_n_values = array() ) {
393
+	public static function save_new_state_to_db($props_n_values = array()) {
394 394
 //		EEH_Debug_Tools::printr( $props_n_values, '$props_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
395
-		$existing_state = EEM_State::instance()->get_all( array( $props_n_values, 'limit' => 1 ));
396
-		if ( ! empty( $existing_state )) {
397
-			return array_pop( $existing_state );
395
+		$existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1));
396
+		if ( ! empty($existing_state)) {
397
+			return array_pop($existing_state);
398 398
 		}
399
-		$new_state = EE_State::new_instance( $props_n_values );
400
-		if ( $new_state instanceof EE_State ) {
399
+		$new_state = EE_State::new_instance($props_n_values);
400
+		if ($new_state instanceof EE_State) {
401 401
 			// if not non-ajax admin
402
-			$new_state_key = $new_state->country_iso() . '-' . $new_state->abbrev();
402
+			$new_state_key = $new_state->country_iso().'-'.$new_state->abbrev();
403 403
 			$new_state_notice = sprintf(
404
-					__( 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso' ),
405
-					'<b>' . $new_state->name() . '</b>',
406
-					'<b>' . $new_state->abbrev() . '</b>',
407
-					'<b>' . $new_state->country()->name() . '</b>',
408
-					'<a href="' . add_query_arg( array( 'page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso() ), admin_url( 'admin.php' )) . '">' . __( 'Event Espresso - General Settings > Countries Tab', 'event_espresso' ) . '</a>',
404
+					__('A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso'),
405
+					'<b>'.$new_state->name().'</b>',
406
+					'<b>'.$new_state->abbrev().'</b>',
407
+					'<b>'.$new_state->country()->name().'</b>',
408
+					'<a href="'.add_query_arg(array('page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso()), admin_url('admin.php')).'">'.__('Event Espresso - General Settings > Countries Tab', 'event_espresso').'</a>',
409 409
 					'<br />'
410 410
 			);
411
-			EE_Error::add_persistent_admin_notice( $new_state_key, $new_state_notice );
411
+			EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice);
412 412
 			$new_state->save();
413 413
 			EEM_State::instance()->reset_cached_states();
414 414
 			return $new_state;
@@ -427,22 +427,22 @@  discard block
 block discarded – undo
427 427
 	 * @param array  $cols_n_values
428 428
 	 * @return        boolean
429 429
 	 */
430
-	public static function update_country_settings( $CNT_ISO = '', $STA_ID = '', $cols_n_values = array() ) {
431
-		$CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : FALSE;
432
-		if ( ! $CNT_ISO ) {
433
-			EE_Error::add_error( __( 'An invalid or missing Country ISO Code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
430
+	public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) {
431
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : FALSE;
432
+		if ( ! $CNT_ISO) {
433
+			EE_Error::add_error(__('An invalid or missing Country ISO Code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
434 434
 		}
435
-		$STA_abbrev = is_array( $cols_n_values ) && isset( $cols_n_values['STA_abbrev'] ) ? $cols_n_values['STA_abbrev'] : FALSE;
436
-		if (  ! $STA_abbrev && ! empty( $STA_ID )) {
437
-			$state = EEM_State::instance()->get_one_by_ID( $STA_ID );
438
-			if ( $state instanceof EE_State ) {
435
+		$STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] : FALSE;
436
+		if ( ! $STA_abbrev && ! empty($STA_ID)) {
437
+			$state = EEM_State::instance()->get_one_by_ID($STA_ID);
438
+			if ($state instanceof EE_State) {
439 439
 				$STA_abbrev = $state->abbrev();
440 440
 			}
441 441
 		}
442
-		if ( ! $STA_abbrev ) {
443
-			EE_Error::add_error( __( 'An invalid or missing State Abbreviation was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
442
+		if ( ! $STA_abbrev) {
443
+			EE_Error::add_error(__('An invalid or missing State Abbreviation was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
444 444
 		}
445
-		EE_Error::dismiss_persistent_admin_notice( $CNT_ISO . '-' . $STA_abbrev, TRUE, TRUE );
445
+		EE_Error::dismiss_persistent_admin_notice($CNT_ISO.'-'.$STA_abbrev, TRUE, TRUE);
446 446
 	}
447 447
 
448 448
 
@@ -458,19 +458,19 @@  discard block
 block discarded – undo
458 458
 	 * @param $answer
459 459
 	 * @return bool
460 460
 	 */
461
-	public static function inject_new_reg_state_into_options( $state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) {
462
-		if ( $answer instanceof EE_Answer  && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state ) {
461
+	public static function inject_new_reg_state_into_options($state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) {
462
+		if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state) {
463 463
 			$STA_ID = $answer->value();
464
-			if ( ! empty( $STA_ID ) ) {
465
-				$state = EEM_State::instance()->get_one_by_ID( $STA_ID );
466
-				if ( $state instanceof EE_State ) {
464
+			if ( ! empty($STA_ID)) {
465
+				$state = EEM_State::instance()->get_one_by_ID($STA_ID);
466
+				if ($state instanceof EE_State) {
467 467
 					$country = $state->country();
468
-					if ( $country instanceof EE_Country ) {
469
-						if ( ! isset( $state_options[ $country->name() ] )) {
470
-							$state_options[ $country->name() ] = array();
468
+					if ($country instanceof EE_Country) {
469
+						if ( ! isset($state_options[$country->name()])) {
470
+							$state_options[$country->name()] = array();
471 471
 						}
472
-						if ( ! isset( $state_options[ $country->name() ][ $STA_ID ] )) {
473
-							$state_options[ $country->name() ][ $STA_ID ] = $state->name();
472
+						if ( ! isset($state_options[$country->name()][$STA_ID])) {
473
+							$state_options[$country->name()][$STA_ID] = $state->name();
474 474
 						}
475 475
 					}
476 476
 				}
@@ -492,14 +492,14 @@  discard block
 block discarded – undo
492 492
 	 * @param $answer
493 493
 	 * @return bool
494 494
 	 */
495
-	public static function inject_new_reg_country_into_options( $country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) {
496
-		if ( $answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country ) {
495
+	public static function inject_new_reg_country_into_options($country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) {
496
+		if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country) {
497 497
 			$CNT_ISO = $answer->value();
498
-			if ( ! empty( $CNT_ISO ) ) {
499
-				$country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO );
500
-				if ( $country instanceof EE_Country ) {
501
-					if ( ! isset( $country_options[ $CNT_ISO ] ) ) {
502
-						$country_options[ $CNT_ISO ] = $country->name();
498
+			if ( ! empty($CNT_ISO)) {
499
+				$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
500
+				if ($country instanceof EE_Country) {
501
+					if ( ! isset($country_options[$CNT_ISO])) {
502
+						$country_options[$CNT_ISO] = $country->name();
503 503
 					}
504 504
 				}
505 505
 			}
@@ -516,17 +516,17 @@  discard block
 block discarded – undo
516 516
 	 * @param EE_State[]  $state_options
517 517
 	 * @return        boolean
518 518
 	 */
519
-	public static function state_options( $state_options = array() ) {
519
+	public static function state_options($state_options = array()) {
520 520
 		$new_states = EE_Registry::instance()->SSN->get_session_data(
521 521
 			'new_states'
522 522
 		);
523
-		if ( is_array( $new_states ) && ! empty( $new_states )) {
524
-			foreach ( $new_states as $new_state ) {
523
+		if (is_array($new_states) && ! empty($new_states)) {
524
+			foreach ($new_states as $new_state) {
525 525
 				if (
526 526
 					$new_state instanceof EE_State
527 527
 					&& $new_state->country() instanceof EE_Country
528 528
 				) {
529
-					$state_options[ $new_state->country()->name() ][ $new_state->ID() ] = $new_state->name();
529
+					$state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name();
530 530
 				}
531 531
 			}
532 532
 		}
@@ -542,17 +542,17 @@  discard block
 block discarded – undo
542 542
 	 * @param EE_Country[]  $country_options
543 543
 	 * @return        boolean
544 544
 	 */
545
-	public static function country_options( $country_options = array() ) {
545
+	public static function country_options($country_options = array()) {
546 546
 		$new_states = EE_Registry::instance()->SSN->get_session_data(
547 547
 			'new_states'
548 548
 		);
549
-		if ( is_array( $new_states ) && ! empty( $new_states )) {
550
-			foreach ( $new_states as $new_state ) {
549
+		if (is_array($new_states) && ! empty($new_states)) {
550
+			foreach ($new_states as $new_state) {
551 551
 				if (
552 552
 					$new_state instanceof EE_State
553 553
 					&& $new_state->country() instanceof EE_Country
554 554
 				) {
555
-					$country_options[ $new_state->country()->ID() ] = $new_state->country()->name();
555
+					$country_options[$new_state->country()->ID()] = $new_state->country()->name();
556 556
 				}
557 557
 			}
558 558
 		}
Please login to merge, or discard this patch.
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 1 patch
Spacing   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 	 * @return EED_Single_Page_Checkout
39 39
 	 */
40 40
 	public static function instance() {
41
-		add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' );
42
-		return parent::get_instance( __CLASS__ );
41
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
42
+		return parent::get_instance(__CLASS__);
43 43
 	}
44 44
 
45 45
 
@@ -84,22 +84,22 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public static function set_hooks_admin() {
86 86
 		EED_Single_Page_Checkout::set_definitions();
87
-		if ( defined( 'DOING_AJAX' )) {
87
+		if (defined('DOING_AJAX')) {
88 88
 			// going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
89 89
 			ob_start();
90 90
 			EED_Single_Page_Checkout::load_request_handler();
91 91
 			EED_Single_Page_Checkout::load_reg_steps();
92 92
 		} else {
93 93
 			// hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called
94
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
94
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
95 95
 		}
96 96
 		// set ajax hooks
97
-		add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
98
-		add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
99
-		add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
100
-		add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
101
-		add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
102
-		add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
97
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
98
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
99
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
100
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
101
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
102
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
103 103
 	}
104 104
 
105 105
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * 	process ajax request
109 109
 	 * @param string $ajax_action
110 110
 	 */
111
-	public static function process_ajax_request( $ajax_action ) {
112
-		EE_Registry::instance()->REQ->set( 'action', $ajax_action );
111
+	public static function process_ajax_request($ajax_action) {
112
+		EE_Registry::instance()->REQ->set('action', $ajax_action);
113 113
 		EED_Single_Page_Checkout::instance()->_initialize();
114 114
 	}
115 115
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * 	ajax display registration step
120 120
 	 */
121 121
 	public static function display_reg_step() {
122
-		EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' );
122
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
123 123
 	}
124 124
 
125 125
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * 	ajax process registration step
129 129
 	 */
130 130
 	public static function process_reg_step() {
131
-		EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' );
131
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
132 132
 	}
133 133
 
134 134
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * 	ajax process registration step
138 138
 	 */
139 139
 	public static function update_reg_step() {
140
-		EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' );
140
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
141 141
 	}
142 142
 
143 143
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @return void
150 150
 	 */
151 151
 	public static function update_checkout() {
152
-		EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' );
152
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
153 153
 	}
154 154
 
155 155
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public static function load_request_handler() {
164 164
 		// load core Request_Handler class
165
-		if ( ! isset( EE_Registry::instance()->REQ )) {
166
-			EE_Registry::instance()->load_core( 'Request_Handler' );
165
+		if ( ! isset(EE_Registry::instance()->REQ)) {
166
+			EE_Registry::instance()->load_core('Request_Handler');
167 167
 		}
168 168
 	}
169 169
 
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 	 *  @return 	void
177 177
 	 */
178 178
 	public static function set_definitions() {
179
-		define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
180
-		define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS );
181
-		define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS );
182
-		define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS );
183
-		define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS );
184
-		define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS );
185
-		define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS );
186
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE );
179
+		define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
180
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
181
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
182
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
183
+		define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
184
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
185
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
186
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE);
187 187
 	}
188 188
 
189 189
 
@@ -198,31 +198,31 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public static function load_reg_steps() {
200 200
 		static $reg_steps_loaded = FALSE;
201
-		if ( $reg_steps_loaded ) {
201
+		if ($reg_steps_loaded) {
202 202
 			return;
203 203
 		}
204 204
 		// load EE_SPCO_Reg_Step base class
205 205
 //		EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_SPCO_Reg_Step', 'class'  );
206 206
 		// filter list of reg_steps
207
-		$reg_steps_to_load = apply_filters( 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps() );
207
+		$reg_steps_to_load = apply_filters('AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps());
208 208
 		// sort by key (order)
209
-		ksort( $reg_steps_to_load );
209
+		ksort($reg_steps_to_load);
210 210
 		// loop through folders
211
-		foreach ( $reg_steps_to_load as $order => $reg_step ) {
211
+		foreach ($reg_steps_to_load as $order => $reg_step) {
212 212
 			// we need a
213
-			if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
213
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
214 214
 				// copy over to the reg_steps_array
215
-				EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step;
215
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
216 216
 				// register custom key route for each reg step ( ie: step=>"slug" - this is the entire reason we load the reg steps array now )
217
-				EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' );
217
+				EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
218 218
 				// add AJAX or other hooks
219
-				if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) {
219
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
220 220
 					// setup autoloaders if necessary
221
-					if ( ! class_exists( $reg_step['class_name'] )) {
222
-						EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE );
221
+					if ( ! class_exists($reg_step['class_name'])) {
222
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE);
223 223
 					}
224
-					if ( is_callable( $reg_step['class_name'], 'set_hooks' )) {
225
-						call_user_func( array( $reg_step['class_name'], 'set_hooks' ));
224
+					if (is_callable($reg_step['class_name'], 'set_hooks')) {
225
+						call_user_func(array($reg_step['class_name'], 'set_hooks'));
226 226
 					}
227 227
 				}
228 228
 			}
@@ -241,28 +241,28 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public static function get_reg_steps() {
243 243
 		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
244
-		if ( empty( $reg_steps )) {
244
+		if (empty($reg_steps)) {
245 245
 			$reg_steps = array(
246 246
 				10 => array(
247
-					'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information',
247
+					'file_path' => SPCO_REG_STEPS_PATH.'attendee_information',
248 248
 					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
249 249
 					'slug' => 'attendee_information',
250 250
 					'has_hooks' => FALSE
251 251
 				),
252 252
 				20 => array(
253
-					'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation',
253
+					'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation',
254 254
 					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
255 255
 					'slug' => 'registration_confirmation',
256 256
 					'has_hooks' => FALSE
257 257
 				),
258 258
 				30 => array(
259
-					'file_path' => SPCO_REG_STEPS_PATH . 'payment_options',
259
+					'file_path' => SPCO_REG_STEPS_PATH.'payment_options',
260 260
 					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
261 261
 					'slug' => 'payment_options',
262 262
 					'has_hooks' => TRUE
263 263
 				),
264 264
 				999 => array(
265
-					'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration',
265
+					'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration',
266 266
 					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
267 267
 					'slug' => 'finalize_registration',
268 268
 					'has_hooks' => FALSE
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	public static function registration_checkout_for_admin() {
284 284
 		EED_Single_Page_Checkout::load_reg_steps();
285
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
286
-		EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' );
287
-		EE_Registry::instance()->REQ->set( 'process_form_submission', false );
285
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
286
+		EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
287
+		EE_Registry::instance()->REQ->set('process_form_submission', false);
288 288
 		EED_Single_Page_Checkout::instance()->_initialize();
289 289
 		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
290 290
 		return EE_Registry::instance()->REQ->get_output();
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
 	 */
301 301
 	public static function process_registration_from_admin() {
302 302
 		EED_Single_Page_Checkout::load_reg_steps();
303
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
304
-		EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' );
305
-		EE_Registry::instance()->REQ->set( 'process_form_submission', true );
303
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
304
+		EE_Registry::instance()->REQ->set('action', 'process_reg_step');
305
+		EE_Registry::instance()->REQ->set('process_form_submission', true);
306 306
 		EED_Single_Page_Checkout::instance()->_initialize();
307
-		if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) {
308
-			$final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps );
309
-			if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
310
-				if ( $final_reg_step->process_reg_step() ) {
307
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
308
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
309
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
310
+				if ($final_reg_step->process_reg_step()) {
311 311
 					return EED_Single_Page_Checkout::instance()->checkout->transaction;
312 312
 				}
313 313
 			}
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 	 * @param WP_Query $WP_Query
325 325
 	 * @return    void
326 326
 	 */
327
-	public function run( $WP_Query ) {
328
-		if ( $WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )) {
327
+	public function run($WP_Query) {
328
+		if ($WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters('FHEE__EED_Single_Page_Checkout__run', true)) {
329 329
 			$this->_initialize();
330 330
 		}
331 331
 	}
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 	 * @param WP_Query $WP_Query
341 341
 	 * @return    void
342 342
 	 */
343
-	public static function init( $WP_Query ) {
344
-		EED_Single_Page_Checkout::instance()->run( $WP_Query );
343
+	public static function init($WP_Query) {
344
+		EED_Single_Page_Checkout::instance()->run($WP_Query);
345 345
 	}
346 346
 
347 347
 
@@ -355,32 +355,32 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	private function _initialize() {
357 357
 		// ensure SPCO doesn't run twice
358
-		if ( EED_Single_Page_Checkout::$_initialized ) {
358
+		if (EED_Single_Page_Checkout::$_initialized) {
359 359
 			return;
360 360
 		}
361 361
 		// setup the EE_Checkout object
362 362
 		$this->checkout = $this->_initialize_checkout();
363 363
 		// filter checkout
364
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout );
364
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
365 365
 		// get the $_GET
366 366
 		$this->_get_request_vars();
367 367
 		// filter continue_reg
368
-		$this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout );
368
+		$this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout);
369 369
 		// load the reg steps array
370
-		if ( ! $this->_load_and_instantiate_reg_steps() ) {
370
+		if ( ! $this->_load_and_instantiate_reg_steps()) {
371 371
 			EED_Single_Page_Checkout::$_initialized = true;
372 372
 			return;
373 373
 		}
374 374
 		// set the current step
375
-		$this->checkout->set_current_step( $this->checkout->step );
375
+		$this->checkout->set_current_step($this->checkout->step);
376 376
 		// and the next step
377 377
 		$this->checkout->set_next_step();
378 378
 		// was there already a valid transaction in the checkout from the session ?
379
-		if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
379
+		if ( ! $this->checkout->transaction instanceof EE_Transaction) {
380 380
 			// get transaction from db or session
381 381
 			$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() ? $this->_get_transaction_and_cart_for_previous_visit() : $this->_get_cart_for_current_session_and_setup_new_transaction();
382
-			if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
383
-				EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
382
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
383
+				EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
384 384
 				// add some style and make it dance
385 385
 				$this->checkout->transaction = EE_Transaction::new_instance();
386 386
 				$this->add_styles_and_scripts();
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
 				return;
389 389
 			}
390 390
 			// and the registrations for the transaction
391
-			$this->_get_registrations( $this->checkout->transaction );
391
+			$this->_get_registrations($this->checkout->transaction);
392 392
 		}
393 393
 		// verify that everything has been setup correctly
394
-		if ( ! $this->_final_verifications() ) {
394
+		if ( ! $this->_final_verifications()) {
395 395
 			EED_Single_Page_Checkout::$_initialized = true;
396 396
 			return;
397 397
 		}
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
 		// set no cache headers and constants
417 417
 		EE_System::do_not_cache();
418 418
 		// add anchor
419
-		add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 );
419
+		add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
420 420
 		// remove transaction lock
421
-		add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 );
421
+		add_action('shutdown', array($this, 'unlock_transaction'), 1);
422 422
 	}
423 423
 
424 424
 
@@ -435,20 +435,20 @@  discard block
 block discarded – undo
435 435
 		// look in session for existing checkout
436 436
 		$checkout = EE_Registry::instance()->SSN->checkout();
437 437
 		// verify
438
-		if ( ! $checkout instanceof EE_Checkout ) {
438
+		if ( ! $checkout instanceof EE_Checkout) {
439 439
 			// instantiate EE_Checkout object for handling the properties of the current checkout process
440
-			$checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE  );
440
+			$checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE);
441 441
 			// verify again
442
-			if ( ! $checkout instanceof EE_Checkout ) {
443
-				throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) );
442
+			if ( ! $checkout instanceof EE_Checkout) {
443
+				throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
444 444
 			}
445 445
 		} else {
446
-			if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true )  {
447
-				wp_safe_redirect( $checkout->redirect_url );
446
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
447
+				wp_safe_redirect($checkout->redirect_url);
448 448
 				exit();
449 449
 			}
450 450
 		}
451
-		$checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout );
451
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
452 452
 		// reset anything that needs a clean slate for each request
453 453
 		$checkout->reset_for_current_request();
454 454
 		return $checkout;
@@ -466,22 +466,22 @@  discard block
 block discarded – undo
466 466
 		// load classes
467 467
 		EED_Single_Page_Checkout::load_request_handler();
468 468
 		//make sure this request is marked as belonging to EE
469
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
469
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
470 470
 		// which step is being requested ?
471
-		$this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() );
471
+		$this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
472 472
 		// which step is being edited ?
473
-		$this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' );
473
+		$this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
474 474
 		// and what we're doing on the current step
475
-		$this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' );
475
+		$this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
476 476
 		// returning to edit ?
477
-		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' );
477
+		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
478 478
 		// or some other kind of revisit ?
479
-		$this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE );
479
+		$this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE);
480 480
 		// and whether or not to generate a reg form for this request
481
-		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); 		// TRUE 	FALSE
481
+		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE 	FALSE
482 482
 		// and whether or not to process a reg form submission for this request
483
-		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); 		// TRUE 	FALSE
484
-		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; 		// TRUE 	FALSE
483
+		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE 	FALSE
484
+		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE 	FALSE
485 485
 		//$this->_display_request_vars();
486 486
 	}
487 487
 
@@ -494,17 +494,17 @@  discard block
 block discarded – undo
494 494
 	 * @return    void
495 495
 	 */
496 496
 	protected function _display_request_vars() {
497
-		if ( ! WP_DEBUG ) {
497
+		if ( ! WP_DEBUG) {
498 498
 			return;
499 499
 		}
500
-		EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
501
-		EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ );
502
-		EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ );
503
-		EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ );
504
-		EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ );
505
-		EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ );
506
-		EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ );
507
-		EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ );
500
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
501
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
502
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
503
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
504
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
505
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
506
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
507
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
508 508
 	}
509 509
 
510 510
 
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
 	 * @return    array
519 519
 	 */
520 520
 	private function _get_first_step() {
521
-		$first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array );
522
-		return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information';
521
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
522
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
523 523
 	}
524 524
 
525 525
 
@@ -535,37 +535,37 @@  discard block
 block discarded – undo
535 535
 	private function _load_and_instantiate_reg_steps() {
536 536
 		// have reg_steps already been instantiated ?
537 537
 		if (
538
-			empty( $this->checkout->reg_steps ) ||
539
-			apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout )
538
+			empty($this->checkout->reg_steps) ||
539
+			apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
540 540
 		) {
541 541
 			// if not, then loop through raw reg steps array
542
-			foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) {
543
-				if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) {
542
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
543
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
544 544
 					return false;
545 545
 				}
546 546
 			}
547 547
 			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE;
548 548
 			EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE;
549 549
 			// skip the registration_confirmation page ?
550
-			if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) {
550
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
551 551
 				// just remove it from the reg steps array
552
-				$this->checkout->remove_reg_step( 'registration_confirmation', false );
553
-			} else if ( EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset( 	$this->checkout->reg_steps['registration_confirmation'] )) {
552
+				$this->checkout->remove_reg_step('registration_confirmation', false);
553
+			} else if (EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset($this->checkout->reg_steps['registration_confirmation'])) {
554 554
 				// set the order to something big like 100
555
-				$this->checkout->set_reg_step_order( 'registration_confirmation', 100 );
555
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
556 556
 			}
557 557
 			// filter the array for good luck
558
-			$this->checkout->reg_steps = apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps );
558
+			$this->checkout->reg_steps = apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps);
559 559
 			// finally re-sort based on the reg step class order properties
560 560
 			$this->checkout->sort_reg_steps();
561 561
 		} else {
562
-			foreach ( $this->checkout->reg_steps as $reg_step ) {
562
+			foreach ($this->checkout->reg_steps as $reg_step) {
563 563
 				// set all current step stati to FALSE
564
-				$reg_step->set_is_current_step( FALSE );
564
+				$reg_step->set_is_current_step(FALSE);
565 565
 			}
566 566
 		}
567
-		if ( empty( $this->checkout->reg_steps )) {
568
-			EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
567
+		if (empty($this->checkout->reg_steps)) {
568
+			EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
569 569
 			return false;
570 570
 		}
571 571
 			// make reg step details available to JS
@@ -583,34 +583,34 @@  discard block
 block discarded – undo
583 583
 	 * @param int   $order
584 584
 	 * @return bool
585 585
 	 */
586
-	private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) {
586
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) {
587 587
 
588 588
 		// we need a file_path, class_name, and slug to add a reg step
589
-		if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
589
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
590 590
 			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
591
-			if ( $this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration' ) {
591
+			if ($this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration') {
592 592
 				return true;
593 593
 			}
594 594
 			// instantiate step class using file path and class name
595
-			$reg_step_obj = EE_Registry::instance()->load_file( $reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE  );
595
+			$reg_step_obj = EE_Registry::instance()->load_file($reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE);
596 596
 			// did we gets the goods ?
597
-			if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) {
597
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
598 598
 				// set reg step order based on config
599
-				$reg_step_obj->set_order( $order );
599
+				$reg_step_obj->set_order($order);
600 600
 				// add instantiated reg step object to the master reg steps array
601
-				$this->checkout->add_reg_step( $reg_step_obj );
601
+				$this->checkout->add_reg_step($reg_step_obj);
602 602
 			} else {
603
-				EE_Error::add_error( __( 'The current step could not be set.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
603
+				EE_Error::add_error(__('The current step could not be set.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
604 604
 				return false;
605 605
 			}
606 606
 		} else {
607
-			if ( WP_DEBUG ) {
607
+			if (WP_DEBUG) {
608 608
 				EE_Error::add_error(
609 609
 					sprintf(
610
-						__( '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' ),
611
-						isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '',
612
-						isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '',
613
-						isset( $reg_step['slug'] ) ? $reg_step['slug'] : '',
610
+						__('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'),
611
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
612
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
613
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
614 614
 						'<ul>',
615 615
 						'<li>',
616 616
 						'</li>',
@@ -634,16 +634,16 @@  discard block
 block discarded – undo
634 634
 	 */
635 635
 	private function _get_transaction_and_cart_for_previous_visit() {
636 636
 		/** @var $TXN_model EEM_Transaction */
637
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
637
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
638 638
 		// 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
639
-		$transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link );
639
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
640 640
 		// verify transaction
641
-		if ( $transaction instanceof EE_Transaction ) {
641
+		if ($transaction instanceof EE_Transaction) {
642 642
 			// and get the cart that was used for that transaction
643
-			$this->checkout->cart = $this->_get_cart_for_transaction( $transaction );
643
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
644 644
 			return $transaction;
645 645
 		} else {
646
-			EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
646
+			EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
647 647
 			return NULL;
648 648
 		}
649 649
 	}
@@ -657,11 +657,11 @@  discard block
 block discarded – undo
657 657
 	 * @param EE_Transaction $transaction
658 658
 	 * @return EE_Cart
659 659
 	 */
660
-	private function _get_cart_for_transaction( $transaction ) {
661
-		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL;
660
+	private function _get_cart_for_transaction($transaction) {
661
+		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL;
662 662
 		// verify cart
663
-		if ( ! $cart instanceof EE_Cart ) {
664
-			$cart = EE_Registry::instance()->load_core( 'Cart' );
663
+		if ( ! $cart instanceof EE_Cart) {
664
+			$cart = EE_Registry::instance()->load_core('Cart');
665 665
 		}
666 666
 		return $cart;
667 667
 	}
@@ -676,8 +676,8 @@  discard block
 block discarded – undo
676 676
 	 * @param EE_Transaction $transaction
677 677
 	 * 	@return EE_Cart
678 678
 	 */
679
-	public function get_cart_for_transaction( EE_Transaction $transaction ) {
680
-		return EE_Cart::get_cart_from_txn( $transaction );
679
+	public function get_cart_for_transaction(EE_Transaction $transaction) {
680
+		return EE_Cart::get_cart_from_txn($transaction);
681 681
 	}
682 682
 
683 683
 
@@ -692,17 +692,17 @@  discard block
 block discarded – undo
692 692
 	private function _get_cart_for_current_session_and_setup_new_transaction() {
693 693
 		//  if there's no transaction, then this is the FIRST visit to SPCO
694 694
 		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
695
-		$this->checkout->cart = $this->_get_cart_for_transaction( NULL );
695
+		$this->checkout->cart = $this->_get_cart_for_transaction(NULL);
696 696
 		// and then create a new transaction
697 697
 		$transaction = $this->_initialize_transaction();
698 698
 		// verify transaction
699
-		if ( $transaction instanceof EE_Transaction ) {
699
+		if ($transaction instanceof EE_Transaction) {
700 700
 			// save it so that we have an ID for other objects to use
701 701
 			$transaction->save();
702 702
 			// and save TXN data to the cart
703
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() );
703
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
704 704
 		} else {
705
-			EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
705
+			EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
706 706
 		}
707 707
 		return $transaction;
708 708
 	}
@@ -722,15 +722,15 @@  discard block
 block discarded – undo
722 722
 			// grab the cart grand total
723 723
 			$cart_total = $this->checkout->cart->get_cart_grand_total();
724 724
 			// create new TXN
725
-			return EE_Transaction::new_instance( array(
725
+			return EE_Transaction::new_instance(array(
726 726
 				'TXN_timestamp' 	=> time(),
727 727
 				'TXN_reg_steps' 		=> $this->checkout->initialize_txn_reg_steps_array(),
728 728
 				'TXN_total' 				=> $cart_total > 0 ? $cart_total : 0,
729 729
 				'TXN_paid' 				=> 0,
730 730
 				'STS_ID' 					=> EEM_Transaction::failed_status_code,
731 731
 			));
732
-		} catch( Exception $e ) {
733
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
732
+		} catch (Exception $e) {
733
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
734 734
 		}
735 735
 		return NULL;
736 736
 	}
@@ -744,34 +744,34 @@  discard block
 block discarded – undo
744 744
 	 * @param EE_Transaction $transaction
745 745
 	 * @return EE_Cart
746 746
 	 */
747
-	private function _get_registrations( EE_Transaction $transaction ) {
747
+	private function _get_registrations(EE_Transaction $transaction) {
748 748
 		// first step: grab the registrants  { : o
749
-		$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true );
749
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
750 750
 		// verify registrations have been set
751
-		if ( empty( $registrations )) {
751
+		if (empty($registrations)) {
752 752
 			// if no cached registrations, then check the db
753
-			$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false );
753
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
754 754
 			// still nothing ? well as long as this isn't a revisit
755
-			if ( empty( $registrations ) && ! $this->checkout->revisit ) {
755
+			if (empty($registrations) && ! $this->checkout->revisit) {
756 756
 				// generate new registrations from scratch
757
-				$registrations = $this->_initialize_registrations( $transaction );
757
+				$registrations = $this->_initialize_registrations($transaction);
758 758
 			}
759 759
 		}
760 760
 		// sort by their original registration order
761
-		usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' ));
761
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
762 762
 		// then loop thru the array
763
-		foreach ( $registrations as $registration ) {
763
+		foreach ($registrations as $registration) {
764 764
 			// verify each registration
765
-			if ( $registration instanceof EE_Registration ) {
765
+			if ($registration instanceof EE_Registration) {
766 766
 				// we display all attendee info for the primary registrant
767
-				if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) {
767
+				if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) {
768 768
 					$this->checkout->primary_revisit = TRUE;
769 769
 					break;
770
-				} else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) {
770
+				} else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) {
771 771
 					// but hide info if it doesn't belong to you
772
-					$transaction->clear_cache( 'Registration', $registration->ID() );
772
+					$transaction->clear_cache('Registration', $registration->ID());
773 773
 				}
774
-				$this->checkout->set_reg_status_updated( $registration->ID(), false );
774
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
775 775
 			}
776 776
 		}
777 777
 	}
@@ -785,17 +785,17 @@  discard block
 block discarded – undo
785 785
 	 * @param EE_Transaction $transaction
786 786
 	 * @return    array
787 787
 	 */
788
-	private function _initialize_registrations( EE_Transaction $transaction ) {
788
+	private function _initialize_registrations(EE_Transaction $transaction) {
789 789
 		$att_nmbr = 0;
790 790
 		$registrations = array();
791
-		if ( $transaction instanceof EE_Transaction ) {
791
+		if ($transaction instanceof EE_Transaction) {
792 792
 			/** @type EE_Registration_Processor $registration_processor */
793
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
793
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
794 794
 			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
795 795
 			// now let's add the cart items to the $transaction
796
-			foreach ( $this->checkout->cart->get_tickets() as $line_item ) {
796
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
797 797
 				//do the following for each ticket of this type they selected
798
-				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
798
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
799 799
 					$att_nmbr++;
800 800
 					$registration = $registration_processor->generate_ONE_registration_from_line_item(
801 801
 						$line_item,
@@ -803,12 +803,12 @@  discard block
 block discarded – undo
803 803
 						$att_nmbr,
804 804
 						$this->checkout->total_ticket_count
805 805
 					);
806
-					if ( $registration instanceof EE_Registration ) {
807
-						$registrations[ $registration->ID() ] = $registration;
806
+					if ($registration instanceof EE_Registration) {
807
+						$registrations[$registration->ID()] = $registration;
808 808
 					}
809 809
 				}
810 810
 			}
811
-			$registration_processor->fix_reg_final_price_rounding_issue( $transaction );
811
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
812 812
 		}
813 813
 		return $registrations;
814 814
 	}
@@ -823,12 +823,12 @@  discard block
 block discarded – undo
823 823
 	 * @param EE_Registration $reg_B
824 824
 	 * @return array()
825 825
 	 */
826
-	public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) {
826
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) {
827 827
 		// this shouldn't ever happen within the same TXN, but oh well
828
-		if ( $reg_A->count() == $reg_B->count() ) {
828
+		if ($reg_A->count() == $reg_B->count()) {
829 829
 			return 0;
830 830
 		}
831
-		return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1;
831
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
832 832
 	}
833 833
 
834 834
 
@@ -843,35 +843,35 @@  discard block
 block discarded – undo
843 843
 	 */
844 844
 	private function _final_verifications() {
845 845
 		// filter checkout
846
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout );
846
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
847 847
 		//verify that current step is still set correctly
848
-		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) {
849
-			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__ );
848
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
849
+			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__);
850 850
 			return false;
851 851
 		}
852 852
 		// if returning to SPCO, then verify that primary registrant is set
853
-		if ( ! empty( $this->checkout->reg_url_link )) {
853
+		if ( ! empty($this->checkout->reg_url_link)) {
854 854
 			$valid_registrant = $this->checkout->transaction->primary_registration();
855
-			if ( ! $valid_registrant instanceof EE_Registration ) {
856
-				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__ );
855
+			if ( ! $valid_registrant instanceof EE_Registration) {
856
+				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__);
857 857
 				return false;
858 858
 			}
859 859
 			$valid_registrant = null;
860
-			foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) {
861
-				if ( $registration instanceof EE_Registration ) {
862
-					if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) {
860
+			foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
861
+				if ($registration instanceof EE_Registration) {
862
+					if ($registration->reg_url_link() == $this->checkout->reg_url_link) {
863 863
 						$valid_registrant = $registration;
864 864
 					}
865 865
 				}
866 866
 			}
867
-			if ( ! $valid_registrant instanceof EE_Registration ) {
868
-				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__ );
867
+			if ( ! $valid_registrant instanceof EE_Registration) {
868
+				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__);
869 869
 				return false;
870 870
 			}
871 871
 		}
872 872
 		// now that things have been kinda sufficiently verified,
873 873
 		// let's add the checkout to the session so that's available other systems
874
-		EE_Registry::instance()->SSN->set_checkout( $this->checkout );
874
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
875 875
 		return true;
876 876
 	}
877 877
 
@@ -887,28 +887,28 @@  discard block
 block discarded – undo
887 887
 	 * @access    private
888 888
 	 * @param bool $reinitializing
889 889
 	 */
890
-	private function _initialize_reg_steps( $reinitializing = false ) {
891
-		$this->checkout->set_reg_step_initiated( $this->checkout->current_step );
890
+	private function _initialize_reg_steps($reinitializing = false) {
891
+		$this->checkout->set_reg_step_initiated($this->checkout->current_step);
892 892
 		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
893
-		foreach ( $this->checkout->reg_steps as $reg_step ) {
894
-			if ( ! $reg_step->initialize_reg_step() ) {
893
+		foreach ($this->checkout->reg_steps as $reg_step) {
894
+			if ( ! $reg_step->initialize_reg_step()) {
895 895
 				// if not initialized then maybe this step is being removed...
896
-				if ( $reg_step->is_current_step() && ! $reinitializing ) {
896
+				if ($reg_step->is_current_step() && ! $reinitializing) {
897 897
 					// if it was the current step, then we need to start over here
898
-					$this->_initialize_reg_steps( true );
898
+					$this->_initialize_reg_steps(true);
899 899
 					return;
900 900
 				}
901 901
 				continue;
902 902
 			}
903 903
 			// i18n
904 904
 			$reg_step->translate_js_strings();
905
-			if ( $reg_step->is_current_step() ) {
905
+			if ($reg_step->is_current_step()) {
906 906
 				// the text that appears on the reg step form submit button
907 907
 				$reg_step->set_submit_button_text();
908 908
 			}
909 909
 		}
910 910
 		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
911
-		do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step );
911
+		do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
912 912
 	}
913 913
 
914 914
 
@@ -921,39 +921,39 @@  discard block
 block discarded – undo
921 921
 	 */
922 922
 	private function _check_form_submission() {
923 923
 		//does this request require the reg form to be generated ?
924
-		if ( $this->checkout->generate_reg_form ) {
924
+		if ($this->checkout->generate_reg_form) {
925 925
 			// ever heard that song by Blue Rodeo ?
926 926
 			try {
927 927
 				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
928 928
 				// if not displaying a form, then check for form submission
929
-				if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) {
929
+				if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) {
930 930
 					// clear out any old data in case this step is being run again
931
-					$this->checkout->current_step->set_valid_data( array() );
931
+					$this->checkout->current_step->set_valid_data(array());
932 932
 					// capture submitted form data
933 933
 					$this->checkout->current_step->reg_form->receive_form_submission(
934
-						apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout )
934
+						apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout)
935 935
 					);
936 936
 					// validate submitted form data
937
-					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) {
937
+					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) {
938 938
 						// thou shall not pass !!!
939 939
 						$this->checkout->continue_reg = FALSE;
940 940
 						// any form validation errors?
941
-						if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) {
941
+						if ($this->checkout->current_step->reg_form->submission_error_message() != '') {
942 942
 							$submission_error_messages = array();
943 943
 							// bad, bad, bad registrant
944
-							foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){
945
-								if ( $validation_error instanceof EE_Validation_Error ) {
946
-									$submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() );
944
+							foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
945
+								if ($validation_error instanceof EE_Validation_Error) {
946
+									$submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage());
947 947
 								}
948 948
 							}
949
-							EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
949
+							EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
950 950
 						}
951 951
 						// well not really... what will happen is we'll just get redirected back to redo the current step
952 952
 						$this->go_to_next_step();
953 953
 						return;
954 954
 					}
955 955
 				}
956
-			} catch( EE_Error $e ) {
956
+			} catch (EE_Error $e) {
957 957
 				$e->get_error();
958 958
 			}
959 959
 		}
@@ -969,38 +969,38 @@  discard block
 block discarded – undo
969 969
 	 */
970 970
 	private function _process_form_action() {
971 971
 		// what cha wanna do?
972
-		switch( $this->checkout->action ) {
972
+		switch ($this->checkout->action) {
973 973
 			// AJAX next step reg form
974 974
 			case 'display_spco_reg_step' :
975 975
 				$this->checkout->redirect = FALSE;
976
-				if ( EE_Registry::instance()->REQ->ajax ) {
977
-					$this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() );
976
+				if (EE_Registry::instance()->REQ->ajax) {
977
+					$this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
978 978
 				}
979 979
 				break;
980 980
 
981 981
 			default :
982 982
 				// meh... do one of those other steps first
983
-				if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) {
983
+				if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
984 984
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
985
-					do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
985
+					do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
986 986
 					// call action on current step
987
-					if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) {
987
+					if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
988 988
 						// good registrant, you get to proceed
989
-						if ( $this->checkout->current_step->success_message() != '' ) {
990
-							if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) {
991
-								EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() );
989
+						if ($this->checkout->current_step->success_message() != '') {
990
+							if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) {
991
+								EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions());
992 992
 							}
993 993
 						}
994 994
 						// pack it up, pack it in...
995 995
 						$this->_setup_redirect();
996 996
 					}
997 997
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
998
-					do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
998
+					do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
999 999
 
1000 1000
 				} else {
1001 1001
 					EE_Error::add_error(
1002 1002
 						sprintf(
1003
-							__( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ),
1003
+							__('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1004 1004
 							$this->checkout->action,
1005 1005
 							$this->checkout->current_step->name()
1006 1006
 						),
@@ -1026,10 +1026,10 @@  discard block
 block discarded – undo
1026 1026
 	public function add_styles_and_scripts() {
1027 1027
 		// i18n
1028 1028
 		$this->translate_js_strings();
1029
-		if ( $this->checkout->admin_request ) {
1030
-			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 );
1029
+		if ($this->checkout->admin_request) {
1030
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1031 1031
 		} else {
1032
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 );
1032
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1033 1033
 		}
1034 1034
 	}
1035 1035
 
@@ -1045,42 +1045,42 @@  discard block
 block discarded – undo
1045 1045
 		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1046 1046
 		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1047 1047
 		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');
1048
-		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' );
1049
-		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' );
1050
-		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' );
1048
+		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');
1049
+		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');
1050
+		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');
1051 1051
 		EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1052 1052
 		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');
1053
-		EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' );
1054
-		EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' );
1053
+		EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>');
1054
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1055 1055
 		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1056 1056
 		EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1057 1057
 		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1058
-		EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' );
1059
-		EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' );
1060
-		EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' );
1061
-		EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' );
1062
-		EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' );
1063
-		EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' );
1064
-		EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' );
1065
-		EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' );
1066
-		EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' );
1067
-		EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' );
1068
-		EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' );
1069
-		EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' );
1070
-		EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' );
1071
-		EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' );
1058
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1059
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1060
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1061
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1062
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1063
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1064
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1065
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1066
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1067
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1068
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1069
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1070
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1071
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1072 1072
 		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1073
-			__( '%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' ),
1073
+			__('%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'),
1074 1074
 			'<h4 class="important-notice">',
1075 1075
 			'</h4>',
1076 1076
 			'<br />',
1077 1077
 			'<p>',
1078
-			'<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="',
1078
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1079 1079
 			'">',
1080 1080
 			'</a>',
1081 1081
 			'</p>'
1082 1082
 		);
1083
-		EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true );
1083
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1084 1084
 	}
1085 1085
 
1086 1086
 
@@ -1093,25 +1093,25 @@  discard block
 block discarded – undo
1093 1093
 	 */
1094 1094
 	public function enqueue_styles_and_scripts() {
1095 1095
 		// load css
1096
-		wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION );
1097
-		wp_enqueue_style( 'single_page_checkout' );
1096
+		wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1097
+		wp_enqueue_style('single_page_checkout');
1098 1098
 		// load JS
1099
-		wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array( 'jquery' ), '1.0.1', TRUE );
1100
-		wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE );
1101
-		wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE );
1102
-		wp_enqueue_script( 'single_page_checkout' );
1099
+		wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery	.plugin.min.js', array('jquery'), '1.0.1', TRUE);
1100
+		wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE);
1101
+		wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE);
1102
+		wp_enqueue_script('single_page_checkout');
1103 1103
 
1104 1104
 		/**
1105 1105
 		 * global action hook for enqueueing styles and scripts with
1106 1106
 		 * spco calls.
1107 1107
 		 */
1108
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this );
1108
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1109 1109
 
1110 1110
 		/**
1111 1111
 		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1112 1112
 		 * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1113 1113
 		 */
1114
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this );
1114
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this);
1115 1115
 
1116 1116
 		// add css and JS for current step
1117 1117
 		$this->checkout->current_step->enqueue_styles_and_scripts();
@@ -1127,20 +1127,20 @@  discard block
 block discarded – undo
1127 1127
 	 */
1128 1128
 	private function _display_spco_reg_form() {
1129 1129
 		// if registering via the admin, just display the reg form for the current step
1130
-		if ( $this->checkout->admin_request ) {
1131
-			EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() );
1130
+		if ($this->checkout->admin_request) {
1131
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1132 1132
 		} else {
1133 1133
 			// add powered by EE msg
1134
-			add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' ));
1134
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1135 1135
 
1136
-			$empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false;
1136
+			$empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false;
1137 1137
 			$cookies_not_set_msg = '';
1138
-			if ( $empty_cart ) {
1139
-				if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) {
1138
+			if ($empty_cart) {
1139
+				if ( ! isset($_COOKIE['ee_cookie_test'])) {
1140 1140
 					$cookies_not_set_msg = apply_filters(
1141 1141
 						'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1142 1142
 						sprintf(
1143
-							__( '%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' ),
1143
+							__('%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'),
1144 1144
 							'<div class="ee-attention">',
1145 1145
 							'</div>',
1146 1146
 							'<h6 class="important-notice">',
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 					'layout_strategy' =>
1162 1162
 						new EE_Template_Layout(
1163 1163
 							array(
1164
-								'layout_template_file' 			=> SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1164
+								'layout_template_file' 			=> SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1165 1165
 								'template_args' => array(
1166 1166
 									'empty_cart' 		=> $empty_cart,
1167 1167
 									'revisit' 				=> $this->checkout->revisit,
@@ -1170,8 +1170,8 @@  discard block
 block discarded – undo
1170 1170
 									'empty_msg' 		=> apply_filters(
1171 1171
 										'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1172 1172
 										sprintf(
1173
-											__( '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' ),
1174
-											'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
1173
+											__('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'),
1174
+											'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1175 1175
 											'">',
1176 1176
 											'</a>'
1177 1177
 										)
@@ -1179,14 +1179,14 @@  discard block
 block discarded – undo
1179 1179
 									'cookies_not_set_msg' 		=> $cookies_not_set_msg,
1180 1180
 									'registration_time_limit' 	=> $this->checkout->get_registration_time_limit(),
1181 1181
 									'session_expiration' 			=>
1182
-										gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) )
1182
+										gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS))
1183 1183
 							)
1184 1184
 						)
1185 1185
 					)
1186 1186
 				)
1187 1187
 			);
1188 1188
 			// load template and add to output sent that gets filtered into the_content()
1189
-			EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() );
1189
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js());
1190 1190
 		}
1191 1191
 	}
1192 1192
 
@@ -1200,8 +1200,8 @@  discard block
 block discarded – undo
1200 1200
 	 * @internal  param string $label
1201 1201
 	 * @return        string
1202 1202
 	 */
1203
-	public function add_extra_finalize_registration_inputs( $next_step ) {
1204
-		if ( $next_step == 'finalize_registration' ) {
1203
+	public function add_extra_finalize_registration_inputs($next_step) {
1204
+		if ($next_step == 'finalize_registration') {
1205 1205
 			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1206 1206
 		}
1207 1207
 	}
@@ -1215,18 +1215,18 @@  discard block
 block discarded – undo
1215 1215
 	 *  @return 	string
1216 1216
 	 */
1217 1217
 	public static function display_registration_footer() {
1218
-		if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) {
1219
-			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1220
-			$url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'http://eventespresso.com/' );
1221
-			$url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url );
1218
+		if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) {
1219
+			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1220
+			$url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'http://eventespresso.com/');
1221
+			$url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1222 1222
 			echo apply_filters(
1223 1223
 				'FHEE__EE_Front_Controller__display_registration_footer',
1224 1224
 				sprintf(
1225
-					__( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ),
1226
-					'<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="',
1225
+					__('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'),
1226
+					'<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="',
1227 1227
 					'" target="_blank">',
1228 1228
 					'</a>',
1229
-					'<a href="' . $url . '" title="',
1229
+					'<a href="'.$url.'" title="',
1230 1230
 					'" target="_blank">',
1231 1231
 					'</a></div>'
1232 1232
 				)
@@ -1257,12 +1257,12 @@  discard block
 block discarded – undo
1257 1257
 	 * @return 	array
1258 1258
 	 */
1259 1259
 	private function _setup_redirect() {
1260
-		if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
1260
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1261 1261
 			$this->checkout->redirect = TRUE;
1262
-			if ( empty( $this->checkout->redirect_url )) {
1262
+			if (empty($this->checkout->redirect_url)) {
1263 1263
 				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1264 1264
 			}
1265
-			$this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout );
1265
+			$this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout);
1266 1266
 		}
1267 1267
 	}
1268 1268
 
@@ -1275,12 +1275,12 @@  discard block
 block discarded – undo
1275 1275
 	 * @return void
1276 1276
 	 */
1277 1277
 	public function go_to_next_step() {
1278
-		if ( EE_Registry::instance()->REQ->ajax ) {
1278
+		if (EE_Registry::instance()->REQ->ajax) {
1279 1279
 			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1280
-			$this->checkout->json_response->set_unexpected_errors( ob_get_clean() );
1280
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1281 1281
 		}
1282 1282
 		// just return for these conditions
1283
-		if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) {
1283
+		if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') {
1284 1284
 			return;
1285 1285
 		}
1286 1286
 		// AJAX response
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 	 */
1302 1302
 	protected function _handle_json_response() {
1303 1303
 		// if this is an ajax request
1304
-		if ( EE_Registry::instance()->REQ->ajax ) {
1304
+		if (EE_Registry::instance()->REQ->ajax) {
1305 1305
 			// DEBUG LOG
1306 1306
 			//$this->checkout->log(
1307 1307
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1311,10 +1311,10 @@  discard block
 block discarded – undo
1311 1311
 			//		'continue_reg'               => $this->checkout->continue_reg,
1312 1312
 			//	)
1313 1313
 			//);
1314
-			$this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() );
1315
-			$this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing );
1314
+			$this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit());
1315
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1316 1316
 			// just send the ajax (
1317
-			$json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response );
1317
+			$json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response);
1318 1318
 			$this->unlock_transaction();
1319 1319
 			echo $json_response;
1320 1320
 			exit();
@@ -1331,9 +1331,9 @@  discard block
 block discarded – undo
1331 1331
 	 */
1332 1332
 	protected function _handle_html_redirects() {
1333 1333
 		// going somewhere ?
1334
-		if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) {
1334
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1335 1335
 			// store notices in a transient
1336
-			EE_Error::get_notices( false, true, true );
1336
+			EE_Error::get_notices(false, true, true);
1337 1337
 			$this->unlock_transaction();
1338 1338
 			// DEBUG LOG
1339 1339
 			//$this->checkout->log(
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
 			//		'headers_list'    => headers_list(),
1345 1345
 			//	)
1346 1346
 			//);
1347
-			wp_safe_redirect( $this->checkout->redirect_url );
1347
+			wp_safe_redirect($this->checkout->redirect_url);
1348 1348
 			exit();
1349 1349
 		}
1350 1350
 	}
Please login to merge, or discard this patch.
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 1 patch
Spacing   +365 added lines, -365 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 	 *  @return 	void
29 29
 	 */
30 30
 	public static function set_hooks() {
31
-		add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) );
32
-		add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
33
-		add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
34
-		add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
35
-		add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
36
-		add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) );
37
-		add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
31
+		add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters'));
32
+		add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
33
+		add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
34
+		add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
35
+		add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
36
+		add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details'));
37
+		add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
38 38
 		);
39
-		add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 );
39
+		add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1);
40 40
 	}
41 41
 
42 42
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * 	ajax switch_spco_billing_form
46 46
 	 */
47 47
 	public static function switch_spco_billing_form() {
48
-		EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' );
48
+		EED_Single_Page_Checkout::process_ajax_request('switch_payment_method');
49 49
 	}
50 50
 
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * 	ajax save_payer_details
55 55
 	 */
56 56
 	public static function save_payer_details() {
57
-		EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' );
57
+		EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax');
58 58
 	}
59 59
 
60 60
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * 	ajax get_transaction_details
64 64
 	 */
65 65
 	public static function get_transaction_details() {
66
-		EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' );
66
+		EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways');
67 67
 	}
68 68
 
69 69
 
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 	 * @param    EE_Checkout $checkout
92 92
 	 * @return    \EE_SPCO_Reg_Step_Payment_Options
93 93
 	 */
94
-	public function __construct( EE_Checkout $checkout ) {
94
+	public function __construct(EE_Checkout $checkout) {
95 95
 		$this->_slug = 'payment_options';
96 96
 		$this->_name = __('Payment Options', 'event_espresso');
97
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
97
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
98 98
 		$this->checkout = $checkout;
99 99
 		$this->_reset_success_message();
100
-		$this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
100
+		$this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
101 101
 	}
102 102
 
103 103
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * @param null $line_item_display
116 116
 	 */
117
-	public function set_line_item_display( $line_item_display ) {
117
+	public function set_line_item_display($line_item_display) {
118 118
 		$this->line_item_display = $line_item_display;
119 119
 	}
120 120
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	 * @return void
126 126
 	 */
127 127
 	public function translate_js_strings() {
128
-		EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' );
129
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' );
130
-		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' );
128
+		EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso');
129
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso');
130
+		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso');
131 131
 	}
132 132
 
133 133
 
@@ -156,20 +156,20 @@  discard block
 block discarded – undo
156 156
 			// 	$ 0.00 transactions (no payment required)
157 157
 			! $this->checkout->payment_required()
158 158
 			// but do NOT remove if current action being called belongs to this reg step
159
-			&& ! is_callable( array( $this, $this->checkout->action ) )
159
+			&& ! is_callable(array($this, $this->checkout->action))
160 160
 			&& ! $this->completed()
161 161
 		) {
162 162
 			// and if so, then we no longer need the Payment Options step
163
-			if ( $this->is_current_step() ) {
163
+			if ($this->is_current_step()) {
164 164
 				$this->checkout->generate_reg_form = false;
165 165
 			}
166
-			$this->checkout->remove_reg_step( $this->_slug );
166
+			$this->checkout->remove_reg_step($this->_slug);
167 167
 			// DEBUG LOG
168 168
 			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
169 169
 			return false;
170 170
 		}
171 171
 		// load EEM_Payment_Method
172
-		EE_Registry::instance()->load_model( 'Payment_Method' );
172
+		EE_Registry::instance()->load_model('Payment_Method');
173 173
 		// get all active payment methods
174 174
 		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
175 175
 			$this->checkout->transaction, EEM_Payment_Method::scope_cart
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return bool
184 184
 	 */
185 185
 	public function generate_reg_form() {
186
-		EE_Registry::instance()->load_helper( 'HTML' );
186
+		EE_Registry::instance()->load_helper('HTML');
187 187
 		// reset in case someone changes their mind
188 188
 		$this->_reset_selected_method_of_payment();
189 189
 		// set some defaults
@@ -194,16 +194,16 @@  discard block
 block discarded – undo
194 194
 		$sold_out_events = array();
195 195
 		$reg_count = 0;
196 196
 		// loop thru registrations to gather info
197
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
198
-		foreach ( $registrations as $registration ) {
197
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
198
+		foreach ($registrations as $registration) {
199 199
 			//echo '<h3 style="color:#E76700;line-height:1em;">' . $registration->ID() . '<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span>    <b style="font-size:10px;color:#333">  ' . __LINE__ . ' </b></h3>';
200 200
 			/** @var $registration EE_Registration */
201 201
 			$reg_count++;
202 202
 			// if returning registrant is Approved then do NOT do this
203
-			if ( ! ( $this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved )) {
204
-				if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true )) {
203
+			if ( ! ($this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved)) {
204
+				if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) {
205 205
 					// add event to list of events that are sold out
206
-					$sold_out_events[ $registration->event()->ID() ] = $registration->event();
206
+					$sold_out_events[$registration->event()->ID()] = $registration->event();
207 207
 					do_action(
208 208
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
209 209
 						$registration->event(),
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 					);
212 212
 				}
213 213
 				// event requires admin approval
214
-				if ( $registration->status_ID() == EEM_Registration::status_id_not_approved ) {
214
+				if ($registration->status_ID() == EEM_Registration::status_id_not_approved) {
215 215
 					// add event to list of events with pre-approval reg status
216
-					$registrations_requiring_pre_approval[ $registration->ID() ] = $registration;
216
+					$registrations_requiring_pre_approval[$registration->ID()] = $registration;
217 217
 					do_action(
218 218
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
219 219
 						$registration->event(),
@@ -222,29 +222,29 @@  discard block
 block discarded – undo
222 222
 				}
223 223
 			}
224 224
 			// are they allowed to pay now and is there monies owing?
225
-			if ( $registration->owes_monies_and_can_pay() ) {
226
-				$registrations_requiring_payment[ $registration->ID() ] = $registration;
225
+			if ($registration->owes_monies_and_can_pay()) {
226
+				$registrations_requiring_payment[$registration->ID()] = $registration;
227 227
 				do_action(
228 228
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
229 229
 					$registration->event(),
230 230
 					$this
231 231
 				);
232
-			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()  ) {
233
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
232
+			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) {
233
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
234 234
 			}
235 235
 		}
236 236
 		$subsections = array();
237 237
 		// now decide which template to load
238
-		if ( ! empty( $sold_out_events )) {
239
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
238
+		if ( ! empty($sold_out_events)) {
239
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
240 240
 		}
241
-		if ( ! empty( $registrations_requiring_pre_approval )) {
242
-			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval );
241
+		if ( ! empty($registrations_requiring_pre_approval)) {
242
+			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval);
243 243
 		}
244
-		if ( ! empty( $registrations_for_free_events ) ) {
245
-			$subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events );
244
+		if ( ! empty($registrations_for_free_events)) {
245
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
246 246
 		}
247
-		if ( ! empty( $registrations_requiring_payment ) ) {
247
+		if ( ! empty($registrations_requiring_payment)) {
248 248
 			//EEH_Debug_Tools::printr( $registrations_requiring_payment, '$registrations_requiring_payment', __FILE__, __LINE__ );
249 249
 			// autoload Line_Item_Display classes
250 250
 			EEH_Autoloader::register_line_item_filter_autoloaders();
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
 			//EEH_Debug_Tools::printr( $filtered_line_item_tree->total(), '$filtered_line_item_tree->total()', __FILE__, __LINE__ );
262 262
 			$this->checkout->amount_owing = $filtered_line_item_tree->total();
263 263
 
264
-			if ( $this->checkout->amount_owing > 0 ) {
264
+			if ($this->checkout->amount_owing > 0) {
265 265
 				EEH_Autoloader::register_line_item_display_autoloaders();
266
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
267
-				$subsections[ 'payment_options' ] = $this->_display_payment_options(
268
-					$this->line_item_display->display_line_item( $filtered_line_item_tree )
266
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
267
+				$subsections['payment_options'] = $this->_display_payment_options(
268
+					$this->line_item_display->display_line_item($filtered_line_item_tree)
269 269
 				);
270 270
 				$this->_apply_transaction_payments_to_amount_owing();
271 271
 			}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection
301 301
 	 * @return \EE_Line_Item_Filter_Collection
302 302
 	 */
303
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
303
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
304 304
 		$line_item_filter_collection->add(
305 305
 			new EE_Billable_Line_Item_Filter(
306 306
 				EE_Registry::instance()->SSN->checkout()->transaction->registrations(
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 				)
309 309
 			)
310 310
 		);
311
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
311
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
312 312
 		return $line_item_filter_collection;
313 313
 	}
314 314
 
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 	 * @return void
323 323
 	 */
324 324
 	protected function _hide_reg_step_submit_button_if_revisit() {
325
-		if ( $this->checkout->revisit ) {
326
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
325
+		if ($this->checkout->revisit) {
326
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
327 327
 		}
328 328
 	}
329 329
 
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
 	 * @param \EE_Event[] $sold_out_events_array
335 335
 	 * @return \EE_Form_Section_Proper
336 336
 	 */
337
-	private function _sold_out_events( $sold_out_events_array = array() ) {
337
+	private function _sold_out_events($sold_out_events_array = array()) {
338 338
 		// set some defaults
339 339
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
340 340
 		$sold_out_events = '';
341
-		foreach ( $sold_out_events_array as $sold_out_event ) {
342
-			$sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ));
341
+		foreach ($sold_out_events_array as $sold_out_event) {
342
+			$sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text'));
343 343
 		}
344 344
 		return new EE_Form_Section_Proper(
345 345
 			array(
@@ -351,14 +351,14 @@  discard block
 block discarded – undo
351 351
 				),
352 352
 				'layout_strategy'		=> new EE_Template_Layout(
353 353
 					array(
354
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template
354
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template
355 355
 						'template_args'  				=> apply_filters(
356 356
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
357 357
 							array(
358 358
 								'sold_out_events' 			=> $sold_out_events,
359 359
 								'sold_out_events_msg' 	=> apply_filters(
360 360
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg',
361
-									__( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' )
361
+									__('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso')
362 362
 								)
363 363
 							)
364 364
 						)
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
 	 * @param array $registrations_requiring_pre_approval
376 376
 	 * @return \EE_Form_Section_Proper
377 377
 	 */
378
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) {
378
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
379 379
 		$events_requiring_pre_approval = '';
380
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
381
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
382
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
383
-					EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
380
+		foreach ($registrations_requiring_pre_approval as $registration) {
381
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
382
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
383
+					EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
384 384
 					)
385
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
385
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
386 386
 				);
387 387
 			}
388 388
 		}
@@ -394,14 +394,14 @@  discard block
 block discarded – undo
394 394
 				),
395 395
 				'layout_strategy'		=> new EE_Template_Layout(
396 396
 					array(
397
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template
397
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template
398 398
 						'template_args'  				=> apply_filters(
399 399
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
400 400
 							array(
401
-								'events_requiring_pre_approval' 			=> implode( '', $events_requiring_pre_approval ),
401
+								'events_requiring_pre_approval' 			=> implode('', $events_requiring_pre_approval),
402 402
 								'events_requiring_pre_approval_msg' 	=> apply_filters(
403 403
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
404
-									__( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' )
404
+									__('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso')
405 405
 								)
406 406
 							)
407 407
 						),
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	 * @param \EE_Event[] $registrations_for_free_events
420 420
 	 * @return \EE_Form_Section_Proper
421 421
 	 */
422
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
422
+	private function _no_payment_required($registrations_for_free_events = array()) {
423 423
 		// set some defaults
424 424
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
425 425
 		// generate no_payment_required form
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 				),
432 432
 				'layout_strategy' 	=> new EE_Template_Layout(
433 433
 					array(
434
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template
434
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template
435 435
 						'template_args'  				=> apply_filters(
436 436
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
437 437
 							array(
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 								'registrations' => array(),
440 440
 								'ticket_count' 	=> array(),
441 441
 								'registrations_for_free_events' 	=> $registrations_for_free_events,
442
-								'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' ))
442
+								'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso'))
443 443
 							)
444 444
 						),
445 445
 					)
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 	 * @param string $transaction_details
457 457
 	 * @return \EE_Form_Section_Proper
458 458
 	 */
459
-	private function _display_payment_options( $transaction_details = '' ) {
459
+	private function _display_payment_options($transaction_details = '') {
460 460
 		// has method_of_payment been set by no-js user?
461 461
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
462 462
 		// build payment options form
@@ -468,20 +468,20 @@  discard block
 block discarded – undo
468 468
 						'before_payment_options' => apply_filters(
469 469
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
470 470
 							new EE_Form_Section_Proper(
471
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
471
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
472 472
 							)
473 473
 						),
474 474
 						'payment_options' => $this->_setup_payment_options(),
475 475
 						'after_payment_options' => apply_filters(
476 476
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
477 477
 							new EE_Form_Section_Proper(
478
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
478
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
479 479
 							)
480 480
 						),
481 481
 						'default_hidden_inputs' => $this->reg_step_hidden_inputs(),
482
-						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs( FALSE )
482
+						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs(FALSE)
483 483
 					),
484
-					'layout_strategy'	=> new EE_Template_Layout( array(
484
+					'layout_strategy'	=> new EE_Template_Layout(array(
485 485
 							'layout_template_file' 	=> $this->_template,
486 486
 							'template_args'  				=> apply_filters(
487 487
 								'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args',
@@ -505,11 +505,11 @@  discard block
 block discarded – undo
505 505
 	 * @param bool $no_payment_required
506 506
 	 * @return \EE_Form_Section_Proper
507 507
 	 */
508
-	private function _extra_hidden_inputs( $no_payment_required = TRUE ) {
508
+	private function _extra_hidden_inputs($no_payment_required = TRUE) {
509 509
 
510 510
 		return new EE_Form_Section_Proper(
511 511
 			array(
512
-				'html_id' 				=> 'ee-' . $this->slug() . '-extra-hidden-inputs',
512
+				'html_id' 				=> 'ee-'.$this->slug().'-extra-hidden-inputs',
513 513
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
514 514
 				'subsections' 		=> array(
515 515
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
 	 */
545 545
 	protected function _apply_transaction_payments_to_amount_owing() {
546 546
 		$payments = $this->checkout->transaction->approved_payments();
547
-		if ( ! empty( $payments ) ) {
548
-			foreach ( $payments as $payment ) {
549
-				if ( $payment instanceof EE_Payment ) {
547
+		if ( ! empty($payments)) {
548
+			foreach ($payments as $payment) {
549
+				if ($payment instanceof EE_Payment) {
550 550
 					$this->checkout->amount_owing -= $payment->amount();
551 551
 				}
552 552
 			}
@@ -562,9 +562,9 @@  discard block
 block discarded – undo
562 562
 	 * @param 	bool $force_reset
563 563
 	 * @return 	void
564 564
 	 */
565
-	private function _reset_selected_method_of_payment( $force_reset = FALSE ) {
566
-		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE ));
567
-		if ( $reset_payment_method ) {
565
+	private function _reset_selected_method_of_payment($force_reset = FALSE) {
566
+		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE));
567
+		if ($reset_payment_method) {
568 568
 			$this->checkout->selected_method_of_payment = NULL;
569 569
 			$this->checkout->payment_method = NULL;
570 570
 			$this->checkout->billing_form = NULL;
@@ -583,9 +583,9 @@  discard block
 block discarded – undo
583 583
 	 * @param string $selected_method_of_payment
584 584
 	 * 	@return 		EE_Billing_Info_Form
585 585
 	 */
586
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
587
-		$selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
588
-		EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment ));
586
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
587
+		$selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
588
+		EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment));
589 589
 	}
590 590
 
591 591
 
@@ -598,40 +598,40 @@  discard block
 block discarded – undo
598 598
 		// load payment method classes
599 599
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
600 600
 		// switch up header depending on number of available payment methods
601
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
602
-			? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' ))
603
-			: apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' ));
601
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
602
+			? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso'))
603
+			: apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso'));
604 604
 		$available_payment_methods = array(
605 605
 			// display the "Payment Method" header
606 606
 			'payment_method_header' => new EE_Form_Section_HTML(
607
-				EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' )
607
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
608 608
 			)
609 609
 		);
610 610
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
611 611
 		$available_payment_method_options = array();
612 612
 		$default_payment_method_option = array();
613 613
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
614
-		$payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' )));
614
+		$payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;')));
615 615
 		// loop through payment methods
616
-		foreach( $this->checkout->available_payment_methods as $payment_method ) {
617
-			if ( $payment_method instanceof EE_Payment_Method ) {
618
-				$payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' );
616
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
617
+			if ($payment_method instanceof EE_Payment_Method) {
618
+				$payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img');
619 619
 				// check if any payment methods are set as default
620 620
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
621
-				if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) {
621
+				if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) {
622 622
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
623 623
 					$this->_save_selected_method_of_payment();
624
-					$default_payment_method_option[ $payment_method->slug() ] =  $payment_method_button;
624
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
625 625
 				} else {
626
-					$available_payment_method_options[ $payment_method->slug() ] =  $payment_method_button;
626
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
627 627
 				}
628
-				$payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method );
628
+				$payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method);
629 629
 			}
630 630
 		}
631 631
 		// prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs
632 632
 		$available_payment_method_options = $default_payment_method_option + $available_payment_method_options;
633 633
 		// now generate the actual form  inputs
634
-		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options );
634
+		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options);
635 635
 		$available_payment_methods = $available_payment_methods + $payment_methods_billing_info;
636 636
 
637 637
 		// build the available payment methods form
@@ -651,19 +651,19 @@  discard block
 block discarded – undo
651 651
 	 * @return EE_Payment_Method[]
652 652
 	 */
653 653
 	protected function _get_available_payment_methods() {
654
-		if ( ! empty( $this->checkout->available_payment_methods )) {
654
+		if ( ! empty($this->checkout->available_payment_methods)) {
655 655
 			return $this->checkout->available_payment_methods;
656 656
 		}
657 657
 		$available_payment_methods = array();
658 658
 		// load EEM_Payment_Method
659
-		EE_Registry::instance()->load_model( 'Payment_Method' );
659
+		EE_Registry::instance()->load_model('Payment_Method');
660 660
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
661 661
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
662 662
 		// get all active payment methods
663
-		$payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart );
664
-		foreach ( $payment_methods as $payment_method ) {
665
-			if ( $payment_method instanceof EE_Payment_Method ) {
666
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
663
+		$payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart);
664
+		foreach ($payment_methods as $payment_method) {
665
+			if ($payment_method instanceof EE_Payment_Method) {
666
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
667 667
 			}
668 668
 		}
669 669
 		return $available_payment_methods;
@@ -679,14 +679,14 @@  discard block
 block discarded – undo
679 679
 	 * @param 	array $available_payment_method_options
680 680
 	 * @return 	\EE_Form_Section_Proper
681 681
 	 */
682
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
682
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
683 683
 		// generate inputs
684 684
 		return new EE_Form_Section_Proper(
685 685
 			array(
686 686
 				'html_id' 				=> 'ee-available-payment-method-inputs',
687 687
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
688 688
 				'subsections' 		=> array(
689
-					'' => new EE_Radio_Button_Input (
689
+					'' => new EE_Radio_Button_Input(
690 690
 						$available_payment_method_options,
691 691
 						array(
692 692
 							'html_name' 				=> 'selected_method_of_payment',
@@ -710,36 +710,36 @@  discard block
 block discarded – undo
710 710
 	 * @param 	EE_Payment_Method $payment_method
711 711
 	 * @return 	\EE_Form_Section_Proper
712 712
 	 */
713
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
713
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
714 714
 		$currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE;
715 715
 		// generate the billing form for payment method
716
-		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML();
716
+		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML();
717 717
 		$this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form;
718 718
 		// it's all in the details
719
-		$info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' );
719
+		$info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr');
720 720
 		// add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not
721
-		if ( $payment_method->description() ) {
721
+		if ($payment_method->description()) {
722 722
 			$payment_method_info = $payment_method->description();
723
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
724
-			$payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
723
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
724
+			$payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
725 725
 		} else {
726
-			$payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
726
+			$payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
727 727
 		}
728
-		$info_html .= EEH_HTML::p (
729
-			apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ),
728
+		$info_html .= EEH_HTML::p(
729
+			apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info),
730 730
 			'',
731 731
 			'spco-payment-method-desc ee-attention'
732 732
 		);
733 733
 
734 734
 		return new EE_Form_Section_Proper(
735 735
 			array(
736
-				'html_id' 					=> 'spco-payment-method-info-' . $payment_method->slug(),
736
+				'html_id' 					=> 'spco-payment-method-info-'.$payment_method->slug(),
737 737
 				'html_class' 			=> 'spco-payment-method-info-dv',
738 738
 				// only display the selected or default PM
739 739
 				'html_style' 			=> $currently_selected ? '' : 'display:none;',
740 740
 				'layout_strategy'		=> new EE_Div_Per_Section_Layout(),
741 741
 				'subsections' 			=> array(
742
-					'info' 					=> new EE_Form_Section_HTML( $info_html ),
742
+					'info' 					=> new EE_Form_Section_HTML($info_html),
743 743
 					'billing_form' 		=> $currently_selected ? $billing_form : new EE_Form_Section_HTML()
744 744
 				)
745 745
 			)
@@ -757,12 +757,12 @@  discard block
 block discarded – undo
757 757
 	 */
758 758
 	public function get_billing_form_html_for_payment_method() {
759 759
 		// how have they chosen to pay?
760
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
760
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
761 761
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
762
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
762
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
763 763
 			return FALSE;
764 764
 		}
765
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
765
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
766 766
             EE_Error::add_success(
767 767
                 apply_filters(
768 768
                     'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -771,20 +771,20 @@  discard block
 block discarded – undo
771 771
             );
772 772
         }
773 773
 		// now generate billing form for selected method of payment
774
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
774
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
775 775
 		// fill form with attendee info if applicable
776
-		if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
777
-			$payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
776
+		if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
777
+			$payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
778 778
 		}
779 779
 		// and debug content
780
-		if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
781
-			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form );
780
+		if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
781
+			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form);
782 782
 		}
783 783
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : '';
784
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ));
784
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
785 785
 		// localize validation rules for main form
786 786
 		$this->checkout->current_step->reg_form->localize_validation_rules();
787
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
787
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
788 788
 		return TRUE;
789 789
 	}
790 790
 
@@ -797,15 +797,15 @@  discard block
 block discarded – undo
797 797
 	 * @param EE_Payment_Method $payment_method
798 798
 	 * @return \EE_Billing_Info_Form
799 799
 	 */
800
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
801
-		$billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) );
802
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
803
-			if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) {
804
-                if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
800
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
801
+		$billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing));
802
+		if ($billing_form instanceof EE_Billing_Info_Form) {
803
+			if (EE_Registry::instance()->REQ->is_set('payment_method')) {
804
+                if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
805 805
                     EE_Error::add_success(
806 806
                         apply_filters(
807 807
                             'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
808
-                            sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
808
+                            sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name())
809 809
                         )
810 810
                     );
811 811
                 }
@@ -830,27 +830,27 @@  discard block
 block discarded – undo
830 830
 	 * @param string 		$request_param
831 831
 	 * @return NULL|string
832 832
 	 */
833
-	private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) {
833
+	private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') {
834 834
 		// is selected_method_of_payment set in the request ?
835
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE );
836
-		if ( $selected_method_of_payment ) {
835
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE);
836
+		if ($selected_method_of_payment) {
837 837
 			// sanitize it
838
-			$selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment;
839
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
838
+			$selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment;
839
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
840 840
 			// store it in the session so that it's available for all subsequent requests including AJAX
841
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
841
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
842 842
 		} else {
843 843
 			// or is is set in the session ?
844
-			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' );
844
+			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment');
845 845
 		}
846 846
 		// do ya really really gotta have it?
847
-		if ( empty( $selected_method_of_payment ) && $required ) {
847
+		if (empty($selected_method_of_payment) && $required) {
848 848
 			EE_Error::add_error(
849 849
 				sprintf(
850
-					__( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ),
850
+					__('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'),
851 851
 					'<br/>',
852 852
 					'<br/>',
853
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
853
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
854 854
 				),
855 855
 				__FILE__, __FUNCTION__, __LINE__
856 856
 			);
@@ -876,37 +876,37 @@  discard block
 block discarded – undo
876 876
 	 * @return string
877 877
 	 */
878 878
 	public function switch_payment_method() {
879
-		if ( ! $this->_verify_payment_method_is_set() ) {
879
+		if ( ! $this->_verify_payment_method_is_set()) {
880 880
 			return FALSE;
881 881
 		}
882
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
882
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
883 883
 			EE_Error::add_success(
884 884
 				apply_filters(
885 885
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
886
-					sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() )
886
+					sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
887 887
 				)
888 888
 			);
889 889
 		}
890 890
 		// generate billing form for selected method of payment if it hasn't been done already
891
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
892
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
891
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
892
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
893 893
 		}
894 894
 		// fill form with attendee info if applicable
895
-		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
896
-			$this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
895
+		if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
896
+			$this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
897 897
 		}
898 898
 		// and debug content
899
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
900
-			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form );
899
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
900
+			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form);
901 901
 		}
902 902
 		// get html and validation rules for form
903
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
904
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() ));
903
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
904
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html()));
905 905
 			// localize validation rules for main form
906
-			$this->checkout->billing_form->localize_validation_rules( TRUE );
907
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
906
+			$this->checkout->billing_form->localize_validation_rules(TRUE);
907
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
908 908
 		} else {
909
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ));
909
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
910 910
 		}
911 911
 		//prevents advancement to next step
912 912
 		$this->checkout->continue_reg = FALSE;
@@ -921,12 +921,12 @@  discard block
 block discarded – undo
921 921
 	 */
922 922
 	protected function _verify_payment_method_is_set() {
923 923
 		// generate billing form for selected method of payment if it hasn't been done already
924
-		if ( empty( $this->checkout->selected_method_of_payment )) {
924
+		if (empty($this->checkout->selected_method_of_payment)) {
925 925
 			// how have they chosen to pay?
926
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
926
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
927 927
 		}
928 928
 		// verify payment method
929
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
929
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
930 930
 			// get payment method for selected method of payment
931 931
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
932 932
 		}
@@ -946,23 +946,23 @@  discard block
 block discarded – undo
946 946
 	 * @return void
947 947
 	 */
948 948
 	public function save_payer_details_via_ajax() {
949
-		if ( ! $this->_verify_payment_method_is_set() ) {
949
+		if ( ! $this->_verify_payment_method_is_set()) {
950 950
 			return;
951 951
 		}
952 952
 		// generate billing form for selected method of payment if it hasn't been done already
953
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
954
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
953
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
954
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
955 955
 		}
956 956
 		// generate primary attendee from payer info if applicable
957 957
 		if ( ! $this->checkout->transaction_has_primary_registrant()) {
958 958
 			$attendee = $this->_create_attendee_from_request_data();
959
-			if ( $attendee instanceof EE_Attendee ) {
960
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
961
-					if ( $registration->is_primary_registrant() ) {
959
+			if ($attendee instanceof EE_Attendee) {
960
+				foreach ($this->checkout->transaction->registrations() as $registration) {
961
+					if ($registration->is_primary_registrant()) {
962 962
 						$this->checkout->primary_attendee_obj = $attendee;
963
-						$registration->_add_relation_to( $attendee, 'Attendee' );
964
-						$registration->set_attendee_id( $attendee->ID() );
965
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
963
+						$registration->_add_relation_to($attendee, 'Attendee');
964
+						$registration->set_attendee_id($attendee->ID());
965
+						$registration->update_cache_after_object_save('Attendee', $attendee);
966 966
 					}
967 967
 				}
968 968
 			}
@@ -975,56 +975,56 @@  discard block
 block discarded – undo
975 975
 	 * uses info from alternate GET or POST data (such as AJAX) to create a new attendee
976 976
 	 * @return \EE_Attendee
977 977
 	 */
978
-	protected function _create_attendee_from_request_data(){
978
+	protected function _create_attendee_from_request_data() {
979 979
 		// get State ID
980
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
981
-		if ( ! empty( $STA_ID )) {
980
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
981
+		if ( ! empty($STA_ID)) {
982 982
 			// can we get state object from name ?
983
-			EE_Registry::instance()->load_model( 'State' );
984
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' );
985
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
983
+			EE_Registry::instance()->load_model('State');
984
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
985
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
986 986
 		}
987 987
 		// get Country ISO
988
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
989
-		if ( ! empty( $CNT_ISO )) {
988
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
989
+		if ( ! empty($CNT_ISO)) {
990 990
 			// can we get country object from name ?
991
-			EE_Registry::instance()->load_model( 'Country' );
992
-			$country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' );
993
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
991
+			EE_Registry::instance()->load_model('Country');
992
+			$country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO');
993
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
994 994
 		}
995 995
 		// grab attendee data
996 996
 		$attendee_data = array(
997
-			'ATT_fname' 		=> ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
998
-			'ATT_lname' 		=> ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
999
-			'ATT_email' 		=> ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1000
-			'ATT_address' 		=> ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1001
-			'ATT_address2' 	=> ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1002
-			'ATT_city' 			=> ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
997
+			'ATT_fname' 		=> ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
998
+			'ATT_lname' 		=> ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
999
+			'ATT_email' 		=> ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1000
+			'ATT_address' 		=> ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1001
+			'ATT_address2' 	=> ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1002
+			'ATT_city' 			=> ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1003 1003
 			'STA_ID' 				=> $STA_ID,
1004 1004
 			'CNT_ISO' 			=> $CNT_ISO,
1005
-			'ATT_zip' 				=> ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1006
-			'ATT_phone' 		=> ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1005
+			'ATT_zip' 				=> ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1006
+			'ATT_phone' 		=> ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1007 1007
 		);
1008 1008
 		// validate the email address since it is the most important piece of info
1009
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) {
1010
-			EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1009
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) {
1010
+			EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1011 1011
 		}
1012 1012
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1013
-		if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) {
1014
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1013
+		if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) {
1014
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1015 1015
 				'ATT_fname' => $attendee_data['ATT_fname'],
1016 1016
 				'ATT_lname' => $attendee_data['ATT_lname'],
1017 1017
 				'ATT_email' => $attendee_data['ATT_email']
1018 1018
 			));
1019
-			if ( $existing_attendee instanceof EE_Attendee ) {
1019
+			if ($existing_attendee instanceof EE_Attendee) {
1020 1020
 				return $existing_attendee;
1021 1021
 			}
1022 1022
 		}
1023 1023
 		// no existing attendee? kk let's create a new one
1024 1024
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1025
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1026
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1027
-		return EE_Attendee::new_instance( $attendee_data );
1025
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1026
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1027
+		return EE_Attendee::new_instance($attendee_data);
1028 1028
 	}
1029 1029
 
1030 1030
 
@@ -1044,22 +1044,22 @@  discard block
 block discarded – undo
1044 1044
 	 */
1045 1045
 	public function process_reg_step() {
1046 1046
 		// how have they chosen to pay?
1047
-		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE );
1047
+		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE);
1048 1048
 		// choose your own adventure based on method_of_payment
1049
-		switch(  $this->checkout->selected_method_of_payment ) {
1049
+		switch ($this->checkout->selected_method_of_payment) {
1050 1050
 
1051 1051
 			case 'events_sold_out' :
1052 1052
 				$this->checkout->redirect = TRUE;
1053 1053
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1054
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1054
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1055 1055
 				// mark this reg step as completed
1056 1056
 				$this->set_completed();
1057 1057
 				return FALSE;
1058 1058
 				break;
1059 1059
 
1060 1060
 			case 'payments_closed' :
1061
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) {
1062
-					EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1061
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) {
1062
+					EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1063 1063
 				}
1064 1064
 				// mark this reg step as completed
1065 1065
 				$this->set_completed();
@@ -1067,8 +1067,8 @@  discard block
 block discarded – undo
1067 1067
 				break;
1068 1068
 
1069 1069
 			case 'no_payment_required' :
1070
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) {
1071
-					EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1070
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) {
1071
+					EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1072 1072
 				}
1073 1073
 				// mark this reg step as completed
1074 1074
 				$this->set_completed();
@@ -1077,9 +1077,9 @@  discard block
 block discarded – undo
1077 1077
 
1078 1078
 			default:
1079 1079
 				$payment_successful = $this->_process_payment();
1080
-				if ( $payment_successful ) {
1080
+				if ($payment_successful) {
1081 1081
 					$this->checkout->continue_reg = true;
1082
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1082
+					$this->_maybe_set_completed($this->checkout->payment_method);
1083 1083
 				} else {
1084 1084
 					$this->checkout->continue_reg = false;
1085 1085
 				}
@@ -1097,8 +1097,8 @@  discard block
 block discarded – undo
1097 1097
 	 * @param \EE_Payment_Method $payment_method
1098 1098
 	 * @return void
1099 1099
 	 */
1100
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1101
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1100
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1101
+		switch ($payment_method->type_obj()->payment_occurs()) {
1102 1102
 			case EE_PMT_Base::offsite :
1103 1103
 				break;
1104 1104
 			case EE_PMT_Base::onsite :
@@ -1121,15 +1121,15 @@  discard block
 block discarded – undo
1121 1121
 	public function update_reg_step() {
1122 1122
 		$success = TRUE;
1123 1123
 		// if payment required
1124
-		if ( $this->checkout->transaction->total() > 0 ) {
1125
-			do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction );
1124
+		if ($this->checkout->transaction->total() > 0) {
1125
+			do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction);
1126 1126
 			// attempt payment via payment method
1127 1127
 			$success = $this->process_reg_step();
1128 1128
 		}
1129
-		if ( $success && ! $this->checkout->redirect ) {
1130
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() );
1129
+		if ($success && ! $this->checkout->redirect) {
1130
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID());
1131 1131
 			 // set return URL
1132
-			$this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url );
1132
+			$this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url);
1133 1133
 		}
1134 1134
 		return $success;
1135 1135
 	}
@@ -1149,24 +1149,24 @@  discard block
 block discarded – undo
1149 1149
 		// clear any previous errors related to not selecting a payment method
1150 1150
 //		EE_Error::overwrite_errors();
1151 1151
 		// ya gotta make a choice man
1152
-		if ( empty( $this->checkout->selected_method_of_payment )) {
1153
-			$this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' ));
1152
+		if (empty($this->checkout->selected_method_of_payment)) {
1153
+			$this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso'));
1154 1154
 			return FALSE;
1155 1155
 		}
1156 1156
 		// get EE_Payment_Method object
1157
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1157
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1158 1158
 			return FALSE;
1159 1159
 		}
1160 1160
 		// setup billing form
1161
-		if ( $this->checkout->payment_method->is_on_site() ) {
1162
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1161
+		if ($this->checkout->payment_method->is_on_site()) {
1162
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1163 1163
 			// bad billing form ?
1164
-			if ( ! $this->_billing_form_is_valid() ) {
1164
+			if ( ! $this->_billing_form_is_valid()) {
1165 1165
 				return FALSE;
1166 1166
 			}
1167 1167
 		}
1168 1168
 		// ensure primary registrant has been fully processed
1169
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1169
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1170 1170
 			return FALSE;
1171 1171
 		}
1172 1172
 		/** @type EE_Transaction_Processor $transaction_processor */
@@ -1174,24 +1174,24 @@  discard block
 block discarded – undo
1174 1174
 		// in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved
1175 1175
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1176 1176
 		// attempt payment
1177
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1177
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1178 1178
 		// process results
1179
-		$payment = $this->_validate_payment( $payment );
1180
-		$payment = $this->_post_payment_processing( $payment );
1179
+		$payment = $this->_validate_payment($payment);
1180
+		$payment = $this->_post_payment_processing($payment);
1181 1181
 		// verify payment
1182
-		if ( $payment instanceof EE_Payment ) {
1182
+		if ($payment instanceof EE_Payment) {
1183 1183
 			// store that for later
1184 1184
 			$this->checkout->payment = $payment;
1185 1185
 			/** @type EE_Transaction_Processor $transaction_processor */
1186
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1186
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1187 1187
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1188
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1189
-			if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) {
1188
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1189
+			if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) {
1190 1190
 				return true;
1191 1191
 			} else {
1192 1192
 				return false;
1193 1193
 			}
1194
-		} else if ( $payment === true ) {
1194
+		} else if ($payment === true) {
1195 1195
 			// please note that offline payment methods will NOT make a payment,
1196 1196
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1197 1197
 			$this->checkout->payment = $payment;
@@ -1210,10 +1210,10 @@  discard block
 block discarded – undo
1210 1210
 	 * @return bool
1211 1211
 	 */
1212 1212
 	public function redirect_form() {
1213
-		$payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() );
1213
+		$payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment());
1214 1214
 		$html = $payment_method_billing_info->get_html_and_js();
1215 1215
 		$html .= $this->checkout->redirect_form;
1216
-		EE_Registry::instance()->REQ->add_output( $html );
1216
+		EE_Registry::instance()->REQ->add_output($html);
1217 1217
 		return TRUE;
1218 1218
 	}
1219 1219
 
@@ -1226,33 +1226,33 @@  discard block
 block discarded – undo
1226 1226
 	 * @return bool
1227 1227
 	 */
1228 1228
 	private function _billing_form_is_valid() {
1229
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1230
-			if ( $this->checkout->billing_form->was_submitted() ) {
1229
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1230
+			if ($this->checkout->billing_form->was_submitted()) {
1231 1231
 				$this->checkout->billing_form->receive_form_submission();
1232
-				if ( $this->checkout->billing_form->is_valid() ) {
1232
+				if ($this->checkout->billing_form->is_valid()) {
1233 1233
 					return TRUE;
1234 1234
 				}
1235 1235
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1236 1236
 				$error_strings = array();
1237
-				foreach( $validation_errors as $validation_error ){
1238
-					if( $validation_error instanceof EE_Validation_Error ){
1237
+				foreach ($validation_errors as $validation_error) {
1238
+					if ($validation_error instanceof EE_Validation_Error) {
1239 1239
 						$form_section = $validation_error->get_form_section();
1240
-						if( $form_section instanceof EE_Form_Input_Base ){
1240
+						if ($form_section instanceof EE_Form_Input_Base) {
1241 1241
 							$label = $form_section->html_label_text();
1242
-						}elseif( $form_section instanceof EE_Form_Section_Base ){
1242
+						}elseif ($form_section instanceof EE_Form_Section_Base) {
1243 1243
 							$label = $form_section->name();
1244
-						}else{
1245
-							$label = __( 'Validation Error', 'event_espresso' );
1244
+						} else {
1245
+							$label = __('Validation Error', 'event_espresso');
1246 1246
 						}
1247
-						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() );
1247
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1248 1248
 					}
1249 1249
 				}
1250
-				EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings )  ), __FILE__, __FUNCTION__, __LINE__ );
1250
+				EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__);
1251 1251
 			} else {
1252
-				EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1252
+				EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1253 1253
 			}
1254 1254
 		} else {
1255
-			EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1255
+			EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1256 1256
 		}
1257 1257
 		return FALSE;
1258 1258
 	}
@@ -1270,9 +1270,9 @@  discard block
 block discarded – undo
1270 1270
 	 */
1271 1271
 		private function _setup_primary_registrant_prior_to_payment() {
1272 1272
 			// check if transaction has a primary registrant and that it has a related Attendee object
1273
-			if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1273
+			if ( ! $this->checkout->transaction_has_primary_registrant()) {
1274 1274
 				// need to at least gather some primary registrant data before attempting payment
1275
-				if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) {
1275
+				if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) {
1276 1276
 					return FALSE;
1277 1277
 				}
1278 1278
 			}
@@ -1280,13 +1280,13 @@  discard block
 block discarded – undo
1280 1280
 			// grab the primary_registration object
1281 1281
 			$primary_registration = $this->checkout->transaction->primary_registration();
1282 1282
 			/** @type EE_Transaction_Processor $transaction_processor */
1283
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1283
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1284 1284
 			// at this point we'll consider a TXN to not have been failed
1285
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1285
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1286 1286
 			// save the TXN ( which clears cached copy of primary_registration)
1287 1287
 			$this->checkout->transaction->save();
1288 1288
 			// grab TXN ID and save it to the primary_registration
1289
-			$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1289
+			$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1290 1290
 			// save what we have so far
1291 1291
 			$primary_registration->save();
1292 1292
 			return TRUE;
@@ -1303,41 +1303,41 @@  discard block
 block discarded – undo
1303 1303
 		private function _capture_primary_registration_data_from_billing_form() {
1304 1304
 			// convert billing form data into an attendee
1305 1305
 			$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1306
-			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1306
+			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1307 1307
 				EE_Error::add_error(
1308 1308
 					sprintf(
1309
-						__( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1309
+						__('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1310 1310
 						'<br/>',
1311
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1311
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1312 1312
 					), __FILE__, __FUNCTION__, __LINE__
1313 1313
 				);
1314 1314
 				return FALSE;
1315 1315
 			}
1316 1316
 			$primary_registration = $this->checkout->transaction->primary_registration();
1317
-			if ( ! $primary_registration instanceof EE_Registration ) {
1317
+			if ( ! $primary_registration instanceof EE_Registration) {
1318 1318
 				EE_Error::add_error(
1319 1319
 					sprintf(
1320
-						__( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1320
+						__('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1321 1321
 						'<br/>',
1322
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1322
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1323 1323
 					), __FILE__, __FUNCTION__, __LINE__
1324 1324
 				);
1325 1325
 				return FALSE;
1326 1326
 			}
1327
-			if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) {
1327
+			if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) {
1328 1328
 				EE_Error::add_error(
1329 1329
 					sprintf(
1330
-						__( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1330
+						__('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1331 1331
 						'<br/>',
1332
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1332
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1333 1333
 					), __FILE__, __FUNCTION__, __LINE__
1334 1334
 				);
1335 1335
 				return FALSE;
1336 1336
 			}
1337 1337
 			/** @type EE_Registration_Processor $registration_processor */
1338
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1338
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1339 1339
 			// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1340
-			$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1340
+			$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1341 1341
 
1342 1342
 			return TRUE;
1343 1343
 		}
@@ -1353,35 +1353,35 @@  discard block
 block discarded – undo
1353 1353
 	 */
1354 1354
 		private function _get_payment_method_for_selected_method_of_payment() {
1355 1355
 			// get EE_Payment_Method object
1356
-			if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) {
1357
-				$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1356
+			if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1357
+				$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1358 1358
 			} else {
1359 1359
 				// load EEM_Payment_Method
1360
-				EE_Registry::instance()->load_model( 'Payment_Method' );
1360
+				EE_Registry::instance()->load_model('Payment_Method');
1361 1361
 				/** @type EEM_Payment_Method $EEM_Payment_Method */
1362 1362
 				$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1363
-				$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1363
+				$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1364 1364
 			}
1365 1365
 			// verify $payment_method
1366
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
1366
+			if ( ! $payment_method instanceof EE_Payment_Method) {
1367 1367
 				// not a payment
1368 1368
 				EE_Error::add_error(
1369 1369
 					sprintf(
1370
-						__( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1370
+						__('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1371 1371
 						'<br/>',
1372
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1372
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1373 1373
 					), __FILE__, __FUNCTION__, __LINE__
1374 1374
 				);
1375 1375
 				return NULL;
1376 1376
 			}
1377 1377
 			// and verify it has a valid Payment_Method Type object
1378
-			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1378
+			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1379 1379
 				// not a payment
1380 1380
 				EE_Error::add_error(
1381 1381
 					sprintf(
1382
-						__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1382
+						__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1383 1383
 						'<br/>',
1384
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1384
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1385 1385
 					), __FILE__, __FUNCTION__, __LINE__
1386 1386
 				);
1387 1387
 				return NULL;
@@ -1400,30 +1400,30 @@  discard block
 block discarded – undo
1400 1400
 	 * 	@type 	EE_Payment_Method $payment_method
1401 1401
 	 * 	@return 	mixed	EE_Payment | boolean
1402 1402
 	 */
1403
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1404
-		$payment =NULL;
1403
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1404
+		$payment = NULL;
1405 1405
 		$this->checkout->transaction->save();
1406
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1407
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1406
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1407
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1408 1408
 			return FALSE;
1409 1409
 		}
1410 1410
 		try {
1411
-			$payment_processor->set_revisit( $this->checkout->revisit );
1411
+			$payment_processor->set_revisit($this->checkout->revisit);
1412 1412
 			// generate payment object
1413 1413
 			$payment = $payment_processor->process_payment(
1414 1414
 				$payment_method,
1415 1415
 				$this->checkout->transaction,
1416 1416
 				$this->checkout->amount_owing,
1417 1417
 				$this->checkout->billing_form,
1418
-				$this->_get_return_url( $payment_method ),
1418
+				$this->_get_return_url($payment_method),
1419 1419
 				'CART',
1420 1420
 				$this->checkout->admin_request,
1421 1421
 				TRUE,
1422 1422
 				$this->reg_step_url()
1423 1423
 			);
1424 1424
 
1425
-		} catch( Exception $e ) {
1426
-			$this->_handle_payment_processor_exception( $e );
1425
+		} catch (Exception $e) {
1426
+			$this->_handle_payment_processor_exception($e);
1427 1427
 		}
1428 1428
 		return $payment;
1429 1429
 	}
@@ -1437,12 +1437,12 @@  discard block
 block discarded – undo
1437 1437
 	 * @param \Exception $e
1438 1438
 	 * @return void
1439 1439
 	 */
1440
-	protected function _handle_payment_processor_exception( Exception $e ) {
1440
+	protected function _handle_payment_processor_exception(Exception $e) {
1441 1441
 		EE_Error::add_error(
1442 1442
 			sprintf(
1443
-				__( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ),
1443
+				__('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'),
1444 1444
 				'<br/>',
1445
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
1445
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
1446 1446
 				$e->getMessage(),
1447 1447
 				$e->getFile(),
1448 1448
 				$e->getLine()
@@ -1459,9 +1459,9 @@  discard block
 block discarded – undo
1459 1459
 	 * @param \EE_Payment_Method $payment_method
1460 1460
 	 * @return string
1461 1461
 	 */
1462
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
1462
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
1463 1463
 		$return_url = '';
1464
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1464
+		switch ($payment_method->type_obj()->payment_occurs()) {
1465 1465
 
1466 1466
 			case EE_PMT_Base::offsite :
1467 1467
 				$return_url = add_query_arg(
@@ -1492,27 +1492,27 @@  discard block
 block discarded – undo
1492 1492
 	 * @param EE_Payment $payment
1493 1493
 	 * @return EE_Payment | FALSE
1494 1494
 	 */
1495
-	private function _validate_payment( $payment = NULL ) {
1496
-		if (  $this->checkout->payment_method->is_off_line() ) {
1495
+	private function _validate_payment($payment = NULL) {
1496
+		if ($this->checkout->payment_method->is_off_line()) {
1497 1497
 			return TRUE;
1498 1498
 		}
1499 1499
 		// verify payment object
1500
-		if ( $payment instanceof EE_Payment ) {
1500
+		if ($payment instanceof EE_Payment) {
1501 1501
 			if (
1502 1502
 				$payment->status() != EEM_Payment::status_id_approved
1503 1503
 				&& $payment->status() != EEM_Payment::status_id_pending
1504 1504
 				&& $payment->status() != EEM_Payment::status_id_cancelled
1505 1505
 				&& $payment->gateway_response() != ''
1506 1506
 			) {
1507
-				EE_Error::add_error( $payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__ );
1507
+				EE_Error::add_error($payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__);
1508 1508
 			}
1509 1509
 		} else {
1510 1510
 			// not a payment
1511 1511
 			EE_Error::add_error(
1512 1512
 				sprintf(
1513
-					__( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1513
+					__('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1514 1514
 					'<br/>',
1515
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1515
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1516 1516
 				), __FILE__, __FUNCTION__, __LINE__
1517 1517
 			);
1518 1518
 			return FALSE;
@@ -1529,23 +1529,23 @@  discard block
 block discarded – undo
1529 1529
 	 * @param EE_Payment $payment
1530 1530
 	 * @return bool
1531 1531
 	 */
1532
-	private function _post_payment_processing( $payment = NULL ) {
1532
+	private function _post_payment_processing($payment = NULL) {
1533 1533
 		// On-Site payment?
1534
-		if ( $this->checkout->payment_method->is_on_site() ) {
1535
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) {
1534
+		if ($this->checkout->payment_method->is_on_site()) {
1535
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
1536 1536
 				//$this->_setup_redirect_for_next_step();
1537 1537
 				$this->checkout->continue_reg = false;
1538 1538
 			}
1539 1539
 			// Off-Site payment?
1540
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
1540
+		} else if ($this->checkout->payment_method->is_off_site()) {
1541 1541
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
1542
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ){
1543
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
1542
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
1543
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
1544 1544
 				$this->checkout->redirect = TRUE;
1545 1545
 				$this->checkout->redirect_form = $payment->redirect_form();
1546
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
1546
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
1547 1547
 				// set JSON response
1548
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
1548
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
1549 1549
 				// set cron job for finalizing the TXN
1550 1550
 				// in case the user does not return from the off-site gateway
1551 1551
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -1553,21 +1553,21 @@  discard block
 block discarded – undo
1553 1553
 					$this->checkout->transaction->ID()
1554 1554
 				);
1555 1555
 				// and lastly, let's bump the payment status to pending
1556
-				$payment->set_status( EEM_Payment::status_id_pending );
1556
+				$payment->set_status(EEM_Payment::status_id_pending);
1557 1557
 				$payment->save();
1558 1558
 			} else {
1559 1559
 				// not a payment
1560 1560
 				$this->checkout->continue_reg = false;
1561 1561
 				EE_Error::add_error(
1562 1562
 					sprintf(
1563
-						__( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1563
+						__('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1564 1564
 						'<br/>',
1565
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1565
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1566 1566
 					), __FILE__, __FUNCTION__, __LINE__
1567 1567
 				);
1568 1568
 			}
1569 1569
 			// Off-Line payment?
1570
-		} else if ( $payment === TRUE ) {
1570
+		} else if ($payment === TRUE) {
1571 1571
 			//$this->_setup_redirect_for_next_step();
1572 1572
 			return TRUE;
1573 1573
 		} else {
@@ -1603,65 +1603,65 @@  discard block
 block discarded – undo
1603 1603
 	 * @return bool
1604 1604
 	 * @throws \EE_Error
1605 1605
 	 */
1606
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
1606
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
1607 1607
 		// off-line payment? carry on
1608
-		if ( $payment_occurs == EE_PMT_Base::offline ) {
1608
+		if ($payment_occurs == EE_PMT_Base::offline) {
1609 1609
 			return true;
1610 1610
 		}
1611 1611
 		// verify payment validity
1612
-		if ( $payment instanceof EE_Payment ) {
1613
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
1612
+		if ($payment instanceof EE_Payment) {
1613
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
1614 1614
 			$msg = $payment->gateway_response();
1615 1615
 			// check results
1616
-			switch ( $payment->status() ) {
1616
+			switch ($payment->status()) {
1617 1617
 
1618 1618
 				// good payment
1619 1619
 				case EEM_Payment::status_id_approved :
1620
-					EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1620
+					EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1621 1621
 					return TRUE;
1622 1622
 					break;
1623 1623
 
1624 1624
 				// slow payment
1625 1625
 				case EEM_Payment::status_id_pending :
1626
-					if ( empty( $msg )) {
1627
-						$msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' );
1626
+					if (empty($msg)) {
1627
+						$msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso');
1628 1628
 					}
1629
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
1629
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
1630 1630
 					return TRUE;
1631 1631
 					break;
1632 1632
 
1633 1633
 				// don't wanna payment
1634 1634
 				case EEM_Payment::status_id_cancelled :
1635
-					if ( empty( $msg )) {
1635
+					if (empty($msg)) {
1636 1636
 						$msg = _n(
1637 1637
 							'Payment cancelled. Please try again.',
1638 1638
 							'Payment cancelled. Please try again or select another method of payment.',
1639
-							count( $this->checkout->available_payment_methods ),
1639
+							count($this->checkout->available_payment_methods),
1640 1640
 							'event_espresso'
1641 1641
 						);
1642 1642
 					}
1643
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1643
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1644 1644
 					return FALSE;
1645 1645
 					break;
1646 1646
 
1647 1647
 				// not enough payment
1648 1648
 				case EEM_Payment::status_id_declined :
1649
-					if ( empty( $msg )) {
1649
+					if (empty($msg)) {
1650 1650
 						$msg = _n(
1651 1651
 							'We\'re sorry but your payment was declined. Please try again.',
1652 1652
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
1653
-							count( $this->checkout->available_payment_methods ),
1653
+							count($this->checkout->available_payment_methods),
1654 1654
 							'event_espresso'
1655 1655
 						);
1656 1656
 					}
1657
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1657
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1658 1658
 					return FALSE;
1659 1659
 					break;
1660 1660
 
1661 1661
 				// bad payment
1662 1662
 				case EEM_Payment::status_id_failed :
1663
-					if ( ! empty( $msg ) ) {
1664
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1663
+					if ( ! empty($msg)) {
1664
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1665 1665
 						return false;
1666 1666
 					}
1667 1667
 					// default to error below
@@ -1671,14 +1671,14 @@  discard block
 block discarded – undo
1671 1671
 		}
1672 1672
 		// off-site payment gateway responses are too unreliable, so let's just assume that
1673 1673
 		// the payment processing is just running slower than the registrant's request
1674
-		if ( $payment_occurs == EE_PMT_Base::offsite ) {
1674
+		if ($payment_occurs == EE_PMT_Base::offsite) {
1675 1675
 			return true;
1676 1676
 		}
1677 1677
 		EE_Error::add_error(
1678 1678
 				sprintf(
1679
-					__( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1679
+					__('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1680 1680
 					'<br/>',
1681
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1681
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1682 1682
 				),
1683 1683
 				__FILE__, __FUNCTION__, __LINE__
1684 1684
 			);
@@ -1711,13 +1711,13 @@  discard block
 block discarded – undo
1711 1711
 	public function process_gateway_response() {
1712 1712
 		$payment = null;
1713 1713
 		// how have they chosen to pay?
1714
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1714
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1715 1715
 		// get EE_Payment_Method object
1716
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1716
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1717 1717
 			$this->checkout->continue_reg = false;
1718 1718
 			return false;
1719 1719
 		}
1720
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
1720
+		if ( ! $this->checkout->payment_method->is_off_site()) {
1721 1721
 			return false;
1722 1722
 		}
1723 1723
 		$this->_validate_offsite_return();
@@ -1731,23 +1731,23 @@  discard block
 block discarded – undo
1731 1731
 		//	true
1732 1732
 		//);
1733 1733
 		// verify TXN
1734
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
1734
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1735 1735
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
1736
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
1736
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
1737 1737
 				$this->checkout->continue_reg = false;
1738 1738
 				return false;
1739 1739
 			}
1740
-			$payment = $this->_process_off_site_payment( $gateway );
1741
-			$payment = $this->_process_cancelled_payments( $payment );
1742
-			$payment = $this->_validate_payment( $payment );
1740
+			$payment = $this->_process_off_site_payment($gateway);
1741
+			$payment = $this->_process_cancelled_payments($payment);
1742
+			$payment = $this->_validate_payment($payment);
1743 1743
 			// if payment was not declined by the payment gateway or cancelled by the registrant
1744
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
1744
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
1745 1745
 				//$this->_setup_redirect_for_next_step();
1746 1746
 				// store that for later
1747 1747
 				$this->checkout->payment = $payment;
1748 1748
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
1749 1749
 				// because we will complete this step during the IPN processing then
1750
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) {
1750
+				if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) {
1751 1751
 					$this->set_completed();
1752 1752
 				}
1753 1753
 				return true;
@@ -1770,19 +1770,19 @@  discard block
 block discarded – undo
1770 1770
 	 * @return bool
1771 1771
 	 */
1772 1772
 	private function _validate_offsite_return() {
1773
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
1774
-		if ( $TXN_ID != $this->checkout->transaction->ID() ) {
1773
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
1774
+		if ($TXN_ID != $this->checkout->transaction->ID()) {
1775 1775
 			// Houston... we might have a problem
1776 1776
 			$invalid_TXN = false;
1777 1777
 			// first gather some info
1778
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1778
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1779 1779
 			$primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null;
1780 1780
 			// let's start by retrieving the cart for this TXN
1781
-			$cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction );
1782
-			if ( $cart instanceof EE_Cart ) {
1781
+			$cart = EE_Cart::get_cart_from_txn($this->checkout->transaction);
1782
+			if ($cart instanceof EE_Cart) {
1783 1783
 				// verify that the current cart has tickets
1784 1784
 				$tickets = $cart->get_tickets();
1785
-				if ( empty( $tickets ) ) {
1785
+				if (empty($tickets)) {
1786 1786
 					$invalid_TXN = true;
1787 1787
 				}
1788 1788
 			} else {
@@ -1790,39 +1790,39 @@  discard block
 block discarded – undo
1790 1790
 			}
1791 1791
 			$valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null;
1792 1792
 			// validate current Session ID and compare against valid TXN session ID
1793
-			if ( EE_Session::instance()->id() === null ) {
1793
+			if (EE_Session::instance()->id() === null) {
1794 1794
 				$invalid_TXN = true;
1795
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
1795
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
1796 1796
 				// WARNING !!!
1797 1797
 				// this could be PayPal sending back duplicate requests (ya they do that)
1798 1798
 				// or it **could** mean someone is simply registering AGAIN after having just done so
1799 1799
 				// so now we need to determine if this current TXN looks valid or not
1800 1800
 				/** @type EE_Transaction_Processor $transaction_processor */
1801
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1801
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1802 1802
 				// has this step even been started ?
1803
-				if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false )
1803
+				if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false)
1804 1804
 				) {
1805 1805
 					// really? you're half way through this reg step, but you never started it ?
1806 1806
 					$invalid_TXN = true;
1807 1807
 				}
1808 1808
 			}
1809
-			if ( $invalid_TXN ) {
1809
+			if ($invalid_TXN) {
1810 1810
 				// is the valid TXN completed ?
1811
-				if ( $valid_TXN instanceof EE_Transaction ) {
1811
+				if ($valid_TXN instanceof EE_Transaction) {
1812 1812
 					/** @type EE_Transaction_Processor $transaction_processor */
1813
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1813
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1814 1814
 					// has this step even been started ?
1815
-					$reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() );
1816
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
1815
+					$reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug());
1816
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
1817 1817
 						// so it **looks** like this is a double request from PayPal
1818 1818
 						// so let's try to pick up where we left off
1819 1819
 						$this->checkout->transaction = $valid_TXN;
1820
-						$this->checkout->refresh_all_entities( true );
1820
+						$this->checkout->refresh_all_entities(true);
1821 1821
 						return;
1822 1822
 					}
1823 1823
 				}
1824 1824
 				// you appear to be lost?
1825
-				$this->_redirect_wayward_request( $primary_registrant );
1825
+				$this->_redirect_wayward_request($primary_registrant);
1826 1826
 			}
1827 1827
 		}
1828 1828
 	}
@@ -1836,16 +1836,16 @@  discard block
 block discarded – undo
1836 1836
 	 * @param \EE_Registration $primary_registrant
1837 1837
 	 * @return bool
1838 1838
 	 */
1839
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
1840
-		if ( ! $primary_registrant instanceof EE_Registration ) {
1839
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
1840
+		if ( ! $primary_registrant instanceof EE_Registration) {
1841 1841
 			// try redirecting based on the current TXN
1842 1842
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null;
1843
-			if ( ! $primary_registrant instanceof EE_Registration ) {
1843
+			if ( ! $primary_registrant instanceof EE_Registration) {
1844 1844
 				EE_Error::add_error(
1845 1845
 					sprintf(
1846
-						__( 'Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1846
+						__('Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1847 1847
 						'<br/>',
1848
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1848
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1849 1849
 					),
1850 1850
 					__FILE__, __FUNCTION__, __LINE__
1851 1851
 				);
@@ -1873,16 +1873,16 @@  discard block
 block discarded – undo
1873 1873
 	 * @param \EE_Offsite_Gateway $gateway
1874 1874
 	 * @return \EE_Payment
1875 1875
 	 */
1876
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
1876
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
1877 1877
 		try {
1878 1878
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
1879
-			if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) {
1879
+			if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) {
1880 1880
 				$payment = $this->checkout->transaction->last_payment();
1881 1881
 				//$payment_source = 'last_payment';
1882 1882
 			} else {
1883 1883
 				// get payment details and process results
1884 1884
 				/** @type EE_Payment_Processor $payment_processor */
1885
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1885
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1886 1886
 				$payment = $payment_processor->process_ipn(
1887 1887
 					$_REQUEST,
1888 1888
 					$this->checkout->transaction,
@@ -1892,14 +1892,14 @@  discard block
 block discarded – undo
1892 1892
 				);
1893 1893
 				//$payment_source = 'process_ipn';
1894 1894
 			}
1895
-		} catch ( Exception $e ) {
1895
+		} catch (Exception $e) {
1896 1896
 			// let's just eat the exception and try to move on using any previously set payment info
1897 1897
 			$payment = $this->checkout->transaction->last_payment();
1898 1898
 			//$payment_source = 'last_payment after Exception';
1899 1899
 			// but if we STILL don't have a payment object
1900
-			if ( ! $payment instanceof EE_Payment ) {
1900
+			if ( ! $payment instanceof EE_Payment) {
1901 1901
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
1902
-				$this->_handle_payment_processor_exception( $e );
1902
+				$this->_handle_payment_processor_exception($e);
1903 1903
 			}
1904 1904
 		}
1905 1905
 		// DEBUG LOG
@@ -1923,13 +1923,13 @@  discard block
 block discarded – undo
1923 1923
 	 * @param EE_Payment $payment
1924 1924
 	 * @return EE_Payment | FALSE
1925 1925
 	 */
1926
-	private function _process_cancelled_payments( $payment = NULL ) {
1926
+	private function _process_cancelled_payments($payment = NULL) {
1927 1927
 		if (
1928
-			isset( $_REQUEST[ 'ee_cancel_payment' ] )
1928
+			isset($_REQUEST['ee_cancel_payment'])
1929 1929
 			&& $payment instanceof EE_Payment
1930 1930
 			&& $payment->status() == EEM_Payment::status_id_failed
1931 1931
 		) {
1932
-			$payment->set_status( EEM_Payment::status_id_cancelled );
1932
+			$payment->set_status(EEM_Payment::status_id_cancelled);
1933 1933
 		}
1934 1934
 		return $payment;
1935 1935
 	}
@@ -1946,23 +1946,23 @@  discard block
 block discarded – undo
1946 1946
 	public function get_transaction_details_for_gateways() {
1947 1947
 		$txn_details = array();
1948 1948
 		// ya gotta make a choice man
1949
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1949
+		if (empty($this->checkout->selected_method_of_payment)) {
1950 1950
 			$txn_details = array(
1951
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
1951
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
1952 1952
 			);
1953 1953
 		}
1954 1954
 		// get EE_Payment_Method object
1955 1955
 		if (
1956
-			empty( $txn_details ) &&
1956
+			empty($txn_details) &&
1957 1957
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
1958 1958
 		) {
1959 1959
 			$txn_details = array(
1960 1960
 				'selected_method_of_payment' => $this->checkout->selected_method_of_payment,
1961
-				'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' )
1961
+				'error' => __('A valid Payment Method could not be determined.', 'event_espresso')
1962 1962
 			);
1963 1963
 		}
1964
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
1965
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
1964
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
1965
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
1966 1966
 			$txn_details = array(
1967 1967
 				'TXN_ID'        			=> $this->checkout->transaction->ID(),
1968 1968
 				'TXN_timestamp' 	=> $this->checkout->transaction->datetime(),
@@ -1973,7 +1973,7 @@  discard block
 block discarded – undo
1973 1973
 				'PMD_ID'        			=> $this->checkout->transaction->payment_method_ID(),
1974 1974
 				'payment_amount' => $this->checkout->amount_owing,
1975 1975
 				'return_url' 				=> $return_url,
1976
-				'cancel_url' 				=> add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
1976
+				'cancel_url' 				=> add_query_arg(array('ee_cancel_payment' => true), $return_url),
1977 1977
 				'notify_url' 				=> EE_Config::instance()->core->txn_page_url(
1978 1978
 					array(
1979 1979
 						'e_reg_url_link'    			=> $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
 				)
1983 1983
 			);
1984 1984
 		}
1985
-		echo json_encode( $txn_details );
1985
+		echo json_encode($txn_details);
1986 1986
 		exit();
1987 1987
 	}
1988 1988
 
Please login to merge, or discard this patch.