Completed
Branch BUG-10059-allow-multiple-invoi... (76c0cc)
by
unknown
40:24 queued 26:41
created
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 	 * _get_transaction_and_cart_for_previous_visit
691 691
 	 *
692 692
 	 * @access private
693
-	 * 	@return mixed EE_Transaction|NULL
693
+	 * 	@return EE_Transaction|null EE_Transaction|NULL
694 694
 	 */
695 695
 	private function _get_transaction_and_cart_for_previous_visit() {
696 696
 		/** @var $TXN_model EEM_Transaction */
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 	 * 	generates a new EE_Transaction object and adds it to the $_transaction property.
769 769
 	 *
770 770
 	 * 	@access private
771
-	 * 	@return mixed EE_Transaction|NULL
771
+	 * 	@return EE_Transaction|null EE_Transaction|NULL
772 772
 	 */
773 773
 	private function _initialize_transaction() {
774 774
 		try {
Please login to merge, or discard this patch.
Spacing   +265 added lines, -265 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\domain\services\capabilities\PublicCapabilities;
2 2
 use EventEspresso\core\exceptions\InvalidEntityException;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 * @return EED_Single_Page_Checkout
55 55
 	 */
56 56
 	public static function instance() {
57
-		add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' );
58
-		return parent::get_instance( __CLASS__ );
57
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
58
+		return parent::get_instance(__CLASS__);
59 59
 	}
60 60
 
61 61
 
@@ -100,22 +100,22 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public static function set_hooks_admin() {
102 102
 		EED_Single_Page_Checkout::set_definitions();
103
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
103
+		if (defined('DOING_AJAX') && DOING_AJAX) {
104 104
 			// going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
105 105
 			ob_start();
106 106
 			EED_Single_Page_Checkout::load_request_handler();
107 107
 			EED_Single_Page_Checkout::load_reg_steps();
108 108
 		} else {
109 109
 			// 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
110
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
110
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
111 111
 		}
112 112
 		// set ajax hooks
113
-		add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
114
-		add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
115
-		add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
116
-		add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
117
-		add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
118
-		add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
113
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
114
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
115
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
116
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
117
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
118
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
119 119
 	}
120 120
 
121 121
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 * @param string $ajax_action
127 127
 	 * @throws \EE_Error
128 128
 	 */
129
-	public static function process_ajax_request( $ajax_action ) {
130
-		EE_Registry::instance()->REQ->set( 'action', $ajax_action );
129
+	public static function process_ajax_request($ajax_action) {
130
+		EE_Registry::instance()->REQ->set('action', $ajax_action);
131 131
 		EED_Single_Page_Checkout::instance()->_initialize();
132 132
 	}
133 133
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 * @throws \EE_Error
140 140
 	 */
141 141
 	public static function display_reg_step() {
142
-		EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' );
142
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
143 143
 	}
144 144
 
145 145
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 * @throws \EE_Error
151 151
 	 */
152 152
 	public static function process_reg_step() {
153
-		EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' );
153
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
154 154
 	}
155 155
 
156 156
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 * @throws \EE_Error
162 162
 	 */
163 163
 	public static function update_reg_step() {
164
-		EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' );
164
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
165 165
 	}
166 166
 
167 167
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @throws \EE_Error
175 175
 	 */
176 176
 	public static function update_checkout() {
177
-		EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' );
177
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
178 178
 	}
179 179
 
180 180
 
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public static function load_request_handler() {
189 189
 		// load core Request_Handler class
190
-		if ( ! isset( EE_Registry::instance()->REQ )) {
191
-			EE_Registry::instance()->load_core( 'Request_Handler' );
190
+		if ( ! isset(EE_Registry::instance()->REQ)) {
191
+			EE_Registry::instance()->load_core('Request_Handler');
192 192
 		}
193 193
 	}
194 194
 
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 	 * @throws \EE_Error
203 203
 	 */
204 204
 	public static function set_definitions() {
205
-        define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
206
-		define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS );
207
-		define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS );
208
-		define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS );
209
-		define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS );
210
-		define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS );
211
-		define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS );
212
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE );
205
+        define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
206
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
207
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
208
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
209
+		define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
210
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
211
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
212
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE);
213 213
 	}
214 214
 
215 215
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	 */
225 225
 	public static function load_reg_steps() {
226 226
 		static $reg_steps_loaded = FALSE;
227
-		if ( $reg_steps_loaded ) {
227
+		if ($reg_steps_loaded) {
228 228
 			return;
229 229
 		}
230 230
 		// filter list of reg_steps
@@ -233,24 +233,24 @@  discard block
 block discarded – undo
233 233
 			EED_Single_Page_Checkout::get_reg_steps()
234 234
 		);
235 235
 		// sort by key (order)
236
-		ksort( $reg_steps_to_load );
236
+		ksort($reg_steps_to_load);
237 237
 		// loop through folders
238
-		foreach ( $reg_steps_to_load as $order => $reg_step ) {
238
+		foreach ($reg_steps_to_load as $order => $reg_step) {
239 239
 			// we need a
240
-			if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
240
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
241 241
 				// copy over to the reg_steps_array
242
-				EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step;
242
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
243 243
 				// register custom key route for each reg step
244 244
 				// ie: step=>"slug" - this is the entire reason we load the reg steps array now
245
-				EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' );
245
+				EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
246 246
 				// add AJAX or other hooks
247
-				if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) {
247
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
248 248
 					// setup autoloaders if necessary
249
-					if ( ! class_exists( $reg_step['class_name'] )) {
250
-						EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE );
249
+					if ( ! class_exists($reg_step['class_name'])) {
250
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE);
251 251
 					}
252
-					if ( is_callable( $reg_step['class_name'], 'set_hooks' )) {
253
-						call_user_func( array( $reg_step['class_name'], 'set_hooks' ));
252
+					if (is_callable($reg_step['class_name'], 'set_hooks')) {
253
+						call_user_func(array($reg_step['class_name'], 'set_hooks'));
254 254
 					}
255 255
 				}
256 256
 			}
@@ -269,28 +269,28 @@  discard block
 block discarded – undo
269 269
 	 */
270 270
 	public static function get_reg_steps() {
271 271
 		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
272
-		if ( empty( $reg_steps )) {
272
+		if (empty($reg_steps)) {
273 273
 			$reg_steps = array(
274 274
 				10 => array(
275
-					'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information',
275
+					'file_path' => SPCO_REG_STEPS_PATH.'attendee_information',
276 276
 					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
277 277
 					'slug' => 'attendee_information',
278 278
 					'has_hooks' => FALSE
279 279
 				),
280 280
 				20 => array(
281
-					'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation',
281
+					'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation',
282 282
 					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
283 283
 					'slug' => 'registration_confirmation',
284 284
 					'has_hooks' => FALSE
285 285
 				),
286 286
 				30 => array(
287
-					'file_path' => SPCO_REG_STEPS_PATH . 'payment_options',
287
+					'file_path' => SPCO_REG_STEPS_PATH.'payment_options',
288 288
 					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
289 289
 					'slug' => 'payment_options',
290 290
 					'has_hooks' => TRUE
291 291
 				),
292 292
 				999 => array(
293
-					'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration',
293
+					'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration',
294 294
 					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
295 295
 					'slug' => 'finalize_registration',
296 296
 					'has_hooks' => FALSE
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 	 */
312 312
 	public static function registration_checkout_for_admin() {
313 313
 		EED_Single_Page_Checkout::load_reg_steps();
314
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
315
-		EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' );
316
-		EE_Registry::instance()->REQ->set( 'process_form_submission', false );
314
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
315
+		EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
316
+		EE_Registry::instance()->REQ->set('process_form_submission', false);
317 317
 		EED_Single_Page_Checkout::instance()->_initialize();
318 318
 		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
319 319
 		return EE_Registry::instance()->REQ->get_output();
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
 	 */
331 331
 	public static function process_registration_from_admin() {
332 332
 		EED_Single_Page_Checkout::load_reg_steps();
333
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
334
-		EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' );
335
-		EE_Registry::instance()->REQ->set( 'process_form_submission', true );
333
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
334
+		EE_Registry::instance()->REQ->set('action', 'process_reg_step');
335
+		EE_Registry::instance()->REQ->set('process_form_submission', true);
336 336
 		EED_Single_Page_Checkout::instance()->_initialize();
337
-		if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) {
338
-			$final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps );
339
-			if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
340
-				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step );
341
-				if ( $final_reg_step->process_reg_step() ) {
337
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
338
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
339
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
340
+				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step);
341
+				if ($final_reg_step->process_reg_step()) {
342 342
 					$final_reg_step->set_completed();
343 343
 					EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array();
344 344
 					return EED_Single_Page_Checkout::instance()->checkout->transaction;
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
 	 * @return    void
359 359
 	 * @throws \EE_Error
360 360
 	 */
361
-	public function run( $WP_Query ) {
361
+	public function run($WP_Query) {
362 362
         if (
363 363
 			$WP_Query instanceof WP_Query
364 364
 			&& $WP_Query->is_main_query()
365
-			&& apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )
365
+			&& apply_filters('FHEE__EED_Single_Page_Checkout__run', true)
366 366
 			&& $this->_is_reg_checkout()
367 367
 		) {
368 368
 			$this->_initialize();
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
         $reg_page_url = \get_permalink(EE_Config::instance()->core->reg_page_id);
382 382
         // get request URI for current request, but without the scheme or host
383 383
         $current_request_uri = \EEH_URL::filter_input_server_url('REQUEST_URI');
384
-        $current_request_uri = html_entity_decode( $current_request_uri );
384
+        $current_request_uri = html_entity_decode($current_request_uri);
385 385
         // get array of query args from the current request URI
386 386
         $query_args = \EEH_URL::get_query_string($current_request_uri);
387 387
         // grab page id if it is set
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
         // now strip all query args from current request URI
392 392
         $current_request_uri = remove_query_arg(array_flip($query_args), $current_request_uri);
393 393
         // and re-add the page id if it was set
394
-        if ($page_id){
394
+        if ($page_id) {
395 395
             $current_request_uri = add_query_arg('page_id', $page_id, $current_request_uri);
396 396
         }
397 397
         // remove slashes and ?
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
 	 * @return    void
411 411
 	 * @throws \EE_Error
412 412
 	 */
413
-	public static function init( $WP_Query ) {
414
-		EED_Single_Page_Checkout::instance()->run( $WP_Query );
413
+	public static function init($WP_Query) {
414
+		EED_Single_Page_Checkout::instance()->run($WP_Query);
415 415
 	}
416 416
 
417 417
 
@@ -425,35 +425,35 @@  discard block
 block discarded – undo
425 425
 	 */
426 426
 	private function _initialize() {
427 427
 		// ensure SPCO doesn't run twice
428
-		if ( EED_Single_Page_Checkout::$_initialized ) {
428
+		if (EED_Single_Page_Checkout::$_initialized) {
429 429
 			return;
430 430
 		}
431 431
         try {
432 432
 			// setup the EE_Checkout object
433 433
 			$this->checkout = $this->_initialize_checkout();
434 434
 			// filter checkout
435
-			$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout );
435
+			$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
436 436
 			// get the $_GET
437 437
 			$this->_get_request_vars();
438 438
 			$this->_block_bots();
439 439
 			// filter continue_reg
440
-			$this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout );
440
+			$this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout);
441 441
 			// load the reg steps array
442
-			if ( ! $this->_load_and_instantiate_reg_steps() ) {
442
+			if ( ! $this->_load_and_instantiate_reg_steps()) {
443 443
 				EED_Single_Page_Checkout::$_initialized = true;
444 444
 				return;
445 445
 			}
446 446
 			// set the current step
447
-			$this->checkout->set_current_step( $this->checkout->step );
447
+			$this->checkout->set_current_step($this->checkout->step);
448 448
 			// and the next step
449 449
 			$this->checkout->set_next_step();
450 450
 			// was there already a valid transaction in the checkout from the session ?
451
-			if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
451
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
452 452
 				// get transaction from db or session
453 453
 				$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin()
454 454
 					? $this->_get_transaction_and_cart_for_previous_visit()
455 455
 					: $this->_get_cart_for_current_session_and_setup_new_transaction();
456
-				if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
456
+				if ( ! $this->checkout->transaction instanceof EE_Transaction) {
457 457
 					// add some style and make it dance
458 458
 					$this->checkout->transaction = EE_Transaction::new_instance();
459 459
 					$this->add_styles_and_scripts();
@@ -461,10 +461,10 @@  discard block
 block discarded – undo
461 461
 					return;
462 462
 				}
463 463
 				// and the registrations for the transaction
464
-				$this->_get_registrations( $this->checkout->transaction );
464
+				$this->_get_registrations($this->checkout->transaction);
465 465
 			}
466 466
 			// verify that everything has been setup correctly
467
-			if ( ! $this->_final_verifications() ) {
467
+			if ( ! $this->_final_verifications()) {
468 468
 				EED_Single_Page_Checkout::$_initialized = true;
469 469
 				return;
470 470
 			}
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
 			// set no cache headers and constants
490 490
 			EE_System::do_not_cache();
491 491
 			// add anchor
492
-			add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 );
493
-		} catch ( Exception $e ) {
494
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
492
+			add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
493
+		} catch (Exception $e) {
494
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
495 495
 		}
496 496
 	}
497 497
 
@@ -509,20 +509,20 @@  discard block
 block discarded – undo
509 509
 		// look in session for existing checkout
510 510
 		$checkout = EE_Registry::instance()->SSN->checkout();
511 511
 		// verify
512
-		if ( ! $checkout instanceof EE_Checkout ) {
512
+		if ( ! $checkout instanceof EE_Checkout) {
513 513
 			// instantiate EE_Checkout object for handling the properties of the current checkout process
514
-			$checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE  );
514
+			$checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE);
515 515
 		} else {
516
-			if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true )  {
516
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
517 517
 				$this->unlock_transaction();
518
-				wp_safe_redirect( $checkout->redirect_url );
518
+				wp_safe_redirect($checkout->redirect_url);
519 519
 				exit();
520 520
 			}
521 521
 		}
522
-		$checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout );
522
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
523 523
 		// verify again
524
-		if ( ! $checkout instanceof EE_Checkout ) {
525
-			throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) );
524
+		if ( ! $checkout instanceof EE_Checkout) {
525
+			throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
526 526
 		}
527 527
 		// reset anything that needs a clean slate for each request
528 528
 		$checkout->reset_for_current_request();
@@ -542,26 +542,26 @@  discard block
 block discarded – undo
542 542
 		// load classes
543 543
 		EED_Single_Page_Checkout::load_request_handler();
544 544
 		//make sure this request is marked as belonging to EE
545
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
545
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
546 546
 		// which step is being requested ?
547
-		$this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() );
547
+		$this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
548 548
 		// which step is being edited ?
549
-		$this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' );
549
+		$this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
550 550
 		// and what we're doing on the current step
551
-		$this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' );
551
+		$this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
552 552
 		// timestamp
553
-		$this->checkout->uts = EE_Registry::instance()->REQ->get( 'uts', 0 );
553
+		$this->checkout->uts = EE_Registry::instance()->REQ->get('uts', 0);
554 554
 		// returning to edit ?
555
-		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' );
555
+		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
556 556
 		// or some other kind of revisit ?
557
-		$this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE );
557
+		$this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE);
558 558
 		// and whether or not to generate a reg form for this request
559
-		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); 		// TRUE 	FALSE
559
+		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE 	FALSE
560 560
 		// and whether or not to process a reg form submission for this request
561
-		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); 		// TRUE 	FALSE
561
+		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE 	FALSE
562 562
 		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step'
563 563
 			? $this->checkout->process_form_submission
564
-			: FALSE; 		// TRUE 	FALSE
564
+			: FALSE; // TRUE 	FALSE
565 565
 		// $this->_display_request_vars();
566 566
 	}
567 567
 
@@ -574,17 +574,17 @@  discard block
 block discarded – undo
574 574
 	 * @return    void
575 575
 	 */
576 576
 	protected function _display_request_vars() {
577
-		if ( ! WP_DEBUG ) {
577
+		if ( ! WP_DEBUG) {
578 578
 			return;
579 579
 		}
580
-		EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
581
-		EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ );
582
-		EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ );
583
-		EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ );
584
-		EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ );
585
-		EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ );
586
-		EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ );
587
-		EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ );
580
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
581
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
582
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
583
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
584
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
585
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
586
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
587
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
588 588
 	}
589 589
 
590 590
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 	 */
600 600
 	private function _block_bots() {
601 601
 		$invalid_checkout_access = \EED_Invalid_Checkout_Access::getInvalidCheckoutAccess();
602
-		if ( $invalid_checkout_access->checkoutAccessIsInvalid( $this->checkout ) ) {
602
+		if ($invalid_checkout_access->checkoutAccessIsInvalid($this->checkout)) {
603 603
 			$this->_handle_html_redirects();
604 604
 		}
605 605
 	}
@@ -615,8 +615,8 @@  discard block
 block discarded – undo
615 615
 	 * @return    array
616 616
 	 */
617 617
 	private function _get_first_step() {
618
-		$first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array );
619
-		return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information';
618
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
619
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
620 620
 	}
621 621
 
622 622
 
@@ -632,27 +632,27 @@  discard block
 block discarded – undo
632 632
 	private function _load_and_instantiate_reg_steps() {
633 633
 		// have reg_steps already been instantiated ?
634 634
 		if (
635
-			empty( $this->checkout->reg_steps ) ||
636
-			apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout )
635
+			empty($this->checkout->reg_steps) ||
636
+			apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
637 637
 		) {
638 638
 			// if not, then loop through raw reg steps array
639
-			foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) {
640
-				if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) {
639
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
640
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
641 641
 					return false;
642 642
 				}
643 643
 			}
644 644
 			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE;
645 645
 			EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE;
646 646
 			// skip the registration_confirmation page ?
647
-			if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) {
647
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
648 648
 				// just remove it from the reg steps array
649
-				$this->checkout->remove_reg_step( 'registration_confirmation', false );
649
+				$this->checkout->remove_reg_step('registration_confirmation', false);
650 650
 			} else if (
651
-				isset( $this->checkout->reg_steps['registration_confirmation'] )
651
+				isset($this->checkout->reg_steps['registration_confirmation'])
652 652
 				&& EE_Registry::instance()->CFG->registration->reg_confirmation_last
653 653
 			) {
654 654
 				// set the order to something big like 100
655
-				$this->checkout->set_reg_step_order( 'registration_confirmation', 100 );
655
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
656 656
 			}
657 657
 			// filter the array for good luck
658 658
 			$this->checkout->reg_steps = apply_filters(
@@ -662,13 +662,13 @@  discard block
 block discarded – undo
662 662
 			// finally re-sort based on the reg step class order properties
663 663
 			$this->checkout->sort_reg_steps();
664 664
 		} else {
665
-			foreach ( $this->checkout->reg_steps as $reg_step ) {
665
+			foreach ($this->checkout->reg_steps as $reg_step) {
666 666
 				// set all current step stati to FALSE
667
-				$reg_step->set_is_current_step( FALSE );
667
+				$reg_step->set_is_current_step(FALSE);
668 668
 			}
669 669
 		}
670
-		if ( empty( $this->checkout->reg_steps )) {
671
-			EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
670
+		if (empty($this->checkout->reg_steps)) {
671
+			EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
672 672
 			return false;
673 673
 		}
674 674
 			// make reg step details available to JS
@@ -686,10 +686,10 @@  discard block
 block discarded – undo
686 686
 	 * @param int   $order
687 687
 	 * @return bool
688 688
 	 */
689
-	private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) {
689
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) {
690 690
 
691 691
 		// we need a file_path, class_name, and slug to add a reg step
692
-		if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
692
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
693 693
 			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
694 694
 			if (
695 695
 				$this->checkout->reg_url_link
@@ -707,26 +707,26 @@  discard block
 block discarded – undo
707 707
 				FALSE
708 708
 			);
709 709
 			// did we gets the goods ?
710
-			if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) {
710
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
711 711
 				// set reg step order based on config
712
-				$reg_step_obj->set_order( $order );
712
+				$reg_step_obj->set_order($order);
713 713
 				// add instantiated reg step object to the master reg steps array
714
-				$this->checkout->add_reg_step( $reg_step_obj );
714
+				$this->checkout->add_reg_step($reg_step_obj);
715 715
 			} else {
716 716
 				EE_Error::add_error(
717
-					__( 'The current step could not be set.', 'event_espresso' ),
717
+					__('The current step could not be set.', 'event_espresso'),
718 718
 					__FILE__, __FUNCTION__, __LINE__
719 719
 				);
720 720
 				return false;
721 721
 			}
722 722
 		} else {
723
-			if ( WP_DEBUG ) {
723
+			if (WP_DEBUG) {
724 724
 				EE_Error::add_error(
725 725
 					sprintf(
726
-						__( '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' ),
727
-						isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '',
728
-						isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '',
729
-						isset( $reg_step['slug'] ) ? $reg_step['slug'] : '',
726
+						__('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'),
727
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
728
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
729
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
730 730
 						'<ul>',
731 731
 						'<li>',
732 732
 						'</li>',
@@ -750,16 +750,16 @@  discard block
 block discarded – undo
750 750
 	 */
751 751
 	private function _get_transaction_and_cart_for_previous_visit() {
752 752
 		/** @var $TXN_model EEM_Transaction */
753
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
753
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
754 754
 		// because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db
755
-		$transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link );
755
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
756 756
 		// verify transaction
757
-		if ( $transaction instanceof EE_Transaction ) {
757
+		if ($transaction instanceof EE_Transaction) {
758 758
 			// and get the cart that was used for that transaction
759
-			$this->checkout->cart = $this->_get_cart_for_transaction( $transaction );
759
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
760 760
 			return $transaction;
761 761
 		} else {
762
-			EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
762
+			EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
763 763
 			return NULL;
764 764
 		}
765 765
 	}
@@ -773,8 +773,8 @@  discard block
 block discarded – undo
773 773
 	 * @param EE_Transaction $transaction
774 774
 	 * @return EE_Cart
775 775
 	 */
776
-	private function _get_cart_for_transaction( $transaction ) {
777
-		return $this->checkout->get_cart_for_transaction( $transaction );
776
+	private function _get_cart_for_transaction($transaction) {
777
+		return $this->checkout->get_cart_for_transaction($transaction);
778 778
 	}
779 779
 
780 780
 
@@ -786,8 +786,8 @@  discard block
 block discarded – undo
786 786
 	 * @param EE_Transaction $transaction
787 787
 	 * @return EE_Cart
788 788
 	 */
789
-	public function get_cart_for_transaction( EE_Transaction $transaction ) {
790
-		return $this->checkout->get_cart_for_transaction( $transaction );
789
+	public function get_cart_for_transaction(EE_Transaction $transaction) {
790
+		return $this->checkout->get_cart_for_transaction($transaction);
791 791
 	}
792 792
 
793 793
 
@@ -803,17 +803,17 @@  discard block
 block discarded – undo
803 803
 	private function _get_cart_for_current_session_and_setup_new_transaction() {
804 804
 		//  if there's no transaction, then this is the FIRST visit to SPCO
805 805
 		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
806
-		$this->checkout->cart = $this->_get_cart_for_transaction( NULL );
806
+		$this->checkout->cart = $this->_get_cart_for_transaction(NULL);
807 807
 		// and then create a new transaction
808 808
 		$transaction = $this->_initialize_transaction();
809 809
 		// verify transaction
810
-		if ( $transaction instanceof EE_Transaction ) {
810
+		if ($transaction instanceof EE_Transaction) {
811 811
 			// save it so that we have an ID for other objects to use
812 812
 			$transaction->save();
813 813
 			// and save TXN data to the cart
814
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() );
814
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
815 815
 		} else {
816
-			EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
816
+			EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
817 817
 		}
818 818
 		return $transaction;
819 819
 	}
@@ -841,8 +841,8 @@  discard block
 block discarded – undo
841 841
 					'STS_ID'        => EEM_Transaction::failed_status_code,
842 842
 				)
843 843
 			);
844
-		} catch( Exception $e ) {
845
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
844
+		} catch (Exception $e) {
845
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
846 846
 		}
847 847
 		return NULL;
848 848
 	}
@@ -858,38 +858,38 @@  discard block
 block discarded – undo
858 858
      * @throws \EventEspresso\core\exceptions\InvalidEntityException
859 859
      * @throws \EE_Error
860 860
      */
861
-	private function _get_registrations( EE_Transaction $transaction ) {
861
+	private function _get_registrations(EE_Transaction $transaction) {
862 862
 		// first step: grab the registrants  { : o
863
-		$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true );
863
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
864 864
 		// verify registrations have been set
865
-		if ( empty( $registrations )) {
865
+		if (empty($registrations)) {
866 866
 			// if no cached registrations, then check the db
867
-			$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false );
867
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
868 868
 			// still nothing ? well as long as this isn't a revisit
869
-			if ( empty( $registrations ) && ! $this->checkout->revisit ) {
869
+			if (empty($registrations) && ! $this->checkout->revisit) {
870 870
 				// generate new registrations from scratch
871
-				$registrations = $this->_initialize_registrations( $transaction );
871
+				$registrations = $this->_initialize_registrations($transaction);
872 872
 			}
873 873
 		}
874 874
 		// sort by their original registration order
875
-		usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' ));
875
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
876 876
 		// then loop thru the array
877
-		foreach ( $registrations as $registration ) {
877
+		foreach ($registrations as $registration) {
878 878
 			// verify each registration
879
-			if ( $registration instanceof EE_Registration ) {
879
+			if ($registration instanceof EE_Registration) {
880 880
 				// we display all attendee info for the primary registrant
881
-				if ( $this->checkout->reg_url_link === $registration->reg_url_link()
881
+				if ($this->checkout->reg_url_link === $registration->reg_url_link()
882 882
 				     && $registration->is_primary_registrant()
883 883
 				) {
884 884
 					$this->checkout->primary_revisit = true;
885 885
 					break;
886
-				} else if ( $this->checkout->revisit
886
+				} else if ($this->checkout->revisit
887 887
 				            && $this->checkout->reg_url_link !== $registration->reg_url_link()
888 888
 				) {
889 889
 					// but hide info if it doesn't belong to you
890
-					$transaction->clear_cache( 'Registration', $registration->ID() );
890
+					$transaction->clear_cache('Registration', $registration->ID());
891 891
 				}
892
-				$this->checkout->set_reg_status_updated( $registration->ID(), false );
892
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
893 893
 			}
894 894
 		}
895 895
 	}
@@ -905,17 +905,17 @@  discard block
 block discarded – undo
905 905
      * @throws \EventEspresso\core\exceptions\InvalidEntityException
906 906
      * @throws \EE_Error
907 907
      */
908
-	private function _initialize_registrations( EE_Transaction $transaction ) {
908
+	private function _initialize_registrations(EE_Transaction $transaction) {
909 909
 		$att_nmbr = 0;
910 910
 		$registrations = array();
911
-		if ( $transaction instanceof EE_Transaction ) {
911
+		if ($transaction instanceof EE_Transaction) {
912 912
 			/** @type EE_Registration_Processor $registration_processor */
913
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
913
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
914 914
 			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
915 915
 			// now let's add the cart items to the $transaction
916
-			foreach ( $this->checkout->cart->get_tickets() as $line_item ) {
916
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
917 917
 				//do the following for each ticket of this type they selected
918
-				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
918
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
919 919
 					$att_nmbr++;
920 920
                     /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */
921 921
                     $CreateRegistrationCommand = EE_Registry::instance()
@@ -931,17 +931,17 @@  discard block
 block discarded – undo
931 931
                     // override capabilities for frontend registrations
932 932
                     if ( ! is_admin()) {
933 933
                         $CreateRegistrationCommand->setCapCheck(
934
-	                        new PublicCapabilities( '', 'create_new_registration' )
934
+	                        new PublicCapabilities('', 'create_new_registration')
935 935
                         );
936 936
                     }
937
-					$registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand );
938
-					if ( ! $registration instanceof EE_Registration ) {
939
-						throw new InvalidEntityException( $registration, 'EE_Registration' );
937
+					$registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand);
938
+					if ( ! $registration instanceof EE_Registration) {
939
+						throw new InvalidEntityException($registration, 'EE_Registration');
940 940
 					}
941
-					$registrations[ $registration->ID() ] = $registration;
941
+					$registrations[$registration->ID()] = $registration;
942 942
 				}
943 943
 			}
944
-			$registration_processor->fix_reg_final_price_rounding_issue( $transaction );
944
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
945 945
 		}
946 946
 		return $registrations;
947 947
 	}
@@ -956,12 +956,12 @@  discard block
 block discarded – undo
956 956
 	 * @param EE_Registration $reg_B
957 957
 	 * @return int
958 958
 	 */
959
-	public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) {
959
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) {
960 960
 		// this shouldn't ever happen within the same TXN, but oh well
961
-		if ( $reg_A->count() === $reg_B->count() ) {
961
+		if ($reg_A->count() === $reg_B->count()) {
962 962
 			return 0;
963 963
 		}
964
-		return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1;
964
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
965 965
 	}
966 966
 
967 967
 
@@ -976,21 +976,21 @@  discard block
 block discarded – undo
976 976
 	 */
977 977
 	private function _final_verifications() {
978 978
 		// filter checkout
979
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout );
979
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
980 980
 		//verify that current step is still set correctly
981
-		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) {
982
-			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__ );
981
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
982
+			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__);
983 983
 			return false;
984 984
 		}
985 985
 		// if returning to SPCO, then verify that primary registrant is set
986
-		if ( ! empty( $this->checkout->reg_url_link )) {
986
+		if ( ! empty($this->checkout->reg_url_link)) {
987 987
 			$valid_registrant = $this->checkout->transaction->primary_registration();
988
-			if ( ! $valid_registrant instanceof EE_Registration ) {
989
-				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__ );
988
+			if ( ! $valid_registrant instanceof EE_Registration) {
989
+				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__);
990 990
 				return false;
991 991
 			}
992 992
 			$valid_registrant = null;
993
-			foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) {
993
+			foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
994 994
 				if (
995 995
 					$registration instanceof EE_Registration
996 996
 					&& $registration->reg_url_link() === $this->checkout->reg_url_link
@@ -998,9 +998,9 @@  discard block
 block discarded – undo
998 998
 					$valid_registrant = $registration;
999 999
 				}
1000 1000
 			}
1001
-			if ( ! $valid_registrant instanceof EE_Registration ) {
1001
+			if ( ! $valid_registrant instanceof EE_Registration) {
1002 1002
 				// hmmm... maybe we have the wrong session because the user is opening multiple tabs ?
1003
-				if ( EED_Single_Page_Checkout::$_checkout_verified ) {
1003
+				if (EED_Single_Page_Checkout::$_checkout_verified) {
1004 1004
 					// clear the session, mark the checkout as unverified, and try again
1005 1005
 					EE_Registry::instance()->SSN->clear_session();
1006 1006
 					EED_Single_Page_Checkout::$_initialized = false;
@@ -1009,13 +1009,13 @@  discard block
 block discarded – undo
1009 1009
 					EE_Error::reset_notices();
1010 1010
 					return false;
1011 1011
 				}
1012
-				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__ );
1012
+				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__);
1013 1013
 				return false;
1014 1014
 			}
1015 1015
 		}
1016 1016
 		// now that things have been kinda sufficiently verified,
1017 1017
 		// let's add the checkout to the session so that's available other systems
1018
-		EE_Registry::instance()->SSN->set_checkout( $this->checkout );
1018
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
1019 1019
 		return true;
1020 1020
 	}
1021 1021
 
@@ -1030,15 +1030,15 @@  discard block
 block discarded – undo
1030 1030
 	 * @param bool $reinitializing
1031 1031
 	 * @throws \EE_Error
1032 1032
 	 */
1033
-	private function _initialize_reg_steps( $reinitializing = false ) {
1034
-		$this->checkout->set_reg_step_initiated( $this->checkout->current_step );
1033
+	private function _initialize_reg_steps($reinitializing = false) {
1034
+		$this->checkout->set_reg_step_initiated($this->checkout->current_step);
1035 1035
 		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
1036
-		foreach ( $this->checkout->reg_steps as $reg_step ) {
1037
-			if ( ! $reg_step->initialize_reg_step() ) {
1036
+		foreach ($this->checkout->reg_steps as $reg_step) {
1037
+			if ( ! $reg_step->initialize_reg_step()) {
1038 1038
 				// if not initialized then maybe this step is being removed...
1039
-				if ( ! $reinitializing && $reg_step->is_current_step() ) {
1039
+				if ( ! $reinitializing && $reg_step->is_current_step()) {
1040 1040
 					// if it was the current step, then we need to start over here
1041
-					$this->_initialize_reg_steps( true );
1041
+					$this->_initialize_reg_steps(true);
1042 1042
 					return;
1043 1043
 				}
1044 1044
 				continue;
@@ -1047,13 +1047,13 @@  discard block
 block discarded – undo
1047 1047
 			$reg_step->enqueue_styles_and_scripts();
1048 1048
 			// i18n
1049 1049
 			$reg_step->translate_js_strings();
1050
-			if ( $reg_step->is_current_step() ) {
1050
+			if ($reg_step->is_current_step()) {
1051 1051
 				// the text that appears on the reg step form submit button
1052 1052
 				$reg_step->set_submit_button_text();
1053 1053
 			}
1054 1054
 		}
1055 1055
 		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
1056
-		do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step );
1056
+		do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
1057 1057
 	}
1058 1058
 
1059 1059
 
@@ -1066,43 +1066,43 @@  discard block
 block discarded – undo
1066 1066
 	 */
1067 1067
 	private function _check_form_submission() {
1068 1068
 		//does this request require the reg form to be generated ?
1069
-		if ( $this->checkout->generate_reg_form ) {
1069
+		if ($this->checkout->generate_reg_form) {
1070 1070
 			// ever heard that song by Blue Rodeo ?
1071 1071
 			try {
1072 1072
 				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
1073 1073
 				// if not displaying a form, then check for form submission
1074
-				if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) {
1074
+				if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) {
1075 1075
 					// clear out any old data in case this step is being run again
1076
-					$this->checkout->current_step->set_valid_data( array() );
1076
+					$this->checkout->current_step->set_valid_data(array());
1077 1077
 					// capture submitted form data
1078 1078
 					$this->checkout->current_step->reg_form->receive_form_submission(
1079
-						apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout )
1079
+						apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout)
1080 1080
 					);
1081 1081
 					// validate submitted form data
1082
-					if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid() ) {
1082
+					if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid()) {
1083 1083
 						// thou shall not pass !!!
1084 1084
 						$this->checkout->continue_reg = FALSE;
1085 1085
 						// any form validation errors?
1086
-						if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) {
1086
+						if ($this->checkout->current_step->reg_form->submission_error_message() !== '') {
1087 1087
 							$submission_error_messages = array();
1088 1088
 							// bad, bad, bad registrant
1089
-							foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){
1090
-								if ( $validation_error instanceof EE_Validation_Error ) {
1089
+							foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
1090
+								if ($validation_error instanceof EE_Validation_Error) {
1091 1091
 									$submission_error_messages[] = sprintf(
1092
-										__( '%s : %s', 'event_espresso' ),
1092
+										__('%s : %s', 'event_espresso'),
1093 1093
 										$validation_error->get_form_section()->html_label_text(),
1094 1094
 										$validation_error->getMessage()
1095 1095
 									);
1096 1096
 								}
1097 1097
 							}
1098
-							EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1098
+							EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1099 1099
 						}
1100 1100
 						// well not really... what will happen is we'll just get redirected back to redo the current step
1101 1101
 						$this->go_to_next_step();
1102 1102
 						return;
1103 1103
 					}
1104 1104
 				}
1105
-			} catch( EE_Error $e ) {
1105
+			} catch (EE_Error $e) {
1106 1106
 				$e->get_error();
1107 1107
 			}
1108 1108
 		}
@@ -1119,22 +1119,22 @@  discard block
 block discarded – undo
1119 1119
 	 */
1120 1120
 	private function _process_form_action() {
1121 1121
 		// what cha wanna do?
1122
-		switch( $this->checkout->action ) {
1122
+		switch ($this->checkout->action) {
1123 1123
 			// AJAX next step reg form
1124 1124
 			case 'display_spco_reg_step' :
1125 1125
 				$this->checkout->redirect = FALSE;
1126
-				if ( EE_Registry::instance()->REQ->ajax ) {
1127
-					$this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() );
1126
+				if (EE_Registry::instance()->REQ->ajax) {
1127
+					$this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
1128 1128
 				}
1129 1129
 				break;
1130 1130
 
1131 1131
 			default :
1132 1132
 				// meh... do one of those other steps first
1133
-				if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) {
1133
+				if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
1134 1134
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
1135
-					do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
1135
+					do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1136 1136
 					// call action on current step
1137
-					if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) {
1137
+					if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
1138 1138
 						// good registrant, you get to proceed
1139 1139
 						if (
1140 1140
 							$this->checkout->current_step->success_message() !== ''
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
 						) {
1146 1146
 								EE_Error::add_success(
1147 1147
 									$this->checkout->current_step->success_message()
1148
-									. '<br />' . $this->checkout->next_step->_instructions()
1148
+									. '<br />'.$this->checkout->next_step->_instructions()
1149 1149
 								);
1150 1150
 
1151 1151
 						}
@@ -1153,12 +1153,12 @@  discard block
 block discarded – undo
1153 1153
 						$this->_setup_redirect();
1154 1154
 					}
1155 1155
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
1156
-					do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
1156
+					do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1157 1157
 
1158 1158
 				} else {
1159 1159
 					EE_Error::add_error(
1160 1160
 						sprintf(
1161
-							__( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ),
1161
+							__('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1162 1162
 							$this->checkout->action,
1163 1163
 							$this->checkout->current_step->name()
1164 1164
 						),
@@ -1184,10 +1184,10 @@  discard block
 block discarded – undo
1184 1184
 	public function add_styles_and_scripts() {
1185 1185
 		// i18n
1186 1186
 		$this->translate_js_strings();
1187
-		if ( $this->checkout->admin_request ) {
1188
-			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 );
1187
+		if ($this->checkout->admin_request) {
1188
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1189 1189
 		} else {
1190
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 );
1190
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1191 1191
 		}
1192 1192
 	}
1193 1193
 
@@ -1203,42 +1203,42 @@  discard block
 block discarded – undo
1203 1203
 		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1204 1204
 		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1205 1205
 		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');
1206
-		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' );
1207
-		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' );
1208
-		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' );
1206
+		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');
1207
+		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');
1208
+		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');
1209 1209
 		EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1210 1210
 		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');
1211
-		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/>' );
1212
-		EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' );
1211
+		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/>');
1212
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1213 1213
 		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1214 1214
 		EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1215 1215
 		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1216
-		EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' );
1217
-		EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' );
1218
-		EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' );
1219
-		EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' );
1220
-		EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' );
1221
-		EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' );
1222
-		EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' );
1223
-		EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' );
1224
-		EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' );
1225
-		EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' );
1226
-		EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' );
1227
-		EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' );
1228
-		EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' );
1229
-		EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' );
1216
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1217
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1218
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1219
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1220
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1221
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1222
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1223
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1224
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1225
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1226
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1227
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1228
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1229
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1230 1230
 		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1231
-			__( '%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' ),
1231
+			__('%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'),
1232 1232
 			'<h4 class="important-notice">',
1233 1233
 			'</h4>',
1234 1234
 			'<br />',
1235 1235
 			'<p>',
1236
-			'<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="',
1236
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1237 1237
 			'">',
1238 1238
 			'</a>',
1239 1239
 			'</p>'
1240 1240
 		);
1241
-		EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true );
1241
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1242 1242
 	}
1243 1243
 
1244 1244
 
@@ -1252,26 +1252,26 @@  discard block
 block discarded – undo
1252 1252
 	 */
1253 1253
 	public function enqueue_styles_and_scripts() {
1254 1254
 		// load css
1255
-		wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION );
1256
-		wp_enqueue_style( 'single_page_checkout' );
1255
+		wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1256
+		wp_enqueue_style('single_page_checkout');
1257 1257
 		// load JS
1258
-		wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array( 'jquery' ), '1.0.1', TRUE );
1259
-		wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE );
1260
-		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 );
1258
+		wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery	.plugin.min.js', array('jquery'), '1.0.1', TRUE);
1259
+		wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE);
1260
+		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);
1261 1261
 		$this->checkout->registration_form->enqueue_js();
1262
-		wp_enqueue_script( 'single_page_checkout' );
1262
+		wp_enqueue_script('single_page_checkout');
1263 1263
 
1264 1264
 		/**
1265 1265
 		 * global action hook for enqueueing styles and scripts with
1266 1266
 		 * spco calls.
1267 1267
 		 */
1268
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this );
1268
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1269 1269
 
1270 1270
 		/**
1271 1271
 		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1272 1272
 		 * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1273 1273
 		 */
1274
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this );
1274
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this);
1275 1275
 
1276 1276
 	}
1277 1277
 
@@ -1286,19 +1286,19 @@  discard block
 block discarded – undo
1286 1286
 	 */
1287 1287
 	private function _display_spco_reg_form() {
1288 1288
 		// if registering via the admin, just display the reg form for the current step
1289
-		if ( $this->checkout->admin_request ) {
1290
-			EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() );
1289
+		if ($this->checkout->admin_request) {
1290
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1291 1291
 		} else {
1292 1292
 			// add powered by EE msg
1293
-			add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' ));
1293
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1294 1294
 
1295
-			$empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false;
1295
+			$empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false;
1296 1296
 			$cookies_not_set_msg = '';
1297
-			if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) {
1297
+			if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) {
1298 1298
 				$cookies_not_set_msg = apply_filters(
1299 1299
 					'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1300 1300
 					sprintf(
1301
-						__( '%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' ),
1301
+						__('%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'),
1302 1302
 						'<div class="ee-attention">',
1303 1303
 						'</div>',
1304 1304
 						'<h6 class="important-notice">',
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
 					'layout_strategy' =>
1319 1319
 						new EE_Template_Layout(
1320 1320
 							array(
1321
-								'layout_template_file' 			=> SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1321
+								'layout_template_file' 			=> SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1322 1322
 								'template_args' => array(
1323 1323
 									'empty_cart' 		=> $empty_cart,
1324 1324
 									'revisit' 				=> $this->checkout->revisit,
@@ -1327,8 +1327,8 @@  discard block
 block discarded – undo
1327 1327
 									'empty_msg' 		=> apply_filters(
1328 1328
 										'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1329 1329
 										sprintf(
1330
-											__( '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' ),
1331
-											'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
1330
+											__('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'),
1331
+											'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1332 1332
 											'">',
1333 1333
 											'</a>'
1334 1334
 										)
@@ -1336,14 +1336,14 @@  discard block
 block discarded – undo
1336 1336
 									'cookies_not_set_msg' 		=> $cookies_not_set_msg,
1337 1337
 									'registration_time_limit' 	=> $this->checkout->get_registration_time_limit(),
1338 1338
 									'session_expiration' 			=>
1339
-										date( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) )
1339
+										date('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS))
1340 1340
 							)
1341 1341
 						)
1342 1342
 					)
1343 1343
 				)
1344 1344
 			);
1345 1345
 			// load template and add to output sent that gets filtered into the_content()
1346
-			EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html() );
1346
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html());
1347 1347
 		}
1348 1348
 	}
1349 1349
 
@@ -1357,8 +1357,8 @@  discard block
 block discarded – undo
1357 1357
 	 * @internal  param string $label
1358 1358
 	 * @return void
1359 1359
 	 */
1360
-	public function add_extra_finalize_registration_inputs( $next_step ) {
1361
-		if ( $next_step === 'finalize_registration' ) {
1360
+	public function add_extra_finalize_registration_inputs($next_step) {
1361
+		if ($next_step === 'finalize_registration') {
1362 1362
 			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1363 1363
 		}
1364 1364
 	}
@@ -1380,8 +1380,8 @@  discard block
 block discarded – undo
1380 1380
 		) {
1381 1381
 			add_filter(
1382 1382
 				'FHEE__EEH_Template__powered_by_event_espresso__url',
1383
-				function( $url) {
1384
-					return apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url );
1383
+				function($url) {
1384
+					return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1385 1385
 				}
1386 1386
 			);
1387 1387
 			echo apply_filters(
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 				\EEH_Template::powered_by_event_espresso(
1390 1390
 					'',
1391 1391
 					'espresso-registration-footer-dv',
1392
-					array( 'utm_content' => 'registration_checkout' )
1392
+					array('utm_content' => 'registration_checkout')
1393 1393
 				)
1394 1394
 			);
1395 1395
 		}
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
 	 * @throws \EE_Error
1407 1407
 	 */
1408 1408
 	public function unlock_transaction() {
1409
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
1409
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1410 1410
 			$this->checkout->transaction->unlock();
1411 1411
 		}
1412 1412
 	}
@@ -1421,9 +1421,9 @@  discard block
 block discarded – undo
1421 1421
 	 * @return void
1422 1422
 	 */
1423 1423
 	private function _setup_redirect() {
1424
-		if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
1424
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1425 1425
 			$this->checkout->redirect = TRUE;
1426
-			if ( empty( $this->checkout->redirect_url )) {
1426
+			if (empty($this->checkout->redirect_url)) {
1427 1427
 				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1428 1428
 			}
1429 1429
 			$this->checkout->redirect_url = apply_filters(
@@ -1444,9 +1444,9 @@  discard block
 block discarded – undo
1444 1444
 	 * @throws \EE_Error
1445 1445
 	 */
1446 1446
 	public function go_to_next_step() {
1447
-		if ( EE_Registry::instance()->REQ->ajax ) {
1447
+		if (EE_Registry::instance()->REQ->ajax) {
1448 1448
 			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1449
-			$this->checkout->json_response->set_unexpected_errors( ob_get_clean() );
1449
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1450 1450
 		}
1451 1451
 		$this->unlock_transaction();
1452 1452
 		// just return for these conditions
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 	 */
1476 1476
 	protected function _handle_json_response() {
1477 1477
 		// if this is an ajax request
1478
-		if ( EE_Registry::instance()->REQ->ajax ) {
1478
+		if (EE_Registry::instance()->REQ->ajax) {
1479 1479
 			// DEBUG LOG
1480 1480
 			//$this->checkout->log(
1481 1481
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
 			$this->checkout->json_response->set_registration_time_limit(
1489 1489
 				$this->checkout->get_registration_time_limit()
1490 1490
 			);
1491
-			$this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing );
1491
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1492 1492
 			// just send the ajax (
1493 1493
 			$json_response = apply_filters(
1494 1494
 				'FHEE__EE_Single_Page_Checkout__JSON_response',
@@ -1509,9 +1509,9 @@  discard block
 block discarded – undo
1509 1509
 	 */
1510 1510
 	protected function _handle_html_redirects() {
1511 1511
 		// going somewhere ?
1512
-		if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) {
1512
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1513 1513
 			// store notices in a transient
1514
-			EE_Error::get_notices( false, true, true );
1514
+			EE_Error::get_notices(false, true, true);
1515 1515
 			// DEBUG LOG
1516 1516
 			//$this->checkout->log(
1517 1517
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
 			//		'headers_list'    => headers_list(),
1522 1522
 			//	)
1523 1523
 			//);
1524
-			wp_safe_redirect( $this->checkout->redirect_url );
1524
+			wp_safe_redirect($this->checkout->redirect_url);
1525 1525
 			exit();
1526 1526
 		}
1527 1527
 	}
Please login to merge, or discard this patch.
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * @throws \EE_Error
203 203
 	 */
204 204
 	public static function set_definitions() {
205
-        define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
205
+		define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
206 206
 		define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS );
207 207
 		define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS );
208 208
 		define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS );
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
 
323 323
 
324 324
 	/**
325
-     * process_registration_from_admin
326
-     *
327
-     * @access public
325
+	 * process_registration_from_admin
326
+	 *
327
+	 * @access public
328 328
 	 * @return \EE_Transaction
329 329
 	 * @throws \EE_Error
330 330
 	 */
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	 * @throws \EE_Error
360 360
 	 */
361 361
 	public function run( $WP_Query ) {
362
-        if (
362
+		if (
363 363
 			$WP_Query instanceof WP_Query
364 364
 			&& $WP_Query->is_main_query()
365 365
 			&& apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )
@@ -371,38 +371,38 @@  discard block
 block discarded – undo
371 371
 
372 372
 
373 373
 
374
-    /**
375
-     * determines whether current url matches reg page url
376
-     *
377
-     * @return bool
378
-     */
379
-    protected function _is_reg_checkout() {
380
-        // get current permalink for reg page without any extra query args
381
-        $reg_page_url = \get_permalink(EE_Config::instance()->core->reg_page_id);
382
-        // get request URI for current request, but without the scheme or host
383
-        $current_request_uri = \EEH_URL::filter_input_server_url('REQUEST_URI');
384
-        $current_request_uri = html_entity_decode( $current_request_uri );
385
-        // get array of query args from the current request URI
386
-        $query_args = \EEH_URL::get_query_string($current_request_uri);
387
-        // grab page id if it is set
388
-        $page_id = isset($query_args['page_id']) ? absint($query_args['page_id']) : 0;
389
-        // and remove the page id from the query args (we will re-add it later)
390
-        unset($query_args['page_id']);
391
-        // now strip all query args from current request URI
392
-        $current_request_uri = remove_query_arg(array_flip($query_args), $current_request_uri);
393
-        // and re-add the page id if it was set
394
-        if ($page_id){
395
-            $current_request_uri = add_query_arg('page_id', $page_id, $current_request_uri);
396
-        }
397
-        // remove slashes and ?
398
-        $current_request_uri = trim($current_request_uri, '?/');
399
-        // is current request URI part of the known full reg page URL ?
400
-        return strpos($reg_page_url, $current_request_uri) !== false;
401
-    }
402
-
403
-
404
-
405
-    /**
374
+	/**
375
+	 * determines whether current url matches reg page url
376
+	 *
377
+	 * @return bool
378
+	 */
379
+	protected function _is_reg_checkout() {
380
+		// get current permalink for reg page without any extra query args
381
+		$reg_page_url = \get_permalink(EE_Config::instance()->core->reg_page_id);
382
+		// get request URI for current request, but without the scheme or host
383
+		$current_request_uri = \EEH_URL::filter_input_server_url('REQUEST_URI');
384
+		$current_request_uri = html_entity_decode( $current_request_uri );
385
+		// get array of query args from the current request URI
386
+		$query_args = \EEH_URL::get_query_string($current_request_uri);
387
+		// grab page id if it is set
388
+		$page_id = isset($query_args['page_id']) ? absint($query_args['page_id']) : 0;
389
+		// and remove the page id from the query args (we will re-add it later)
390
+		unset($query_args['page_id']);
391
+		// now strip all query args from current request URI
392
+		$current_request_uri = remove_query_arg(array_flip($query_args), $current_request_uri);
393
+		// and re-add the page id if it was set
394
+		if ($page_id){
395
+			$current_request_uri = add_query_arg('page_id', $page_id, $current_request_uri);
396
+		}
397
+		// remove slashes and ?
398
+		$current_request_uri = trim($current_request_uri, '?/');
399
+		// is current request URI part of the known full reg page URL ?
400
+		return strpos($reg_page_url, $current_request_uri) !== false;
401
+	}
402
+
403
+
404
+
405
+	/**
406 406
 	 *    run
407 407
 	 *
408 408
 	 * @access    public
@@ -428,16 +428,16 @@  discard block
 block discarded – undo
428 428
 		if ( EED_Single_Page_Checkout::$_initialized ) {
429 429
 			return;
430 430
 		}
431
-        try {
431
+		try {
432 432
 			// setup the EE_Checkout object
433 433
 			$this->checkout = $this->_initialize_checkout();
434 434
 			// filter checkout
435 435
 			$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout );
436 436
 			// get the $_GET
437 437
 			$this->_get_request_vars();
438
-            if ($this->_block_bots()) {
439
-                return;
440
-            }
438
+			if ($this->_block_bots()) {
439
+				return;
440
+			}
441 441
 			// filter continue_reg
442 442
 			$this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout );
443 443
 			// load the reg steps array
@@ -598,8 +598,8 @@  discard block
 block discarded – undo
598 598
 	 *  a REG URL Link, which indicates that the request is a return visit to SPCO for a valid TXN
599 599
 	 * so if you're not coming from the Ticket Selector nor returning for a valid IP...
600 600
 	 * then where you coming from man?
601
-     *
602
-     * @return boolean
601
+	 *
602
+	 * @return boolean
603 603
 	 */
604 604
 	private function _block_bots() {
605 605
 		$invalid_checkout_access = \EED_Invalid_Checkout_Access::getInvalidCheckoutAccess();
@@ -854,15 +854,15 @@  discard block
 block discarded – undo
854 854
 
855 855
 
856 856
 
857
-    /**
858
-     * _get_registrations
859
-     *
860
-     * @access private
861
-     * @param EE_Transaction $transaction
862
-     * @return void
863
-     * @throws \EventEspresso\core\exceptions\InvalidEntityException
864
-     * @throws \EE_Error
865
-     */
857
+	/**
858
+	 * _get_registrations
859
+	 *
860
+	 * @access private
861
+	 * @param EE_Transaction $transaction
862
+	 * @return void
863
+	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
864
+	 * @throws \EE_Error
865
+	 */
866 866
 	private function _get_registrations( EE_Transaction $transaction ) {
867 867
 		// first step: grab the registrants  { : o
868 868
 		$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true );
@@ -884,12 +884,12 @@  discard block
 block discarded – undo
884 884
 			if ( $registration instanceof EE_Registration ) {
885 885
 				// we display all attendee info for the primary registrant
886 886
 				if ( $this->checkout->reg_url_link === $registration->reg_url_link()
887
-				     && $registration->is_primary_registrant()
887
+					 && $registration->is_primary_registrant()
888 888
 				) {
889 889
 					$this->checkout->primary_revisit = true;
890 890
 					break;
891 891
 				} else if ( $this->checkout->revisit
892
-				            && $this->checkout->reg_url_link !== $registration->reg_url_link()
892
+							&& $this->checkout->reg_url_link !== $registration->reg_url_link()
893 893
 				) {
894 894
 					// but hide info if it doesn't belong to you
895 895
 					$transaction->clear_cache( 'Registration', $registration->ID() );
@@ -901,15 +901,15 @@  discard block
 block discarded – undo
901 901
 
902 902
 
903 903
 
904
-    /**
905
-     *    adds related EE_Registration objects for each ticket in the cart to the current EE_Transaction object
906
-     *
907
-     * @access private
908
-     * @param EE_Transaction $transaction
909
-     * @return    array
910
-     * @throws \EventEspresso\core\exceptions\InvalidEntityException
911
-     * @throws \EE_Error
912
-     */
904
+	/**
905
+	 *    adds related EE_Registration objects for each ticket in the cart to the current EE_Transaction object
906
+	 *
907
+	 * @access private
908
+	 * @param EE_Transaction $transaction
909
+	 * @return    array
910
+	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
911
+	 * @throws \EE_Error
912
+	 */
913 913
 	private function _initialize_registrations( EE_Transaction $transaction ) {
914 914
 		$att_nmbr = 0;
915 915
 		$registrations = array();
@@ -922,23 +922,23 @@  discard block
 block discarded – undo
922 922
 				//do the following for each ticket of this type they selected
923 923
 				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
924 924
 					$att_nmbr++;
925
-                    /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */
926
-                    $CreateRegistrationCommand = EE_Registry::instance()
927
-                        ->create(
928
-                           'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
929
-                           array(
930
-	                           $transaction,
931
-	                           $line_item,
932
-	                           $att_nmbr,
933
-	                           $this->checkout->total_ticket_count
934
-                           )
935
-                        );
936
-                    // override capabilities for frontend registrations
937
-                    if ( ! is_admin()) {
938
-                        $CreateRegistrationCommand->setCapCheck(
939
-	                        new PublicCapabilities( '', 'create_new_registration' )
940
-                        );
941
-                    }
925
+					/** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */
926
+					$CreateRegistrationCommand = EE_Registry::instance()
927
+						->create(
928
+						   'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
929
+						   array(
930
+							   $transaction,
931
+							   $line_item,
932
+							   $att_nmbr,
933
+							   $this->checkout->total_ticket_count
934
+						   )
935
+						);
936
+					// override capabilities for frontend registrations
937
+					if ( ! is_admin()) {
938
+						$CreateRegistrationCommand->setCapCheck(
939
+							new PublicCapabilities( '', 'create_new_registration' )
940
+						);
941
+					}
942 942
 					$registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand );
943 943
 					if ( ! $registration instanceof EE_Registration ) {
944 944
 						throw new InvalidEntityException( $registration, 'EE_Registration' );
@@ -1433,10 +1433,10 @@  discard block
 block discarded – undo
1433 1433
 				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1434 1434
 			}
1435 1435
 			$this->checkout->redirect_url = apply_filters(
1436
-			    'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url',
1437
-                $this->checkout->redirect_url,
1438
-                $this->checkout
1439
-            );
1436
+				'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url',
1437
+				$this->checkout->redirect_url,
1438
+				$this->checkout
1439
+			);
1440 1440
 		}
1441 1441
 	}
1442 1442
 
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_Checkout.class.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
 	/**
278 278
 	 * @param $REG_ID
279
-	 * @param $reg_status
279
+	 * @param boolean $reg_status
280 280
 	 */
281 281
 	public function set_reg_status_updated( $REG_ID, $reg_status ) {
282 282
 		$this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN );
@@ -1110,6 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 	 *
1111 1111
 	 * @param    string | int    $reg_cache_ID
1112 1112
 	 * @param    EE_Registration $registration
1113
+	 * @param integer $reg_cache_ID
1113 1114
 	 * @return void
1114 1115
 	 * @throws \EE_Error
1115 1116
 	 */
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_Checkout
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage    core
10
- * @author				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_Checkout
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage    core
10
+  * @author				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_Checkout {
15 15
 
16 16
 	/**
@@ -804,10 +804,10 @@  discard block
 block discarded – undo
804 804
 	 */
805 805
 	public function visit_allows_processing_of_this_registration( EE_Registration $registration ) {
806 806
 		return ! $this->revisit
807
-		       || $this->primary_revisit
808
-		       || (
809
-			       $this->revisit && $this->reg_url_link === $registration->reg_url_link()
810
-		       )
807
+			   || $this->primary_revisit
808
+			   || (
809
+				   $this->revisit && $this->reg_url_link === $registration->reg_url_link()
810
+			   )
811 811
 			? true
812 812
 			: false;
813 813
 	}
@@ -1190,19 +1190,19 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
 
1192 1192
 
1193
-    /**
1194
-     *    __sleep
1195
-     * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon serialization
1196
-     * EE_Checkout will handle the reimplementation of itself upon waking,
1197
-     * but we won't bother with the reg form, because if needed, it will be regenerated anyways
1198
-     *
1199
-     * @return array
1200
-     */
1201
-    public function __sleep()
1202
-    {
1203
-        // remove the reg form and the checkout
1204
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) );
1205
-    }
1193
+	/**
1194
+	 *    __sleep
1195
+	 * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon serialization
1196
+	 * EE_Checkout will handle the reimplementation of itself upon waking,
1197
+	 * but we won't bother with the reg form, because if needed, it will be regenerated anyways
1198
+	 *
1199
+	 * @return array
1200
+	 */
1201
+	public function __sleep()
1202
+	{
1203
+		// remove the reg form and the checkout
1204
+		return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) );
1205
+	}
1206 1206
 
1207 1207
 
1208 1208
 	/**
Please login to merge, or discard this patch.
Spacing   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 		$this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url();
248 248
 		$this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url();
249 249
 		$this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url();
250
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE );
250
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE);
251 251
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax;
252
-		$this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' ));
252
+		$this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC'));
253 253
 	}
254 254
 
255 255
 
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 	 * @return boolean
261 261
 	 */
262 262
 	public function any_reg_status_updated() {
263
-		foreach ( $this->reg_status_updated as $reg_status ) {
264
-			if ( $reg_status ) {
263
+		foreach ($this->reg_status_updated as $reg_status) {
264
+			if ($reg_status) {
265 265
 				return true;
266 266
 			}
267 267
 		}
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 	 * @param $REG_ID
275 275
 	 * @return boolean
276 276
 	 */
277
-	public function reg_status_updated( $REG_ID ) {
278
-		return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false;
277
+	public function reg_status_updated($REG_ID) {
278
+		return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false;
279 279
 	}
280 280
 
281 281
 
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 	 * @param $REG_ID
285 285
 	 * @param $reg_status
286 286
 	 */
287
-	public function set_reg_status_updated( $REG_ID, $reg_status ) {
288
-		$this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN );
287
+	public function set_reg_status_updated($REG_ID, $reg_status) {
288
+		$this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN);
289 289
 	}
290 290
 
291 291
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 * can ONLY be set by the  Finalize_Registration reg step
307 307
 	 */
308 308
 	public function set_exit_spco() {
309
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
309
+		if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
310 310
 			$this->exit_spco = true;
311 311
 		}
312 312
 	}
@@ -323,12 +323,12 @@  discard block
 block discarded – undo
323 323
 	 */
324 324
 	public function reset_for_current_request() {
325 325
 		$this->process_form_submission = FALSE;
326
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true );
326
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true);
327 327
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax;
328 328
 		$this->continue_reg = true;
329 329
 		$this->redirect = false;
330 330
 		// don't reset the cached redirect form if we're about to be asked to display it !!!
331
-		if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) {
331
+		if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') {
332 332
 			$this->redirect_form = '';
333 333
 		}
334 334
 		$this->redirect_url = '';
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
 	 * @param EE_SPCO_Reg_Step $reg_step_obj
346 346
 	 * @return    void
347 347
 	 */
348
-	public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) {
349
-		$this->reg_steps[ $reg_step_obj->slug()  ] = $reg_step_obj;
348
+	public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) {
349
+		$this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj;
350 350
 	}
351 351
 
352 352
 
@@ -362,22 +362,22 @@  discard block
 block discarded – undo
362 362
 	 * @return    void
363 363
 	 * @throws \EE_Error
364 364
 	 */
365
-	public function skip_reg_step( $reg_step_slug = '' ) {
366
-		$step_to_skip = $this->find_reg_step( $reg_step_slug );
367
-		if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) {
368
-			$step_to_skip->set_is_current_step( false );
365
+	public function skip_reg_step($reg_step_slug = '') {
366
+		$step_to_skip = $this->find_reg_step($reg_step_slug);
367
+		if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) {
368
+			$step_to_skip->set_is_current_step(false);
369 369
 			$step_to_skip->set_completed();
370 370
 			// advance to the next step
371
-			$this->set_current_step( $this->next_step->slug() );
371
+			$this->set_current_step($this->next_step->slug());
372 372
 			// also reset the step param in the request in case any other code references that directly
373
-			EE_Registry::instance()->REQ->set( 'step', $this->current_step->slug() );
373
+			EE_Registry::instance()->REQ->set('step', $this->current_step->slug());
374 374
 			// since we are skipping a step and setting the current step to be what was previously the next step,
375 375
 			// we need to check that the next step is now correct, and not still set to the current step.
376
-			if ( $this->current_step->slug() === $this->next_step->slug() ) {
376
+			if ($this->current_step->slug() === $this->next_step->slug()) {
377 377
 				// correctly setup the next step
378 378
 				$this->set_next_step();
379 379
 			}
380
-			$this->set_reg_step_initiated( $this->current_step );
380
+			$this->set_reg_step_initiated($this->current_step);
381 381
 		}
382 382
 	}
383 383
 
@@ -391,14 +391,14 @@  discard block
 block discarded – undo
391 391
 	 * @param bool   $reset whether to reset reg steps after removal
392 392
 	 * @throws EE_Error
393 393
 	 */
394
-	public function remove_reg_step( $reg_step_slug = '', $reset = true ) {
395
-		unset( $this->reg_steps[ $reg_step_slug  ] );
396
-		if ( $this->transaction instanceof EE_Transaction ) {
394
+	public function remove_reg_step($reg_step_slug = '', $reset = true) {
395
+		unset($this->reg_steps[$reg_step_slug]);
396
+		if ($this->transaction instanceof EE_Transaction) {
397 397
 			// now remove reg step from TXN and save
398
-			$this->transaction->remove_reg_step( $reg_step_slug );
398
+			$this->transaction->remove_reg_step($reg_step_slug);
399 399
 			$this->transaction->save();
400 400
 		}
401
-		if ( $reset ) {
401
+		if ($reset) {
402 402
 			$this->reset_reg_steps();
403 403
 		}
404 404
 	}
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
 	 * @param int    $order
414 414
 	 * @return    void
415 415
 	 */
416
-	public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) {
417
-		if ( isset( $this->reg_steps[ $reg_step_slug  ] )) {
418
-			$this->reg_steps[ $reg_step_slug ]->set_order( $order );
416
+	public function set_reg_step_order($reg_step_slug = '', $order = 100) {
417
+		if (isset($this->reg_steps[$reg_step_slug])) {
418
+			$this->reg_steps[$reg_step_slug]->set_order($order);
419 419
 		}
420 420
 	}
421 421
 
@@ -428,25 +428,25 @@  discard block
 block discarded – undo
428 428
 	 * @param string $current_step
429 429
 	 * @return    void
430 430
 	 */
431
-	public function set_current_step( $current_step ) {
431
+	public function set_current_step($current_step) {
432 432
 		// grab what step we're on
433
-		$this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps );
433
+		$this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps);
434 434
 		// verify instance
435
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step ) {
435
+		if ($this->current_step instanceof EE_SPCO_Reg_Step) {
436 436
 			// we don't want to repeat completed steps if this is the first time through SPCO
437
-			if ( $this->continue_reg && ! $this->revisit && $this->current_step->completed() ) {
437
+			if ($this->continue_reg && ! $this->revisit && $this->current_step->completed()) {
438 438
 				// so advance to the next step
439 439
 				$this->set_next_step();
440
-				if ( $this->next_step instanceof EE_SPCO_Reg_Step ) {
440
+				if ($this->next_step instanceof EE_SPCO_Reg_Step) {
441 441
 					// and attempt to set it as the current step
442
-					$this->set_current_step( $this->next_step->slug() );
442
+					$this->set_current_step($this->next_step->slug());
443 443
 				}
444 444
 				return;
445 445
 			}
446
-			$this->current_step->set_is_current_step( TRUE );
446
+			$this->current_step->set_is_current_step(TRUE);
447 447
 		} else {
448 448
 			EE_Error::add_error(
449
-				__( 'The current step could not be set.', 'event_espresso' ),
449
+				__('The current step could not be set.', 'event_espresso'),
450 450
 				__FILE__, __FUNCTION__, __LINE__
451 451
 			);
452 452
 		}
@@ -463,20 +463,20 @@  discard block
 block discarded – undo
463 463
 	 */
464 464
 	public function set_next_step() {
465 465
 		// set pointer to start of array
466
-		reset( $this->reg_steps );
466
+		reset($this->reg_steps);
467 467
 		// if there is more than one step
468
-		if ( count( $this->reg_steps ) > 1 ) {
468
+		if (count($this->reg_steps) > 1) {
469 469
 			// advance to the current step and set pointer
470
-			while ( key( $this->reg_steps ) !== $this->current_step->slug() && key( $this->reg_steps ) !== '' ) {
471
-				next( $this->reg_steps );
470
+			while (key($this->reg_steps) !== $this->current_step->slug() && key($this->reg_steps) !== '') {
471
+				next($this->reg_steps);
472 472
 			}
473 473
 		}
474 474
 		// advance one more spot ( if it exists )
475
-		$this->next_step = next( $this->reg_steps );
475
+		$this->next_step = next($this->reg_steps);
476 476
 		// verify instance
477
-		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step  : NULL;
477
+		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL;
478 478
 		// then back to current step to reset
479
-		prev( $this->reg_steps );
479
+		prev($this->reg_steps);
480 480
 	}
481 481
 
482 482
 
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
 	 *  @return 	EE_SPCO_Reg_Step | null
491 491
 	 */
492 492
 	public function get_next_reg_step() {
493
-		$next = next( $this->reg_steps );
494
-		prev( $this->reg_steps );
493
+		$next = next($this->reg_steps);
494
+		prev($this->reg_steps);
495 495
 		return $next instanceof EE_SPCO_Reg_Step ? $next : null;
496 496
 	}
497 497
 
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 	 *  @return 	EE_SPCO_Reg_Step | null
507 507
 	 */
508 508
 	public function get_prev_reg_step() {
509
-		$prev = prev( $this->reg_steps );
510
-		next( $this->reg_steps );
509
+		$prev = prev($this->reg_steps);
510
+		next($this->reg_steps);
511 511
 		return $prev instanceof EE_SPCO_Reg_Step ? $prev : null;
512 512
 	}
513 513
 
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
 	 * @return void
521 521
 	 */
522 522
 	public function sort_reg_steps() {
523
-		$reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' );
524
-		uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback ));
523
+		$reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback');
524
+		uasort($this->reg_steps, array($this, $reg_step_sorting_callback));
525 525
 	}
526 526
 
527 527
 
@@ -534,19 +534,19 @@  discard block
 block discarded – undo
534 534
 	 * @param string $reg_step_slug
535 535
 	 * @return EE_SPCO_Reg_Step|null
536 536
 	 */
537
-	public function find_reg_step( $reg_step_slug = '' ) {
538
-		if ( ! empty( $reg_step_slug ) ) {
537
+	public function find_reg_step($reg_step_slug = '') {
538
+		if ( ! empty($reg_step_slug)) {
539 539
 			// copy reg step array
540 540
 			$reg_steps = $this->reg_steps;
541 541
 			// set pointer to start of array
542
-			reset( $reg_steps );
542
+			reset($reg_steps);
543 543
 			// if there is more than one step
544
-			if ( count( $reg_steps ) > 1 ) {
544
+			if (count($reg_steps) > 1) {
545 545
 				// advance to the current step and set pointer
546
-				while ( key( $reg_steps ) !== $reg_step_slug && key( $reg_steps ) !== '' ) {
547
-					next( $reg_steps );
546
+				while (key($reg_steps) !== $reg_step_slug && key($reg_steps) !== '') {
547
+					next($reg_steps);
548 548
 				}
549
-				return current( $reg_steps );
549
+				return current($reg_steps);
550 550
 			}
551 551
 		}
552 552
 		return null;
@@ -562,17 +562,17 @@  discard block
 block discarded – undo
562 562
 	 * @param EE_SPCO_Reg_Step $reg_step_B
563 563
 	 * @return int
564 564
 	 */
565
-	public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) {
565
+	public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) {
566 566
 		// send finalize_registration step to the end of the array
567
-		if ( $reg_step_A->slug() === 'finalize_registration' ) {
567
+		if ($reg_step_A->slug() === 'finalize_registration') {
568 568
 			return 1;
569
-		} else if ( $reg_step_B->slug() === 'finalize_registration' ) {
569
+		} else if ($reg_step_B->slug() === 'finalize_registration') {
570 570
 			return -1;
571 571
 		}
572
-		if ( $reg_step_A->order() === $reg_step_B->order() ) {
572
+		if ($reg_step_A->order() === $reg_step_B->order()) {
573 573
 			return 0;
574 574
 		}
575
-		return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1;
575
+		return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1;
576 576
 	}
577 577
 
578 578
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 	 * @param    EE_SPCO_Reg_Step $reg_step
585 585
 	 * @throws \EE_Error
586 586
 	 */
587
-	public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) {
587
+	public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) {
588 588
 		// call set_reg_step_initiated ???
589 589
 		if (
590 590
 			// first time visiting SPCO ?
@@ -597,11 +597,11 @@  discard block
 block discarded – undo
597 597
 			)
598 598
 		) {
599 599
 			// set the start time for this reg step
600
-			if ( ! $this->transaction->set_reg_step_initiated( $reg_step->slug() ) ) {
601
-				if ( WP_DEBUG ) {
600
+			if ( ! $this->transaction->set_reg_step_initiated($reg_step->slug())) {
601
+				if (WP_DEBUG) {
602 602
 					EE_Error::add_error(
603 603
 						sprintf(
604
-							__( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ),
604
+							__('The "%1$s" registration step was not initialized properly.', 'event_espresso'),
605 605
 							$reg_step->name()
606 606
 						),
607 607
 						__FILE__, __FUNCTION__, __LINE__
@@ -620,10 +620,10 @@  discard block
 block discarded – undo
620 620
 	 * 	@return 	void
621 621
 	 */
622 622
 	public function set_reg_step_JSON_info() {
623
-		EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array();
623
+		EE_Registry::$i18n_js_strings['reg_steps'] = array();
624 624
 		// pass basic reg step data to JS
625
-		foreach ( $this->reg_steps as $reg_step ) {
626
-			EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug();
625
+		foreach ($this->reg_steps as $reg_step) {
626
+			EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug();
627 627
 		}
628 628
 		// reset reg step html
629 629
 //		$this->json_response->set_reg_step_html( '' );
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 	 */
640 640
 	public function reset_reg_steps() {
641 641
 		$this->sort_reg_steps();
642
-		$this->set_current_step( EE_Registry::instance()->REQ->get( 'step' ));
642
+		$this->set_current_step(EE_Registry::instance()->REQ->get('step'));
643 643
 		$this->set_next_step();
644 644
 		// the text that appears on the reg step form submit button
645 645
 		$this->current_step->set_submit_button_text();
@@ -656,9 +656,9 @@  discard block
 block discarded – undo
656 656
 	 */
657 657
 	public function get_registration_time_limit() {
658 658
 
659
-		$registration_time_limit = (float)( EE_Registry::instance()	->SSN->expiration() - time() );
659
+		$registration_time_limit = (float) (EE_Registry::instance()	->SSN->expiration() - time());
660 660
 		$time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s';
661
-		$registration_time_limit = date( $time_limit_format, $registration_time_limit );
661
+		$registration_time_limit = date($time_limit_format, $registration_time_limit);
662 662
 		return apply_filters(
663 663
 			'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit',
664 664
 			$registration_time_limit
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 		//		overpaid TXN
679 679
 		//		free TXN ( total = 0.00 )
680 680
 		// then payment required is TRUE
681
-		return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE;
681
+		return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE;
682 682
 	}
683 683
 
684 684
 
@@ -690,12 +690,12 @@  discard block
 block discarded – undo
690 690
 	 * @param EE_Transaction $transaction
691 691
 	 * @return EE_Cart
692 692
 	 */
693
-	public function get_cart_for_transaction( $transaction ) {
694
-		$session = EE_Registry::instance()->load_core( 'Session' );
695
-		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction, $session ) : null;
693
+	public function get_cart_for_transaction($transaction) {
694
+		$session = EE_Registry::instance()->load_core('Session');
695
+		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction, $session) : null;
696 696
 		// verify cart
697
-		if ( ! $cart instanceof EE_Cart ) {
698
-			$cart = EE_Registry::instance()->load_core( 'Cart' );
697
+		if ( ! $cart instanceof EE_Cart) {
698
+			$cart = EE_Registry::instance()->load_core('Cart');
699 699
 		}
700 700
 
701 701
 		return $cart;
@@ -711,8 +711,8 @@  discard block
 block discarded – undo
711 711
 	 */
712 712
 	public function initialize_txn_reg_steps_array() {
713 713
 		$txn_reg_steps_array = array();
714
-		foreach ( $this->reg_steps as $reg_step ) {
715
-			$txn_reg_steps_array[ $reg_step->slug() ] = FALSE;
714
+		foreach ($this->reg_steps as $reg_step) {
715
+			$txn_reg_steps_array[$reg_step->slug()] = FALSE;
716 716
 		}
717 717
 		return $txn_reg_steps_array;
718 718
 	}
@@ -728,14 +728,14 @@  discard block
 block discarded – undo
728 728
 	 */
729 729
 	public function update_txn_reg_steps_array() {
730 730
 		$updated = false;
731
-		foreach ( $this->reg_steps as $reg_step ) {
732
-			if ( $reg_step->completed() ) {
733
-				$updated = $this->transaction->set_reg_step_completed( $reg_step->slug() )
731
+		foreach ($this->reg_steps as $reg_step) {
732
+			if ($reg_step->completed()) {
733
+				$updated = $this->transaction->set_reg_step_completed($reg_step->slug())
734 734
 					? true
735 735
 					: $updated;
736 736
 			}
737 737
 		}
738
-		if ( $updated ) {
738
+		if ($updated) {
739 739
 			$this->transaction->save();
740 740
 		}
741 741
 		return $updated;
@@ -751,14 +751,14 @@  discard block
 block discarded – undo
751 751
 	 * @throws \EE_Error
752 752
 	 */
753 753
 	public function stash_transaction_and_checkout() {
754
-		if ( ! $this->revisit ) {
754
+		if ( ! $this->revisit) {
755 755
 			$this->update_txn_reg_steps_array();
756 756
 		}
757 757
 		$this->track_transaction_and_registration_status_updates();
758 758
 		// save all data to the db, but suppress errors
759 759
 		//$this->save_all_data( FALSE );
760 760
 		// cache the checkout in the session
761
-		EE_Registry::instance()->SSN->set_checkout( $this );
761
+		EE_Registry::instance()->SSN->set_checkout($this);
762 762
 	}
763 763
 
764 764
 
@@ -773,15 +773,15 @@  discard block
 block discarded – undo
773 773
 	 */
774 774
 	public function track_transaction_and_registration_status_updates() {
775 775
 		// verify the transaction
776
-		if ( $this->transaction instanceof EE_Transaction ) {
776
+		if ($this->transaction instanceof EE_Transaction) {
777 777
 			// has there been a TXN status change during this checkout?
778 778
 			$this->txn_status_updated = $this->transaction->txn_status_updated();
779 779
 			/** @type EE_Registration_Processor $registration_processor */
780
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
780
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
781 781
 			// grab the saved registrations from the transaction
782
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) {
783
-				if ( $registration_processor->reg_status_updated( $registration->ID() ) ) {
784
-					$this->set_reg_status_updated( $registration->ID(), true );
782
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) {
783
+				if ($registration_processor->reg_status_updated($registration->ID())) {
784
+					$this->set_reg_status_updated($registration->ID(), true);
785 785
 				}
786 786
 			}
787 787
 		}
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 	 * @return    bool
803 803
 	 * @throws \EE_Error
804 804
 	 */
805
-	public function visit_allows_processing_of_this_registration( EE_Registration $registration ) {
805
+	public function visit_allows_processing_of_this_registration(EE_Registration $registration) {
806 806
 		return ! $this->revisit
807 807
 		       || $this->primary_revisit
808 808
 		       || (
@@ -835,18 +835,18 @@  discard block
 block discarded – undo
835 835
 	 * @return bool
836 836
 	 * @throws \EE_Error
837 837
 	 */
838
-	public function save_all_data( $show_errors = TRUE ) {
838
+	public function save_all_data($show_errors = TRUE) {
839 839
 		// verify the transaction
840
-		if ( $this->transaction instanceof EE_Transaction ) {
840
+		if ($this->transaction instanceof EE_Transaction) {
841 841
 			// save to ensure that TXN has ID
842 842
 			$this->transaction->save();
843 843
 			// grab the saved registrations from the transaction
844
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as  $registration ) {
845
-				$this->_save_registration( $registration, $show_errors );
844
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as  $registration) {
845
+				$this->_save_registration($registration, $show_errors);
846 846
 			}
847 847
 		} else {
848
-			if ( $show_errors ) {
849
-				EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
848
+			if ($show_errors) {
849
+				EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850 850
 			}
851 851
 			return FALSE;
852 852
 		}
@@ -863,32 +863,32 @@  discard block
 block discarded – undo
863 863
 	 * @return void
864 864
 	 * @throws \EE_Error
865 865
 	 */
866
-	private function _save_registration( $registration, $show_errors = TRUE  ) {
866
+	private function _save_registration($registration, $show_errors = TRUE) {
867 867
 		// verify object
868
-		if ( $registration instanceof EE_Registration ) {
868
+		if ($registration instanceof EE_Registration) {
869 869
 			// should this registration be processed during this visit ?
870
-			if ( $this->visit_allows_processing_of_this_registration( $registration ) ) {
870
+			if ($this->visit_allows_processing_of_this_registration($registration)) {
871 871
 				//set TXN ID
872
-				if ( ! $registration->transaction_ID() ) {
873
-					$registration->set_transaction_id( $this->transaction->ID() );
872
+				if ( ! $registration->transaction_ID()) {
873
+					$registration->set_transaction_id($this->transaction->ID());
874 874
 				}
875 875
 				// verify and save the attendee
876
-				$this->_save_registration_attendee( $registration, $show_errors );
876
+				$this->_save_registration_attendee($registration, $show_errors);
877 877
 				// save answers to reg form questions
878
-				$this->_save_registration_answers( $registration, $show_errors );
878
+				$this->_save_registration_answers($registration, $show_errors);
879 879
 				// save changes
880 880
 				$registration->save();
881 881
 				// update txn cache
882
-				if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) {
883
-					if ( $show_errors ) {
884
-						EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
882
+				if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) {
883
+					if ($show_errors) {
884
+						EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
885 885
 					}
886 886
 				}
887 887
 			}
888 888
 		} else {
889
-			if ( $show_errors ) {
889
+			if ($show_errors) {
890 890
 				EE_Error::add_error(
891
-					__( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ),
891
+					__('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'),
892 892
 					__FILE__, __FUNCTION__, __LINE__
893 893
 				);
894 894
 			}
@@ -905,25 +905,25 @@  discard block
 block discarded – undo
905 905
 	 * @return void
906 906
 	 * @throws \EE_Error
907 907
 	 */
908
-	private function _save_registration_attendee( $registration, $show_errors = TRUE ) {
909
-		if ( $registration->attendee() instanceof EE_Attendee ) {
908
+	private function _save_registration_attendee($registration, $show_errors = TRUE) {
909
+		if ($registration->attendee() instanceof EE_Attendee) {
910 910
 			// save so that ATT has ID
911 911
 			$registration->attendee()->save();
912
-			if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() ) ) {
913
-				if ( $show_errors ) {
912
+			if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) {
913
+				if ($show_errors) {
914 914
 					EE_Error::add_error(
915
-						__( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ),
915
+						__('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'),
916 916
 						__FILE__, __FUNCTION__, __LINE__
917 917
 					);
918 918
 				}
919 919
 			}
920 920
 		} else {
921
-			if ( $show_errors ) {
921
+			if ($show_errors) {
922 922
 				EE_Error::add_error(
923 923
 					sprintf(
924 924
 						'%1$s||%1$s $attendee = %2$s',
925
-						__( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ),
926
-						var_export( $registration->attendee(), true )
925
+						__('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'),
926
+						var_export($registration->attendee(), true)
927 927
 					),
928 928
 					__FILE__, __FUNCTION__, __LINE__
929 929
 				);
@@ -941,25 +941,25 @@  discard block
 block discarded – undo
941 941
 	 * @return void
942 942
 	 * @throws \EE_Error
943 943
 	 */
944
-	private function _save_registration_answers( $registration, $show_errors = TRUE ) {
944
+	private function _save_registration_answers($registration, $show_errors = TRUE) {
945 945
 		// now save the answers
946
-		foreach ( $registration->answers() as $cache_key => $answer ) {
946
+		foreach ($registration->answers() as $cache_key => $answer) {
947 947
 			// verify object
948
-			if ( $answer instanceof EE_Answer ) {
949
-				$answer->set_registration( $registration->ID() );
948
+			if ($answer instanceof EE_Answer) {
949
+				$answer->set_registration($registration->ID());
950 950
 				$answer->save();
951
-				if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) {
952
-					if ( $show_errors ) {
951
+				if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) {
952
+					if ($show_errors) {
953 953
 						EE_Error::add_error(
954
-							__( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ),
954
+							__('The newly saved Answer object could not be cached on the registration.', 'event_espresso'),
955 955
 							__FILE__, __FUNCTION__, __LINE__
956 956
 						);
957 957
 					}
958 958
 				}
959 959
 			} else {
960
-				if ( $show_errors ) {
960
+				if ($show_errors) {
961 961
 					EE_Error::add_error(
962
-						__( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ),
962
+						__('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'),
963 963
 						__FILE__, __FUNCTION__, __LINE__
964 964
 					);
965 965
 				}
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 	 * @return bool
979 979
 	 * @throws \EE_Error
980 980
 	 */
981
-	public function refresh_all_entities( $from_db = false ) {
981
+	public function refresh_all_entities($from_db = false) {
982 982
 		$from_db = $this->current_step->is_final_step() || $this->action === 'process_gateway_response'
983 983
 			? true
984 984
 			: $from_db;
@@ -1002,11 +1002,11 @@  discard block
 block discarded – undo
1002 1002
 	 */
1003 1003
 	protected function refresh_from_db() {
1004 1004
 		// verify the transaction
1005
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1005
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1006 1006
 			// pull fresh TXN data from the db
1007
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() );
1007
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID());
1008 1008
 			// update EE_Checkout's cached primary_attendee object
1009
-			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction );
1009
+			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction);
1010 1010
 			// update EE_Checkout's cached payment object
1011 1011
 			$payment = $this->transaction->last_payment();
1012 1012
 			$this->payment = $payment instanceof EE_Payment ? $payment : $this->payment;
@@ -1014,9 +1014,9 @@  discard block
 block discarded – undo
1014 1014
 			$payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null;
1015 1015
 			$this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method;
1016 1016
 			//now refresh the cart, based on the TXN
1017
-			$this->cart = $this->get_cart_for_transaction( $this->transaction );
1017
+			$this->cart = $this->get_cart_for_transaction($this->transaction);
1018 1018
 		} else {
1019
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
1019
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1020 1020
 			return FALSE;
1021 1021
 		}
1022 1022
 		return TRUE;
@@ -1031,21 +1031,21 @@  discard block
 block discarded – undo
1031 1031
 	 * @return  EE_Attendee | null
1032 1032
 	 * @throws \EE_Error
1033 1033
 	 */
1034
-	protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) {
1034
+	protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) {
1035 1035
 
1036 1036
 		$primary_attendee_obj = null;
1037 1037
 		// grab the saved registrations from the transaction
1038
-		foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) {
1038
+		foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) {
1039 1039
 			// verify object
1040
-			if ( $registration instanceof EE_Registration ) {
1040
+			if ($registration instanceof EE_Registration) {
1041 1041
 				$attendee = $registration->attendee();
1042 1042
 				// verify object && maybe cache primary_attendee_obj ?
1043
-				if ( $attendee instanceof EE_Attendee&& $registration->is_primary_registrant() ) {
1043
+				if ($attendee instanceof EE_Attendee && $registration->is_primary_registrant()) {
1044 1044
 					$primary_attendee_obj = $attendee;
1045 1045
 				}
1046 1046
 			} else {
1047 1047
 				EE_Error::add_error(
1048
-						__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1048
+						__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1049 1049
 						__FILE__, __FUNCTION__, __LINE__
1050 1050
 				);
1051 1051
 			}
@@ -1066,43 +1066,43 @@  discard block
 block discarded – undo
1066 1066
 	 */
1067 1067
 	protected function refresh_entity_map() {
1068 1068
 		// verify the transaction
1069
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1069
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1070 1070
 			// never cache payment info
1071
-			$this->transaction->clear_cache( 'Payment' );
1071
+			$this->transaction->clear_cache('Payment');
1072 1072
 			// is the Payment Options Reg Step completed ?
1073
-			if ( $this->transaction->reg_step_completed( 'payment_options' ) ) {
1073
+			if ($this->transaction->reg_step_completed('payment_options')) {
1074 1074
 				// then check for payments and update TXN accordingly
1075 1075
 				/** @type EE_Transaction_Payments $transaction_payments */
1076
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1077
-				$transaction_payments->calculate_total_payments_and_update_status( $this->transaction );
1076
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1077
+				$transaction_payments->calculate_total_payments_and_update_status($this->transaction);
1078 1078
 			}
1079 1079
 			// grab the saved registrations from the transaction
1080 1080
 			foreach (
1081
-				$this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration
1081
+				$this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration
1082 1082
 			) {
1083
-				$this->_refresh_registration( $reg_cache_ID, $registration );
1083
+				$this->_refresh_registration($reg_cache_ID, $registration);
1084 1084
 			}
1085 1085
 			// make sure our cached TXN is added to the model entity mapper
1086
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction );
1086
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction);
1087 1087
 
1088 1088
 		} else {
1089
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
1089
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1090 1090
 			return FALSE;
1091 1091
 		}
1092 1092
 		// verify and update the cart because inaccurate totals are not so much fun
1093
-		if ( $this->cart instanceof EE_Cart ) {
1093
+		if ($this->cart instanceof EE_Cart) {
1094 1094
 			$grand_total = $this->cart->get_grand_total();
1095
-			if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) {
1095
+			if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) {
1096 1096
 				$grand_total->recalculate_total_including_taxes();
1097 1097
 				$grand_total = $grand_total->get_model()->refresh_entity_map_with(
1098 1098
 					$this->cart->get_grand_total()->ID(),
1099 1099
 					$this->cart->get_grand_total()
1100 1100
 				);
1101 1101
 			}
1102
-			if ( $grand_total instanceof EE_Line_Item ) {
1103
-				$this->cart = EE_Cart::instance( $grand_total );
1102
+			if ($grand_total instanceof EE_Line_Item) {
1103
+				$this->cart = EE_Cart::instance($grand_total);
1104 1104
 			} else {
1105
-				EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1105
+				EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1106 1106
 				return false;
1107 1107
 			}
1108 1108
 		}
@@ -1119,19 +1119,19 @@  discard block
 block discarded – undo
1119 1119
 	 * @return void
1120 1120
 	 * @throws \EE_Error
1121 1121
 	 */
1122
-	protected function _refresh_registration( $reg_cache_ID, $registration ) {
1122
+	protected function _refresh_registration($reg_cache_ID, $registration) {
1123 1123
 
1124 1124
 		// verify object
1125
-		if ( $registration instanceof EE_Registration ) {
1125
+		if ($registration instanceof EE_Registration) {
1126 1126
 			// update the entity mapper attendee
1127
-			$this->_refresh_registration_attendee( $registration );
1127
+			$this->_refresh_registration_attendee($registration);
1128 1128
 			// update the entity mapper answers for reg form questions
1129
-			$this->_refresh_registration_answers( $registration );
1129
+			$this->_refresh_registration_answers($registration);
1130 1130
 			// make sure the cached registration is added to the model entity mapper
1131
-			$registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration );
1131
+			$registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration);
1132 1132
 		} else {
1133 1133
 			EE_Error::add_error(
1134
-				__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1134
+				__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1135 1135
 				__FILE__, __FUNCTION__, __LINE__
1136 1136
 			);
1137 1137
 		}
@@ -1146,15 +1146,15 @@  discard block
 block discarded – undo
1146 1146
 	 * @return void
1147 1147
 	 * @throws \EE_Error
1148 1148
 	 */
1149
-	protected function _refresh_registration_attendee( $registration ) {
1149
+	protected function _refresh_registration_attendee($registration) {
1150 1150
 
1151 1151
 		$attendee = $registration->attendee();
1152 1152
 		// verify object
1153
-		if ( $attendee instanceof EE_Attendee && $attendee->ID() ) {
1153
+		if ($attendee instanceof EE_Attendee && $attendee->ID()) {
1154 1154
 			// make sure the cached attendee is added to the model entity mapper
1155
-			$registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee );
1155
+			$registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee);
1156 1156
 			// maybe cache primary_attendee_obj ?
1157
-			if ( $registration->is_primary_registrant() ) {
1157
+			if ($registration->is_primary_registrant()) {
1158 1158
 				$this->primary_attendee_obj = $attendee;
1159 1159
 			}
1160 1160
 		}
@@ -1169,19 +1169,19 @@  discard block
 block discarded – undo
1169 1169
 	 * @return void
1170 1170
 	 * @throws \EE_Error
1171 1171
 	 */
1172
-	protected function _refresh_registration_answers( $registration ) {
1172
+	protected function _refresh_registration_answers($registration) {
1173 1173
 
1174 1174
 		// now update the answers
1175
-		foreach ( $registration->answers() as $cache_key => $answer ) {
1175
+		foreach ($registration->answers() as $cache_key => $answer) {
1176 1176
 			// verify object
1177
-			if ( $answer instanceof EE_Answer ) {
1178
-				if ( $answer->ID() ) {
1177
+			if ($answer instanceof EE_Answer) {
1178
+				if ($answer->ID()) {
1179 1179
 					// make sure the cached answer is added to the model entity mapper
1180
-					$answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer );
1180
+					$answer->get_model()->refresh_entity_map_with($answer->ID(), $answer);
1181 1181
 				}
1182 1182
 			} else {
1183 1183
 				EE_Error::add_error(
1184
-					__( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1184
+					__('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1185 1185
 					__FILE__, __FUNCTION__, __LINE__
1186 1186
 				);
1187 1187
 			}
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
     public function __sleep()
1202 1202
     {
1203 1203
         // remove the reg form and the checkout
1204
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) );
1204
+        return array_diff(array_keys(get_object_vars($this)), array('billing_form', 'registration_form'));
1205 1205
     }
1206 1206
 
1207 1207
 
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 	 * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object
1212 1212
 	 */
1213 1213
 	public function __wakeup() {
1214
-		foreach ( $this->reg_steps as $reg_step ) {
1214
+		foreach ($this->reg_steps as $reg_step) {
1215 1215
 			$reg_step->checkout = $this;
1216 1216
 		}
1217 1217
 	}
@@ -1228,12 +1228,12 @@  discard block
 block discarded – undo
1228 1228
 	 * @param bool   $display_request
1229 1229
 	 * @throws \EE_Error
1230 1230
 	 */
1231
-	public function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) {
1231
+	public function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) {
1232 1232
 		$disabled = true;
1233
-		if ( WP_DEBUG && ! $disabled ) {
1234
-			$debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() );
1233
+		if (WP_DEBUG && ! $disabled) {
1234
+			$debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array());
1235 1235
 			$default_data = array(
1236
-				$class 		=> $func . '() : ' . $line,
1236
+				$class 		=> $func.'() : '.$line,
1237 1237
 				'request->step' 		=> $this->step,
1238 1238
 				'request->action' 	=> $this->action,
1239 1239
 				'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ?
@@ -1245,24 +1245,24 @@  discard block
 block discarded – undo
1245 1245
 				'reg_url_link' => $this->reg_url_link,
1246 1246
 				'REQ' => $display_request ? $_REQUEST : '',
1247 1247
 			);
1248
-			if ( $this->transaction instanceof EE_Transaction ) {
1249
-				$default_data[ 'TXN_status' ] 		= $this->transaction->status_ID();
1250
-				$default_data[ 'TXN_reg_steps' ] 	= $this->transaction->reg_steps();
1251
-				foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) {
1252
-					$default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID();
1248
+			if ($this->transaction instanceof EE_Transaction) {
1249
+				$default_data['TXN_status'] = $this->transaction->status_ID();
1250
+				$default_data['TXN_reg_steps'] = $this->transaction->reg_steps();
1251
+				foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) {
1252
+					$default_data['registrations'][$REG_ID] = $registration->status_ID();
1253 1253
 				}
1254
-				if ( $this->transaction->ID() ) {
1255
-					$TXN_ID = 'EE_Transaction: ' . $this->transaction->ID();
1254
+				if ($this->transaction->ID()) {
1255
+					$TXN_ID = 'EE_Transaction: '.$this->transaction->ID();
1256 1256
 					// don't serialize objects
1257
-					$info = $this->_strip_objects( $info );
1258
-					if ( ! isset( $debug_data[ $TXN_ID ] ) ) {
1259
-						$debug_data[ $TXN_ID ] = array();
1257
+					$info = $this->_strip_objects($info);
1258
+					if ( ! isset($debug_data[$TXN_ID])) {
1259
+						$debug_data[$TXN_ID] = array();
1260 1260
 					}
1261
-					$debug_data[ $TXN_ID ][ microtime() ] = array_merge(
1261
+					$debug_data[$TXN_ID][microtime()] = array_merge(
1262 1262
 						$default_data,
1263 1263
 						$info
1264 1264
 					);
1265
-					update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data );
1265
+					update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data);
1266 1266
 				}
1267 1267
 			}
1268 1268
 		}
@@ -1275,23 +1275,23 @@  discard block
 block discarded – undo
1275 1275
 	 * @param array $info
1276 1276
 	 * @return array
1277 1277
 	 */
1278
-	public function _strip_objects( $info = array() ) {
1279
-		foreach ( (array)$info as $key => $value ) {
1280
-			if ( is_array( $value )) {
1281
-				$info[ $key ] = $this->_strip_objects( $value );
1282
-			} else if ( is_object( $value ) ) {
1283
-				$object_class = get_class( $value );
1284
-				$info[ $object_class ] = array();
1285
-				$info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0;
1286
-				if ( method_exists( $value, 'status' ) ) {
1287
-					$info[ $object_class ][ 'status' ] = $value->status();
1288
-				} else if ( method_exists( $value, 'status_ID' ) ) {
1289
-					$info[ $object_class ][ 'status' ] = $value->status_ID();
1278
+	public function _strip_objects($info = array()) {
1279
+		foreach ((array) $info as $key => $value) {
1280
+			if (is_array($value)) {
1281
+				$info[$key] = $this->_strip_objects($value);
1282
+			} else if (is_object($value)) {
1283
+				$object_class = get_class($value);
1284
+				$info[$object_class] = array();
1285
+				$info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0;
1286
+				if (method_exists($value, 'status')) {
1287
+					$info[$object_class]['status'] = $value->status();
1288
+				} else if (method_exists($value, 'status_ID')) {
1289
+					$info[$object_class]['status'] = $value->status_ID();
1290 1290
 				}
1291
-				unset( $info[ $key ] );
1291
+				unset($info[$key]);
1292 1292
 			}
1293 1293
 		}
1294
-		return (array)$info;
1294
+		return (array) $info;
1295 1295
 	}
1296 1296
 
1297 1297
 
Please login to merge, or discard this patch.
attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -91,6 +91,7 @@
 block discarded – undo
91 91
 	 * @param EE_Registration $registration
92 92
 	 * @param EE_Question     $question
93 93
 	 * @param mixed EE_Answer|NULL      $answer
94
+	 * @param EE_Answer $answer
94 95
 	 * @return EE_Form_Input_Base
95 96
 	 */
96 97
 	public function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
Please login to merge, or discard this patch.
Spacing   +229 added lines, -230 removed lines patch added patch discarded remove patch
@@ -41,21 +41,21 @@  discard block
 block discarded – undo
41 41
 	 * @access    public
42 42
 	 * @param    EE_Checkout $checkout
43 43
 	 */
44
-	public function __construct( EE_Checkout $checkout ) {
44
+	public function __construct(EE_Checkout $checkout) {
45 45
 		$this->_slug = 'attendee_information';
46 46
 		$this->_name = __('Attendee Information', 'event_espresso');
47
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php';
47
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php';
48 48
 		$this->checkout = $checkout;
49 49
 		$this->_reset_success_message();
50 50
 		$this->set_instructions(
51
-			__( 'Please answer the following registration questions before proceeding.', 'event_espresso' )
51
+			__('Please answer the following registration questions before proceeding.', 'event_espresso')
52 52
 		);
53 53
 	}
54 54
 
55 55
 
56 56
 
57 57
 	public function translate_js_strings() {
58
-		EE_Registry::$i18n_js_strings['required_field'] = __( ' is a required question.', 'event_espresso' );
58
+		EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso');
59 59
 		EE_Registry::$i18n_js_strings['required_multi_field'] = __(
60 60
 			' is a required question. Please enter a value for at least one of the options.',
61 61
 			'event_espresso'
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		// calculate taxes
116 116
 		$Line_Item_Display->display_line_item(
117 117
 			$this->checkout->cart->get_grand_total(),
118
-			array( 'set_tax_rate' => true )
118
+			array('set_tax_rate' => true)
119 119
 		);
120 120
 		/** @var $subsections EE_Form_Section_Proper[] */
121 121
 		$subsections = array(
@@ -127,51 +127,51 @@  discard block
 block discarded – undo
127 127
 			'ticket_count' 	=> array()
128 128
 		);
129 129
 		// grab the saved registrations from the transaction
130
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
131
-		if ( $registrations ) {
132
-			foreach ( $registrations as $registration ) {
130
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
131
+		if ($registrations) {
132
+			foreach ($registrations as $registration) {
133 133
 				// can this registration be processed during this visit ?
134 134
 				if (
135 135
 					$registration instanceof EE_Registration
136
-					&& $this->checkout->visit_allows_processing_of_this_registration( $registration )
136
+					&& $this->checkout->visit_allows_processing_of_this_registration($registration)
137 137
 				) {
138
-					$subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration );
139
-					if ( ! $this->checkout->admin_request ) {
140
-						$template_args['registrations'][ $registration->reg_url_link() ] = $registration;
141
-						$template_args['ticket_count'][ $registration->ticket()->ID() ] = isset(
142
-							$template_args['ticket_count'][ $registration->ticket()->ID() ]
138
+					$subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration);
139
+					if ( ! $this->checkout->admin_request) {
140
+						$template_args['registrations'][$registration->reg_url_link()] = $registration;
141
+						$template_args['ticket_count'][$registration->ticket()->ID()] = isset(
142
+							$template_args['ticket_count'][$registration->ticket()->ID()]
143 143
 						)
144
-							? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1
144
+							? $template_args['ticket_count'][$registration->ticket()->ID()] + 1
145 145
 							: 1;
146 146
 						$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs(
147 147
 							$this->checkout->cart->get_grand_total(),
148 148
 							'Ticket',
149
-							array( $registration->ticket()->ID() )
149
+							array($registration->ticket()->ID())
150 150
 						);
151
-						$ticket_line_item = is_array( $ticket_line_item )
152
-							? reset( $ticket_line_item )
151
+						$ticket_line_item = is_array($ticket_line_item)
152
+							? reset($ticket_line_item)
153 153
 							: $ticket_line_item;
154
-						$template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item(
154
+						$template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item(
155 155
 							$ticket_line_item
156 156
 						);
157 157
 					}
158
-					if ( $registration->is_primary_registrant() ) {
158
+					if ($registration->is_primary_registrant()) {
159 159
 						$primary_registrant = $registration->reg_url_link();
160 160
 					}
161 161
 				}
162 162
 			}
163 163
 			// print_copy_info ?
164
-			if ( $primary_registrant && ! $this->checkout->admin_request && count( $registrations ) > 1 ) {
164
+			if ($primary_registrant && ! $this->checkout->admin_request && count($registrations) > 1) {
165 165
 				// TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info
166 166
 				$copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info
167 167
 					? $this->_copy_attendee_info_form()
168 168
 					: $this->_auto_copy_attendee_info();
169 169
 				// generate hidden input
170 170
 				if (
171
-					isset( $subsections[ $primary_registrant ] )
172
-				     && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper
171
+					isset($subsections[$primary_registrant])
172
+				     && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper
173 173
 				) {
174
-					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
174
+					$subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false);
175 175
 				}
176 176
 			}
177 177
 
@@ -183,8 +183,7 @@  discard block
 block discarded – undo
183 183
 				'html_id' 					=> $this->reg_form_name(),
184 184
 				'subsections' 			=> $subsections,
185 185
 				'layout_strategy'		=> $this->checkout->admin_request ?
186
-					new EE_Div_Per_Section_Layout() :
187
-					new EE_Template_Layout(
186
+					new EE_Div_Per_Section_Layout() : new EE_Template_Layout(
188 187
 						array(
189 188
 							'layout_template_file' 	=> $this->_template, // layout_template
190 189
 							'template_args' 				=> $template_args
@@ -202,11 +201,11 @@  discard block
 block discarded – undo
202 201
 	 * @return EE_Form_Section_Proper
203 202
 	 * @throws \EE_Error
204 203
 	 */
205
-	private function _registrations_reg_form( EE_Registration $registration ) {
204
+	private function _registrations_reg_form(EE_Registration $registration) {
206 205
 		static $attendee_nmbr = 1;
207 206
 		// array of params to pass to parent constructor
208 207
 		$form_args = array(
209
-			'html_id'         => 'ee-registration-' . $registration->reg_url_link(),
208
+			'html_id'         => 'ee-registration-'.$registration->reg_url_link(),
210 209
 			'html_class'      => 'ee-reg-form-attendee-dv',
211 210
 			'html_style'      => $this->checkout->admin_request
212 211
 				? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'
@@ -215,24 +214,24 @@  discard block
 block discarded – undo
215 214
 			'layout_strategy' => new EE_Fieldset_Section_Layout(
216 215
 				array(
217 216
 					'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text',
218
-					'legend_text'  => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr )
217
+					'legend_text'  => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr)
219 218
 				)
220 219
 			)
221 220
 		);
222 221
 		// verify that registration has valid event
223
-		if ( $registration->event() instanceof EE_Event ) {
222
+		if ($registration->event() instanceof EE_Event) {
224 223
 			$query_params = array(
225 224
 				array(
226 225
 					'Event.EVT_ID' => $registration->event()->ID(),
227 226
 					'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false
228 227
 				),
229
-				'order_by'=>array( 'QSG_order'=>'ASC' )
228
+				'order_by'=>array('QSG_order'=>'ASC')
230 229
 			);
231
-			$question_groups = $registration->event()->question_groups( $query_params );
232
-			if ( $question_groups ) {
233
-				foreach ( $question_groups as $question_group ) {
234
-					if ( $question_group instanceof EE_Question_Group ) {
235
-						$form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form(
230
+			$question_groups = $registration->event()->question_groups($query_params);
231
+			if ($question_groups) {
232
+				foreach ($question_groups as $question_group) {
233
+					if ($question_group instanceof EE_Question_Group) {
234
+						$form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form(
236 235
 							$registration,
237 236
 							$question_group
238 237
 						);
@@ -245,10 +244,10 @@  discard block
 block discarded – undo
245 244
 				// if we have question groups for additional attendees, then display the copy options
246 245
 				$this->_print_copy_info = $attendee_nmbr > 1 ? true : $this->_print_copy_info;
247 246
 			} else {
248
-				$form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link(
249
-				) ] = new EE_Form_Section_HTML(
247
+				$form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link(
248
+				)] = new EE_Form_Section_HTML(
250 249
 					EEH_Template::locate_template(
251
-						SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php',
250
+						SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php',
252 251
 						apply_filters(
253 252
 							'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args',
254 253
 							array()
@@ -267,12 +266,12 @@  discard block
 block discarded – undo
267 266
 
268 267
 			}
269 268
 		}
270
-		if ( $registration->is_primary_registrant() ) {
269
+		if ($registration->is_primary_registrant()) {
271 270
 			// generate hidden input
272
-			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration );
271
+			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration);
273 272
 		}
274 273
 		$attendee_nmbr++;
275
-		return new EE_Form_Section_Proper( $form_args );
274
+		return new EE_Form_Section_Proper($form_args);
276 275
 	}
277 276
 
278 277
 
@@ -293,7 +292,7 @@  discard block
 block discarded – undo
293 292
 		// generate hidden input
294 293
 		return new EE_Hidden_Input(
295 294
 			array(
296
-				'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),
295
+				'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(),
297 296
 				'default' => $additional_attendee_reg_info
298 297
 			)
299 298
 		);
@@ -307,26 +306,26 @@  discard block
 block discarded – undo
307 306
 	 * @return EE_Form_Section_Proper
308 307
 	 * @throws \EE_Error
309 308
 	 */
310
-	private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){
309
+	private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) {
311 310
 		// array of params to pass to parent constructor
312 311
 		$form_args = array(
313
-			'html_id'         => 'ee-reg-form-qstn-grp-' . $question_group->identifier(),
312
+			'html_id'         => 'ee-reg-form-qstn-grp-'.$question_group->identifier(),
314 313
 			'html_class'      => $this->checkout->admin_request
315 314
 				? 'form-table ee-reg-form-qstn-grp-dv'
316 315
 				: 'ee-reg-form-qstn-grp-dv',
317
-			'html_label_id'   => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl',
316
+			'html_label_id'   => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl',
318 317
 			'subsections'     => array(
319
-				'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group )
318
+				'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group)
320 319
 			),
321 320
 			'layout_strategy' => $this->checkout->admin_request
322 321
 				? new EE_Admin_Two_Column_Layout()
323 322
 				: new EE_Div_Per_Section_Layout()
324 323
 		);
325 324
 		// where params
326
-		$query_params = array( 'QST_deleted' => 0 );
325
+		$query_params = array('QST_deleted' => 0);
327 326
 		// don't load admin only questions on the frontend
328
-		if ( ! $this->checkout->admin_request ) {
329
-			$query_params['QST_admin_only'] = array( '!=', true );
327
+		if ( ! $this->checkout->admin_request) {
328
+			$query_params['QST_admin_only'] = array('!=', true);
330 329
 		}
331 330
 		$questions = $question_group->get_many_related(
332 331
 			'Question',
@@ -348,10 +347,10 @@  discard block
 block discarded – undo
348 347
 			)
349 348
 		);
350 349
 		// loop thru questions
351
-		foreach ( $questions as $question ) {
352
-			if( $question instanceof EE_Question ){
350
+		foreach ($questions as $question) {
351
+			if ($question instanceof EE_Question) {
353 352
 				$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
354
-				$form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question );
353
+				$form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question);
355 354
 			}
356 355
 		}
357 356
 		$form_args['subsections'] = apply_filters(
@@ -372,7 +371,7 @@  discard block
 block discarded – undo
372 371
 			)
373 372
 		);
374 373
 //		d( $form_args );
375
-		$question_group_reg_form = new EE_Form_Section_Proper( $form_args );
374
+		$question_group_reg_form = new EE_Form_Section_Proper($form_args);
376 375
 		return apply_filters(
377 376
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',
378 377
 			$question_group_reg_form,
@@ -389,11 +388,11 @@  discard block
 block discarded – undo
389 388
 	 * @param EE_Question_Group $question_group
390 389
 	 * @return 	EE_Form_Section_HTML
391 390
 	 */
392
-	private function _question_group_header( EE_Question_Group $question_group ){
391
+	private function _question_group_header(EE_Question_Group $question_group) {
393 392
 		$html = '';
394 393
 		// group_name
395
-		if ( $question_group->show_group_name() && $question_group->name() !== '' ) {
396
-			if ( $this->checkout->admin_request ) {
394
+		if ($question_group->show_group_name() && $question_group->name() !== '') {
395
+			if ($this->checkout->admin_request) {
397 396
 				$html .= EEH_HTML::br();
398 397
 				$html .= EEH_HTML::h3(
399 398
 					$question_group->name(),
@@ -407,7 +406,7 @@  discard block
 block discarded – undo
407 406
 			}
408 407
 		}
409 408
 		// group_desc
410
-		if ( $question_group->show_group_desc() && $question_group->desc() !== '' ) {
409
+		if ($question_group->show_group_desc() && $question_group->desc() !== '') {
411 410
 			$html .= EEH_HTML::p(
412 411
 				$question_group->desc(),
413 412
 				'',
@@ -417,7 +416,7 @@  discard block
 block discarded – undo
417 416
 			);
418 417
 
419 418
 		}
420
-		return new EE_Form_Section_HTML( $html );
419
+		return new EE_Form_Section_HTML($html);
421 420
 	}
422 421
 
423 422
 
@@ -427,7 +426,7 @@  discard block
 block discarded – undo
427 426
 	 * @return    EE_Form_Section_Proper
428 427
 	 * @throws \EE_Error
429 428
 	 */
430
-	private function _copy_attendee_info_form(){
429
+	private function _copy_attendee_info_form() {
431 430
 		// array of params to pass to parent constructor
432 431
 		return new EE_Form_Section_Proper(
433 432
 			array(
@@ -456,7 +455,7 @@  discard block
 block discarded – undo
456 455
 	private function _auto_copy_attendee_info() {
457 456
 		return new EE_Form_Section_HTML(
458 457
 			EEH_Template::locate_template(
459
-				SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php',
458
+				SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php',
460 459
 				apply_filters(
461 460
 					'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args',
462 461
 					array()
@@ -480,32 +479,32 @@  discard block
 block discarded – undo
480 479
 		$copy_attendee_info_inputs = array();
481 480
 		$prev_ticket = NULL;
482 481
 		// grab the saved registrations from the transaction
483
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
484
-		foreach ( $registrations as $registration ) {
482
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
483
+		foreach ($registrations as $registration) {
485 484
 			// for all  attendees other than the primary attendee
486
-			if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) {
485
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
487 486
 				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
488
-				if ( $registration->ticket()->ID() !== $prev_ticket ) {
487
+				if ($registration->ticket()->ID() !== $prev_ticket) {
489 488
 					$item_name = $registration->ticket()->name();
490 489
 					$item_name .= $registration->ticket()->description() !== ''
491
-						? ' - ' . $registration->ticket()->description()
490
+						? ' - '.$registration->ticket()->description()
492 491
 						: '';
493
-					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML(
494
-						'<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
492
+					$copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML(
493
+						'<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
495 494
 					);
496 495
 					$prev_ticket = $registration->ticket()->ID();
497 496
 				}
498 497
 
499
-				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new
498
+				$copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new
500 499
 				EE_Checkbox_Multi_Input(
501 500
 					array(
502 501
 						$registration->ID() => sprintf(
503
-							__( 'Attendee #%s', 'event_espresso' ),
502
+							__('Attendee #%s', 'event_espresso'),
504 503
 							$registration->count()
505 504
 						)
506 505
 					),
507 506
 					array(
508
-						'html_id'                 => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
507
+						'html_id'                 => 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
509 508
 						'html_class'              => 'spco-copy-attendee-chk ee-do-not-validate',
510 509
 						'display_html_label_text' => false
511 510
 					)
@@ -525,7 +524,7 @@  discard block
 block discarded – undo
525 524
 	 * @return    EE_Form_Input_Base
526 525
 	 * @throws \EE_Error
527 526
 	 */
528
-	private function _additional_primary_registrant_inputs( EE_Registration $registration ){
527
+	private function _additional_primary_registrant_inputs(EE_Registration $registration) {
529 528
 		// generate hidden input
530 529
 		return new EE_Hidden_Input(
531 530
 			array(
@@ -544,7 +543,7 @@  discard block
 block discarded – undo
544 543
 	 * @return    EE_Form_Input_Base
545 544
 	 * @throws \EE_Error
546 545
 	 */
547
-	public function reg_form_question( EE_Registration $registration, EE_Question $question ){
546
+	public function reg_form_question(EE_Registration $registration, EE_Question $question) {
548 547
 
549 548
 		// if this question was for an attendee detail, then check for that answer
550 549
 		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value(
@@ -553,32 +552,32 @@  discard block
 block discarded – undo
553 552
 		);
554 553
 		$answer = $answer_value === null
555 554
 			? EEM_Answer::instance()->get_one(
556
-				array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) )
555
+				array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))
557 556
 			)
558 557
 			: null;
559 558
 		// if NOT returning to edit an existing registration
560 559
 		// OR if this question is for an attendee property
561 560
 		// OR we still don't have an EE_Answer object
562
-		if( $answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link() ) {
561
+		if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) {
563 562
 			// create an EE_Answer object for storing everything in
564
-			$answer = EE_Answer::new_instance ( array(
563
+			$answer = EE_Answer::new_instance(array(
565 564
 				'QST_ID'=> $question->ID(),
566 565
 				'REG_ID'=> $registration->ID()
567 566
 			));
568 567
 		}
569 568
 		// verify instance
570
-		if( $answer instanceof EE_Answer ){
571
-			if ( ! empty( $answer_value )) {
572
-				$answer->set( 'ANS_value', $answer_value );
569
+		if ($answer instanceof EE_Answer) {
570
+			if ( ! empty($answer_value)) {
571
+				$answer->set('ANS_value', $answer_value);
573 572
 			}
574
-			$answer->cache( 'Question', $question );
573
+			$answer->cache('Question', $question);
575 574
 			//remember system ID had a bug where sometimes it could be null
576
-			$answer_cache_id =$question->is_system_question()
577
-				? $question->system_ID() . '-' . $registration->reg_url_link()
578
-				: $question->ID() . '-' . $registration->reg_url_link();
579
-			$registration->cache( 'Answer', $answer, $answer_cache_id );
575
+			$answer_cache_id = $question->is_system_question()
576
+				? $question->system_ID().'-'.$registration->reg_url_link()
577
+				: $question->ID().'-'.$registration->reg_url_link();
578
+			$registration->cache('Answer', $answer, $answer_cache_id);
580 579
 		}
581
-		return $this->_generate_question_input( $registration, $question, $answer );
580
+		return $this->_generate_question_input($registration, $question, $answer);
582 581
 
583 582
 	}
584 583
 
@@ -591,46 +590,46 @@  discard block
 block discarded – undo
591 590
 	 * @return EE_Form_Input_Base
592 591
 	 * @throws \EE_Error
593 592
 	 */
594
-	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
593
+	private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) {
595 594
 		$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
596
-		$this->_required_questions[ $identifier ] = $question->required() ? true : false;
595
+		$this->_required_questions[$identifier] = $question->required() ? true : false;
597 596
 		add_filter(
598 597
 			'FHEE__EE_Question__generate_form_input__country_options',
599
-			array( $this, 'use_cached_countries_for_form_input' ),
598
+			array($this, 'use_cached_countries_for_form_input'),
600 599
 			10,
601 600
 			4
602 601
 		);
603 602
 		add_filter(
604 603
 			'FHEE__EE_Question__generate_form_input__state_options',
605
-			array( $this, 'use_cached_states_for_form_input' ),
604
+			array($this, 'use_cached_states_for_form_input'),
606 605
 			10,
607 606
 			4
608 607
 		);
609 608
 		$input_constructor_args = array(
610
-			'html_name'     => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
611
-			'html_id'       => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
612
-			'html_class'    => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
613
-			'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
609
+			'html_name'     => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
610
+			'html_id'       => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
611
+			'html_class'    => 'ee-reg-qstn ee-reg-qstn-'.$identifier,
612
+			'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
614 613
 			'html_label_class'	=> 'ee-reg-qstn',
615 614
 		);
616
-		$input_constructor_args['html_label_id'] 	.= '-lbl';
617
-		if ( $answer instanceof EE_Answer && $answer->ID() ) {
618
-			$input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']';
619
-			$input_constructor_args[ 'html_id' ] .= '-' . $answer->ID();
620
-			$input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID();
615
+		$input_constructor_args['html_label_id'] .= '-lbl';
616
+		if ($answer instanceof EE_Answer && $answer->ID()) {
617
+			$input_constructor_args['html_name'] .= '['.$answer->ID().']';
618
+			$input_constructor_args['html_id'] .= '-'.$answer->ID();
619
+			$input_constructor_args['html_label_id'] .= '-'.$answer->ID();
621 620
 		}
622
-		$form_input =  $question->generate_form_input(
621
+		$form_input = $question->generate_form_input(
623 622
 			$registration,
624 623
 			$answer,
625 624
 			$input_constructor_args
626 625
 		);
627 626
 		remove_filter(
628 627
 			'FHEE__EE_Question__generate_form_input__country_options',
629
-			array( $this, 'use_cached_countries_for_form_input' )
628
+			array($this, 'use_cached_countries_for_form_input')
630 629
 		);
631 630
 		remove_filter(
632 631
 			'FHEE__EE_Question__generate_form_input__state_options',
633
-			array( $this, 'use_cached_states_for_form_input' )
632
+			array($this, 'use_cached_states_for_form_input')
634 633
 		);
635 634
 		return $form_input;
636 635
 	}
@@ -652,22 +651,22 @@  discard block
 block discarded – undo
652 651
 		\EE_Registration $registration = null,
653 652
 		\EE_Answer $answer = null
654 653
 	) {
655
-		$country_options = array( '' => '' );
654
+		$country_options = array('' => '');
656 655
 		// get possibly cached list of countries
657 656
 		$countries = $this->checkout->action === 'process_reg_step'
658 657
 			? EEM_Country::instance()->get_all_countries()
659 658
 			: EEM_Country::instance()->get_all_active_countries();
660
-		if ( ! empty( $countries )) {
661
-			foreach( $countries as $country ){
662
-				if ( $country instanceof EE_Country ) {
663
-					$country_options[ $country->ID() ] = $country->name();
659
+		if ( ! empty($countries)) {
660
+			foreach ($countries as $country) {
661
+				if ($country instanceof EE_Country) {
662
+					$country_options[$country->ID()] = $country->name();
664 663
 				}
665 664
 			}
666 665
 		}
667
-		if( $question instanceof EE_Question
668
-			&& $registration instanceof EE_Registration ) {
666
+		if ($question instanceof EE_Question
667
+			&& $registration instanceof EE_Registration) {
669 668
 			$answer = EEM_Answer::instance()->get_one(
670
-				array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) )
669
+				array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))
671 670
 			);
672 671
 		} else {
673 672
 			$answer = EE_Answer::new_instance();
@@ -700,14 +699,14 @@  discard block
 block discarded – undo
700 699
 		\EE_Registration $registration = null,
701 700
 		\EE_Answer $answer = null
702 701
 	) {
703
-		$state_options = array( '' => array( '' => ''));
702
+		$state_options = array('' => array('' => ''));
704 703
 		$states = $this->checkout->action === 'process_reg_step'
705 704
 			? EEM_State::instance()->get_all_states()
706 705
 			: EEM_State::instance()->get_all_active_states();
707
-		if ( ! empty( $states )) {
708
-			foreach( $states as $state ){
709
-				if ( $state instanceof EE_State ) {
710
-					$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
706
+		if ( ! empty($states)) {
707
+			foreach ($states as $state) {
708
+				if ($state instanceof EE_State) {
709
+					$state_options[$state->country()->name()][$state->ID()] = $state->name();
711 710
 				}
712 711
 			}
713 712
 		}
@@ -735,24 +734,24 @@  discard block
 block discarded – undo
735 734
 	 * @throws \EE_Error
736 735
 	 */
737 736
 	public function process_reg_step() {
738
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
737
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
739 738
 		// grab validated data from form
740 739
 		$valid_data = $this->checkout->current_step->valid_data();
741 740
 		// EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
742 741
 		// EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );
743 742
 		// if we don't have any $valid_data then something went TERRIBLY WRONG !!!
744
-		if ( empty( $valid_data ))  {
743
+		if (empty($valid_data)) {
745 744
 			EE_Error::add_error(
746
-				__( 'No valid question responses were received.', 'event_espresso' ),
745
+				__('No valid question responses were received.', 'event_espresso'),
747 746
 				__FILE__,
748 747
 				__FUNCTION__,
749 748
 				__LINE__
750 749
 			);
751 750
 			return false;
752 751
 		}
753
-		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) {
752
+		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
754 753
 			EE_Error::add_error(
755
-				__( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ),
754
+				__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'),
756 755
 				__FILE__,
757 756
 				__FUNCTION__,
758 757
 				__LINE__
@@ -760,11 +759,11 @@  discard block
 block discarded – undo
760 759
 			return false;
761 760
 		}
762 761
 		// get cached registrations
763
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
762
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
764 763
 		// verify we got the goods
765
-		if ( empty( $registrations )) {
764
+		if (empty($registrations)) {
766 765
 			EE_Error::add_error(
767
-				__( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ),
766
+				__('Your form data could not be applied to any valid registrations.', 'event_espresso'),
768 767
 				__FILE__,
769 768
 				__FUNCTION__,
770 769
 				__LINE__
@@ -772,15 +771,15 @@  discard block
 block discarded – undo
772 771
 			return false;
773 772
 		}
774 773
 		// extract attendee info from form data and save to model objects
775
-		$registrations_processed = $this->_process_registrations( $registrations, $valid_data );
774
+		$registrations_processed = $this->_process_registrations($registrations, $valid_data);
776 775
 		// if first pass thru SPCO,
777 776
 		// then let's check processed registrations against the total number of tickets in the cart
778
-		if ( $registrations_processed === false ) {
777
+		if ($registrations_processed === false) {
779 778
 			// but return immediately if the previous step exited early due to errors
780 779
 			return false;
781
-		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) {
780
+		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
782 781
 			// generate a correctly translated string for all possible singular/plural combinations
783
-			if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) {
782
+			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
784 783
 				$error_msg = sprintf(
785 784
 					__(
786 785
 						'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed',
@@ -789,7 +788,7 @@  discard block
 block discarded – undo
789 788
 					$this->checkout->total_ticket_count,
790 789
 					$registrations_processed
791 790
 				);
792
-			} else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) {
791
+			} else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
793 792
 				$error_msg = sprintf(
794 793
 					__(
795 794
 						'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed',
@@ -808,17 +807,17 @@  discard block
 block discarded – undo
808 807
 					$registrations_processed
809 808
 				);
810 809
 			}
811
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
810
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
812 811
 			return false;
813 812
 		}
814 813
 		// mark this reg step as completed
815 814
 		$this->set_completed();
816 815
 		$this->_set_success_message(
817
-			__( 'The Attendee Information Step has been successfully completed.', 'event_espresso' )
816
+			__('The Attendee Information Step has been successfully completed.', 'event_espresso')
818 817
 		);
819 818
 		//do action in case a plugin wants to do something with the data submitted in step 1.
820 819
 		//passes EE_Single_Page_Checkout, and it's posted data
821
-		do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data );
820
+		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
822 821
 		return true;
823 822
 	}
824 823
 
@@ -832,9 +831,9 @@  discard block
 block discarded – undo
832 831
 	 * @return boolean | int
833 832
 	 * @throws \EE_Error
834 833
 	 */
835
-	private function _process_registrations( $registrations = array(), $valid_data = array() ) {
834
+	private function _process_registrations($registrations = array(), $valid_data = array()) {
836 835
 		// load resources and set some defaults
837
-		EE_Registry::instance()->load_model( 'Attendee' );
836
+		EE_Registry::instance()->load_model('Attendee');
838 837
 		// holder for primary registrant attendee object
839 838
 		$this->checkout->primary_attendee_obj = NULL;
840 839
 		// array for tracking reg form data for the primary registrant
@@ -851,9 +850,9 @@  discard block
 block discarded – undo
851 850
 		// attendee counter
852 851
 		$att_nmbr = 0;
853 852
 		// grab the saved registrations from the transaction
854
-		foreach ( $registrations  as $registration ) {
853
+		foreach ($registrations  as $registration) {
855 854
 			// verify EE_Registration object
856
-			if ( ! $registration instanceof EE_Registration ) {
855
+			if ( ! $registration instanceof EE_Registration) {
857 856
 				EE_Error::add_error(
858 857
 					__(
859 858
 						'An invalid Registration object was discovered when attempting to process your registration information.',
@@ -868,12 +867,12 @@  discard block
 block discarded – undo
868 867
 			/** @var string $reg_url_link */
869 868
 			$reg_url_link = $registration->reg_url_link();
870 869
 			// reg_url_link exists ?
871
-			if ( ! empty( $reg_url_link ) ) {
870
+			if ( ! empty($reg_url_link)) {
872 871
 				// should this registration be processed during this visit ?
873
-				if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
872
+				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
874 873
 					// if NOT revisiting, then let's save the registration now,
875 874
 					// so that we have a REG_ID to use when generating other objects
876
-					if ( ! $this->checkout->revisit ) {
875
+					if ( ! $this->checkout->revisit) {
877 876
 						$registration->save();
878 877
 					}
879 878
 					/**
@@ -883,7 +882,7 @@  discard block
 block discarded – undo
883 882
 					 * @var bool   if true is returned by the plugin then the
884 883
 					 *      		registration processing is halted.
885 884
 					 */
886
-					if ( apply_filters(
885
+					if (apply_filters(
887 886
 						'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process',
888 887
 						false,
889 888
 						$att_nmbr,
@@ -891,38 +890,38 @@  discard block
 block discarded – undo
891 890
 						$registrations,
892 891
 						$valid_data,
893 892
 						$this
894
-					) ) {
893
+					)) {
895 894
 						return false;
896 895
 					}
897 896
 
898 897
 					// Houston, we have a registration!
899 898
 					$att_nmbr++;
900
-					$this->_attendee_data[ $reg_url_link ] = array();
899
+					$this->_attendee_data[$reg_url_link] = array();
901 900
 					// grab any existing related answer objects
902 901
 					$this->_registration_answers = $registration->answers();
903 902
 					// unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
904
-					if ( isset( $valid_data[ $reg_url_link ] ) ) {
903
+					if (isset($valid_data[$reg_url_link])) {
905 904
 						// do we need to copy basic info from primary attendee ?
906
-						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] )
907
-						                && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0
905
+						$copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info'])
906
+						                && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0
908 907
 							? true
909 908
 							: false;
910 909
 						// filter form input data for this registration
911
-						$valid_data[ $reg_url_link ] = (array)apply_filters(
910
+						$valid_data[$reg_url_link] = (array) apply_filters(
912 911
 							'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',
913
-							$valid_data[ $reg_url_link ]
912
+							$valid_data[$reg_url_link]
914 913
 						);
915 914
 						// EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ );
916
-						if ( isset( $valid_data['primary_attendee'] )) {
917
-							$primary_registrant['line_item_id'] =  ! empty( $valid_data['primary_attendee'] )
915
+						if (isset($valid_data['primary_attendee'])) {
916
+							$primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee'])
918 917
 								? $valid_data['primary_attendee']
919 918
 								: false;
920
-							unset( $valid_data['primary_attendee'] );
919
+							unset($valid_data['primary_attendee']);
921 920
 						}
922 921
 						// now loop through our array of valid post data && process attendee reg forms
923
-						foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) {
924
-							if ( ! in_array( $form_section, $non_input_form_sections )) {
925
-								foreach ( $form_inputs as $form_input => $input_value ) {
922
+						foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) {
923
+							if ( ! in_array($form_section, $non_input_form_sections)) {
924
+								foreach ($form_inputs as $form_input => $input_value) {
926 925
 									// \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ );
927 926
 									// check for critical inputs
928 927
 									if (
@@ -936,16 +935,16 @@  discard block
 block discarded – undo
936 935
 									// store a bit of data about the primary attendee
937 936
 									if (
938 937
 										$att_nmbr === 1
939
-										&& ! empty( $input_value )
938
+										&& ! empty($input_value)
940 939
 										&& $reg_url_link === $primary_registrant['line_item_id']
941 940
 									) {
942
-										$primary_registrant[ $form_input ] = $input_value;
941
+										$primary_registrant[$form_input] = $input_value;
943 942
 									} else if (
944 943
 										$copy_primary
945 944
 										&& $input_value === null
946
-										&& isset( $primary_registrant[ $form_input ] )
945
+										&& isset($primary_registrant[$form_input])
947 946
 									) {
948
-										$input_value = $primary_registrant[ $form_input ];
947
+										$input_value = $primary_registrant[$form_input];
949 948
 									}
950 949
 									// now attempt to save the input data
951 950
 									if (
@@ -987,55 +986,55 @@  discard block
 block discarded – undo
987 986
 						// have we met before?
988 987
 						$attendee = $this->_find_existing_attendee(
989 988
 							$registration,
990
-							$this->_attendee_data[ $reg_url_link ]
989
+							$this->_attendee_data[$reg_url_link]
991 990
 						);
992 991
 						// did we find an already existing record for this attendee ?
993
-						if ( $attendee instanceof EE_Attendee ) {
992
+						if ($attendee instanceof EE_Attendee) {
994 993
 							$attendee = $this->_update_existing_attendee_data(
995 994
 								$attendee,
996
-								$this->_attendee_data[ $reg_url_link ]
995
+								$this->_attendee_data[$reg_url_link]
997 996
 							);
998 997
 						} else {
999 998
 							// ensure critical details are set for additional attendees
1000
-							$this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1
999
+							$this->_attendee_data[$reg_url_link] = $att_nmbr > 1
1001 1000
 								? $this->_copy_critical_attendee_details_from_primary_registrant(
1002
-									$this->_attendee_data[ $reg_url_link ]
1001
+									$this->_attendee_data[$reg_url_link]
1003 1002
 								)
1004
-								: $this->_attendee_data[ $reg_url_link ];
1003
+								: $this->_attendee_data[$reg_url_link];
1005 1004
 							$attendee = $this->_create_new_attendee(
1006 1005
 								$registration,
1007
-								$this->_attendee_data[ $reg_url_link ]
1006
+								$this->_attendee_data[$reg_url_link]
1008 1007
 							);
1009 1008
 						}
1010 1009
 						// who's #1 ?
1011
-						if ( $att_nmbr === 1 ) {
1010
+						if ($att_nmbr === 1) {
1012 1011
 							$this->checkout->primary_attendee_obj = $attendee;
1013 1012
 						}
1014 1013
 					}
1015 1014
 					// EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );
1016 1015
 					// add relation to registration, set attendee ID, and cache attendee
1017
-					$this->_associate_attendee_with_registration( $registration, $attendee );
1016
+					$this->_associate_attendee_with_registration($registration, $attendee);
1018 1017
 					// \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ );
1019
-					if ( ! $registration->attendee() instanceof EE_Attendee ) {
1020
-						EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ );
1018
+					if ( ! $registration->attendee() instanceof EE_Attendee) {
1019
+						EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__);
1021 1020
 						return false;
1022 1021
 					}
1023 1022
 					/** @type EE_Registration_Processor $registration_processor */
1024
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1023
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1025 1024
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1026
-					$registration_processor->toggle_incomplete_registration_status_to_default( $registration, false );
1025
+					$registration_processor->toggle_incomplete_registration_status_to_default($registration, false);
1027 1026
 					// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1028 1027
 					$this->checkout->transaction->toggle_failed_transaction_status();
1029 1028
 					// if we've gotten this far, then let's save what we have
1030 1029
 					$registration->save();
1031 1030
 					// add relation between TXN and registration
1032
-					$this->_associate_registration_with_transaction( $registration );
1031
+					$this->_associate_registration_with_transaction($registration);
1033 1032
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
1034 1033
 
1035
-			}  else {
1036
-				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1034
+			} else {
1035
+				EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1037 1036
 				// remove malformed data
1038
-				unset( $valid_data[ $reg_url_link ] );
1037
+				unset($valid_data[$reg_url_link]);
1039 1038
 				return false;
1040 1039
 			}
1041 1040
 
@@ -1064,26 +1063,26 @@  discard block
 block discarded – undo
1064 1063
 		// \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );
1065 1064
 		// allow for plugins to hook in and do their own processing of the form input.
1066 1065
 		// For plugins to bypass normal processing here, they just need to return a boolean value.
1067
-		if ( apply_filters(
1066
+		if (apply_filters(
1068 1067
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input',
1069 1068
 			false,
1070 1069
 			$registration,
1071 1070
 			$form_input,
1072 1071
 			$input_value,
1073 1072
 			$this
1074
-		) ) {
1073
+		)) {
1075 1074
 			return true;
1076 1075
 		}
1077 1076
 		// $answer_cache_id is the key used to find the EE_Answer we want
1078 1077
 		$answer_cache_id = $this->checkout->reg_url_link
1079 1078
 			? $form_input
1080
-			: $form_input . '-' . $registration->reg_url_link();
1081
-		$answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] )
1082
-		                 && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer
1079
+			: $form_input.'-'.$registration->reg_url_link();
1080
+		$answer_is_obj = isset($this->_registration_answers[$answer_cache_id])
1081
+		                 && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer
1083 1082
 			? true
1084 1083
 			: false;
1085 1084
 		//rename form_inputs if they are EE_Attendee properties
1086
-		switch( (string)$form_input ) {
1085
+		switch ((string) $form_input) {
1087 1086
 
1088 1087
 			case 'state' :
1089 1088
 			case 'STA_ID' :
@@ -1098,32 +1097,32 @@  discard block
 block discarded – undo
1098 1097
 				break;
1099 1098
 
1100 1099
 			default :
1101
-				$ATT_input = 'ATT_' . $form_input;
1100
+				$ATT_input = 'ATT_'.$form_input;
1102 1101
 				//EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );
1103
-				$attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? true : false;
1104
-				$form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;
1102
+				$attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false;
1103
+				$form_input = $attendee_property ? 'ATT_'.$form_input : $form_input;
1105 1104
 		}
1106 1105
 		// EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );
1107 1106
 		// EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );
1108 1107
 		// EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );
1109 1108
 		// if this form input has a corresponding attendee property
1110
-		if ( $attendee_property ) {
1111
-			$this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
1112
-			if ( $answer_is_obj ) {
1109
+		if ($attendee_property) {
1110
+			$this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;
1111
+			if ($answer_is_obj) {
1113 1112
 				// and delete the corresponding answer since we won't be storing this data in that object
1114
-				$registration->_remove_relation_to( $this->_registration_answers[ $answer_cache_id ], 'Answer' );
1115
-				$this->_registration_answers[ $answer_cache_id ]->delete_permanently();
1113
+				$registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer');
1114
+				$this->_registration_answers[$answer_cache_id]->delete_permanently();
1116 1115
 			}
1117 1116
 			return true;
1118
-		} elseif ( $answer_is_obj ) {
1117
+		} elseif ($answer_is_obj) {
1119 1118
 			// save this data to the answer object
1120
-			$this->_registration_answers[ $answer_cache_id ]->set_value( $input_value );
1121
-			$result = $this->_registration_answers[ $answer_cache_id ]->save();
1119
+			$this->_registration_answers[$answer_cache_id]->set_value($input_value);
1120
+			$result = $this->_registration_answers[$answer_cache_id]->save();
1122 1121
 			return $result !== false ? true : false;
1123 1122
 		} else {
1124
-			foreach ( $this->_registration_answers as $answer ) {
1125
-				if ( $answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id ) {
1126
-					$answer->set_value( $input_value );
1123
+			foreach ($this->_registration_answers as $answer) {
1124
+				if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) {
1125
+					$answer->set_value($input_value);
1127 1126
 					$result = $answer->save();
1128 1127
 					return $result !== false ? true : false;
1129 1128
 				}
@@ -1145,15 +1144,15 @@  discard block
 block discarded – undo
1145 1144
 		$form_input = '',
1146 1145
 		$input_value = ''
1147 1146
 	) {
1148
-		if ( empty( $input_value ) ) {
1147
+		if (empty($input_value)) {
1149 1148
 			// if the form input isn't marked as being required, then just return
1150
-			if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) {
1149
+			if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) {
1151 1150
 				return true;
1152 1151
 			}
1153
-			switch ( $form_input ) {
1152
+			switch ($form_input) {
1154 1153
 				case 'fname' :
1155 1154
 					EE_Error::add_error(
1156
-						__( 'First Name is a required value.', 'event_espresso' ),
1155
+						__('First Name is a required value.', 'event_espresso'),
1157 1156
 						__FILE__,
1158 1157
 						__FUNCTION__,
1159 1158
 						__LINE__
@@ -1162,7 +1161,7 @@  discard block
 block discarded – undo
1162 1161
 					break;
1163 1162
 				case 'lname' :
1164 1163
 					EE_Error::add_error(
1165
-						__( 'Last Name is a required value.', 'event_espresso' ),
1164
+						__('Last Name is a required value.', 'event_espresso'),
1166 1165
 						__FILE__,
1167 1166
 						__FUNCTION__,
1168 1167
 						__LINE__
@@ -1171,7 +1170,7 @@  discard block
 block discarded – undo
1171 1170
 					break;
1172 1171
 				case 'email' :
1173 1172
 					EE_Error::add_error(
1174
-						__( 'Please enter a valid email address.', 'event_espresso' ),
1173
+						__('Please enter a valid email address.', 'event_espresso'),
1175 1174
 						__FILE__,
1176 1175
 						__FUNCTION__,
1177 1176
 						__LINE__
@@ -1204,21 +1203,21 @@  discard block
 block discarded – undo
1204 1203
 	 * @param array           $attendee_data
1205 1204
 	 * @return boolean
1206 1205
 	 */
1207
-	private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) {
1206
+	private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) {
1208 1207
 		$existing_attendee = null;
1209 1208
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1210
-		$ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] )
1209
+		$ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname'])
1211 1210
 			? $attendee_data['ATT_fname']
1212 1211
 			: '';
1213
-		$ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] )
1212
+		$ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname'])
1214 1213
 			? $attendee_data['ATT_lname']
1215 1214
 			: '';
1216
-		$ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] )
1215
+		$ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email'])
1217 1216
 			? $attendee_data['ATT_email']
1218 1217
 			: '';
1219 1218
 		// but only if those have values
1220
-		if ( $ATT_fname && $ATT_lname && $ATT_email ) {
1221
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1219
+		if ($ATT_fname && $ATT_lname && $ATT_email) {
1220
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1222 1221
 				'ATT_fname' => $ATT_fname,
1223 1222
 				'ATT_lname' => $ATT_lname,
1224 1223
 				'ATT_email' => $ATT_email
@@ -1242,13 +1241,13 @@  discard block
 block discarded – undo
1242 1241
 	 * @return \EE_Attendee
1243 1242
 	 * @throws \EE_Error
1244 1243
 	 */
1245
-	private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) {
1244
+	private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) {
1246 1245
 		// first remove fname, lname, and email from attendee data
1247
-		$dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1246
+		$dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email');
1248 1247
 		// now loop thru what's left and add to attendee CPT
1249
-		foreach ( $attendee_data as $property_name => $property_value ) {
1250
-			if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) {
1251
-				$existing_attendee->set( $property_name, $property_value );
1248
+		foreach ($attendee_data as $property_name => $property_value) {
1249
+			if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) {
1250
+				$existing_attendee->set($property_name, $property_value);
1252 1251
 			}
1253 1252
 		}
1254 1253
 		// better save that now
@@ -1266,11 +1265,11 @@  discard block
 block discarded – undo
1266 1265
 	 * @return void
1267 1266
 	 * @throws \EE_Error
1268 1267
 	 */
1269
-	private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) {
1268
+	private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) {
1270 1269
 		// add relation to attendee
1271
-		$registration->_add_relation_to( $attendee, 'Attendee' );
1272
-		$registration->set_attendee_id( $attendee->ID() );
1273
-		$registration->update_cache_after_object_save( 'Attendee', $attendee );
1270
+		$registration->_add_relation_to($attendee, 'Attendee');
1271
+		$registration->set_attendee_id($attendee->ID());
1272
+		$registration->update_cache_after_object_save('Attendee', $attendee);
1274 1273
 	}
1275 1274
 
1276 1275
 
@@ -1282,10 +1281,10 @@  discard block
 block discarded – undo
1282 1281
 	 * @return void
1283 1282
 	 * @throws \EE_Error
1284 1283
 	 */
1285
-	private function _associate_registration_with_transaction( EE_Registration $registration ) {
1284
+	private function _associate_registration_with_transaction(EE_Registration $registration) {
1286 1285
 		// add relation to attendee
1287
-		$this->checkout->transaction->_add_relation_to( $registration, 'Registration' );
1288
-		$this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration );
1286
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
1287
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
1289 1288
 	}
1290 1289
 
1291 1290
 
@@ -1298,14 +1297,14 @@  discard block
 block discarded – undo
1298 1297
 	 * @return array
1299 1298
 	 * @throws \EE_Error
1300 1299
 	 */
1301
-	private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) {
1300
+	private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) {
1302 1301
 		// bare minimum critical details include first name, last name, email address
1303
-		$critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1302
+		$critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email');
1304 1303
 		// add address info to critical details?
1305
-		if ( apply_filters(
1304
+		if (apply_filters(
1306 1305
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details',
1307 1306
 			false
1308
-		) ) {
1307
+		)) {
1309 1308
 			$address_details = array(
1310 1309
 				'ATT_address',
1311 1310
 				'ATT_address2',
@@ -1315,13 +1314,13 @@  discard block
 block discarded – undo
1315 1314
 				'ATT_zip',
1316 1315
 				'ATT_phone'
1317 1316
 			);
1318
-			$critical_attendee_details = array_merge( $critical_attendee_details, $address_details );
1317
+			$critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1319 1318
 		}
1320
-		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1321
-			if ( ! isset( $attendee_data[ $critical_attendee_detail ] )
1322
-			     || empty( $attendee_data[ $critical_attendee_detail ] )
1319
+		foreach ($critical_attendee_details as $critical_attendee_detail) {
1320
+			if ( ! isset($attendee_data[$critical_attendee_detail])
1321
+			     || empty($attendee_data[$critical_attendee_detail])
1323 1322
 			) {
1324
-				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(
1323
+				$attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get(
1325 1324
 					$critical_attendee_detail
1326 1325
 				);
1327 1326
 			}
@@ -1339,11 +1338,11 @@  discard block
 block discarded – undo
1339 1338
 	 * @return \EE_Attendee
1340 1339
 	 * @throws \EE_Error
1341 1340
 	 */
1342
-	private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) {
1341
+	private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) {
1343 1342
 		// create new attendee object
1344
-		$new_attendee = EE_Attendee::new_instance( $attendee_data );
1343
+		$new_attendee = EE_Attendee::new_instance($attendee_data);
1345 1344
 		// set author to event creator
1346
-		$new_attendee->set( 'ATT_author', $registration->event()->wp_user() );
1345
+		$new_attendee->set('ATT_author', $registration->event()->wp_user());
1347 1346
 		$new_attendee->save();
1348 1347
 		return $new_attendee;
1349 1348
 	}
@@ -1360,7 +1359,7 @@  discard block
 block discarded – undo
1360 1359
 	 */
1361 1360
 	public function update_reg_step() {
1362 1361
 		// save everything
1363
-		if ( $this->process_reg_step() ) {
1362
+		if ($this->process_reg_step()) {
1364 1363
 			$this->checkout->redirect = true;
1365 1364
 			$this->checkout->redirect_url = add_query_arg(
1366 1365
 				array(
@@ -1369,7 +1368,7 @@  discard block
 block discarded – undo
1369 1368
 				),
1370 1369
 				$this->checkout->thank_you_page_url
1371 1370
 			);
1372
-			$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1371
+			$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1373 1372
 			return true;
1374 1373
 		}
1375 1374
 		return false;
Please login to merge, or discard this patch.
core/business/EE_Transaction_Processor.class.php 1 patch
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 
4 4
 /**
5 5
  * Class EE_Transaction_Processor
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 	 * @param array $registration_query_params
51 51
 	 *@return EE_Transaction_Processor instance
52 52
 	 */
53
-	public static function instance( $registration_query_params = array() ) {
53
+	public static function instance($registration_query_params = array()) {
54 54
 		// check if class object is instantiated
55
-		if ( ! self::$_instance instanceof EE_Transaction_Processor ) {
56
-			self::$_instance = new self( $registration_query_params );
55
+		if ( ! self::$_instance instanceof EE_Transaction_Processor) {
56
+			self::$_instance = new self($registration_query_params);
57 57
 		}
58 58
 		return self::$_instance;
59 59
 	}
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	/**
64 64
 	 * @param array $registration_query_params
65 65
 	 */
66
-	private function __construct( $registration_query_params = array() ) {
66
+	private function __construct($registration_query_params = array()) {
67 67
 		// make sure some query params are set for retrieving registrations
68
-		$this->_set_registration_query_params( $registration_query_params );
68
+		$this->_set_registration_query_params($registration_query_params);
69 69
 	}
70 70
 
71 71
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 	 * @access private
75 75
 	 * @param array $registration_query_params
76 76
 	 */
77
-	private function _set_registration_query_params( $registration_query_params ) {
78
-		$this->_registration_query_params = ! empty( $registration_query_params ) ? $registration_query_params : array( 'order_by' => array( 'REG_count' => 'ASC' ));
77
+	private function _set_registration_query_params($registration_query_params) {
78
+		$this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params : array('order_by' => array('REG_count' => 'ASC'));
79 79
 	}
80 80
 
81 81
 
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 		);
105 105
 		// send messages
106 106
 		/** @type EE_Registration_Processor $registration_processor */
107
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
107
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
108 108
 		$registration_processor->trigger_registration_update_notifications(
109 109
 			$transaction->primary_registration(),
110
-			array( 'manually_updated' 	=> true )
110
+			array('manually_updated' 	=> true)
111 111
 		);
112 112
 		do_action(
113 113
 			'AHEE__EE_Transaction_Processor__manually_update_registration_statuses',
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
 		$registration_query_params = array()
195 195
 	) {
196 196
 		// make sure some query params are set for retrieving registrations
197
-		$this->_set_registration_query_params( $registration_query_params );
197
+		$this->_set_registration_query_params($registration_query_params);
198 198
 		// get final reg step status
199 199
 		$finalized = $transaction->final_reg_step_completed();
200 200
 		// if the 'finalize_registration' step has been initiated (has a timestamp)
201 201
 		// but has not yet been fully completed (TRUE)
202
-		if ( is_int( $finalized ) && $finalized !== false && $finalized !== true ) {
203
-			$transaction->set_reg_step_completed( 'finalize_registration' );
202
+		if (is_int($finalized) && $finalized !== false && $finalized !== true) {
203
+			$transaction->set_reg_step_completed('finalize_registration');
204 204
 			$finalized = true;
205 205
 		}
206 206
 		$transaction->save();
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 
224 224
 		// send messages
225 225
 		/** @type EE_Registration_Processor $registration_processor */
226
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
226
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
227 227
 		$registration_processor->trigger_registration_update_notifications(
228 228
 			$transaction->primary_registration(),
229 229
 			$update_params
@@ -254,22 +254,22 @@  discard block
 block discarded – undo
254 254
 		$update_txn = true
255 255
 	) {
256 256
 		// these reg statuses should not be considered in any calculations involving monies owing
257
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
258
-		if ( in_array( $registration->status_ID(), $closed_reg_statuses ) ) {
257
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
258
+		if (in_array($registration->status_ID(), $closed_reg_statuses)) {
259 259
 			return false;
260 260
 		}
261 261
 		try {
262
-			$transaction = $this->get_transaction_for_registration( $registration );
262
+			$transaction = $this->get_transaction_for_registration($registration);
263 263
 			$ticket_line_item = $this->get_ticket_line_item_for_transaction_registration(
264 264
 				$transaction,
265 265
 				$registration
266 266
 			);
267 267
 			// un-cancel the ticket
268
-			$success = EEH_Line_Item::reinstate_canceled_ticket_line_item( $ticket_line_item );
269
-		} catch ( EE_Error $e ) {
268
+			$success = EEH_Line_Item::reinstate_canceled_ticket_line_item($ticket_line_item);
269
+		} catch (EE_Error $e) {
270 270
 			EE_Error::add_error(
271 271
 				sprintf(
272
-					__( 'The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', 'event_espresso' ),
272
+					__('The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', 'event_espresso'),
273 273
 					$registration->ID(),
274 274
 					'<br />',
275 275
 					$e->getMessage()
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			);
279 279
 			return false;
280 280
 		}
281
-		if ( $update_txn ) {
281
+		if ($update_txn) {
282 282
 			return $transaction->save() ? $success : false;
283 283
 		}
284 284
 		return $success;
@@ -302,18 +302,18 @@  discard block
 block discarded – undo
302 302
 		$update_txn = true
303 303
 	) {
304 304
 		// these reg statuses should not be considered in any calculations involving monies owing
305
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
306
-		if ( ! in_array( $registration->status_ID(), $closed_reg_statuses ) ) {
305
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
306
+		if ( ! in_array($registration->status_ID(), $closed_reg_statuses)) {
307 307
 			return false;
308 308
 		}
309 309
 		try {
310
-			$transaction = $this->get_transaction_for_registration( $registration );
311
-			$ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( $transaction, $registration );
312
-			EEH_Line_Item::cancel_ticket_line_item( $ticket_line_item );
313
-		} catch ( EE_Error $e ) {
310
+			$transaction = $this->get_transaction_for_registration($registration);
311
+			$ticket_line_item = $this->get_ticket_line_item_for_transaction_registration($transaction, $registration);
312
+			EEH_Line_Item::cancel_ticket_line_item($ticket_line_item);
313
+		} catch (EE_Error $e) {
314 314
 			EE_Error::add_error(
315 315
 				sprintf(
316
-					__( 'The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', 'event_espresso' ),
316
+					__('The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', 'event_espresso'),
317 317
 					$registration->ID(),
318 318
 					'<br />',
319 319
 					$e->getMessage()
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 			);
323 323
 			return false;
324 324
 		}
325
-		if ( $update_txn ) {
325
+		if ($update_txn) {
326 326
 			return $transaction->save() ? true : false;
327 327
 		}
328 328
 		return true;
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
 	 * @return 	EE_Transaction
339 339
 	 * @throws 	EE_Error
340 340
 	 */
341
-	public function get_transaction_for_registration( EE_Registration $registration ) {
341
+	public function get_transaction_for_registration(EE_Registration $registration) {
342 342
 		$transaction = $registration->transaction();
343
-		if ( ! $transaction instanceof EE_Transaction ) {
343
+		if ( ! $transaction instanceof EE_Transaction) {
344 344
 			throw new EE_Error(
345 345
 				sprintf(
346
-					__( 'The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso' ),
346
+					__('The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso'),
347 347
 					$registration->ID()
348 348
 				)
349 349
 			);
@@ -366,16 +366,16 @@  discard block
 block discarded – undo
366 366
 		EE_Transaction $transaction,
367 367
 		EE_Registration $registration
368 368
 	) {
369
-		EE_Registry::instance()->load_helper( 'Line_Item' );
369
+		EE_Registry::instance()->load_helper('Line_Item');
370 370
 		$ticket_line_item = EEM_Line_Item::instance()->get_ticket_line_item_for_transaction(
371 371
 			$transaction->ID(),
372 372
 			$registration->ticket_ID()
373 373
 		);
374
-		if ( ! $ticket_line_item instanceof EE_Line_Item ) {
374
+		if ( ! $ticket_line_item instanceof EE_Line_Item) {
375 375
 			throw new EE_Error(
376 376
 				sprintf(
377
-					__( 'The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.',
378
-						'event_espresso' ),
377
+					__('The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.',
378
+						'event_espresso'),
379 379
 					$transaction->ID(),
380 380
 					$registration->ticket_ID()
381 381
 				)
@@ -408,22 +408,22 @@  discard block
 block discarded – undo
408 408
 		$update_txn = true
409 409
 	) {
410 410
 		// make sure some query params are set for retrieving registrations
411
-		$this->_set_registration_query_params( $registration_query_params );
411
+		$this->_set_registration_query_params($registration_query_params);
412 412
 		// these reg statuses should not be considered in any calculations involving monies owing
413
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
413
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
414 414
 		// loop through cached registrations
415
-		foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) {
415
+		foreach ($transaction->registrations($this->_registration_query_params) as $registration) {
416 416
 			if (
417 417
 				$registration instanceof EE_Registration
418
-				&& ! in_array( $registration->status_ID(), $closed_reg_statuses )
418
+				&& ! in_array($registration->status_ID(), $closed_reg_statuses)
419 419
 			) {
420 420
 				return false;
421 421
 			}
422 422
 		}
423
-		if ( in_array( $new_TXN_status, EEM_Transaction::txn_status_array() ) ) {
424
-			$transaction->set_status( $new_TXN_status );
423
+		if (in_array($new_TXN_status, EEM_Transaction::txn_status_array())) {
424
+			$transaction->set_status($new_TXN_status);
425 425
 		}
426
-		if ( $update_txn ) {
426
+		if ($update_txn) {
427 427
 			return $transaction->save() ? true : false;
428 428
 		}
429 429
 		return true;
@@ -452,22 +452,22 @@  discard block
 block discarded – undo
452 452
 	) {
453 453
 		$response = false;
454 454
 		/** @type EE_Registration_Processor $registration_processor */
455
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
455
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
456 456
 		// check that method exists
457
-		if ( ! method_exists( $registration_processor, $method_name )) {
458
-			throw new EE_Error( __( 'Method does not exist.', 'event_espresso' ));
457
+		if ( ! method_exists($registration_processor, $method_name)) {
458
+			throw new EE_Error(__('Method does not exist.', 'event_espresso'));
459 459
 		}
460 460
 		// make sure some query params are set for retrieving registrations
461
-		$this->_set_registration_query_params( $registration_query_params );
461
+		$this->_set_registration_query_params($registration_query_params);
462 462
 		// loop through cached registrations
463
-		foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) {
464
-			if ( $registration instanceof EE_Registration ) {
465
-				if ( $additional_param ) {
466
-					$response = $registration_processor->{$method_name}( $registration, $additional_param )
463
+		foreach ($transaction->registrations($this->_registration_query_params) as $registration) {
464
+			if ($registration instanceof EE_Registration) {
465
+				if ($additional_param) {
466
+					$response = $registration_processor->{$method_name}($registration, $additional_param)
467 467
 						? true
468 468
 						: $response;
469 469
 				} else {
470
-					$response = $registration_processor->{$method_name}( $registration )
470
+					$response = $registration_processor->{$method_name}($registration)
471 471
 						? true
472 472
 						: $response;
473 473
 				}
@@ -494,28 +494,28 @@  discard block
 block discarded – undo
494 494
 	public function set_transaction_payment_method_based_on_registration_statuses(
495 495
 		EE_Registration $edited_registration
496 496
 	) {
497
-		if ( $edited_registration instanceof EE_Registration ) {
497
+		if ($edited_registration instanceof EE_Registration) {
498 498
 			$transaction = $edited_registration->transaction();
499
-			if ( $transaction instanceof EE_Transaction ) {
499
+			if ($transaction instanceof EE_Transaction) {
500 500
 				$all_not_approved = true;
501
-				foreach ( $transaction->registrations() as $registration ) {
502
-					if ( $registration instanceof EE_Registration ) {
501
+				foreach ($transaction->registrations() as $registration) {
502
+					if ($registration instanceof EE_Registration) {
503 503
 						// if any REG != "Not Approved" then toggle to false
504 504
 						$all_not_approved = $registration->is_not_approved() ? $all_not_approved : false;
505 505
 					}
506 506
 				}
507 507
 				// if ALL Registrations are "Not Approved"
508
-				if ( $all_not_approved ) {
509
-					$transaction->set_payment_method_ID( null );
508
+				if ($all_not_approved) {
509
+					$transaction->set_payment_method_ID(null);
510 510
 					$transaction->save();
511 511
 				} else {
512 512
 					$available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
513 513
 						$transaction,
514 514
 						EEM_Payment_Method::scope_cart
515 515
 					);
516
-					if ( ! empty( $available_payment_methods ) ) {
516
+					if ( ! empty($available_payment_methods)) {
517 517
 						$PMD_ID = 0;
518
-						foreach ( $available_payment_methods as $available_payment_method ) {
518
+						foreach ($available_payment_methods as $available_payment_method) {
519 519
 							if (
520 520
 								$available_payment_method instanceof EE_Payment_Method
521 521
 							    && $available_payment_method->open_by_default()
@@ -524,22 +524,22 @@  discard block
 block discarded – undo
524 524
 								break;
525 525
 							}
526 526
 						}
527
-						if ( ! $PMD_ID ) {
528
-							$first_payment_method = reset( $available_payment_methods );
529
-							if ( $first_payment_method instanceof EE_Payment_Method ) {
527
+						if ( ! $PMD_ID) {
528
+							$first_payment_method = reset($available_payment_methods);
529
+							if ($first_payment_method instanceof EE_Payment_Method) {
530 530
 								$PMD_ID = $first_payment_method->ID();
531 531
 							} else {
532 532
 								EE_Error::add_error(
533
-									__( 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso' ),
533
+									__('A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso'),
534 534
 									__FILE__, __LINE__, __FUNCTION__
535 535
 								);
536 536
 							}
537 537
 						}
538
-						$transaction->set_payment_method_ID( $PMD_ID );
538
+						$transaction->set_payment_method_ID($PMD_ID);
539 539
 						$transaction->save();
540 540
 					} else {
541 541
 						EE_Error::add_error(
542
-							__( 'Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso' ),
542
+							__('Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso'),
543 543
 							__FILE__, __LINE__, __FUNCTION__
544 544
 						);
545 545
 					}
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	 * @deprecated 4.9.12
577 577
 	 * @param string $old_txn_status
578 578
 	 */
579
-	public function set_old_txn_status( $old_txn_status ) {
579
+	public function set_old_txn_status($old_txn_status) {
580 580
 		EE_Error::doing_it_wrong(
581 581
 			__METHOD__,
582 582
 			esc_html__(
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 			'4.9.12'
587 587
 		);
588 588
 		// only set the first time
589
-		if ( $this->_old_txn_status === null ) {
589
+		if ($this->_old_txn_status === null) {
590 590
 			$this->_old_txn_status = $old_txn_status;
591 591
 		}
592 592
 	}
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 * @deprecated 4.9.12
616 616
 	 * @param string $new_txn_status
617 617
 	 */
618
-	public function set_new_txn_status( $new_txn_status ) {
618
+	public function set_new_txn_status($new_txn_status) {
619 619
 		EE_Error::doing_it_wrong(
620 620
 			__METHOD__,
621 621
 			esc_html__(
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 	 * @param EE_Transaction $transaction
660 660
 	 * @return boolean
661 661
 	 */
662
-	public function all_reg_steps_completed( EE_Transaction $transaction ) {
662
+	public function all_reg_steps_completed(EE_Transaction $transaction) {
663 663
 		EE_Error::doing_it_wrong(
664 664
 			__METHOD__,
665 665
 			esc_html__(
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 	 * @param string         $exception
687 687
 	 * @return boolean
688 688
 	 */
689
-	public function all_reg_steps_completed_except( EE_Transaction $transaction, $exception = '' ) {
689
+	public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') {
690 690
 		EE_Error::doing_it_wrong(
691 691
 			__METHOD__,
692 692
 			esc_html__(
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 			'4.9.12',
697 697
 			'5.0.0'
698 698
 		);
699
-		return $transaction->all_reg_steps_completed_except( $exception );
699
+		return $transaction->all_reg_steps_completed_except($exception);
700 700
 	}
701 701
 
702 702
 
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 	 * @param EE_Transaction $transaction
713 713
 	 * @return boolean
714 714
 	 */
715
-	public function all_reg_steps_completed_except_final_step( EE_Transaction $transaction ) {
715
+	public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) {
716 716
 		EE_Error::doing_it_wrong(
717 717
 			__METHOD__,
718 718
 			esc_html__(
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 	 * @param string         $reg_step_slug
740 740
 	 * @return boolean | int
741 741
 	 */
742
-	public function reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) {
742
+	public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) {
743 743
 		EE_Error::doing_it_wrong(
744 744
 			__METHOD__,
745 745
 			esc_html__(
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 			'4.9.12',
750 750
 			'5.0.0'
751 751
 		);
752
-		return $transaction->reg_step_completed( $reg_step_slug );
752
+		return $transaction->reg_step_completed($reg_step_slug);
753 753
 	}
754 754
 
755 755
 
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 	 * @param EE_Transaction $transaction
766 766
 	 * @return boolean | int
767 767
 	 */
768
-	public function final_reg_step_completed( EE_Transaction $transaction ) {
768
+	public function final_reg_step_completed(EE_Transaction $transaction) {
769 769
 		EE_Error::doing_it_wrong(
770 770
 			__METHOD__,
771 771
 			esc_html__(
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	 * @return boolean
792 792
 	 * @throws \EE_Error
793 793
 	 */
794
-	public function set_reg_step_initiated( EE_Transaction $transaction, $reg_step_slug ) {
794
+	public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) {
795 795
 		EE_Error::doing_it_wrong(
796 796
 			__METHOD__,
797 797
 			esc_html__(
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 			'4.9.12',
802 802
 			'5.0.0'
803 803
 		);
804
-		return $transaction->set_reg_step_initiated( $reg_step_slug );
804
+		return $transaction->set_reg_step_initiated($reg_step_slug);
805 805
 	}
806 806
 
807 807
 
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 	 * @return boolean
818 818
 	 * @throws \EE_Error
819 819
 	 */
820
-	public function set_reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) {
820
+	public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) {
821 821
 		EE_Error::doing_it_wrong(
822 822
 			__METHOD__,
823 823
 			esc_html__(
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 			'4.9.12',
828 828
 			'5.0.0'
829 829
 		);
830
-		return $transaction->set_reg_step_completed( $reg_step_slug );
830
+		return $transaction->set_reg_step_completed($reg_step_slug);
831 831
 	}
832 832
 
833 833
 
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 	 * @return boolean
844 844
 	 * @throws \EE_Error
845 845
 	 */
846
-	public function set_reg_step_not_completed( EE_Transaction $transaction, $reg_step_slug ) {
846
+	public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) {
847 847
 		EE_Error::doing_it_wrong(
848 848
 			__METHOD__,
849 849
 			esc_html__(
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 			'4.9.12',
854 854
 			'5.0.0'
855 855
 		);
856
-		return $transaction->set_reg_step_not_completed( $reg_step_slug );
856
+		return $transaction->set_reg_step_not_completed($reg_step_slug);
857 857
 	}
858 858
 
859 859
 
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 	 * @param string          $reg_step_slug
871 871
 	 * @return void
872 872
 	 */
873
-	public function remove_reg_step( EE_Transaction $transaction, $reg_step_slug ) {
873
+	public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) {
874 874
 		EE_Error::doing_it_wrong(
875 875
 			__METHOD__,
876 876
 			esc_html__(
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 			'4.9.12',
881 881
 			'5.0.0'
882 882
 		);
883
-		$transaction->remove_reg_step( $reg_step_slug );
883
+		$transaction->remove_reg_step($reg_step_slug);
884 884
 	}
885 885
 
886 886
 
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 	 * @return    boolean
897 897
 	 * @throws \EE_Error
898 898
 	 */
899
-	public function toggle_failed_transaction_status( EE_Transaction $transaction ) {
899
+	public function toggle_failed_transaction_status(EE_Transaction $transaction) {
900 900
 		EE_Error::doing_it_wrong(
901 901
 			__METHOD__,
902 902
 			esc_html__(
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 	 * @param  EE_Transaction $transaction
921 921
 	 * @return boolean
922 922
 	 */
923
-	public function toggle_abandoned_transaction_status( EE_Transaction $transaction ) {
923
+	public function toggle_abandoned_transaction_status(EE_Transaction $transaction) {
924 924
 		EE_Error::doing_it_wrong(
925 925
 			__METHOD__,
926 926
 			esc_html__(
Please login to merge, or discard this patch.
core/db_classes/EE_Transaction.class.php 1 patch
Spacing   +157 added lines, -157 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_Transaction class
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 	 * @return EE_Transaction
35 35
 	 * @throws \EE_Error
36 36
 	 */
37
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
38
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
37
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
38
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
39 39
 		$txn = $has_object
40 40
 			? $has_object
41
-			: new self( $props_n_values, false, $timezone, $date_formats );
42
-		if ( ! $has_object ) {
43
-			$txn->set_old_txn_status( $txn->status_ID() );
41
+			: new self($props_n_values, false, $timezone, $date_formats);
42
+		if ( ! $has_object) {
43
+			$txn->set_old_txn_status($txn->status_ID());
44 44
 		}
45 45
 		return $txn;
46 46
 	}
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 * @return EE_Transaction
55 55
 	 * @throws \EE_Error
56 56
 	 */
57
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
58
-		$txn = new self( $props_n_values, TRUE, $timezone );
59
-		$txn->set_old_txn_status( $txn->status_ID() );
57
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
58
+		$txn = new self($props_n_values, TRUE, $timezone);
59
+		$txn->set_old_txn_status($txn->status_ID());
60 60
 		return $txn;
61 61
 	}
62 62
 
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function lock() {
75 75
 		// attempt to set lock, but if that fails...
76
-		if ( ! $this->add_extra_meta( 'lock', time(), true )  ) {
76
+		if ( ! $this->add_extra_meta('lock', time(), true)) {
77 77
 			// then attempt to remove the lock in case it is expired
78
-			if ( $this->_remove_expired_lock() ) {
78
+			if ($this->_remove_expired_lock()) {
79 79
 				// if removal was successful, then try setting lock again
80 80
 				$this->lock();
81 81
 			} else {
82 82
 				// but if the lock can not be removed, then throw an exception
83 83
 				throw new EE_Error(
84 84
 					sprintf(
85
-						__( 'Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso' ),
85
+						__('Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso'),
86 86
 						$this->ID()
87 87
 					)
88 88
 				);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @throws \EE_Error
102 102
 	 */
103 103
 	public function unlock() {
104
-		return $this->delete_extra_meta( 'lock' );
104
+		return $this->delete_extra_meta('lock');
105 105
 	}
106 106
 
107 107
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function is_locked() {
124 124
 		// if TXN is not locked, then return false immediately
125
-		if ( ! $this->_get_lock() ) {
125
+		if ( ! $this->_get_lock()) {
126 126
 			return false;
127 127
 		}
128 128
 		// if not, then let's try and remove the lock in case it's expired...
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @throws \EE_Error
144 144
 	 */
145 145
 	protected function _get_lock() {
146
-		return (int)$this->get_extra_meta( 'lock', true, 0 );
146
+		return (int) $this->get_extra_meta('lock', true, 0);
147 147
 	}
148 148
 
149 149
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	protected function _remove_expired_lock() {
160 160
 		$locked = $this->_get_lock();
161
-		if ( $locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked ) {
161
+		if ($locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked) {
162 162
 			return $this->unlock();
163 163
 		}
164 164
 		return 0;
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @param        float $total total value of transaction
174 174
 	 * @throws \EE_Error
175 175
 	 */
176
-	public function set_total( $total = 0.00 ) {
177
-		$this->set( 'TXN_total', (float)$total );
176
+	public function set_total($total = 0.00) {
177
+		$this->set('TXN_total', (float) $total);
178 178
 	}
179 179
 
180 180
 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 * @param        float $total_paid total amount paid to date (sum of all payments)
187 187
 	 * @throws \EE_Error
188 188
 	 */
189
-	public function set_paid( $total_paid = 0.00 ) {
190
-		$this->set( 'TXN_paid', (float)$total_paid );
189
+	public function set_paid($total_paid = 0.00) {
190
+		$this->set('TXN_paid', (float) $total_paid);
191 191
 	}
192 192
 
193 193
 
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
 	 * @param        string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set
200 200
 	 * @throws \EE_Error
201 201
 	 */
202
-	public function set_status( $status = '' ) {
203
-		$this->set( 'STS_ID', $status );
202
+	public function set_status($status = '') {
203
+		$this->set('STS_ID', $status);
204 204
 	}
205 205
 
206 206
 
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
 	 * @param        string $hash_salt required for some payment gateways
213 213
 	 * @throws \EE_Error
214 214
 	 */
215
-	public function set_hash_salt( $hash_salt = '' ) {
216
-		$this->set( 'TXN_hash_salt', $hash_salt );
215
+	public function set_hash_salt($hash_salt = '') {
216
+		$this->set('TXN_hash_salt', $hash_salt);
217 217
 	}
218 218
 
219 219
 
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 	 * @param array $txn_reg_steps
225 225
 	 * @throws \EE_Error
226 226
 	 */
227
-	public function set_reg_steps( array $txn_reg_steps ) {
228
-		$this->set( 'TXN_reg_steps', $txn_reg_steps );
227
+	public function set_reg_steps(array $txn_reg_steps) {
228
+		$this->set('TXN_reg_steps', $txn_reg_steps);
229 229
 	}
230 230
 
231 231
 
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 * @throws \EE_Error
238 238
 	 */
239 239
 	public function reg_steps() {
240
-		$TXN_reg_steps = $this->get( 'TXN_reg_steps' );
241
-		return is_array( $TXN_reg_steps ) ? (array)$TXN_reg_steps : array();
240
+		$TXN_reg_steps = $this->get('TXN_reg_steps');
241
+		return is_array($TXN_reg_steps) ? (array) $TXN_reg_steps : array();
242 242
 	}
243 243
 
244 244
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 * @throws \EE_Error
249 249
 	 */
250 250
 	public function pretty_total() {
251
-		return $this->get_pretty( 'TXN_total' );
251
+		return $this->get_pretty('TXN_total');
252 252
 	}
253 253
 
254 254
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * @throws \EE_Error
261 261
 	 */
262 262
 	public function pretty_paid() {
263
-		return $this->get_pretty( 'TXN_paid' );
263
+		return $this->get_pretty('TXN_paid');
264 264
 	}
265 265
 
266 266
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @throws \EE_Error
274 274
 	 */
275 275
 	public function remaining() {
276
-		return (float)( $this->total() - $this->paid() );
276
+		return (float) ($this->total() - $this->paid());
277 277
 	}
278 278
 
279 279
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 * @throws \EE_Error
287 287
 	 */
288 288
 	public function total() {
289
-		return (float)$this->get( 'TXN_total' );
289
+		return (float) $this->get('TXN_total');
290 290
 	}
291 291
 
292 292
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @throws \EE_Error
300 300
 	 */
301 301
 	public function paid() {
302
-		return (float)$this->get( 'TXN_paid' );
302
+		return (float) $this->get('TXN_paid');
303 303
 	}
304 304
 
305 305
 
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 	 * @throws \EE_Error
312 312
 	 */
313 313
 	public function get_cart_session() {
314
-		$session_data = (array)$this->get( 'TXN_session_data' );
315
-		return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart
316
-			? $session_data[ 'cart' ]
314
+		$session_data = (array) $this->get('TXN_session_data');
315
+		return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart
316
+			? $session_data['cart']
317 317
 			: null;
318 318
 	}
319 319
 
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 	 * @throws \EE_Error
327 327
 	 */
328 328
 	public function session_data() {
329
-		$session_data = $this->get( 'TXN_session_data' );
330
-		if ( empty( $session_data ) ) {
329
+		$session_data = $this->get('TXN_session_data');
330
+		if (empty($session_data)) {
331 331
 			$session_data = array(
332 332
 				'id'            => null,
333 333
 				'user_id'       => null,
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
 	 * @param        EE_Session|array $session_data
351 351
 	 * @throws \EE_Error
352 352
 	 */
353
-	public function set_txn_session_data( $session_data ) {
354
-		if ( $session_data instanceof EE_Session ) {
355
-			$this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE ));
353
+	public function set_txn_session_data($session_data) {
354
+		if ($session_data instanceof EE_Session) {
355
+			$this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE));
356 356
 		} else {
357
-			$this->set( 'TXN_session_data', $session_data );
357
+			$this->set('TXN_session_data', $session_data);
358 358
 		}
359 359
 	}
360 360
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	 * @throws \EE_Error
368 368
 	 */
369 369
 	public function hash_salt_() {
370
-		return $this->get( 'TXN_hash_salt' );
370
+		return $this->get('TXN_hash_salt');
371 371
 	}
372 372
 
373 373
 
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
 	 * @return    string | int
388 388
 	 * @throws \EE_Error
389 389
 	 */
390
-	public function datetime( $format = FALSE, $gmt = FALSE ) {
391
-		if ( $format ) {
392
-			return $this->get_pretty( 'TXN_timestamp' );
393
-		} else if ( $gmt ) {
394
-			return $this->get_raw( 'TXN_timestamp' );
390
+	public function datetime($format = FALSE, $gmt = FALSE) {
391
+		if ($format) {
392
+			return $this->get_pretty('TXN_timestamp');
393
+		} else if ($gmt) {
394
+			return $this->get_raw('TXN_timestamp');
395 395
 		} else {
396
-			return $this->get( 'TXN_timestamp' );
396
+			return $this->get('TXN_timestamp');
397 397
 		}
398 398
 	}
399 399
 
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
 	 * @return EE_Registration[]
408 408
 	 * @throws \EE_Error
409 409
 	 */
410
-	public function registrations( $query_params = array(), $get_cached = FALSE ) {
411
-		$query_params = ( empty( $query_params ) || ! is_array( $query_params ) )
410
+	public function registrations($query_params = array(), $get_cached = FALSE) {
411
+		$query_params = (empty($query_params) || ! is_array($query_params))
412 412
 			? array(
413 413
 				'order_by' => array(
414 414
 					'Event.EVT_name' => 'ASC',
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 			)
419 419
 			: $query_params;
420 420
 		$query_params = $get_cached ? array() : $query_params;
421
-		return $this->get_many_related( 'Registration', $query_params );
421
+		return $this->get_many_related('Registration', $query_params);
422 422
 	}
423 423
 
424 424
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	 * @throws \EE_Error
432 432
 	 */
433 433
 	public function attendees() {
434
-		return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) );
434
+		return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID())));
435 435
 	}
436 436
 
437 437
 
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
 	 * @return EE_Payment[]
444 444
 	 * @throws \EE_Error
445 445
 	 */
446
-	public function payments( $query_params = array() ) {
447
-		return $this->get_many_related( 'Payment', $query_params );
446
+	public function payments($query_params = array()) {
447
+		return $this->get_many_related('Payment', $query_params);
448 448
 	}
449 449
 
450 450
 
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
 	 * @throws \EE_Error
457 457
 	 */
458 458
 	public function approved_payments() {
459
-		EE_Registry::instance()->load_model( 'Payment' );
460
-		return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) );
459
+		EE_Registry::instance()->load_model('Payment');
460
+		return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC')));
461 461
 	}
462 462
 
463 463
 
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
 	 * @return string
470 470
 	 * @throws \EE_Error
471 471
 	 */
472
-	public function e_pretty_status( $show_icons = FALSE ) {
473
-		echo $this->pretty_status( $show_icons );
472
+	public function e_pretty_status($show_icons = FALSE) {
473
+		echo $this->pretty_status($show_icons);
474 474
 	}
475 475
 
476 476
 
@@ -482,10 +482,10 @@  discard block
 block discarded – undo
482 482
 	 * @return string
483 483
 	 * @throws \EE_Error
484 484
 	 */
485
-	public function pretty_status( $show_icons = FALSE ) {
486
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
485
+	public function pretty_status($show_icons = FALSE) {
486
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
487 487
 		$icon = '';
488
-		switch ( $this->status_ID() ) {
488
+		switch ($this->status_ID()) {
489 489
 			case EEM_Transaction::complete_status_code:
490 490
 				$icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : '';
491 491
 				break;
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 				$icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : '';
503 503
 				break;
504 504
 		}
505
-		return $icon . $status[ $this->status_ID() ];
505
+		return $icon.$status[$this->status_ID()];
506 506
 	}
507 507
 
508 508
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 	 * @throws \EE_Error
515 515
 	 */
516 516
 	public function status_ID() {
517
-		return $this->get( 'STS_ID' );
517
+		return $this->get('STS_ID');
518 518
 	}
519 519
 
520 520
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 * @throws \EE_Error
527 527
 	 */
528 528
 	public function is_free() {
529
-		return EEH_Money::compare_floats( $this->get( 'TXN_total' ), 0, '==' );
529
+		return EEH_Money::compare_floats($this->get('TXN_total'), 0, '==');
530 530
 	}
531 531
 
532 532
 
@@ -606,12 +606,12 @@  discard block
 block discarded – undo
606 606
 	 * @return string
607 607
 	 * @throws \EE_Error
608 608
 	 */
609
-	public function invoice_url( $type = 'html' ) {
609
+	public function invoice_url($type = 'html') {
610 610
 		$REG = $this->primary_registration();
611
-		if ( ! $REG instanceof EE_Registration ) {
611
+		if ( ! $REG instanceof EE_Registration) {
612 612
 			return '';
613 613
 		}
614
-		return $REG->invoice_url( $type );
614
+		return $REG->invoice_url($type);
615 615
 	}
616 616
 
617 617
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 	 * @throws \EE_Error
624 624
 	 */
625 625
 	public function primary_registration() {
626
-		return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) );
626
+		return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
627 627
 	}
628 628
 
629 629
 
@@ -635,12 +635,12 @@  discard block
 block discarded – undo
635 635
 	 * @return string
636 636
 	 * @throws \EE_Error
637 637
 	 */
638
-	public function receipt_url( $type = 'html' ) {
638
+	public function receipt_url($type = 'html') {
639 639
 		$REG = $this->primary_registration();
640
-		if ( ! $REG instanceof EE_Registration ) {
640
+		if ( ! $REG instanceof EE_Registration) {
641 641
 			return '';
642 642
 		}
643
-		return $REG->receipt_url( $type );
643
+		return $REG->receipt_url($type);
644 644
 	}
645 645
 
646 646
 
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 	 * @throws \EE_Error
666 666
 	 */
667 667
 	public function gateway_response_on_transaction() {
668
-		$payment = $this->get_first_related( 'Payment' );
668
+		$payment = $this->get_first_related('Payment');
669 669
 		return $payment instanceof EE_Payment ? $payment->gateway_response() : '';
670 670
 	}
671 671
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 	 * @throws \EE_Error
679 679
 	 */
680 680
 	public function status_obj() {
681
-		return $this->get_first_related( 'Status' );
681
+		return $this->get_first_related('Status');
682 682
 	}
683 683
 
684 684
 
@@ -690,8 +690,8 @@  discard block
 block discarded – undo
690 690
 	 * @return EE_Extra_Meta
691 691
 	 * @throws \EE_Error
692 692
 	 */
693
-	public function extra_meta( $query_params = array() ) {
694
-		return $this->get_many_related( 'Extra_Meta', $query_params );
693
+	public function extra_meta($query_params = array()) {
694
+		return $this->get_many_related('Extra_Meta', $query_params);
695 695
 	}
696 696
 
697 697
 
@@ -703,8 +703,8 @@  discard block
 block discarded – undo
703 703
 	 * @return EE_Base_Class the relation was added to
704 704
 	 * @throws \EE_Error
705 705
 	 */
706
-	public function add_registration( EE_Registration $registration ) {
707
-		return $this->_add_relation_to( $registration, 'Registration' );
706
+	public function add_registration(EE_Registration $registration) {
707
+		return $this->_add_relation_to($registration, 'Registration');
708 708
 	}
709 709
 
710 710
 
@@ -717,8 +717,8 @@  discard block
 block discarded – undo
717 717
 	 * @return EE_Base_Class that was removed from being related
718 718
 	 * @throws \EE_Error
719 719
 	 */
720
-	public function remove_registration_with_id( $registration_or_id ) {
721
-		return $this->_remove_relation_to( $registration_or_id, 'Registration' );
720
+	public function remove_registration_with_id($registration_or_id) {
721
+		return $this->_remove_relation_to($registration_or_id, 'Registration');
722 722
 	}
723 723
 
724 724
 
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 	 * @throws \EE_Error
731 731
 	 */
732 732
 	public function items_purchased() {
733
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) );
733
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item)));
734 734
 	}
735 735
 
736 736
 
@@ -742,8 +742,8 @@  discard block
 block discarded – undo
742 742
 	 * @return EE_Base_Class the relation was added to
743 743
 	 * @throws \EE_Error
744 744
 	 */
745
-	public function add_line_item( EE_Line_Item $line_item ) {
746
-		return $this->_add_relation_to( $line_item, 'Line_Item' );
745
+	public function add_line_item(EE_Line_Item $line_item) {
746
+		return $this->_add_relation_to($line_item, 'Line_Item');
747 747
 	}
748 748
 
749 749
 
@@ -755,8 +755,8 @@  discard block
 block discarded – undo
755 755
 	 * @return EE_Line_Item[]
756 756
 	 * @throws \EE_Error
757 757
 	 */
758
-	public function line_items( $query_params = array() ) {
759
-		return $this->get_many_related( 'Line_Item', $query_params );
758
+	public function line_items($query_params = array()) {
759
+		return $this->get_many_related('Line_Item', $query_params);
760 760
 	}
761 761
 
762 762
 
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 	 * @throws \EE_Error
769 769
 	 */
770 770
 	public function tax_items() {
771
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) );
771
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax)));
772 772
 	}
773 773
 
774 774
 
@@ -781,10 +781,10 @@  discard block
 block discarded – undo
781 781
 	 * @return \EE_Line_Item
782 782
 	 * @throws \EE_Error
783 783
 	 */
784
-	public function total_line_item( $create_if_not_found = true ) {
785
-		$item =  $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) );
786
-		if( ! $item && $create_if_not_found ){
787
-			$item = EEH_Line_Item::create_total_line_item( $this );
784
+	public function total_line_item($create_if_not_found = true) {
785
+		$item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total)));
786
+		if ( ! $item && $create_if_not_found) {
787
+			$item = EEH_Line_Item::create_total_line_item($this);
788 788
 		}
789 789
 		return $item;
790 790
 	}
@@ -800,10 +800,10 @@  discard block
 block discarded – undo
800 800
 	 */
801 801
 	public function tax_total() {
802 802
 		$tax_line_item = $this->tax_total_line_item();
803
-		if ( $tax_line_item ) {
804
-			return (float)$tax_line_item->total();
803
+		if ($tax_line_item) {
804
+			return (float) $tax_line_item->total();
805 805
 		} else {
806
-			return (float)0;
806
+			return (float) 0;
807 807
 		}
808 808
 	}
809 809
 
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 	 * @throws \EE_Error
817 817
 	 */
818 818
 	public function tax_total_line_item() {
819
-		return EEH_Line_Item::get_taxes_subtotal( $this->total_line_item() );
819
+		return EEH_Line_Item::get_taxes_subtotal($this->total_line_item());
820 820
 	}
821 821
 
822 822
 
@@ -827,20 +827,20 @@  discard block
 block discarded – undo
827 827
 	 * @return EE_Form_Section_Proper
828 828
 	 * @throws \EE_Error
829 829
 	 */
830
-	public function billing_info(){
830
+	public function billing_info() {
831 831
 		$payment_method = $this->payment_method();
832
-		if ( !$payment_method){
832
+		if ( ! $payment_method) {
833 833
 			EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
834 834
 			return false;
835 835
 		}
836 836
 		$primary_reg = $this->primary_registration();
837
-		if ( ! $primary_reg ) {
838
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
837
+		if ( ! $primary_reg) {
838
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
839 839
 			return FALSE;
840 840
 		}
841 841
 		$attendee = $primary_reg->attendee();
842
-		if ( ! $attendee ) {
843
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
842
+		if ( ! $attendee) {
843
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
844 844
 			return FALSE;
845 845
 		}
846 846
 		return $attendee->billing_info_for_payment_method($payment_method);
@@ -881,15 +881,15 @@  discard block
 block discarded – undo
881 881
 	 * @return EE_Payment_Method
882 882
 	 * @throws \EE_Error
883 883
 	 */
884
-	public function payment_method(){
884
+	public function payment_method() {
885 885
 		$pm = $this->get_first_related('Payment_Method');
886
-		if( $pm instanceof EE_Payment_Method ){
886
+		if ($pm instanceof EE_Payment_Method) {
887 887
 			return $pm;
888
-		}else{
888
+		} else {
889 889
 			$last_payment = $this->last_payment();
890
-			if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){
890
+			if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) {
891 891
 				return $last_payment->payment_method();
892
-			}else{
892
+			} else {
893 893
 				return NULL;
894 894
 			}
895 895
 		}
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 	 * @throws \EE_Error
905 905
 	 */
906 906
 	public function last_payment() {
907
-		return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) );
907
+		return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc')));
908 908
 	}
909 909
 
910 910
 
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
 	 * @return EE_Line_Item[]
916 916
 	 * @throws \EE_Error
917 917
 	 */
918
-	public function non_ticket_line_items(){
919
-		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() );
918
+	public function non_ticket_line_items() {
919
+		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID());
920 920
 	}
921 921
 
922 922
 
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 	public function update_based_on_payments()
965 965
 	{
966 966
 		EE_Error::doing_it_wrong(
967
-			__CLASS__ . '::' . __FUNCTION__,
967
+			__CLASS__.'::'.__FUNCTION__,
968 968
 			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
969 969
 				'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
970 970
 			'4.6.0'
@@ -988,9 +988,9 @@  discard block
 block discarded – undo
988 988
 	/**
989 989
 	 * @param string $old_txn_status
990 990
 	 */
991
-	public function set_old_txn_status( $old_txn_status ) {
991
+	public function set_old_txn_status($old_txn_status) {
992 992
 		// only set the first time
993
-		if ( $this->_old_txn_status === null ) {
993
+		if ($this->_old_txn_status === null) {
994 994
 			$this->_old_txn_status = $old_txn_status;
995 995
 		}
996 996
 	}
@@ -1019,17 +1019,17 @@  discard block
 block discarded – undo
1019 1019
 	 * @param bool           $check_all
1020 1020
 	 * @return boolean | int
1021 1021
 	 */
1022
-	private function _reg_steps_completed( $reg_step_slug = '', $check_all = true ) {
1022
+	private function _reg_steps_completed($reg_step_slug = '', $check_all = true) {
1023 1023
 		$reg_steps = $this->reg_steps();
1024
-		if ( ! is_array( $reg_steps ) || empty( $reg_steps ) ) {
1024
+		if ( ! is_array($reg_steps) || empty($reg_steps)) {
1025 1025
 			return false;
1026 1026
 		}
1027 1027
 		// loop thru reg steps array)
1028
-		foreach ( $reg_steps as $slug => $reg_step_completed ) {
1028
+		foreach ($reg_steps as $slug => $reg_step_completed) {
1029 1029
 			// if NOT checking ALL steps (only checking one step)
1030
-			if ( ! $check_all ) {
1030
+			if ( ! $check_all) {
1031 1031
 				// and this is the one
1032
-				if ( $slug === $reg_step_slug ) {
1032
+				if ($slug === $reg_step_slug) {
1033 1033
 					return $reg_step_completed;
1034 1034
 				} else {
1035 1035
 					// skip to next reg step in loop
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 				}
1038 1038
 			}
1039 1039
 			// $check_all must be true, else we would never have gotten to this point
1040
-			if ( $slug === $reg_step_slug ) {
1040
+			if ($slug === $reg_step_slug) {
1041 1041
 				// if we reach this point, then we are testing either:
1042 1042
 				// all_reg_steps_completed_except() or
1043 1043
 				// all_reg_steps_completed_except_final_step(),
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 				// ie: "is everything completed except the final step?"
1047 1047
 				// "that is correct... the final step is not completed, but all others are."
1048 1048
 				return $reg_step_completed !== true ? true : false;
1049
-			} else if ( $reg_step_completed !== true ) {
1049
+			} else if ($reg_step_completed !== true) {
1050 1050
 				// if any reg step is NOT completed, then ALL steps are not completed
1051 1051
 				return false;
1052 1052
 			}
@@ -1080,8 +1080,8 @@  discard block
 block discarded – undo
1080 1080
 	 * @param string         $exception
1081 1081
 	 * @return boolean
1082 1082
 	 */
1083
-	public function all_reg_steps_completed_except( $exception = '' ) {
1084
-		return $this->_reg_steps_completed( $exception );
1083
+	public function all_reg_steps_completed_except($exception = '') {
1084
+		return $this->_reg_steps_completed($exception);
1085 1085
 	}
1086 1086
 
1087 1087
 
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 	 * @return boolean
1097 1097
 	 */
1098 1098
 	public function all_reg_steps_completed_except_final_step() {
1099
-		return $this->_reg_steps_completed( 'finalize_registration' );
1099
+		return $this->_reg_steps_completed('finalize_registration');
1100 1100
 	}
1101 1101
 
1102 1102
 
@@ -1111,8 +1111,8 @@  discard block
 block discarded – undo
1111 1111
 	 * @param string         $reg_step_slug
1112 1112
 	 * @return boolean | int
1113 1113
 	 */
1114
-	public function reg_step_completed( $reg_step_slug ) {
1115
-		return $this->_reg_steps_completed( $reg_step_slug, false );
1114
+	public function reg_step_completed($reg_step_slug) {
1115
+		return $this->_reg_steps_completed($reg_step_slug, false);
1116 1116
 	}
1117 1117
 
1118 1118
 
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 	 * @return boolean | int
1128 1128
 	 */
1129 1129
 	public function final_reg_step_completed() {
1130
-		return $this->_reg_steps_completed( 'finalize_registration', false );
1130
+		return $this->_reg_steps_completed('finalize_registration', false);
1131 1131
 	}
1132 1132
 
1133 1133
 
@@ -1141,8 +1141,8 @@  discard block
 block discarded – undo
1141 1141
 	 * @return boolean
1142 1142
 	 * @throws \EE_Error
1143 1143
 	 */
1144
-	public function set_reg_step_initiated( $reg_step_slug ) {
1145
-		return $this->_set_reg_step_completed_status( $reg_step_slug, time() );
1144
+	public function set_reg_step_initiated($reg_step_slug) {
1145
+		return $this->_set_reg_step_completed_status($reg_step_slug, time());
1146 1146
 	}
1147 1147
 
1148 1148
 
@@ -1156,8 +1156,8 @@  discard block
 block discarded – undo
1156 1156
 	 * @return boolean
1157 1157
 	 * @throws \EE_Error
1158 1158
 	 */
1159
-	public function set_reg_step_completed( $reg_step_slug ) {
1160
-		return $this->_set_reg_step_completed_status( $reg_step_slug, true );
1159
+	public function set_reg_step_completed($reg_step_slug) {
1160
+		return $this->_set_reg_step_completed_status($reg_step_slug, true);
1161 1161
 	}
1162 1162
 
1163 1163
 
@@ -1171,8 +1171,8 @@  discard block
 block discarded – undo
1171 1171
 	 * @return boolean
1172 1172
 	 * @throws \EE_Error
1173 1173
 	 */
1174
-	public function set_reg_step_not_completed( $reg_step_slug ) {
1175
-		return $this->_set_reg_step_completed_status( $reg_step_slug, false );
1174
+	public function set_reg_step_not_completed($reg_step_slug) {
1175
+		return $this->_set_reg_step_completed_status($reg_step_slug, false);
1176 1176
 	}
1177 1177
 
1178 1178
 
@@ -1187,37 +1187,37 @@  discard block
 block discarded – undo
1187 1187
 	 * @return boolean
1188 1188
 	 * @throws \EE_Error
1189 1189
 	 */
1190
-	private function _set_reg_step_completed_status( $reg_step_slug, $status ) {
1190
+	private function _set_reg_step_completed_status($reg_step_slug, $status) {
1191 1191
 		// validate status
1192
-		$status = is_bool( $status ) || is_int( $status ) ? $status : false;
1192
+		$status = is_bool($status) || is_int($status) ? $status : false;
1193 1193
 		// get reg steps array
1194 1194
 		$txn_reg_steps = $this->reg_steps();
1195 1195
 		// if reg step does NOT exist
1196
-		if ( ! isset( $txn_reg_steps[ $reg_step_slug ] ) ) {
1196
+		if ( ! isset($txn_reg_steps[$reg_step_slug])) {
1197 1197
 			return false;
1198 1198
 		}
1199 1199
 		// if  we're trying to complete a step that is already completed
1200
-		if ( $txn_reg_steps[ $reg_step_slug ] === true ) {
1200
+		if ($txn_reg_steps[$reg_step_slug] === true) {
1201 1201
 			return true;
1202 1202
 		}
1203 1203
 		// if  we're trying to complete a step that hasn't even started
1204
-		if ( $status === true && $txn_reg_steps[ $reg_step_slug ] === false ) {
1204
+		if ($status === true && $txn_reg_steps[$reg_step_slug] === false) {
1205 1205
 			return false;
1206 1206
 		}
1207 1207
 		// if current status value matches the incoming value (no change)
1208 1208
 		// type casting as int means values should collapse to either 0, 1, or a timestamp like 1234567890
1209
-		if ( (int) $txn_reg_steps[ $reg_step_slug ] === (int) $status ) {
1209
+		if ((int) $txn_reg_steps[$reg_step_slug] === (int) $status) {
1210 1210
 			// this will happen in cases where multiple AJAX requests occur during the same step
1211 1211
 			return true;
1212 1212
 		}
1213 1213
 		// if we're trying to set a start time, but it has already been set...
1214
-		if ( is_numeric( $status ) && is_numeric( $txn_reg_steps[ $reg_step_slug ] ) ) {
1214
+		if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) {
1215 1215
 			// skip the update below, but don't return FALSE so that errors won't be displayed
1216 1216
 			return true;
1217 1217
 		}
1218 1218
 		// update completed status
1219
-		$txn_reg_steps[ $reg_step_slug ] = $status;
1220
-		$this->set_reg_steps( $txn_reg_steps );
1219
+		$txn_reg_steps[$reg_step_slug] = $status;
1220
+		$this->set_reg_steps($txn_reg_steps);
1221 1221
 		$this->save();
1222 1222
 		return true;
1223 1223
 	}
@@ -1233,11 +1233,11 @@  discard block
 block discarded – undo
1233 1233
 	 * @param string          $reg_step_slug
1234 1234
 	 * @return void
1235 1235
 	 */
1236
-	public function remove_reg_step( $reg_step_slug ) {
1236
+	public function remove_reg_step($reg_step_slug) {
1237 1237
 		// get reg steps array
1238 1238
 		$txn_reg_steps = $this->reg_steps();
1239
-		unset( $txn_reg_steps[ $reg_step_slug ] );
1240
-		$this->set_reg_steps( $txn_reg_steps );
1239
+		unset($txn_reg_steps[$reg_step_slug]);
1240
+		$this->set_reg_steps($txn_reg_steps);
1241 1241
 	}
1242 1242
 
1243 1243
 
@@ -1251,11 +1251,11 @@  discard block
 block discarded – undo
1251 1251
 	 * @param bool $save
1252 1252
 	 * @return bool
1253 1253
 	 */
1254
-	public function toggle_failed_transaction_status( $save = true ) {
1254
+	public function toggle_failed_transaction_status($save = true) {
1255 1255
 		// if TXN status is still set as "failed"...
1256
-		if ( $this->status_ID() === EEM_Transaction::failed_status_code ) {
1257
-			$this->set_status( EEM_Transaction::abandoned_status_code );
1258
-			if ( $save ) {
1256
+		if ($this->status_ID() === EEM_Transaction::failed_status_code) {
1257
+			$this->set_status(EEM_Transaction::abandoned_status_code);
1258
+			if ($save) {
1259 1259
 				$this->save();
1260 1260
 			}
1261 1261
 			return true;
@@ -1284,10 +1284,10 @@  discard block
 block discarded – undo
1284 1284
 				$this->primary_registration() instanceof EE_Registration
1285 1285
 				&& $this->primary_registration()->attendee() instanceof EE_Attendee
1286 1286
 			) {
1287
-				$this->set_status( EEM_Transaction::incomplete_status_code );
1287
+				$this->set_status(EEM_Transaction::incomplete_status_code);
1288 1288
 			} else {
1289 1289
 				// no contact record? yer abandoned!
1290
-				$this->set_status( EEM_Transaction::abandoned_status_code );
1290
+				$this->set_status(EEM_Transaction::abandoned_status_code);
1291 1291
 			}
1292 1292
 			return true;
1293 1293
 		}
@@ -1301,16 +1301,16 @@  discard block
 block discarded – undo
1301 1301
 	 * updates the TXN status based on the amount paid
1302 1302
 	 */
1303 1303
 	public function verify_abandoned_transaction_status() {
1304
-		if ( $this->status_ID() !== EEM_Transaction::abandoned_status_code ) {
1304
+		if ($this->status_ID() !== EEM_Transaction::abandoned_status_code) {
1305 1305
 			return;
1306 1306
 		}
1307
-		$payments = $this->get_many_related( 'Payment' );
1308
-		if ( ! empty( $payments ) ) {
1309
-			foreach ( $payments as $payment ) {
1310
-				if ( $payment instanceof EE_Payment ) {
1307
+		$payments = $this->get_many_related('Payment');
1308
+		if ( ! empty($payments)) {
1309
+			foreach ($payments as $payment) {
1310
+				if ($payment instanceof EE_Payment) {
1311 1311
 					// kk this TXN should NOT be abandoned
1312 1312
 					$this->update_status_based_on_total_paid();
1313
-					if ( is_admin() && ! ( defined('DOING_AJAX') && DOING_AJAX ) ) {
1313
+					if (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)) {
1314 1314
 						EE_Error::add_attention(
1315 1315
 							sprintf(
1316 1316
 								esc_html__(
@@ -1326,8 +1326,8 @@  discard block
 block discarded – undo
1326 1326
 					$finalized = $this->final_reg_step_completed();
1327 1327
 					// if the 'finalize_registration' step has been initiated (has a timestamp)
1328 1328
 					// but has not yet been fully completed (TRUE)
1329
-					if ( is_int( $finalized ) && $finalized !== false && $finalized !== true ) {
1330
-						$this->set_reg_step_completed( 'finalize_registration' );
1329
+					if (is_int($finalized) && $finalized !== false && $finalized !== true) {
1330
+						$this->set_reg_step_completed('finalize_registration');
1331 1331
 						$this->save();
1332 1332
 					}
1333 1333
 				}
Please login to merge, or discard this patch.
finalize_registration/EE_SPCO_Reg_Step_Finalize_Registration.class.php 1 patch
Spacing   +27 added lines, -27 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
 
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	 * @param    EE_Checkout $checkout
23 23
 	 * @return    \EE_SPCO_Reg_Step_Finalize_Registration
24 24
 	 */
25
-	public function __construct( EE_Checkout $checkout ) {
25
+	public function __construct(EE_Checkout $checkout) {
26 26
 		$this->_slug = 'finalize_registration';
27
-		$this->_name = __( 'Finalize Registration', 'event_espresso' );
27
+		$this->_name = __('Finalize Registration', 'event_espresso');
28 28
 		$this->_submit_button_text = $this->_name;
29 29
 		$this->_template = '';
30 30
 		$this->checkout = $checkout;
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function initialize_reg_step() {
49 49
 		// there's actually no reg form to process if this is the final step
50
-		if ( $this->is_current_step() ) {
50
+		if ($this->is_current_step()) {
51 51
 			$this->checkout->step = $_REQUEST['step'] = $this->slug();
52 52
 			$this->checkout->action = $_REQUEST['action'] = 'process_reg_step';
53 53
 			$this->checkout->generate_reg_form = false;
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function process_reg_step() {
75 75
 		// ensure all data gets refreshed from the db
76
-		$this->checkout->refresh_all_entities( true );
76
+		$this->checkout->refresh_all_entities(true);
77 77
 		// ensures that all details and statuses for transaction, registration, and payments are updated
78 78
 		$txn_update_params = $this->_finalize_transaction();
79 79
 		// DEBUG LOG
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
 			$txn_update_params
103 103
 		);
104 104
 		// check if transaction has a primary registrant and that it has a related Attendee object
105
-		if ( ! $this->_validate_primary_registrant() ) {
105
+		if ( ! $this->_validate_primary_registrant()) {
106 106
 			return false;
107 107
 		}
108 108
 		// you don't have to go home but you can't stay here !
109 109
 		$this->checkout->redirect = true;
110 110
 		$this->checkout->continue_reg = true;
111
-		$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
111
+		$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
112 112
 		if (
113 113
 			! (
114 114
 				$this->checkout->payment_method instanceof EE_Payment_Method
@@ -133,24 +133,24 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	protected function _finalize_transaction() {
135 135
 		/** @type EE_Transaction_Processor $transaction_processor */
136
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
136
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
137 137
 		//set revisit flag in txn processor
138
-		$transaction_processor->set_revisit( $this->checkout->revisit );
138
+		$transaction_processor->set_revisit($this->checkout->revisit);
139 139
 		// at this point we'll consider a TXN to not have been abandoned
140 140
 		$this->checkout->transaction->toggle_abandoned_transaction_status();
141
-		if ( $this->checkout->cart instanceof EE_Cart ) {
141
+		if ($this->checkout->cart instanceof EE_Cart) {
142 142
 			// save TXN data to the cart
143 143
 			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn(
144 144
 				$this->checkout->transaction->ID()
145 145
 			);
146 146
 		}
147 147
 		// maybe update status, but don't save transaction just yet
148
-		$this->checkout->transaction->update_status_based_on_total_paid( false );
148
+		$this->checkout->transaction->update_status_based_on_total_paid(false);
149 149
 		// maybe send messages
150 150
 		$this->_trigger_notifications();
151 151
 		// this will result in the base session properties getting saved to the TXN_Session_data field
152 152
 		$this->checkout->transaction->set_txn_session_data(
153
-			EE_Registry::instance()->SSN->get_session_data( null, true )
153
+			EE_Registry::instance()->SSN->get_session_data(null, true)
154 154
 		);
155 155
 		// update the TXN if payment conditions have changed
156 156
 		return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment(
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 	 * @throws \EE_Error
173 173
 	 */
174 174
 	protected function _trigger_notifications() {
175
-		if ( $this->checkout->payment_method instanceof EE_Payment_Method ) {
176
-			$is_revisit = filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN );
177
-			if ( $this->checkout->payment_method->is_off_site() ) {
178
-				$gateway= $this->checkout->payment_method->type_obj()->get_gateway();
175
+		if ($this->checkout->payment_method instanceof EE_Payment_Method) {
176
+			$is_revisit = filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN);
177
+			if ($this->checkout->payment_method->is_off_site()) {
178
+				$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
179 179
 				if (
180 180
 					! $is_revisit
181 181
 					&& $gateway instanceof EE_Offsite_Gateway
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 					)
186 186
 				) {
187 187
 					// first time through SPCO and we are processing the payment notification NOW
188
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
188
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
189 189
 				} else {
190 190
 					// do NOT trigger notifications because this is a revisit, OR it was already done during the IPN
191
-					remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' );
191
+					remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications');
192 192
 					add_filter(
193 193
 						'FHEE__EED_Messages___maybe_registration__deliver_notifications',
194 194
 						'__return_false',
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 				}
198 198
 			} else if (
199 199
 				// if SPCO revisit and TXN status has changed due to a payment
200
-				$is_revisit && ( $this->checkout->transaction->txn_status_updated() || $this->checkout->any_reg_status_updated() )
200
+				$is_revisit && ($this->checkout->transaction->txn_status_updated() || $this->checkout->any_reg_status_updated())
201 201
 			) {
202 202
 				// send out notifications
203
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
204
-			} else if ( ! $is_revisit ) {
205
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
203
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
204
+			} else if ( ! $is_revisit) {
205
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
206 206
 			}
207 207
 		}
208 208
 	}
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 	 * @throws \EE_Error
217 217
 	 */
218 218
 	protected function _validate_primary_registrant() {
219
-		if ( ! $this->checkout->transaction_has_primary_registrant() ) {
219
+		if ( ! $this->checkout->transaction_has_primary_registrant()) {
220 220
 			EE_Error::add_error(
221
-				__( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ),
221
+				__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'),
222 222
 				__FILE__,
223 223
 				__FUNCTION__,
224 224
 				__LINE__
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		}
230 230
 		// setup URL for redirect
231 231
 		$this->checkout->redirect_url = add_query_arg(
232
-			array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ),
232
+			array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()),
233 233
 			$this->checkout->thank_you_page_url
234 234
 		);
235 235
 		return true;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	public function update_reg_step() {
244 244
 		EE_Error::doing_it_wrong(
245
-			__CLASS__ . '::' . __FILE__,
245
+			__CLASS__.'::'.__FILE__,
246 246
 			__(
247 247
 				'Can not call update_reg_step() on the Finalize Registration reg step.',
248 248
 				'event_espresso'
Please login to merge, or discard this patch.
EE_Admin_Table_Registration_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  *
11 11
  */
12 12
 
13
-class EE_Admin_Table_Registration_Line_Item_Display_Strategy extends EE_Admin_Table_Line_Item_Display_Strategy  {
13
+class EE_Admin_Table_Registration_Line_Item_Display_Strategy extends EE_Admin_Table_Line_Item_Display_Strategy {
14 14
 
15 15
 	/**
16 16
 	 * Table header for display.
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 	 * @param array $options
19 19
 	 * @return string
20 20
 	 */
21
-	protected function _table_header( $options ) {
22
-		$html = EEH_HTML::table( '','', $options['table_css_class'] );
21
+	protected function _table_header($options) {
22
+		$html = EEH_HTML::table('', '', $options['table_css_class']);
23 23
 		$html .= EEH_HTML::thead();
24 24
 		$html .= EEH_HTML::tr();
25
-		$html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' );
26
-		$html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' );
27
-		$html .= EEH_HTML::th( __( 'Date(s)', 'event_espresso' ), '', 'jst-left' );
28
-		$html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' );
25
+		$html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left');
26
+		$html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left');
27
+		$html .= EEH_HTML::th(__('Date(s)', 'event_espresso'), '', 'jst-left');
28
+		$html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr');
29 29
 		$html .= EEH_HTML::tbody();
30 30
 		return $html;
31 31
 	}
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 	 * @param array        $options
42 42
 	 * @return mixed
43 43
 	 */
44
-	protected function _item_row( EE_Line_Item $line_item, $options = array() ) {
44
+	protected function _item_row(EE_Line_Item $line_item, $options = array()) {
45 45
 		$line_item_related_object = $line_item->get_object();
46 46
 		$parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item
47 47
 			? $line_item->parent()->get_object()
48 48
 			: null;
49 49
 		// start of row
50 50
 		$row_class = $options['odd'] ? 'item odd' : 'item';
51
-		$html = EEH_HTML::tr( '', '', $row_class );
51
+		$html = EEH_HTML::tr('', '', $row_class);
52 52
 
53 53
 
54 54
 		//Name Column
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		$parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object
59 59
 			? $parent_line_item_related_object->name()
60 60
 			: '';
61
-		$parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item
61
+		$parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item
62 62
 			? $line_item->parent()->name()
63 63
 			: $parent_related_object_name;
64 64
 		$parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links
@@ -68,51 +68,51 @@  discard block
 block discarded – undo
68 68
 
69 69
 		$name_html = $line_item_related_object instanceof EEI_Line_Item_Object
70 70
 			? $line_item_related_object->name() : $line_item->name();
71
-		$name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>'
71
+		$name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>'
72 72
 			: $name_html;
73 73
 		$name_html .= $line_item->is_taxable() ? ' *' : '';
74 74
 		//maybe preface with icon?
75 75
 		$name_html = $line_item_related_object instanceof EEI_Has_Icon
76
-			? $line_item_related_object->get_icon() . $name_html
76
+			? $line_item_related_object->get_icon().$name_html
77 77
 			: $name_html;
78
-		$name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';
79
-		$name_html .=  sprintf(
80
-			_x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
78
+		$name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>';
79
+		$name_html .= sprintf(
80
+			_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
81 81
 			'<span class="ee-line-item-related-parent-object">',
82 82
 			$line_item->parent() instanceof EE_Line_Item
83 83
 				? $line_item->parent()->OBJ_type_i18n()
84
-				: __( 'Item:', 'event_espresso' ),
84
+				: __('Item:', 'event_espresso'),
85 85
 			$parent_related_object_link
86
-				? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>'
86
+				? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>'
87 87
 				: $parent_related_object_name,
88 88
 			'</span>'
89 89
 		);
90
-		$html .= EEH_HTML::td( $name_html, '', 'jst-left' );
90
+		$html .= EEH_HTML::td($name_html, '', 'jst-left');
91 91
 		//Type Column
92 92
 		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : '';
93
-		$type_html .= $this->_get_cancellations( $line_item );
93
+		$type_html .= $this->_get_cancellations($line_item);
94 94
 		$type_html .= $line_item->OBJ_type() ? '<br />' : '';
95 95
 		$code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : '';
96
-		$type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : '';
97
-		$html .= EEH_HTML::td( $type_html, '', 'jst-left' );
96
+		$type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : '';
97
+		$html .= EEH_HTML::td($type_html, '', 'jst-left');
98 98
 
99 99
 		//Date column
100 100
 		$datetime_content = '';
101
-		if ( $line_item_related_object instanceof EE_Ticket ) {
101
+		if ($line_item_related_object instanceof EE_Ticket) {
102 102
 			$datetimes = $line_item_related_object->datetimes();
103
-			foreach ( $datetimes as $datetime ) {
104
-				if ( $datetime instanceof EE_Datetime ) {
105
-					$datetime_content .= $datetime->get_dtt_display_name() . '<br>';
103
+			foreach ($datetimes as $datetime) {
104
+				if ($datetime instanceof EE_Datetime) {
105
+					$datetime_content .= $datetime->get_dtt_display_name().'<br>';
106 106
 				}
107 107
 			}
108 108
 		}
109
-		$html .= EEH_HTML::td( $datetime_content, '', 'jst-left' );
109
+		$html .= EEH_HTML::td($datetime_content, '', 'jst-left');
110 110
 
111 111
 		//Amount Column
112
-		if ( $line_item->is_percent() ) {
113
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' );
112
+		if ($line_item->is_percent()) {
113
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght');
114 114
 		} else {
115
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' );
115
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');
116 116
 		}
117 117
 
118 118
 
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 	 * @param array        $options
131 131
 	 * @return mixed
132 132
 	 */
133
-	protected function _tax_row( EE_Line_Item $line_item, $options = array() ) {
133
+	protected function _tax_row(EE_Line_Item $line_item, $options = array()) {
134 134
 		// start of row
135
-		$html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' );
135
+		$html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr');
136 136
 		// name th
137
-		$html .= EEH_HTML::th(  $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '',  'jst-rght', '', ' colspan="3"' );
137
+		$html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="3"');
138 138
 		// total th
139
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
139
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
140 140
 		// end of row
141 141
 		$html .= EEH_HTML::trx();
142 142
 		return $html;
@@ -153,9 +153,9 @@  discard block
 block discarded – undo
153 153
 	 * @param array        $options
154 154
 	 * @return mixed
155 155
 	 */
156
-	protected function _total_row( EE_Line_Item $line_item, $options = array() ) {
156
+	protected function _total_row(EE_Line_Item $line_item, $options = array()) {
157 157
 
158
-		$registration = isset( $options['EE_Registration'] ) ? $options['EE_Registration'] : null;
158
+		$registration = isset($options['EE_Registration']) ? $options['EE_Registration'] : null;
159 159
 		$registration_total = $registration instanceof EE_Registration ? $registration->pretty_final_price() : 0;
160 160
 		//if no valid registration object then we're not going to show the approximate text.
161 161
 		$total_match = $registration instanceof EE_Registration
@@ -163,26 +163,26 @@  discard block
 block discarded – undo
163 163
 			: true;
164 164
 
165 165
 		// start of row
166
-		$html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' );
166
+		$html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
167 167
 		// Total th label
168
-		if ( $total_match ) {
169
-			$total_label = sprintf( __( 'This registration\'s total %s:', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );
168
+		if ($total_match) {
169
+			$total_label = sprintf(__('This registration\'s total %s:', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
170 170
 		} else {
171
-			$total_label = sprintf( __( 'This registration\'s approximate total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );
171
+			$total_label = sprintf(__('This registration\'s approximate total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
172 172
 			$total_label .= '<br>';
173 173
 			$total_label .= '<p class="ee-footnote-text">'
174 174
 			                . sprintf(
175
-				                __( 'The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others.  This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso' ),
175
+				                __('The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others.  This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso'),
176 176
 				                '<strong>',
177 177
 				                $registration_total,
178 178
 				                '</strong>'
179 179
 			                )
180 180
 			                . '</p>';
181 181
 		}
182
-		$html .= EEH_HTML::th( $total_label, '',  'jst-rght',  '',  ' colspan="3"' );
182
+		$html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="3"');
183 183
 		// total th
184 184
 
185
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'jst-rght' );
185
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
186 186
 		// end of row
187 187
 		$html .= EEH_HTML::trx();
188 188
 		return $html;
Please login to merge, or discard this patch.
line_item_display/EE_Admin_Table_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param array        $options
50 50
 	 * @return mixed
51 51
 	 */
52
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
52
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
53 53
 
54 54
 		$html = '';
55 55
 		// set some default options and merge with incoming
@@ -60,43 +60,43 @@  discard block
 block discarded – undo
60 60
 			'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr',
61 61
 			'total_tr_css_class' => 'admin-primary-mbox-total-tr'
62 62
 		);
63
-		$options = array_merge( $default_options, (array)$options );
63
+		$options = array_merge($default_options, (array) $options);
64 64
 
65
-		switch( $line_item->type() ) {
65
+		switch ($line_item->type()) {
66 66
 
67 67
 			case EEM_Line_Item::type_line_item:
68 68
 				// item row
69
-				$html .= $this->_item_row( $line_item, $options );
69
+				$html .= $this->_item_row($line_item, $options);
70 70
 				break;
71 71
 
72 72
 			case EEM_Line_Item::type_sub_line_item:
73
-				$html .= $this->_sub_item_row( $line_item, $options );
73
+				$html .= $this->_sub_item_row($line_item, $options);
74 74
 				break;
75 75
 
76 76
 			case EEM_Line_Item::type_sub_total:
77
-				if ( $line_item->quantity() === 0 ) {
77
+				if ($line_item->quantity() === 0) {
78 78
 					return $html;
79 79
 				}
80 80
 				//loop through children
81 81
 				$child_line_items = $line_item->children();
82 82
 				//loop through children
83
-				foreach ( $child_line_items as $child_line_item ) {
83
+				foreach ($child_line_items as $child_line_item) {
84 84
 					//recursively feed children back into this method
85
-					$html .= $this->display_line_item( $child_line_item, $options );
85
+					$html .= $this->display_line_item($child_line_item, $options);
86 86
 				}
87
-				$html .= $this->_sub_total_row( $line_item, $options );
87
+				$html .= $this->_sub_total_row($line_item, $options);
88 88
 				break;
89 89
 
90 90
 			case EEM_Line_Item::type_tax:
91
-				if ( $this->_show_taxes ) {
92
-					$this->_taxes_html .= $this->_tax_row( $line_item, $options );
91
+				if ($this->_show_taxes) {
92
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
93 93
 				}
94 94
 				break;
95 95
 
96 96
 			case EEM_Line_Item::type_tax_sub_total:
97
-				foreach( $line_item->children() as $child_line_item ) {
98
-					if ( $child_line_item->type() == EEM_Line_Item::type_tax ) {
99
-						$this->display_line_item( $child_line_item, $options );
97
+				foreach ($line_item->children() as $child_line_item) {
98
+					if ($child_line_item->type() == EEM_Line_Item::type_tax) {
99
+						$this->display_line_item($child_line_item, $options);
100 100
 					}
101 101
 				}
102 102
 				break;
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 				$children = $line_item->children();
109 109
 
110 110
 				// loop thru all non-tax child line items
111
-				foreach( $children as $child_line_item ) {
112
-						$html .= $this->display_line_item( $child_line_item, $options );
111
+				foreach ($children as $child_line_item) {
112
+						$html .= $this->display_line_item($child_line_item, $options);
113 113
 				}
114 114
 
115 115
 				$html .= $this->_taxes_html;
116
-				$html .= $this->_total_row( $line_item, $options );
117
-				if ( $options['use_table_wrapper'] ) {
118
-					$html = $this->_table_header( $options ) . $html . $this->_table_footer( $options );
116
+				$html .= $this->_total_row($line_item, $options);
117
+				if ($options['use_table_wrapper']) {
118
+					$html = $this->_table_header($options).$html.$this->_table_footer($options);
119 119
 				}
120 120
 				break;
121 121
 
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
 	 * @param array $options
133 133
 	 * @return string
134 134
 	 */
135
-	protected function _table_header( $options ) {
136
-		$html = EEH_HTML::table( '','', $options['table_css_class'] );
135
+	protected function _table_header($options) {
136
+		$html = EEH_HTML::table('', '', $options['table_css_class']);
137 137
 		$html .= EEH_HTML::thead();
138 138
 		$html .= EEH_HTML::tr();
139
-		$html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' );
140
-		$html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' );
141
-		$html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' );
142
-		$html .= EEH_HTML::th( __( 'Qty', 'event_espresso' ), '', 'jst-cntr' );
143
-		$html .= EEH_HTML::th( __( 'Line Total', 'event_espresso'), '', 'jst-cntr' );
139
+		$html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left');
140
+		$html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left');
141
+		$html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr');
142
+		$html .= EEH_HTML::th(__('Qty', 'event_espresso'), '', 'jst-cntr');
143
+		$html .= EEH_HTML::th(__('Line Total', 'event_espresso'), '', 'jst-cntr');
144 144
 		$html .= EEH_HTML::tbody();
145 145
 		return $html;
146 146
 	}
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @param array $options array of options for the table.
153 153
 	 * @return string
154 154
 	 */
155
-	protected function _table_footer( $options ) {
156
-		return EEH_HTML::tbodyx() .  EEH_HTML::tablex();
155
+	protected function _table_footer($options) {
156
+		return EEH_HTML::tbodyx().EEH_HTML::tablex();
157 157
 	}
158 158
 
159 159
 
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
 	 * @param array        $options
166 166
 	 * @return mixed
167 167
 	 */
168
-	protected function _item_row( EE_Line_Item $line_item, $options = array() ) {
168
+	protected function _item_row(EE_Line_Item $line_item, $options = array()) {
169 169
 		$line_item_related_object = $line_item->get_object();
170 170
 		$parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null;
171 171
 		// start of row
172 172
 		$row_class = $options['odd'] ? 'item odd' : 'item';
173
-		$html = EEH_HTML::tr( '', '', $row_class );
173
+		$html = EEH_HTML::tr('', '', $row_class);
174 174
 
175 175
 
176 176
 		//Name Column
@@ -178,45 +178,45 @@  discard block
 block discarded – undo
178 178
 
179 179
 		//related object scope.
180 180
 		$parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : '';
181
-		$parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
181
+		$parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
182 182
 		$parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : '';
183 183
 
184 184
 
185 185
 		$name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name();
186
-		$name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;
186
+		$name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html;
187 187
 		$name_html .= $line_item->is_taxable() ? ' *' : '';
188 188
 		//maybe preface with icon?
189
-		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html;
190
-		$name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';
191
-		$name_html .=  sprintf(
192
-			_x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
189
+		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon().$name_html : $name_html;
190
+		$name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>';
191
+		$name_html .= sprintf(
192
+			_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
193 193
 			'<span class="ee-line-item-related-parent-object">',
194
-			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __( 'Item:', 'event_espresso' ),
195
-			$parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name,
194
+			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __('Item:', 'event_espresso'),
195
+			$parent_related_object_link ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' : $parent_related_object_name,
196 196
 			'</span>'
197 197
 		);
198
-		$html .= EEH_HTML::td( $name_html, '', 'jst-left' );
198
+		$html .= EEH_HTML::td($name_html, '', 'jst-left');
199 199
 		//Type Column
200 200
 		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : '';
201
-		$type_html .= $this->_get_cancellations( $line_item );
201
+		$type_html .= $this->_get_cancellations($line_item);
202 202
 		$type_html .= $line_item->OBJ_type() ? '<br />' : '';
203 203
 		$code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : '';
204
-		$type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : '';
205
-		$html .= EEH_HTML::td( $type_html, '', 'jst-left' );
204
+		$type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : '';
205
+		$html .= EEH_HTML::td($type_html, '', 'jst-left');
206 206
 
207 207
 
208 208
 		//Amount Column
209
-		if ( $line_item->is_percent() ) {
210
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' );
209
+		if ($line_item->is_percent()) {
210
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght');
211 211
 		} else {
212
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' );
212
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');
213 213
 		}
214 214
 
215 215
 		//QTY column
216
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'jst-rght' );
216
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght');
217 217
 
218 218
 		//total column
219
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
219
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
220 220
 
221 221
 		//finish things off and return
222 222
 		$html .= EEH_HTML::trx();
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 	 * @param EE_Line_Item $line_item
232 232
 	 * @return string
233 233
 	 */
234
-	protected function _get_cancellations( EE_Line_Item $line_item ) {
234
+	protected function _get_cancellations(EE_Line_Item $line_item) {
235 235
 		$html = '';
236 236
 		$cancellations = $line_item->get_cancellations();
237
-		$cancellation = reset( $cancellations );
237
+		$cancellation = reset($cancellations);
238 238
 		// \EEH_Debug_Tools::printr( $cancellation, '$cancellation', __FILE__, __LINE__ );
239
-		if ( $cancellation instanceof EE_Line_Item ) {
239
+		if ($cancellation instanceof EE_Line_Item) {
240 240
 			$html .= ' <span class="ee-line-item-id">';
241 241
 			$html .= sprintf(
242 242
 				_n(
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 * @param array        $options
262 262
 	 * @return mixed
263 263
 	 */
264
-	protected function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
264
+	protected function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
265 265
 		//for now we're not showing sub-items
266 266
 		return '';
267 267
 	}
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
 	 * @param array        $options
276 276
 	 * @return mixed
277 277
 	 */
278
-	protected function _tax_row( EE_Line_Item $line_item, $options = array() ) {
278
+	protected function _tax_row(EE_Line_Item $line_item, $options = array()) {
279 279
 		// start of row
280
-		$html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' );
280
+		$html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr');
281 281
 		// name th
282
-		$html .= EEH_HTML::th(  $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '',  'jst-rght', '', ' colspan="4"' );
282
+		$html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="4"');
283 283
 		// total th
284
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
284
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
285 285
 		// end of row
286 286
 		$html .= EEH_HTML::trx();
287 287
 		return $html;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	 * @param array        $options
299 299
 	 * @return mixed
300 300
 	 */
301
-	protected function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
301
+	protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) {
302 302
 		//currently not showing subtotal row
303 303
 		return '';
304 304
 	}
@@ -312,15 +312,15 @@  discard block
 block discarded – undo
312 312
 	 * @param array        $options
313 313
 	 * @return mixed
314 314
 	 */
315
-	protected function _total_row( EE_Line_Item $line_item, $options = array() ) {
315
+	protected function _total_row(EE_Line_Item $line_item, $options = array()) {
316 316
 		// start of row
317
-		$html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' );
317
+		$html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
318 318
 		// Total th label
319
-		$total_label = sprintf( __( 'Transaction Total %s', 'event_espresso' ),  '(' . EE_Registry::instance()->CFG->currency->code . ')' );
320
-		$html .= EEH_HTML::th( $total_label, '',  'jst-rght',  '',  ' colspan="4"' );
319
+		$total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
320
+		$html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');
321 321
 		// total th
322 322
 
323
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'jst-rght' );
323
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
324 324
 		// end of row
325 325
 		$html .= EEH_HTML::trx();
326 326
 		return $html;
Please login to merge, or discard this patch.
core/domain/services/registration/CancelRegistrationService.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use EventEspresso\core\domain\services\ticket\CancelTicketLineItemService;
5 5
 
6 6
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
-    exit('No direct script access allowed');
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -21,22 +21,22 @@  discard block
 block discarded – undo
21 21
 class CancelRegistrationService
22 22
 {
23 23
 
24
-    /**
25
-     * @var CancelTicketLineItemService $cancel_ticket_line_item_service
26
-     */
27
-    private $cancel_ticket_line_item_service;
24
+	/**
25
+	 * @var CancelTicketLineItemService $cancel_ticket_line_item_service
26
+	 */
27
+	private $cancel_ticket_line_item_service;
28 28
 
29 29
 
30 30
 
31
-    /**
32
-     * Command constructor
33
-     *
34
-     * @param CancelTicketLineItemService $cancel_ticket_line_item_service
35
-     */
36
-    public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service)
37
-    {
38
-        $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service;
39
-    }
31
+	/**
32
+	 * Command constructor
33
+	 *
34
+	 * @param CancelTicketLineItemService $cancel_ticket_line_item_service
35
+	 */
36
+	public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service)
37
+	{
38
+		$this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service;
39
+	}
40 40
 
41 41
 
42 42
 
@@ -44,27 +44,27 @@  discard block
 block discarded – undo
44 44
 	 * @param \EE_Registration $registration
45 45
 	 * @param bool             $cancel_ticket_line_item
46 46
 	 */
47
-    public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true)
48
-    {
49
-        // first cancel the original line item for the registration's ticket
50
-	    if ( $cancel_ticket_line_item ) {
51
-		    $this->cancel_ticket_line_item_service->forRegistration( $registration );
52
-	    }
53
-        $this->cancelRegistrationOnly($registration);
54
-    }
55
-
56
-
57
-
58
-    /**
59
-     * @param \EE_Registration $registration
60
-     * @throws \EE_Error
61
-     */
62
-    public function cancelRegistrationOnly(\EE_Registration $registration)
63
-    {
64
-        // now cancel the registration itself
65
-        $registration->set_status(\EEM_Registration::status_id_cancelled);
66
-        $registration->save();
67
-    }
47
+	public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true)
48
+	{
49
+		// first cancel the original line item for the registration's ticket
50
+		if ( $cancel_ticket_line_item ) {
51
+			$this->cancel_ticket_line_item_service->forRegistration( $registration );
52
+		}
53
+		$this->cancelRegistrationOnly($registration);
54
+	}
55
+
56
+
57
+
58
+	/**
59
+	 * @param \EE_Registration $registration
60
+	 * @throws \EE_Error
61
+	 */
62
+	public function cancelRegistrationOnly(\EE_Registration $registration)
63
+	{
64
+		// now cancel the registration itself
65
+		$registration->set_status(\EEM_Registration::status_id_cancelled);
66
+		$registration->save();
67
+	}
68 68
 
69 69
 
70 70
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@
 block discarded – undo
47 47
     public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true)
48 48
     {
49 49
         // first cancel the original line item for the registration's ticket
50
-	    if ( $cancel_ticket_line_item ) {
51
-		    $this->cancel_ticket_line_item_service->forRegistration( $registration );
50
+	    if ($cancel_ticket_line_item) {
51
+		    $this->cancel_ticket_line_item_service->forRegistration($registration);
52 52
 	    }
53 53
         $this->cancelRegistrationOnly($registration);
54 54
     }
Please login to merge, or discard this patch.