@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Invoice |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | public static function set_hooks() { |
44 | - EE_Config::register_route( 'download_invoice', 'EED_Invoice', 'download_invoice' ); |
|
45 | - EE_Config::register_route( 'launch_invoice', 'EED_Invoice', 'launch_invoice' ); |
|
44 | + EE_Config::register_route('download_invoice', 'EED_Invoice', 'download_invoice'); |
|
45 | + EE_Config::register_route('launch_invoice', 'EED_Invoice', 'launch_invoice'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | * @access public |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function run( $WP ) { |
|
67 | - if ( is_readable( EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php' )) { |
|
68 | - require_once( EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php' ); |
|
66 | + public function run($WP) { |
|
67 | + if (is_readable(EE_MODULES.'gateways/Invoice/lib/Invoice.class.php')) { |
|
68 | + require_once(EE_MODULES.'gateways/Invoice/lib/Invoice.class.php'); |
|
69 | 69 | } else { |
70 | - $msg = __( 'The Invoice.class.php file could not be loaded.', 'event_espresso' ); |
|
71 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
70 | + $msg = __('The Invoice.class.php file could not be loaded.', 'event_espresso'); |
|
71 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
72 | 72 | } |
73 | 73 | // add_filter( 'FHEE_load_ee_config', '__return_true' ); |
74 | 74 | // add_filter( 'FHEE_run_EE_wp', '__return_true' ); |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function launch_invoice() { |
91 | 91 | $this->run(null); |
92 | - if ( EE_Registry::instance()->REQ->is_set( 'id' )) { |
|
93 | - $id = sanitize_key( EE_Registry::instance()->REQ->get( 'id' )); |
|
94 | - $invoice = new Invoice( $id ); |
|
92 | + if (EE_Registry::instance()->REQ->is_set('id')) { |
|
93 | + $id = sanitize_key(EE_Registry::instance()->REQ->get('id')); |
|
94 | + $invoice = new Invoice($id); |
|
95 | 95 | $invoice->send_invoice(); |
96 | 96 | } |
97 | 97 | } |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function download_invoice() { |
108 | 108 | $this->run(null); |
109 | - if ( EE_Registry::instance()->REQ->is_set( 'id' )) { |
|
110 | - $id = sanitize_key( EE_Registry::instance()->REQ->get( 'id' )); |
|
109 | + if (EE_Registry::instance()->REQ->is_set('id')) { |
|
110 | + $id = sanitize_key(EE_Registry::instance()->REQ->get('id')); |
|
111 | 111 | $invoice = new Invoice($_REQUEST['id']); |
112 | 112 | // send invoice but force download |
113 | - $invoice->send_invoice( TRUE ); |
|
113 | + $invoice->send_invoice(TRUE); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,16 +1,16 @@ |
||
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 | /** |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | /** |
253 | 253 | * returns true if ANY reg status was updated during checkout |
254 | - * @return array |
|
254 | + * @return boolean |
|
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | 257 | foreach ( $this->reg_status_updated as $reg_status ) { |
@@ -276,7 +276,7 @@ discard block |
||
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 ); |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | * reset_reg_steps |
621 | 621 | * |
622 | 622 | * @access public |
623 | - * @return bool |
|
623 | + * @return boolean|null |
|
624 | 624 | */ |
625 | 625 | public function reset_reg_steps() { |
626 | 626 | $this->sort_reg_steps(); |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | * stores whether any updates were made to the TXN or it's related registrations |
734 | 734 | * |
735 | 735 | * @access public |
736 | - * @return bool |
|
736 | + * @return boolean|null |
|
737 | 737 | */ |
738 | 738 | public function track_transaction_and_registration_status_updates() { |
739 | 739 | // verify the transaction |
@@ -1081,6 +1081,7 @@ discard block |
||
1081 | 1081 | * |
1082 | 1082 | * @param string | int $reg_cache_ID |
1083 | 1083 | * @param EE_Registration $registration |
1084 | + * @param integer $reg_cache_ID |
|
1084 | 1085 | * @return void |
1085 | 1086 | */ |
1086 | 1087 | protected function _refresh_registration( $reg_cache_ID, $registration ) { |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | $this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url(); |
243 | 243 | $this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url(); |
244 | 244 | $this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url(); |
245 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE ); |
|
245 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE); |
|
246 | 246 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax; |
247 | - $this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
247 | + $this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC')); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | * @return array |
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | - foreach ( $this->reg_status_updated as $reg_status ) { |
|
258 | - if ( $reg_status ) { |
|
257 | + foreach ($this->reg_status_updated as $reg_status) { |
|
258 | + if ($reg_status) { |
|
259 | 259 | return true; |
260 | 260 | } |
261 | 261 | } |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | * @param $REG_ID |
269 | 269 | * @return array |
270 | 270 | */ |
271 | - public function reg_status_updated( $REG_ID ) { |
|
272 | - return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false; |
|
271 | + public function reg_status_updated($REG_ID) { |
|
272 | + return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | * @param $REG_ID |
279 | 279 | * @param $reg_status |
280 | 280 | */ |
281 | - public function set_reg_status_updated( $REG_ID, $reg_status ) { |
|
282 | - $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
|
281 | + public function set_reg_status_updated($REG_ID, $reg_status) { |
|
282 | + $this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * can ONLY be set by the Finalize_Registration reg step |
301 | 301 | */ |
302 | 302 | public function set_exit_spco() { |
303 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
303 | + if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
304 | 304 | $this->exit_spco = true; |
305 | 305 | } |
306 | 306 | } |
@@ -317,12 +317,12 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public function reset_for_current_request() { |
319 | 319 | $this->process_form_submission = FALSE; |
320 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true ); |
|
320 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true); |
|
321 | 321 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax; |
322 | 322 | $this->continue_reg = true; |
323 | 323 | $this->redirect = false; |
324 | 324 | // don't reset the cached redirect form if we're about to be asked to display it !!! |
325 | - if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) { |
|
325 | + if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') { |
|
326 | 326 | $this->redirect_form = ''; |
327 | 327 | } |
328 | 328 | $this->redirect_url = ''; |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param EE_SPCO_Reg_Step $reg_step_obj |
340 | 340 | * @return void |
341 | 341 | */ |
342 | - public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) { |
|
343 | - $this->reg_steps[ $reg_step_obj->slug() ] = $reg_step_obj; |
|
342 | + public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) { |
|
343 | + $this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -356,22 +356,22 @@ discard block |
||
356 | 356 | * @param string $reg_step_slug |
357 | 357 | * @return void |
358 | 358 | */ |
359 | - public function skip_reg_step( $reg_step_slug = '' ) { |
|
360 | - $step_to_skip = $this->find_reg_step( $reg_step_slug ); |
|
361 | - if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) { |
|
362 | - $step_to_skip->set_is_current_step( false ); |
|
359 | + public function skip_reg_step($reg_step_slug = '') { |
|
360 | + $step_to_skip = $this->find_reg_step($reg_step_slug); |
|
361 | + if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) { |
|
362 | + $step_to_skip->set_is_current_step(false); |
|
363 | 363 | $step_to_skip->set_completed(); |
364 | 364 | // advance to the next step |
365 | - $this->set_current_step( $this->next_step->slug() ); |
|
365 | + $this->set_current_step($this->next_step->slug()); |
|
366 | 366 | // also reset the step param in the request in case any other code references that directly |
367 | - EE_Registry::instance()->REQ->set( 'step', $this->current_step->slug() ); |
|
367 | + EE_Registry::instance()->REQ->set('step', $this->current_step->slug()); |
|
368 | 368 | // since we are skipping a step and setting the current step to be what was previously the next step, |
369 | 369 | // we need to check that the next step is now correct, and not still set to the current step. |
370 | - if ( $this->current_step->slug() == $this->next_step->slug() ) { |
|
370 | + if ($this->current_step->slug() == $this->next_step->slug()) { |
|
371 | 371 | // correctly setup the next step |
372 | 372 | $this->set_next_step(); |
373 | 373 | } |
374 | - $this->set_reg_step_initiated( $this->current_step ); |
|
374 | + $this->set_reg_step_initiated($this->current_step); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | * @param bool $reset whether to reset reg steps after removal |
386 | 386 | * @throws EE_Error |
387 | 387 | */ |
388 | - public function remove_reg_step( $reg_step_slug = '', $reset = true ) { |
|
389 | - unset( $this->reg_steps[ $reg_step_slug ] ); |
|
390 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
388 | + public function remove_reg_step($reg_step_slug = '', $reset = true) { |
|
389 | + unset($this->reg_steps[$reg_step_slug]); |
|
390 | + if ($this->transaction instanceof EE_Transaction) { |
|
391 | 391 | /** @type EE_Transaction_Processor $transaction_processor */ |
392 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
392 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
393 | 393 | // now remove reg step from TXN and save |
394 | - $transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug ); |
|
394 | + $transaction_processor->remove_reg_step($this->transaction, $reg_step_slug); |
|
395 | 395 | $this->transaction->save(); |
396 | 396 | } |
397 | - if ( $reset ) { |
|
397 | + if ($reset) { |
|
398 | 398 | $this->reset_reg_steps(); |
399 | 399 | } |
400 | 400 | } |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | * @param int $order |
410 | 410 | * @return void |
411 | 411 | */ |
412 | - public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
|
413 | - if ( isset( $this->reg_steps[ $reg_step_slug ] )) { |
|
414 | - $this->reg_steps[ $reg_step_slug ]->set_order( $order ); |
|
412 | + public function set_reg_step_order($reg_step_slug = '', $order = 100) { |
|
413 | + if (isset($this->reg_steps[$reg_step_slug])) { |
|
414 | + $this->reg_steps[$reg_step_slug]->set_order($order); |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | |
@@ -424,25 +424,25 @@ discard block |
||
424 | 424 | * @param string $current_step |
425 | 425 | * @return void |
426 | 426 | */ |
427 | - public function set_current_step( $current_step ) { |
|
427 | + public function set_current_step($current_step) { |
|
428 | 428 | // grab what step we're on |
429 | - $this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps ); |
|
429 | + $this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps); |
|
430 | 430 | // verify instance |
431 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step ) { |
|
431 | + if ($this->current_step instanceof EE_SPCO_Reg_Step) { |
|
432 | 432 | // we don't want to repeat completed steps if this is the first time through SPCO |
433 | - if ( $this->continue_reg && $this->current_step->completed() && ! $this->revisit ) { |
|
433 | + if ($this->continue_reg && $this->current_step->completed() && ! $this->revisit) { |
|
434 | 434 | // so advance to the next step |
435 | 435 | $this->set_next_step(); |
436 | - if ( $this->next_step instanceof EE_SPCO_Reg_Step ) { |
|
436 | + if ($this->next_step instanceof EE_SPCO_Reg_Step) { |
|
437 | 437 | // and attempt to set it as the current step |
438 | - $this->set_current_step( $this->next_step->slug() ); |
|
438 | + $this->set_current_step($this->next_step->slug()); |
|
439 | 439 | } |
440 | 440 | return; |
441 | 441 | } |
442 | - $this->current_step->set_is_current_step( TRUE ); |
|
442 | + $this->current_step->set_is_current_step(TRUE); |
|
443 | 443 | } else { |
444 | 444 | EE_Error::add_error( |
445 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
445 | + __('The current step could not be set.', 'event_espresso'), |
|
446 | 446 | __FILE__, __FUNCTION__, __LINE__ |
447 | 447 | ); |
448 | 448 | } |
@@ -459,20 +459,20 @@ discard block |
||
459 | 459 | */ |
460 | 460 | public function set_next_step() { |
461 | 461 | // set pointer to start of array |
462 | - reset( $this->reg_steps ); |
|
462 | + reset($this->reg_steps); |
|
463 | 463 | // if there is more than one step |
464 | - if ( count( $this->reg_steps ) > 1 ) { |
|
464 | + if (count($this->reg_steps) > 1) { |
|
465 | 465 | // advance to the current step and set pointer |
466 | - while ( key( $this->reg_steps ) != $this->current_step->slug() && key( $this->reg_steps ) != '' ) { |
|
467 | - next( $this->reg_steps ); |
|
466 | + while (key($this->reg_steps) != $this->current_step->slug() && key($this->reg_steps) != '') { |
|
467 | + next($this->reg_steps); |
|
468 | 468 | } |
469 | 469 | } |
470 | 470 | // advance one more spot ( if it exists ) |
471 | - $this->next_step = next( $this->reg_steps ); |
|
471 | + $this->next_step = next($this->reg_steps); |
|
472 | 472 | // verify instance |
473 | - $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
473 | + $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
474 | 474 | // then back to current step to reset |
475 | - prev( $this->reg_steps ); |
|
475 | + prev($this->reg_steps); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -486,8 +486,8 @@ discard block |
||
486 | 486 | * @return EE_SPCO_Reg_Step | null |
487 | 487 | */ |
488 | 488 | public function get_next_reg_step() { |
489 | - $next = next( $this->reg_steps ); |
|
490 | - prev( $this->reg_steps ); |
|
489 | + $next = next($this->reg_steps); |
|
490 | + prev($this->reg_steps); |
|
491 | 491 | return $next instanceof EE_SPCO_Reg_Step ? $next : null; |
492 | 492 | } |
493 | 493 | |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | * @return EE_SPCO_Reg_Step | null |
503 | 503 | */ |
504 | 504 | public function get_prev_reg_step() { |
505 | - $prev = prev( $this->reg_steps ); |
|
506 | - next( $this->reg_steps ); |
|
505 | + $prev = prev($this->reg_steps); |
|
506 | + next($this->reg_steps); |
|
507 | 507 | return $prev instanceof EE_SPCO_Reg_Step ? $prev : null; |
508 | 508 | } |
509 | 509 | |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | * @return void |
517 | 517 | */ |
518 | 518 | public function sort_reg_steps() { |
519 | - $reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' ); |
|
520 | - uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback )); |
|
519 | + $reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback'); |
|
520 | + uasort($this->reg_steps, array($this, $reg_step_sorting_callback)); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -530,19 +530,19 @@ discard block |
||
530 | 530 | * @param string $reg_step_slug |
531 | 531 | * @return EE_SPCO_Reg_Step|null |
532 | 532 | */ |
533 | - public function find_reg_step( $reg_step_slug = '' ) { |
|
534 | - if ( ! empty( $reg_step_slug ) ) { |
|
533 | + public function find_reg_step($reg_step_slug = '') { |
|
534 | + if ( ! empty($reg_step_slug)) { |
|
535 | 535 | // copy reg step array |
536 | 536 | $reg_steps = $this->reg_steps; |
537 | 537 | // set pointer to start of array |
538 | - reset( $reg_steps ); |
|
538 | + reset($reg_steps); |
|
539 | 539 | // if there is more than one step |
540 | - if ( count( $reg_steps ) > 1 ) { |
|
540 | + if (count($reg_steps) > 1) { |
|
541 | 541 | // advance to the current step and set pointer |
542 | - while ( key( $reg_steps ) != $reg_step_slug && key( $reg_steps ) != '' ) { |
|
543 | - next( $reg_steps ); |
|
542 | + while (key($reg_steps) != $reg_step_slug && key($reg_steps) != '') { |
|
543 | + next($reg_steps); |
|
544 | 544 | } |
545 | - return current( $reg_steps ); |
|
545 | + return current($reg_steps); |
|
546 | 546 | } |
547 | 547 | } |
548 | 548 | return null; |
@@ -558,17 +558,17 @@ discard block |
||
558 | 558 | * @param EE_SPCO_Reg_Step $reg_step_B |
559 | 559 | * @return array() |
560 | 560 | */ |
561 | - public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
|
561 | + public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) { |
|
562 | 562 | // send finalize_registration step to the end of the array |
563 | - if ( $reg_step_A->slug() == 'finalize_registration' ) { |
|
563 | + if ($reg_step_A->slug() == 'finalize_registration') { |
|
564 | 564 | return 1; |
565 | - } else if ( $reg_step_B->slug() == 'finalize_registration' ) { |
|
565 | + } else if ($reg_step_B->slug() == 'finalize_registration') { |
|
566 | 566 | return -1; |
567 | 567 | } |
568 | - if ( $reg_step_A->order() == $reg_step_B->order() ) { |
|
568 | + if ($reg_step_A->order() == $reg_step_B->order()) { |
|
569 | 569 | return 0; |
570 | 570 | } |
571 | - return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1; |
|
571 | + return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1; |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | * @access public |
580 | 580 | * @param EE_SPCO_Reg_Step $reg_step |
581 | 581 | */ |
582 | - public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) { |
|
582 | + public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) { |
|
583 | 583 | // call set_reg_step_initiated ??? |
584 | 584 | if ( |
585 | 585 | // first time visiting SPCO ? |
@@ -592,13 +592,13 @@ discard block |
||
592 | 592 | ) |
593 | 593 | ) { |
594 | 594 | /** @type EE_Transaction_Processor $transaction_processor */ |
595 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
595 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
596 | 596 | // set the start time for this reg step |
597 | - if ( ! $transaction_processor->set_reg_step_initiated( $this->transaction, $reg_step->slug() ) ) { |
|
598 | - if ( WP_DEBUG ) { |
|
597 | + if ( ! $transaction_processor->set_reg_step_initiated($this->transaction, $reg_step->slug())) { |
|
598 | + if (WP_DEBUG) { |
|
599 | 599 | EE_Error::add_error( |
600 | 600 | sprintf( |
601 | - __( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), |
|
601 | + __('The "%1$s" registration step was not initialized properly.', 'event_espresso'), |
|
602 | 602 | $reg_step->name() |
603 | 603 | ), |
604 | 604 | __FILE__, __FUNCTION__, __LINE__ |
@@ -617,10 +617,10 @@ discard block |
||
617 | 617 | * @return void |
618 | 618 | */ |
619 | 619 | public function set_reg_step_JSON_info() { |
620 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array(); |
|
620 | + EE_Registry::$i18n_js_strings['reg_steps'] = array(); |
|
621 | 621 | // pass basic reg step data to JS |
622 | - foreach ( $this->reg_steps as $reg_step ) { |
|
623 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug(); |
|
622 | + foreach ($this->reg_steps as $reg_step) { |
|
623 | + EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug(); |
|
624 | 624 | } |
625 | 625 | // reset reg step html |
626 | 626 | // $this->json_response->set_reg_step_html( '' ); |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | */ |
637 | 637 | public function reset_reg_steps() { |
638 | 638 | $this->sort_reg_steps(); |
639 | - $this->set_current_step( EE_Registry::instance()->REQ->get( 'step' )); |
|
639 | + $this->set_current_step(EE_Registry::instance()->REQ->get('step')); |
|
640 | 640 | $this->set_next_step(); |
641 | 641 | // the text that appears on the reg step form submit button |
642 | 642 | $this->current_step->set_submit_button_text(); |
@@ -653,9 +653,9 @@ discard block |
||
653 | 653 | */ |
654 | 654 | public function get_registration_time_limit() { |
655 | 655 | |
656 | - $registration_time_limit = (float)( EE_Registry::instance() ->SSN->expiration() - time() ); |
|
656 | + $registration_time_limit = (float) (EE_Registry::instance() ->SSN->expiration() - time()); |
|
657 | 657 | $time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s'; |
658 | - $registration_time_limit = gmdate( $time_limit_format, $registration_time_limit ); |
|
658 | + $registration_time_limit = gmdate($time_limit_format, $registration_time_limit); |
|
659 | 659 | return apply_filters( |
660 | 660 | 'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit', |
661 | 661 | $registration_time_limit |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | // overpaid TXN |
676 | 676 | // free TXN ( total = 0.00 ) |
677 | 677 | // then payment required is TRUE |
678 | - return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE; |
|
678 | + return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE; |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | |
@@ -688,8 +688,8 @@ discard block |
||
688 | 688 | */ |
689 | 689 | public function initialize_txn_reg_steps_array() { |
690 | 690 | $txn_reg_steps_array = array(); |
691 | - foreach ( $this->reg_steps as $reg_step ) { |
|
692 | - $txn_reg_steps_array[ $reg_step->slug() ] = FALSE; |
|
691 | + foreach ($this->reg_steps as $reg_step) { |
|
692 | + $txn_reg_steps_array[$reg_step->slug()] = FALSE; |
|
693 | 693 | } |
694 | 694 | return $txn_reg_steps_array; |
695 | 695 | } |
@@ -705,13 +705,13 @@ discard block |
||
705 | 705 | public function update_txn_reg_steps_array() { |
706 | 706 | $updated = FALSE; |
707 | 707 | /** @type EE_Transaction_Processor $transaction_processor */ |
708 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
709 | - foreach ( $this->reg_steps as $reg_step ) { |
|
710 | - if ( $reg_step->completed() ) { |
|
711 | - $updated = $transaction_processor->set_reg_step_completed( $this->transaction, $reg_step->slug() ) ? TRUE : $updated; |
|
708 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
709 | + foreach ($this->reg_steps as $reg_step) { |
|
710 | + if ($reg_step->completed()) { |
|
711 | + $updated = $transaction_processor->set_reg_step_completed($this->transaction, $reg_step->slug()) ? TRUE : $updated; |
|
712 | 712 | } |
713 | 713 | } |
714 | - if ( $updated ) { |
|
714 | + if ($updated) { |
|
715 | 715 | $this->transaction->save(); |
716 | 716 | } |
717 | 717 | return $updated; |
@@ -726,14 +726,14 @@ discard block |
||
726 | 726 | * @return void |
727 | 727 | */ |
728 | 728 | public function stash_transaction_and_checkout() { |
729 | - if ( ! $this->revisit ) { |
|
729 | + if ( ! $this->revisit) { |
|
730 | 730 | $this->update_txn_reg_steps_array(); |
731 | 731 | } |
732 | 732 | $this->track_transaction_and_registration_status_updates(); |
733 | 733 | // save all data to the db, but suppress errors |
734 | 734 | //$this->save_all_data( FALSE ); |
735 | 735 | // cache the checkout in the session |
736 | - EE_Registry::instance()->SSN->set_checkout( $this ); |
|
736 | + EE_Registry::instance()->SSN->set_checkout($this); |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | |
@@ -749,21 +749,21 @@ discard block |
||
749 | 749 | */ |
750 | 750 | public function track_transaction_and_registration_status_updates() { |
751 | 751 | // verify the transaction |
752 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
752 | + if ($this->transaction instanceof EE_Transaction) { |
|
753 | 753 | /** @type EE_Transaction_Payments $transaction_payments */ |
754 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
754 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
755 | 755 | /** @type EE_Transaction_Processor $transaction_processor */ |
756 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
756 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
757 | 757 | // has there been a TXN status change during this checkout? |
758 | - if ( $transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated() ) { |
|
758 | + if ($transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated()) { |
|
759 | 759 | $this->txn_status_updated = true; |
760 | 760 | } |
761 | 761 | /** @type EE_Registration_Processor $registration_processor */ |
762 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
762 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
763 | 763 | // grab the saved registrations from the transaction |
764 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
765 | - if ( $registration_processor->reg_status_updated( $registration->ID() ) ) { |
|
766 | - $this->set_reg_status_updated( $registration->ID(), true ); |
|
764 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
765 | + if ($registration_processor->reg_status_updated($registration->ID())) { |
|
766 | + $this->set_reg_status_updated($registration->ID(), true); |
|
767 | 767 | } |
768 | 768 | } |
769 | 769 | } |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | * @param EE_Registration $registration |
786 | 786 | * @return bool |
787 | 787 | */ |
788 | - public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
|
789 | - return ! $this->revisit || $this->primary_revisit || ( $this->revisit && $this->reg_url_link == $registration->reg_url_link() ) ? TRUE : FALSE; |
|
788 | + public function visit_allows_processing_of_this_registration(EE_Registration $registration) { |
|
789 | + return ! $this->revisit || $this->primary_revisit || ($this->revisit && $this->reg_url_link == $registration->reg_url_link()) ? TRUE : FALSE; |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | |
@@ -811,18 +811,18 @@ discard block |
||
811 | 811 | * @param bool $show_errors |
812 | 812 | * @return bool |
813 | 813 | */ |
814 | - public function save_all_data( $show_errors = TRUE ) { |
|
814 | + public function save_all_data($show_errors = TRUE) { |
|
815 | 815 | // verify the transaction |
816 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
816 | + if ($this->transaction instanceof EE_Transaction) { |
|
817 | 817 | // save to ensure that TXN has ID |
818 | 818 | $this->transaction->save(); |
819 | 819 | // grab the saved registrations from the transaction |
820 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
821 | - $this->_save_registration( $registration, $show_errors ); |
|
820 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
821 | + $this->_save_registration($registration, $show_errors); |
|
822 | 822 | } |
823 | 823 | } else { |
824 | - if ( $show_errors ) { |
|
825 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
824 | + if ($show_errors) { |
|
825 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
826 | 826 | } |
827 | 827 | return FALSE; |
828 | 828 | } |
@@ -837,32 +837,32 @@ discard block |
||
837 | 837 | * @param bool $show_errors |
838 | 838 | * @return void |
839 | 839 | */ |
840 | - private function _save_registration( $registration, $show_errors = TRUE ) { |
|
840 | + private function _save_registration($registration, $show_errors = TRUE) { |
|
841 | 841 | // verify object |
842 | - if ( $registration instanceof EE_Registration ) { |
|
842 | + if ($registration instanceof EE_Registration) { |
|
843 | 843 | // should this registration be processed during this visit ? |
844 | - if ( $this->visit_allows_processing_of_this_registration( $registration ) ) { |
|
844 | + if ($this->visit_allows_processing_of_this_registration($registration)) { |
|
845 | 845 | //set TXN ID |
846 | - if ( ! $registration->transaction_ID() ) { |
|
847 | - $registration->set_transaction_id( $this->transaction->ID() ); |
|
846 | + if ( ! $registration->transaction_ID()) { |
|
847 | + $registration->set_transaction_id($this->transaction->ID()); |
|
848 | 848 | } |
849 | 849 | // verify and save the attendee |
850 | - $this->_save_registration_attendee( $registration, $show_errors ); |
|
850 | + $this->_save_registration_attendee($registration, $show_errors); |
|
851 | 851 | // save answers to reg form questions |
852 | - $this->_save_registration_answers( $registration, $show_errors ); |
|
852 | + $this->_save_registration_answers($registration, $show_errors); |
|
853 | 853 | // save changes |
854 | 854 | $registration->save(); |
855 | 855 | // update txn cache |
856 | - if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) { |
|
857 | - if ( $show_errors ) { |
|
858 | - EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
856 | + if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) { |
|
857 | + if ($show_errors) { |
|
858 | + EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
859 | 859 | } |
860 | 860 | } |
861 | 861 | } |
862 | 862 | } else { |
863 | - if ( $show_errors ) { |
|
863 | + if ($show_errors) { |
|
864 | 864 | EE_Error::add_error( |
865 | - __( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
865 | + __('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
866 | 866 | __FILE__, __FUNCTION__, __LINE__ |
867 | 867 | ); |
868 | 868 | } |
@@ -878,26 +878,26 @@ discard block |
||
878 | 878 | * @param bool $show_errors |
879 | 879 | * @return void |
880 | 880 | */ |
881 | - private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
|
882 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
881 | + private function _save_registration_attendee($registration, $show_errors = TRUE) { |
|
882 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
883 | 883 | // save so that ATT has ID |
884 | 884 | $registration->attendee()->save(); |
885 | - if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() )) { |
|
886 | - if ( $show_errors ) { |
|
885 | + if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) { |
|
886 | + if ($show_errors) { |
|
887 | 887 | EE_Error::add_error( |
888 | - __( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ), |
|
888 | + __('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'), |
|
889 | 889 | __FILE__, __FUNCTION__, __LINE__ |
890 | 890 | ); |
891 | 891 | } |
892 | 892 | } |
893 | 893 | } else { |
894 | - if ( $show_errors ) { |
|
894 | + if ($show_errors) { |
|
895 | 895 | ob_start(); |
896 | - var_dump( $registration->attendee() ); |
|
896 | + var_dump($registration->attendee()); |
|
897 | 897 | EE_Error::add_error( |
898 | 898 | sprintf( |
899 | 899 | '%1$s||%1$s $attendee = %2$s', |
900 | - __( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
900 | + __('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
901 | 901 | ob_get_clean() |
902 | 902 | ), |
903 | 903 | __FILE__, __FUNCTION__, __LINE__ |
@@ -915,25 +915,25 @@ discard block |
||
915 | 915 | * @param bool $show_errors |
916 | 916 | * @return void |
917 | 917 | */ |
918 | - private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
|
918 | + private function _save_registration_answers($registration, $show_errors = TRUE) { |
|
919 | 919 | // now save the answers |
920 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
920 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
921 | 921 | // verify object |
922 | - if ( $answer instanceof EE_Answer ) { |
|
923 | - $answer->set_registration( $registration->ID() ); |
|
922 | + if ($answer instanceof EE_Answer) { |
|
923 | + $answer->set_registration($registration->ID()); |
|
924 | 924 | $answer->save(); |
925 | - if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) { |
|
926 | - if ( $show_errors ) { |
|
925 | + if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { |
|
926 | + if ($show_errors) { |
|
927 | 927 | EE_Error::add_error( |
928 | - __( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ), |
|
928 | + __('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), |
|
929 | 929 | __FILE__, __FUNCTION__, __LINE__ |
930 | 930 | ); |
931 | 931 | } |
932 | 932 | } |
933 | 933 | } else { |
934 | - if ( $show_errors ) { |
|
934 | + if ($show_errors) { |
|
935 | 935 | EE_Error::add_error( |
936 | - __( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
936 | + __('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
937 | 937 | __FILE__, __FUNCTION__, __LINE__ |
938 | 938 | ); |
939 | 939 | } |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | * @param bool $from_db |
952 | 952 | * @return bool |
953 | 953 | */ |
954 | - public function refresh_all_entities( $from_db = false ) { |
|
954 | + public function refresh_all_entities($from_db = false) { |
|
955 | 955 | $from_db = $this->current_step->is_final_step() || $this->action == 'process_gateway_response' ? true : $from_db; |
956 | 956 | //$this->log( |
957 | 957 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -972,11 +972,11 @@ discard block |
||
972 | 972 | */ |
973 | 973 | protected function refresh_from_db() { |
974 | 974 | // verify the transaction |
975 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
975 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
976 | 976 | // pull fresh TXN data from the db |
977 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() ); |
|
977 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); |
|
978 | 978 | // update EE_Checkout's cached primary_attendee object |
979 | - $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction ); |
|
979 | + $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); |
|
980 | 980 | // update EE_Checkout's cached payment object |
981 | 981 | $payment = $this->transaction->last_payment(); |
982 | 982 | $this->payment = $payment instanceof EE_Payment ? $payment : $this->payment; |
@@ -984,15 +984,15 @@ discard block |
||
984 | 984 | $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; |
985 | 985 | $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method; |
986 | 986 | //now refresh the cart, based on the TXN |
987 | - $this->cart = EE_Cart::get_cart_from_txn( $this->transaction ); |
|
987 | + $this->cart = EE_Cart::get_cart_from_txn($this->transaction); |
|
988 | 988 | // verify and update the cart because inaccurate totals are not so much fun |
989 | - if ( $this->cart instanceof EE_Cart ) { |
|
989 | + if ($this->cart instanceof EE_Cart) { |
|
990 | 990 | $this->cart->get_grand_total()->recalculate_total_including_taxes(); |
991 | 991 | } else { |
992 | - $this->cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
992 | + $this->cart = EE_Registry::instance()->load_core('Cart'); |
|
993 | 993 | } |
994 | 994 | } else { |
995 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
995 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
996 | 996 | return FALSE; |
997 | 997 | } |
998 | 998 | return TRUE; |
@@ -1006,24 +1006,24 @@ discard block |
||
1006 | 1006 | * @param EE_Transaction $transaction |
1007 | 1007 | * @return EE_Attendee | null |
1008 | 1008 | */ |
1009 | - protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
|
1009 | + protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) { |
|
1010 | 1010 | |
1011 | 1011 | $primary_attendee_obj = null; |
1012 | 1012 | // grab the saved registrations from the transaction |
1013 | - foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) { |
|
1013 | + foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) { |
|
1014 | 1014 | // verify object |
1015 | - if ( $registration instanceof EE_Registration ) { |
|
1015 | + if ($registration instanceof EE_Registration) { |
|
1016 | 1016 | $attendee = $registration->attendee(); |
1017 | 1017 | // verify object |
1018 | - if ( $attendee instanceof EE_Attendee ) { |
|
1018 | + if ($attendee instanceof EE_Attendee) { |
|
1019 | 1019 | // maybe cache primary_attendee_obj ? |
1020 | - if ( $registration->is_primary_registrant() ) { |
|
1020 | + if ($registration->is_primary_registrant()) { |
|
1021 | 1021 | $primary_attendee_obj = $attendee; |
1022 | 1022 | } |
1023 | 1023 | } |
1024 | 1024 | } else { |
1025 | 1025 | EE_Error::add_error( |
1026 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1026 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1027 | 1027 | __FILE__, __FUNCTION__, __LINE__ |
1028 | 1028 | ); |
1029 | 1029 | } |
@@ -1043,43 +1043,43 @@ discard block |
||
1043 | 1043 | */ |
1044 | 1044 | protected function refresh_entity_map() { |
1045 | 1045 | // verify the transaction |
1046 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1046 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1047 | 1047 | // never cache payment info |
1048 | - $this->transaction->clear_cache( 'Payment' ); |
|
1048 | + $this->transaction->clear_cache('Payment'); |
|
1049 | 1049 | /** @type EE_Transaction_Processor $transaction_processor */ |
1050 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1050 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1051 | 1051 | // is the Payment Options Reg Step completed ? |
1052 | - if ( $transaction_processor->reg_step_completed( $this->transaction, 'payment_options' ) ) { |
|
1052 | + if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) { |
|
1053 | 1053 | // then check for payments and update TXN accordingly |
1054 | 1054 | /** @type EE_Transaction_Payments $transaction_payments */ |
1055 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1056 | - $transaction_payments->calculate_total_payments_and_update_status( $this->transaction ); |
|
1055 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1056 | + $transaction_payments->calculate_total_payments_and_update_status($this->transaction); |
|
1057 | 1057 | } |
1058 | 1058 | // grab the saved registrations from the transaction |
1059 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration ) { |
|
1060 | - $this->_refresh_registration( $reg_cache_ID, $registration ); |
|
1059 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) { |
|
1060 | + $this->_refresh_registration($reg_cache_ID, $registration); |
|
1061 | 1061 | } |
1062 | 1062 | // make sure our cached TXN is added to the model entity mapper |
1063 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction ); |
|
1063 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction); |
|
1064 | 1064 | |
1065 | 1065 | } else { |
1066 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
1066 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1067 | 1067 | return FALSE; |
1068 | 1068 | } |
1069 | 1069 | // verify and update the cart because inaccurate totals are not so much fun |
1070 | - if ( $this->cart instanceof EE_Cart ) { |
|
1070 | + if ($this->cart instanceof EE_Cart) { |
|
1071 | 1071 | $grand_total = $this->cart->get_grand_total(); |
1072 | - if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) { |
|
1072 | + if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) { |
|
1073 | 1073 | $grand_total->recalculate_total_including_taxes(); |
1074 | 1074 | $grand_total = $grand_total->get_model()->refresh_entity_map_with( |
1075 | 1075 | $this->cart->get_grand_total()->ID(), |
1076 | 1076 | $this->cart->get_grand_total() |
1077 | 1077 | ); |
1078 | 1078 | } |
1079 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
1080 | - $this->cart = EE_Cart::instance( $grand_total ); |
|
1079 | + if ($grand_total instanceof EE_Line_Item) { |
|
1080 | + $this->cart = EE_Cart::instance($grand_total); |
|
1081 | 1081 | } else { |
1082 | - EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1082 | + EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1083 | 1083 | return false; |
1084 | 1084 | } |
1085 | 1085 | } |
@@ -1095,19 +1095,19 @@ discard block |
||
1095 | 1095 | * @param EE_Registration $registration |
1096 | 1096 | * @return void |
1097 | 1097 | */ |
1098 | - protected function _refresh_registration( $reg_cache_ID, $registration ) { |
|
1098 | + protected function _refresh_registration($reg_cache_ID, $registration) { |
|
1099 | 1099 | |
1100 | 1100 | // verify object |
1101 | - if ( $registration instanceof EE_Registration ) { |
|
1101 | + if ($registration instanceof EE_Registration) { |
|
1102 | 1102 | // update the entity mapper attendee |
1103 | - $this->_refresh_registration_attendee( $registration ); |
|
1103 | + $this->_refresh_registration_attendee($registration); |
|
1104 | 1104 | // update the entity mapper answers for reg form questions |
1105 | - $this->_refresh_registration_answers( $registration ); |
|
1105 | + $this->_refresh_registration_answers($registration); |
|
1106 | 1106 | // make sure the cached registration is added to the model entity mapper |
1107 | - $registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration ); |
|
1107 | + $registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration); |
|
1108 | 1108 | } else { |
1109 | 1109 | EE_Error::add_error( |
1110 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1110 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1111 | 1111 | __FILE__, __FUNCTION__, __LINE__ |
1112 | 1112 | ); |
1113 | 1113 | } |
@@ -1121,15 +1121,15 @@ discard block |
||
1121 | 1121 | * @param EE_Registration $registration |
1122 | 1122 | * @return void |
1123 | 1123 | */ |
1124 | - protected function _refresh_registration_attendee( $registration ) { |
|
1124 | + protected function _refresh_registration_attendee($registration) { |
|
1125 | 1125 | |
1126 | 1126 | $attendee = $registration->attendee(); |
1127 | 1127 | // verify object |
1128 | - if ( $attendee instanceof EE_Attendee && $attendee->ID() ) { |
|
1128 | + if ($attendee instanceof EE_Attendee && $attendee->ID()) { |
|
1129 | 1129 | // make sure the cached attendee is added to the model entity mapper |
1130 | - $registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee ); |
|
1130 | + $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee); |
|
1131 | 1131 | // maybe cache primary_attendee_obj ? |
1132 | - if ( $registration->is_primary_registrant() ) { |
|
1132 | + if ($registration->is_primary_registrant()) { |
|
1133 | 1133 | $this->primary_attendee_obj = $attendee; |
1134 | 1134 | } |
1135 | 1135 | } |
@@ -1143,19 +1143,19 @@ discard block |
||
1143 | 1143 | * @param EE_Registration $registration |
1144 | 1144 | * @return void |
1145 | 1145 | */ |
1146 | - protected function _refresh_registration_answers( $registration ) { |
|
1146 | + protected function _refresh_registration_answers($registration) { |
|
1147 | 1147 | |
1148 | 1148 | // now update the answers |
1149 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
1149 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
1150 | 1150 | // verify object |
1151 | - if ( $answer instanceof EE_Answer ) { |
|
1152 | - if ( $answer->ID() ) { |
|
1151 | + if ($answer instanceof EE_Answer) { |
|
1152 | + if ($answer->ID()) { |
|
1153 | 1153 | // make sure the cached answer is added to the model entity mapper |
1154 | - $answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer ); |
|
1154 | + $answer->get_model()->refresh_entity_map_with($answer->ID(), $answer); |
|
1155 | 1155 | } |
1156 | 1156 | } else { |
1157 | 1157 | EE_Error::add_error( |
1158 | - __( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1158 | + __('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1159 | 1159 | __FILE__, __FUNCTION__, __LINE__ |
1160 | 1160 | ); |
1161 | 1161 | } |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
1171 | 1171 | */ |
1172 | 1172 | function __wakeup() { |
1173 | - foreach ( $this->reg_steps as $reg_step ) { |
|
1173 | + foreach ($this->reg_steps as $reg_step) { |
|
1174 | 1174 | $reg_step->checkout = $this; |
1175 | 1175 | } |
1176 | 1176 | } |
@@ -1186,11 +1186,11 @@ discard block |
||
1186 | 1186 | * @param array $info |
1187 | 1187 | * @param bool $display_request |
1188 | 1188 | */ |
1189 | - function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
|
1190 | - if ( WP_DEBUG && false ) { |
|
1191 | - $debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() ); |
|
1189 | + function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { |
|
1190 | + if (WP_DEBUG && false) { |
|
1191 | + $debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array()); |
|
1192 | 1192 | $default_data = array( |
1193 | - $class => $func . '() : ' . $line, |
|
1193 | + $class => $func.'() : '.$line, |
|
1194 | 1194 | 'request->step' => $this->step, |
1195 | 1195 | 'request->action' => $this->action, |
1196 | 1196 | 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? |
@@ -1202,24 +1202,24 @@ discard block |
||
1202 | 1202 | 'reg_url_link' => $this->reg_url_link, |
1203 | 1203 | 'REQ' => $display_request ? $_REQUEST : '', |
1204 | 1204 | ); |
1205 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
1206 | - $default_data[ 'TXN_status' ] = $this->transaction->status_ID(); |
|
1207 | - $default_data[ 'TXN_reg_steps' ] = $this->transaction->reg_steps(); |
|
1208 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) { |
|
1209 | - $default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID(); |
|
1205 | + if ($this->transaction instanceof EE_Transaction) { |
|
1206 | + $default_data['TXN_status'] = $this->transaction->status_ID(); |
|
1207 | + $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); |
|
1208 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { |
|
1209 | + $default_data['registrations'][$REG_ID] = $registration->status_ID(); |
|
1210 | 1210 | } |
1211 | - if ( $this->transaction->ID() ) { |
|
1212 | - $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); |
|
1211 | + if ($this->transaction->ID()) { |
|
1212 | + $TXN_ID = 'EE_Transaction: '.$this->transaction->ID(); |
|
1213 | 1213 | // don't serialize objects |
1214 | - $info = $this->_strip_objects( $info ); |
|
1215 | - if ( ! isset( $debug_data[ $TXN_ID ] ) ) { |
|
1216 | - $debug_data[ $TXN_ID ] = array(); |
|
1214 | + $info = $this->_strip_objects($info); |
|
1215 | + if ( ! isset($debug_data[$TXN_ID])) { |
|
1216 | + $debug_data[$TXN_ID] = array(); |
|
1217 | 1217 | } |
1218 | - $debug_data[ $TXN_ID ][ microtime() ] = array_merge( |
|
1218 | + $debug_data[$TXN_ID][microtime()] = array_merge( |
|
1219 | 1219 | $default_data, |
1220 | 1220 | $info |
1221 | 1221 | ); |
1222 | - update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data ); |
|
1222 | + update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data); |
|
1223 | 1223 | } |
1224 | 1224 | } |
1225 | 1225 | } |
@@ -1232,23 +1232,23 @@ discard block |
||
1232 | 1232 | * @param array $info |
1233 | 1233 | * @return array |
1234 | 1234 | */ |
1235 | - function _strip_objects( $info = array() ) { |
|
1236 | - foreach ( $info as $key => $value ) { |
|
1237 | - if ( is_array( $value )) { |
|
1238 | - $info[ $key ] = $this->_strip_objects( $value ); |
|
1239 | - } else if ( is_object( $value ) ) { |
|
1240 | - $object_class = get_class( $value ); |
|
1241 | - $info[ $object_class ] = array(); |
|
1242 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0; |
|
1243 | - if ( method_exists( $value, 'status' ) ) { |
|
1244 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
1245 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
1246 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
1235 | + function _strip_objects($info = array()) { |
|
1236 | + foreach ($info as $key => $value) { |
|
1237 | + if (is_array($value)) { |
|
1238 | + $info[$key] = $this->_strip_objects($value); |
|
1239 | + } else if (is_object($value)) { |
|
1240 | + $object_class = get_class($value); |
|
1241 | + $info[$object_class] = array(); |
|
1242 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0; |
|
1243 | + if (method_exists($value, 'status')) { |
|
1244 | + $info[$object_class]['status'] = $value->status(); |
|
1245 | + } else if (method_exists($value, 'status_ID')) { |
|
1246 | + $info[$object_class]['status'] = $value->status_ID(); |
|
1247 | 1247 | } |
1248 | - unset( $info[ $key ] ); |
|
1248 | + unset($info[$key]); |
|
1249 | 1249 | } |
1250 | 1250 | } |
1251 | - return (array)$info; |
|
1251 | + return (array) $info; |
|
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_JSON_Response |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since $VID:$ |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_JSON_Response |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since $VID:$ |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_JSON_Response { |
15 | 15 | |
16 | 16 | /** |
@@ -107,71 +107,71 @@ discard block |
||
107 | 107 | public function __toString() { |
108 | 108 | $JSON_response = array(); |
109 | 109 | // grab notices |
110 | - $notices = EE_Error::get_notices( FALSE ); |
|
111 | - $this->set_attention( isset( $notices['attention'] ) ? $notices['attention'] : '' ); |
|
112 | - $this->set_errors( isset( $notices['errors'] ) ? $notices['errors'] : '' ); |
|
113 | - $this->set_success( isset( $notices['success'] ) ? $notices['success'] : '' ); |
|
110 | + $notices = EE_Error::get_notices(FALSE); |
|
111 | + $this->set_attention(isset($notices['attention']) ? $notices['attention'] : ''); |
|
112 | + $this->set_errors(isset($notices['errors']) ? $notices['errors'] : ''); |
|
113 | + $this->set_success(isset($notices['success']) ? $notices['success'] : ''); |
|
114 | 114 | // add notices to JSON response, but only if they exist |
115 | - if ( $this->attention() ) { |
|
115 | + if ($this->attention()) { |
|
116 | 116 | $JSON_response['attention'] = $this->attention(); |
117 | 117 | } |
118 | - if ( $this->errors() ) { |
|
118 | + if ($this->errors()) { |
|
119 | 119 | $JSON_response['errors'] = $this->errors(); |
120 | 120 | } |
121 | - if ( $this->unexpected_errors() ) { |
|
121 | + if ($this->unexpected_errors()) { |
|
122 | 122 | $JSON_response['unexpected_errors'] = $this->unexpected_errors(); |
123 | 123 | } |
124 | - if ( $this->success() ) { |
|
124 | + if ($this->success()) { |
|
125 | 125 | $JSON_response['success'] = $this->success(); |
126 | 126 | } |
127 | 127 | // but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked |
128 | - if ( ! isset( $JSON_response[ 'attention' ] ) && ! isset( $JSON_response[ 'errors' ] ) && ! isset( $JSON_response[ 'success' ] ) ) { |
|
128 | + if ( ! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) { |
|
129 | 129 | $JSON_response['success'] = null; |
130 | 130 | } |
131 | 131 | // set redirect_url, IF it exists |
132 | - if ( $this->redirect_url() ) { |
|
132 | + if ($this->redirect_url()) { |
|
133 | 133 | $JSON_response['redirect_url'] = $this->redirect_url(); |
134 | 134 | } |
135 | 135 | // set registration_time_limit, IF it exists |
136 | - if ( $this->registration_time_limit() ) { |
|
136 | + if ($this->registration_time_limit()) { |
|
137 | 137 | $JSON_response['registration_time_limit'] = $this->registration_time_limit(); |
138 | 138 | } |
139 | 139 | // set payment_amount, IF it exists |
140 | - if ( $this->payment_amount() !== null ) { |
|
141 | - $JSON_response[ 'payment_amount' ] = $this->payment_amount(); |
|
140 | + if ($this->payment_amount() !== null) { |
|
141 | + $JSON_response['payment_amount'] = $this->payment_amount(); |
|
142 | 142 | } |
143 | 143 | // grab generic return data |
144 | 144 | $return_data = $this->return_data(); |
145 | 145 | // add billing form validation rules |
146 | - if ( $this->validation_rules() ) { |
|
146 | + if ($this->validation_rules()) { |
|
147 | 147 | $return_data['validation_rules'] = $this->validation_rules(); |
148 | 148 | } |
149 | 149 | // set reg_step_html, IF it exists |
150 | - if ( $this->reg_step_html() ) { |
|
150 | + if ($this->reg_step_html()) { |
|
151 | 151 | $return_data['reg_step_html'] = $this->reg_step_html(); |
152 | 152 | } |
153 | 153 | // set method of payment, IF it exists |
154 | - if ( $this->method_of_payment() ) { |
|
154 | + if ($this->method_of_payment()) { |
|
155 | 155 | $return_data['method_of_payment'] = $this->method_of_payment(); |
156 | 156 | } |
157 | 157 | // set "plz_select_method_of_payment" message, IF it exists |
158 | - if ( $this->plz_select_method_of_payment() ) { |
|
158 | + if ($this->plz_select_method_of_payment()) { |
|
159 | 159 | $return_data['plz_select_method_of_payment'] = $this->plz_select_method_of_payment(); |
160 | 160 | } |
161 | 161 | // set redirect_form, IF it exists |
162 | - if ( $this->redirect_form() ) { |
|
162 | + if ($this->redirect_form()) { |
|
163 | 163 | $return_data['redirect_form'] = $this->redirect_form(); |
164 | 164 | } |
165 | 165 | // and finally, add return_data array to main JSON response array, IF it contains anything |
166 | 166 | // why did we add some of the above properties to the return data array? |
167 | 167 | // because it is easier and cleaner in the Javascript to deal with this way |
168 | - if ( ! empty( $return_data )) { |
|
168 | + if ( ! empty($return_data)) { |
|
169 | 169 | $JSON_response['return_data'] = $return_data; |
170 | 170 | } |
171 | 171 | // filter final array |
172 | - $JSON_response = apply_filters( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response ); |
|
172 | + $JSON_response = apply_filters('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response); |
|
173 | 173 | // return encoded array |
174 | - return json_encode( $JSON_response ); |
|
174 | + return json_encode($JSON_response); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | /** |
180 | 180 | * @param string $attention |
181 | 181 | */ |
182 | - public function set_attention( $attention ) { |
|
182 | + public function set_attention($attention) { |
|
183 | 183 | $this->_attention = $attention; |
184 | 184 | } |
185 | 185 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | /** |
198 | 198 | * @param string $errors |
199 | 199 | */ |
200 | - public function set_errors( $errors ) { |
|
200 | + public function set_errors($errors) { |
|
201 | 201 | $this->_errors = $errors; |
202 | 202 | } |
203 | 203 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | /** |
225 | 225 | * @param string $unexpected_errors |
226 | 226 | */ |
227 | - public function set_unexpected_errors( $unexpected_errors ) { |
|
227 | + public function set_unexpected_errors($unexpected_errors) { |
|
228 | 228 | $this->_unexpected_errors = $unexpected_errors; |
229 | 229 | } |
230 | 230 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | /** |
234 | 234 | * @param string $success |
235 | 235 | */ |
236 | - public function set_success( $success ) { |
|
236 | + public function set_success($success) { |
|
237 | 237 | $this->_success = $success; |
238 | 238 | } |
239 | 239 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | /** |
252 | 252 | * @param string $method_of_payment |
253 | 253 | */ |
254 | - public function set_method_of_payment( $method_of_payment ) { |
|
254 | + public function set_method_of_payment($method_of_payment) { |
|
255 | 255 | $this->_method_of_payment = $method_of_payment; |
256 | 256 | } |
257 | 257 | |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | /** |
279 | 279 | * @param float $payment_amount |
280 | 280 | */ |
281 | - public function set_payment_amount( $payment_amount ) { |
|
282 | - EE_Registry::instance()->load_helper( 'Money' ); |
|
283 | - $this->_payment_amount = EEH_Money::convert_to_float_from_localized_money( $payment_amount ); |
|
281 | + public function set_payment_amount($payment_amount) { |
|
282 | + EE_Registry::instance()->load_helper('Money'); |
|
283 | + $this->_payment_amount = EEH_Money::convert_to_float_from_localized_money($payment_amount); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | /** |
289 | 289 | * @param string $next_step_html |
290 | 290 | */ |
291 | - public function set_reg_step_html( $next_step_html ) { |
|
291 | + public function set_reg_step_html($next_step_html) { |
|
292 | 292 | $this->_reg_step_html = $next_step_html; |
293 | 293 | } |
294 | 294 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | /** |
307 | 307 | * @param string $redirect_form |
308 | 308 | */ |
309 | - public function set_redirect_form( $redirect_form ) { |
|
309 | + public function set_redirect_form($redirect_form) { |
|
310 | 310 | $this->_redirect_form = $redirect_form; |
311 | 311 | } |
312 | 312 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @return string |
317 | 317 | */ |
318 | 318 | public function redirect_form() { |
319 | - return ! empty( $this->_redirect_form ) ? $this->_redirect_form : FALSE; |
|
319 | + return ! empty($this->_redirect_form) ? $this->_redirect_form : FALSE; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | /** |
325 | 325 | * @param string $plz_select_method_of_payment |
326 | 326 | */ |
327 | - public function set_plz_select_method_of_payment( $plz_select_method_of_payment ) { |
|
327 | + public function set_plz_select_method_of_payment($plz_select_method_of_payment) { |
|
328 | 328 | $this->_plz_select_method_of_payment = $plz_select_method_of_payment; |
329 | 329 | } |
330 | 330 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | /** |
343 | 343 | * @param string $redirect_url |
344 | 344 | */ |
345 | - public function set_redirect_url( $redirect_url ) { |
|
345 | + public function set_redirect_url($redirect_url) { |
|
346 | 346 | $this->_redirect_url = $redirect_url; |
347 | 347 | } |
348 | 348 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | /** |
370 | 370 | * @param string $registration_time_limit |
371 | 371 | */ |
372 | - public function set_registration_time_limit( $registration_time_limit ) { |
|
372 | + public function set_registration_time_limit($registration_time_limit) { |
|
373 | 373 | $this->_registration_time_limit = $registration_time_limit; |
374 | 374 | } |
375 | 375 | |
@@ -378,8 +378,8 @@ discard block |
||
378 | 378 | /** |
379 | 379 | * @param array $return_data |
380 | 380 | */ |
381 | - public function set_return_data( $return_data ) { |
|
382 | - $this->_return_data = array_merge( $this->_return_data, $return_data ); |
|
381 | + public function set_return_data($return_data) { |
|
382 | + $this->_return_data = array_merge($this->_return_data, $return_data); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | |
@@ -396,9 +396,9 @@ discard block |
||
396 | 396 | /** |
397 | 397 | * @param array $validation_rules |
398 | 398 | */ |
399 | - public function add_validation_rules( $validation_rules = array() ) { |
|
400 | - if ( is_array( $validation_rules ) && ! empty( $validation_rules )) { |
|
401 | - $this->_validation_rules = array_merge( $this->_validation_rules, $validation_rules ); |
|
399 | + public function add_validation_rules($validation_rules = array()) { |
|
400 | + if (is_array($validation_rules) && ! empty($validation_rules)) { |
|
401 | + $this->_validation_rules = array_merge($this->_validation_rules, $validation_rules); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @return array | bool |
409 | 409 | */ |
410 | 410 | public function validation_rules() { |
411 | - return ! empty( $this->_validation_rules ) ? $this->_validation_rules : FALSE; |
|
411 | + return ! empty($this->_validation_rules) ? $this->_validation_rules : FALSE; |
|
412 | 412 | } |
413 | 413 | |
414 | 414 |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | * @param EE_Checkout $checkout |
21 | 21 | * @return \EE_SPCO_Reg_Step_Registration_Confirmation |
22 | 22 | */ |
23 | - public function __construct( EE_Checkout $checkout ) { |
|
23 | + public function __construct(EE_Checkout $checkout) { |
|
24 | 24 | $this->_slug = 'registration_confirmation'; |
25 | 25 | $this->_name = __('Registration Confirmation', 'event_espresso'); |
26 | - $this->_template = SPCO_TEMPLATES_PATH . 'registration_page_confirmation.template.php'; |
|
26 | + $this->_template = SPCO_TEMPLATES_PATH.'registration_page_confirmation.template.php'; |
|
27 | 27 | $this->checkout = $checkout; |
28 | 28 | } |
29 | 29 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return string |
50 | 50 | */ |
51 | 51 | public function generate_reg_form() { |
52 | - EE_Registry::instance()->REQ->add_output( 'generate_reg_form' ); |
|
52 | + EE_Registry::instance()->REQ->add_output('generate_reg_form'); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Registration_Confirmation |
|
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_SPCO_Reg_Step_Registration_Confirmation |
|
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_SPCO_Reg_Step_Registration_Confirmation extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
45 | - * @return boolean |
|
45 | + * @return boolean|null |
|
46 | 46 | */ |
47 | 47 | public function initialize_reg_step() { |
48 | 48 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | |
171 | 171 | /** |
172 | - * @return boolean |
|
172 | + * @return boolean|null |
|
173 | 173 | */ |
174 | 174 | public function update_reg_step() { |
175 | 175 | EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Attendee_Information |
|
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_SPCO_Reg_Step_Attendee_Information |
|
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_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -808,7 +808,7 @@ |
||
808 | 808 | |
809 | 809 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
810 | 810 | |
811 | - } else { |
|
811 | + } else { |
|
812 | 812 | 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__ ); |
813 | 813 | // remove malformed data |
814 | 814 | unset( $valid_data[ $reg_url_link ] ); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * _auto_copy_attendee_info |
349 | 349 | * |
350 | 350 | * @access public |
351 | - * @return EE_Form_Section_Proper |
|
351 | + * @return EE_Form_Section_HTML |
|
352 | 352 | */ |
353 | 353 | private function _auto_copy_attendee_info() { |
354 | 354 | return new EE_Form_Section_HTML( |
@@ -462,6 +462,7 @@ discard block |
||
462 | 462 | * @param EE_Registration $registration |
463 | 463 | * @param EE_Question $question |
464 | 464 | * @param mixed EE_Answer|NULL $answer |
465 | + * @param EE_Answer $answer |
|
465 | 466 | * @return EE_Form_Input_Base |
466 | 467 | */ |
467 | 468 | private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | * @param EE_Checkout $checkout |
38 | 38 | * @return \EE_SPCO_Reg_Step_Attendee_Information |
39 | 39 | */ |
40 | - public function __construct( EE_Checkout $checkout ) { |
|
40 | + public function __construct(EE_Checkout $checkout) { |
|
41 | 41 | $this->_slug = 'attendee_information'; |
42 | 42 | $this->_name = __('Attendee Information', 'event_espresso'); |
43 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
43 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
44 | 44 | $this->checkout = $checkout; |
45 | 45 | $this->_reset_success_message(); |
46 | - $this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
46 | + $this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
53 | 53 | EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso'); |
54 | 54 | EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso'); |
55 | - EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' ); |
|
55 | + EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>'); |
|
56 | 56 | EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso'); |
57 | 57 | EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso'); |
58 | 58 | EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso'); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | EEH_Autoloader::register_line_item_display_autoloaders(); |
86 | 86 | $Line_Item_Display = new EE_Line_Item_Display(); |
87 | 87 | // calculate taxes |
88 | - $Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) ); |
|
88 | + $Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true)); |
|
89 | 89 | EE_Registry::instance()->load_helper('Line_Item'); |
90 | 90 | /** @var $subsections EE_Form_Section_Proper[] */ |
91 | 91 | $subsections = array( |
@@ -97,33 +97,33 @@ discard block |
||
97 | 97 | 'ticket_count' => array() |
98 | 98 | ); |
99 | 99 | // grab the saved registrations from the transaction |
100 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
101 | - if ( $registrations ) { |
|
102 | - foreach ( $registrations as $registration ) { |
|
103 | - if ( $registration instanceof EE_Registration ) { |
|
100 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
101 | + if ($registrations) { |
|
102 | + foreach ($registrations as $registration) { |
|
103 | + if ($registration instanceof EE_Registration) { |
|
104 | 104 | // can this registration be processed during this visit ? |
105 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
106 | - $subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration ); |
|
107 | - if ( ! $this->checkout->admin_request ) { |
|
108 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
109 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1; |
|
110 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) ); |
|
111 | - $ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item; |
|
112 | - $template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item ); |
|
105 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
106 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
107 | + if ( ! $this->checkout->admin_request) { |
|
108 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
109 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1; |
|
110 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID())); |
|
111 | + $ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item; |
|
112 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item); |
|
113 | 113 | } |
114 | - if ( $registration->is_primary_registrant() ) { |
|
114 | + if ($registration->is_primary_registrant()) { |
|
115 | 115 | $primary_registrant = $registration->reg_url_link(); |
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
120 | 120 | // print_copy_info ? |
121 | - if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) { |
|
121 | + if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) { |
|
122 | 122 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
123 | 123 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info(); |
124 | 124 | // generate hidden input |
125 | - if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) { |
|
126 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
125 | + if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) { |
|
126 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -135,8 +135,7 @@ discard block |
||
135 | 135 | 'html_id' => $this->reg_form_name(), |
136 | 136 | 'subsections' => $subsections, |
137 | 137 | 'layout_strategy' => $this->checkout->admin_request ? |
138 | - new EE_Div_Per_Section_Layout() : |
|
139 | - new EE_Template_Layout( |
|
138 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
140 | 139 | array( |
141 | 140 | 'layout_template_file' => $this->_template, // layout_template |
142 | 141 | 'template_args' => $template_args |
@@ -153,61 +152,61 @@ discard block |
||
153 | 152 | * @param EE_Registration $registration |
154 | 153 | * @return EE_Form_Section_Proper |
155 | 154 | */ |
156 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
157 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
155 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
156 | + EE_Registry::instance()->load_helper('Template'); |
|
158 | 157 | static $attendee_nmbr = 1; |
159 | 158 | // array of params to pass to parent constructor |
160 | 159 | $form_args = array( |
161 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
160 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
162 | 161 | 'html_class' => 'ee-reg-form-attendee-dv', |
163 | 162 | 'html_style' => $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '', |
164 | 163 | 'subsections' => array(), |
165 | 164 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
166 | 165 | array( |
167 | 166 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
168 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
167 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
169 | 168 | ) |
170 | 169 | ) |
171 | 170 | ); |
172 | 171 | // verify that registration has valid event |
173 | - if ( $registration->event() instanceof EE_Event ) { |
|
172 | + if ($registration->event() instanceof EE_Event) { |
|
174 | 173 | $query_params = array( |
175 | 174 | array( |
176 | 175 | 'Event.EVT_ID' => $registration->event()->ID(), |
177 | 176 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
178 | 177 | ), |
179 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
178 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
180 | 179 | ); |
181 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
182 | - if ( $question_groups ) { |
|
183 | - foreach ( $question_groups as $question_group ) { |
|
184 | - if ( $question_group instanceof EE_Question_Group ) { |
|
185 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group ); |
|
180 | + $question_groups = $registration->event()->question_groups($query_params); |
|
181 | + if ($question_groups) { |
|
182 | + foreach ($question_groups as $question_group) { |
|
183 | + if ($question_group instanceof EE_Question_Group) { |
|
184 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group); |
|
186 | 185 | // add hidden input |
187 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration ); |
|
186 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration); |
|
188 | 187 | } |
189 | 188 | } |
190 | 189 | // if we have question groups for additional attendees, then display the copy options |
191 | 190 | $this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info; |
192 | 191 | } else { |
193 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML( |
|
192 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML( |
|
194 | 193 | EEH_Template::locate_template( |
195 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php', |
|
196 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
194 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php', |
|
195 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
197 | 196 | TRUE, |
198 | 197 | TRUE |
199 | 198 | ) |
200 | 199 | ); |
201 | 200 | // add hidden input |
202 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE ); |
|
201 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE); |
|
203 | 202 | } |
204 | 203 | } |
205 | - if ( $registration->is_primary_registrant() ) { |
|
204 | + if ($registration->is_primary_registrant()) { |
|
206 | 205 | // generate hidden input |
207 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration ); |
|
206 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
208 | 207 | } |
209 | 208 | $attendee_nmbr++; |
210 | - return new EE_Form_Section_Proper( $form_args ); |
|
209 | + return new EE_Form_Section_Proper($form_args); |
|
211 | 210 | } |
212 | 211 | |
213 | 212 | |
@@ -220,11 +219,11 @@ discard block |
||
220 | 219 | * @param bool $additional_attendee_reg_info |
221 | 220 | * @return EE_Form_Input_Base |
222 | 221 | */ |
223 | - private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){ |
|
222 | + private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) { |
|
224 | 223 | // generate hidden input |
225 | 224 | return new EE_Hidden_Input( |
226 | 225 | array( |
227 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
226 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
228 | 227 | 'default' => $additional_attendee_reg_info |
229 | 228 | ) |
230 | 229 | ); |
@@ -237,22 +236,22 @@ discard block |
||
237 | 236 | * @param EE_Question_Group $question_group |
238 | 237 | * @return EE_Form_Section_Proper |
239 | 238 | */ |
240 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
239 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
241 | 240 | // array of params to pass to parent constructor |
242 | 241 | $form_args = array( |
243 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
242 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
244 | 243 | 'html_class' => $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv', |
245 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
244 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
246 | 245 | 'subsections' => array( |
247 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
246 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
248 | 247 | ), |
249 | 248 | 'layout_strategy' => $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout() |
250 | 249 | ); |
251 | 250 | // where params |
252 | - $query_params = array( 'QST_deleted' => 0 ); |
|
251 | + $query_params = array('QST_deleted' => 0); |
|
253 | 252 | // don't load admin only questions on the frontend |
254 | - if ( ! $this->checkout->admin_request ) { |
|
255 | - $query_params['QST_admin_only'] = array( '!=', TRUE ); |
|
253 | + if ( ! $this->checkout->admin_request) { |
|
254 | + $query_params['QST_admin_only'] = array('!=', TRUE); |
|
256 | 255 | } |
257 | 256 | $questions = $question_group->get_many_related( |
258 | 257 | 'Question', |
@@ -264,21 +263,21 @@ discard block |
||
264 | 263 | ) |
265 | 264 | ); |
266 | 265 | // filter for additional content before questions |
267 | - $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this )); |
|
266 | + $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this)); |
|
268 | 267 | // loop thru questions |
269 | - foreach ( $questions as $question ) { |
|
270 | - if( $question instanceof EE_Question ){ |
|
268 | + foreach ($questions as $question) { |
|
269 | + if ($question instanceof EE_Question) { |
|
271 | 270 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
272 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
271 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
273 | 272 | } |
274 | 273 | } |
275 | - $form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this ); |
|
274 | + $form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this); |
|
276 | 275 | |
277 | 276 | // filter for additional content after questions |
278 | - $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this )); |
|
277 | + $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this)); |
|
279 | 278 | // d( $form_args ); |
280 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
281 | - return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this ); |
|
279 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
280 | + return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this); |
|
282 | 281 | } |
283 | 282 | |
284 | 283 | |
@@ -288,12 +287,12 @@ discard block |
||
288 | 287 | * @param EE_Question_Group $question_group |
289 | 288 | * @return EE_Form_Section_HTML |
290 | 289 | */ |
291 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
290 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
292 | 291 | $html = ''; |
293 | 292 | // group_name |
294 | - if ( $question_group->show_group_name() && $question_group->name() != '' ) { |
|
293 | + if ($question_group->show_group_name() && $question_group->name() != '') { |
|
295 | 294 | EE_Registry::instance()->load_helper('HTML'); |
296 | - if ( $this->checkout->admin_request ) { |
|
295 | + if ($this->checkout->admin_request) { |
|
297 | 296 | $html .= EEH_HTML::br(); |
298 | 297 | $html .= EEH_HTML::h3( |
299 | 298 | $question_group->name(), |
@@ -307,7 +306,7 @@ discard block |
||
307 | 306 | } |
308 | 307 | } |
309 | 308 | // group_desc |
310 | - if ( $question_group->show_group_desc() && $question_group->desc() != '' ) { |
|
309 | + if ($question_group->show_group_desc() && $question_group->desc() != '') { |
|
311 | 310 | $html .= EEH_HTML::p( |
312 | 311 | $question_group->desc(), |
313 | 312 | '', |
@@ -315,7 +314,7 @@ discard block |
||
315 | 314 | ); |
316 | 315 | |
317 | 316 | } |
318 | - return new EE_Form_Section_HTML( $html ); |
|
317 | + return new EE_Form_Section_HTML($html); |
|
319 | 318 | } |
320 | 319 | |
321 | 320 | |
@@ -324,14 +323,14 @@ discard block |
||
324 | 323 | * @access public |
325 | 324 | * @return EE_Form_Section_Proper |
326 | 325 | */ |
327 | - private function _copy_attendee_info_form(){ |
|
326 | + private function _copy_attendee_info_form() { |
|
328 | 327 | // array of params to pass to parent constructor |
329 | 328 | return new EE_Form_Section_Proper( |
330 | 329 | array( |
331 | 330 | 'subsections' => $this->_copy_attendee_info_inputs(), |
332 | 331 | 'layout_strategy' => new EE_Template_Layout( |
333 | 332 | array( |
334 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template |
|
333 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template |
|
335 | 334 | 'begin_template_file' => NULL, |
336 | 335 | 'input_template_file' => NULL, |
337 | 336 | 'subsection_template_file' => NULL, |
@@ -353,8 +352,8 @@ discard block |
||
353 | 352 | private function _auto_copy_attendee_info() { |
354 | 353 | return new EE_Form_Section_HTML( |
355 | 354 | EEH_Template::locate_template( |
356 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
357 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
355 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
356 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
358 | 357 | TRUE, |
359 | 358 | TRUE |
360 | 359 | ) |
@@ -373,25 +372,25 @@ discard block |
||
373 | 372 | $copy_attendee_info_inputs = array(); |
374 | 373 | $prev_ticket = NULL; |
375 | 374 | // grab the saved registrations from the transaction |
376 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
377 | - foreach ( $registrations as $registration ) { |
|
375 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
376 | + foreach ($registrations as $registration) { |
|
378 | 377 | // for all attendees other than the primary attendee |
379 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
378 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
380 | 379 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
381 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
380 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
382 | 381 | $item_name = $registration->ticket()->name(); |
383 | - $item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : ''; |
|
384 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
385 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
382 | + $item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : ''; |
|
383 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
384 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
386 | 385 | ); |
387 | 386 | $prev_ticket = $registration->ticket()->ID(); |
388 | 387 | } |
389 | 388 | |
390 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
389 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
391 | 390 | EE_Checkbox_Multi_Input( |
392 | - array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )), |
|
391 | + array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())), |
|
393 | 392 | array( |
394 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
393 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
395 | 394 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
396 | 395 | 'display_html_label_text' => FALSE |
397 | 396 | ) |
@@ -410,7 +409,7 @@ discard block |
||
410 | 409 | * @param EE_Registration $registration |
411 | 410 | * @return EE_Form_Input_Base |
412 | 411 | */ |
413 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
412 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
414 | 413 | // generate hidden input |
415 | 414 | return new EE_Hidden_Input( |
416 | 415 | array( |
@@ -428,31 +427,31 @@ discard block |
||
428 | 427 | * @param EE_Question $question |
429 | 428 | * @return EE_Form_Input_Base |
430 | 429 | */ |
431 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
430 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
432 | 431 | |
433 | 432 | // if this question was for an attendee detail, then check for that answer |
434 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->system_ID() ); |
|
433 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->system_ID()); |
|
435 | 434 | $answer = $answer_value === null |
436 | - ? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ) |
|
435 | + ? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))) |
|
437 | 436 | : null; |
438 | 437 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
439 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
438 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
440 | 439 | // create an EE_Answer object for storing everything in |
441 | - $answer = EE_Answer::new_instance ( array( |
|
440 | + $answer = EE_Answer::new_instance(array( |
|
442 | 441 | 'QST_ID'=> $question->ID(), |
443 | 442 | 'REG_ID'=> $registration->ID() |
444 | 443 | )); |
445 | 444 | } |
446 | 445 | // verify instance |
447 | - if( $answer instanceof EE_Answer ){ |
|
448 | - if ( ! empty( $answer_value )) { |
|
449 | - $answer->set( 'ANS_value', $answer_value ); |
|
446 | + if ($answer instanceof EE_Answer) { |
|
447 | + if ( ! empty($answer_value)) { |
|
448 | + $answer->set('ANS_value', $answer_value); |
|
450 | 449 | } |
451 | - $answer->cache( 'Question', $question ); |
|
452 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
453 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
450 | + $answer->cache('Question', $question); |
|
451 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
452 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
454 | 453 | } |
455 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
454 | + return $this->_generate_question_input($registration, $question, $answer); |
|
456 | 455 | |
457 | 456 | } |
458 | 457 | |
@@ -464,31 +463,31 @@ discard block |
||
464 | 463 | * @param mixed EE_Answer|NULL $answer |
465 | 464 | * @return EE_Form_Input_Base |
466 | 465 | */ |
467 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
466 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
468 | 467 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
469 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
470 | - add_filter( 'FHEE__EE_Question__generate_form_input__country_options', array( $this, 'use_cached_countries_for_form_input' ), 10, 4 ); |
|
471 | - add_filter( 'FHEE__EE_Question__generate_form_input__state_options', array( $this, 'use_cached_states_for_form_input' ), 10, 4 ); |
|
468 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
469 | + add_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input'), 10, 4); |
|
470 | + add_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input'), 10, 4); |
|
472 | 471 | $input_constructor_args = array( |
473 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
474 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
475 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
476 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
472 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
473 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
474 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
475 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
477 | 476 | 'html_label_class' => 'ee-reg-qstn', |
478 | 477 | ); |
479 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
480 | - if ( $answer instanceof EE_Answer && $answer->ID() ) { |
|
481 | - $input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']'; |
|
482 | - $input_constructor_args[ 'html_id' ] .= '-' . $answer->ID(); |
|
483 | - $input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID(); |
|
478 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
479 | + if ($answer instanceof EE_Answer && $answer->ID()) { |
|
480 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
481 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
482 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
484 | 483 | } |
485 | - $form_input = $question->generate_form_input( |
|
484 | + $form_input = $question->generate_form_input( |
|
486 | 485 | $registration, |
487 | 486 | $answer, |
488 | 487 | $input_constructor_args |
489 | 488 | ); |
490 | - remove_filter( 'FHEE__EE_Question__generate_form_input__country_options', array( $this, 'use_cached_countries_for_form_input' ) ); |
|
491 | - remove_filter( 'FHEE__EE_Question__generate_form_input__state_options', array( $this, 'use_cached_states_for_form_input' ) ); |
|
489 | + remove_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input')); |
|
490 | + remove_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input')); |
|
492 | 491 | return $form_input; |
493 | 492 | } |
494 | 493 | |
@@ -502,20 +501,20 @@ discard block |
||
502 | 501 | * @param EE_Registration $registration |
503 | 502 | * @return array 2d keys are country IDs, values are their names |
504 | 503 | */ |
505 | - public function use_cached_countries_for_form_input( $countries_list, $question, $registration, $answer ) { |
|
506 | - $country_options = array( '' => '' ); |
|
504 | + public function use_cached_countries_for_form_input($countries_list, $question, $registration, $answer) { |
|
505 | + $country_options = array('' => ''); |
|
507 | 506 | // get possibly cached list of countries |
508 | 507 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
509 | - if ( ! empty( $countries )) { |
|
510 | - foreach( $countries as $country ){ |
|
511 | - if ( $country instanceof EE_Country ) { |
|
512 | - $country_options[ $country->ID() ] = $country->name(); |
|
508 | + if ( ! empty($countries)) { |
|
509 | + foreach ($countries as $country) { |
|
510 | + if ($country instanceof EE_Country) { |
|
511 | + $country_options[$country->ID()] = $country->name(); |
|
513 | 512 | } |
514 | 513 | } |
515 | 514 | } |
516 | - if( $question instanceof EE_Question |
|
517 | - && $registration instanceof EE_Registration ) { |
|
518 | - $answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ); |
|
515 | + if ($question instanceof EE_Question |
|
516 | + && $registration instanceof EE_Registration) { |
|
517 | + $answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))); |
|
519 | 518 | } else { |
520 | 519 | $answer = EE_Answer::new_instance(); |
521 | 520 | } |
@@ -540,19 +539,19 @@ discard block |
||
540 | 539 | * @param EE_Registration $registration |
541 | 540 | * @return array 2d keys are state IDs, values are their names |
542 | 541 | */ |
543 | - public function use_cached_states_for_form_input( $states_list, $question, $registration, $answer ) { |
|
544 | - $state_options = array( '' => array( '' => '')); |
|
542 | + public function use_cached_states_for_form_input($states_list, $question, $registration, $answer) { |
|
543 | + $state_options = array('' => array('' => '')); |
|
545 | 544 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
546 | - if ( ! empty( $states )) { |
|
547 | - foreach( $states as $state ){ |
|
548 | - if ( $state instanceof EE_State ) { |
|
549 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
545 | + if ( ! empty($states)) { |
|
546 | + foreach ($states as $state) { |
|
547 | + if ($state instanceof EE_State) { |
|
548 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
550 | 549 | } |
551 | 550 | } |
552 | 551 | } |
553 | - if( $question instanceof EE_Question |
|
554 | - && $registration instanceof EE_Registration ) { |
|
555 | - $answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ); |
|
552 | + if ($question instanceof EE_Question |
|
553 | + && $registration instanceof EE_Registration) { |
|
554 | + $answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))); |
|
556 | 555 | } else { |
557 | 556 | $answer = EE_Answer::new_instance(); |
558 | 557 | } |
@@ -586,65 +585,65 @@ discard block |
||
586 | 585 | */ |
587 | 586 | public function process_reg_step() { |
588 | 587 | |
589 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
588 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
590 | 589 | // grab validated data from form |
591 | 590 | $valid_data = $this->checkout->current_step->valid_data(); |
592 | 591 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
593 | 592 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
594 | 593 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
595 | - if ( empty( $valid_data )) { |
|
596 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
594 | + if (empty($valid_data)) { |
|
595 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
597 | 596 | return FALSE; |
598 | 597 | } |
599 | 598 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
600 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
601 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
599 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
600 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
602 | 601 | return FALSE; |
603 | 602 | } |
604 | 603 | // get cached registrations |
605 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
604 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
606 | 605 | // verify we got the goods |
607 | - if ( empty( $registrations )) { |
|
608 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
606 | + if (empty($registrations)) { |
|
607 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
609 | 608 | return FALSE; |
610 | 609 | } |
611 | 610 | // extract attendee info from form data and save to model objects |
612 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
611 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
613 | 612 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
614 | - if ( $registrations_processed === FALSE ) { |
|
613 | + if ($registrations_processed === FALSE) { |
|
615 | 614 | // but return immediately if the previous step exited early due to errors |
616 | 615 | return FALSE; |
617 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
616 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
618 | 617 | // generate a correctly translated string for all possible singular/plural combinations |
619 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
618 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
620 | 619 | $error_msg = sprintf( |
621 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
620 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
622 | 621 | $this->checkout->total_ticket_count, |
623 | 622 | $registrations_processed |
624 | 623 | ); |
625 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
624 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
626 | 625 | $error_msg = sprintf( |
627 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
626 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
628 | 627 | $this->checkout->total_ticket_count, |
629 | 628 | $registrations_processed |
630 | 629 | ); |
631 | 630 | } else { |
632 | 631 | $error_msg = sprintf( |
633 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
632 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
634 | 633 | $this->checkout->total_ticket_count, |
635 | 634 | $registrations_processed |
636 | 635 | ); |
637 | 636 | |
638 | 637 | } |
639 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
638 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
640 | 639 | return FALSE; |
641 | 640 | } |
642 | 641 | // mark this reg step as completed |
643 | 642 | $this->set_completed(); |
644 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
643 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
645 | 644 | //do action in case a plugin wants to do something with the data submitted in step 1. |
646 | 645 | //passes EE_Single_Page_Checkout, and it's posted data |
647 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
646 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
648 | 647 | return TRUE; |
649 | 648 | |
650 | 649 | } |
@@ -658,9 +657,9 @@ discard block |
||
658 | 657 | * @param array $valid_data |
659 | 658 | * @return boolean | int |
660 | 659 | */ |
661 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
660 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
662 | 661 | // load resources and set some defaults |
663 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
662 | + EE_Registry::instance()->load_model('Attendee'); |
|
664 | 663 | // holder for primary registrant attendee object |
665 | 664 | $this->checkout->primary_attendee_obj = NULL; |
666 | 665 | // array for tracking reg form data for the primary registrant |
@@ -677,19 +676,19 @@ discard block |
||
677 | 676 | // attendee counter |
678 | 677 | $att_nmbr = 0; |
679 | 678 | // grab the saved registrations from the transaction |
680 | - foreach ( $registrations as $registration ) { |
|
679 | + foreach ($registrations as $registration) { |
|
681 | 680 | // verify EE_Registration object |
682 | - if ( ! $registration instanceof EE_Registration ) { |
|
683 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
681 | + if ( ! $registration instanceof EE_Registration) { |
|
682 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
684 | 683 | return FALSE; |
685 | 684 | } |
686 | 685 | $reg_url_link = $registration->reg_url_link(); |
687 | 686 | // reg_url_link exists ? |
688 | - if ( $reg_url_link ) { |
|
687 | + if ($reg_url_link) { |
|
689 | 688 | // should this registration be processed during this visit ? |
690 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
689 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
691 | 690 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
692 | - if ( ! $this->checkout->revisit ) { |
|
691 | + if ( ! $this->checkout->revisit) { |
|
693 | 692 | $registration->save(); |
694 | 693 | } |
695 | 694 | |
@@ -700,41 +699,41 @@ discard block |
||
700 | 699 | * @var bool if TRUE is returned by the plugin then the |
701 | 700 | * registration processing is halted. |
702 | 701 | */ |
703 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
702 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
704 | 703 | return FALSE; |
705 | 704 | } |
706 | 705 | |
707 | 706 | // Houston, we have a registration! |
708 | 707 | $att_nmbr++; |
709 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
708 | + $this->_attendee_data[$reg_url_link] = array(); |
|
710 | 709 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
711 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
710 | + if (isset($valid_data[$reg_url_link])) { |
|
712 | 711 | // do we need to copy basic info from primary attendee ? |
713 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE; |
|
712 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE; |
|
714 | 713 | // filter form input data for this registration |
715 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
714 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
716 | 715 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
717 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
718 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
719 | - unset( $valid_data['primary_attendee'] ); |
|
716 | + if (isset($valid_data['primary_attendee'])) { |
|
717 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
718 | + unset($valid_data['primary_attendee']); |
|
720 | 719 | } |
721 | 720 | // now loop through our array of valid post data && process attendee reg forms |
722 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
723 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
724 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
721 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
722 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
723 | + foreach ($form_inputs as $form_input => $input_value) { |
|
725 | 724 | // check for critical inputs |
726 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
725 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
727 | 726 | return FALSE; |
728 | 727 | } |
729 | 728 | // store a bit of data about the primary attendee |
730 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
731 | - $primary_registrant[ $form_input ] = $input_value; |
|
732 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
733 | - $input_value = $primary_registrant[ $form_input ]; |
|
729 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
730 | + $primary_registrant[$form_input] = $input_value; |
|
731 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
732 | + $input_value = $primary_registrant[$form_input]; |
|
734 | 733 | } |
735 | 734 | // now attempt to save the input data |
736 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
737 | - EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ ); |
|
735 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
736 | + EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__); |
|
738 | 737 | return FALSE; |
739 | 738 | } |
740 | 739 | } |
@@ -743,51 +742,51 @@ discard block |
||
743 | 742 | } |
744 | 743 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
745 | 744 | // this registration does not require additional attendee information ? |
746 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
745 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
747 | 746 | // just copy the primary registrant |
748 | 747 | $attendee = $this->checkout->primary_attendee_obj; |
749 | 748 | } else { |
750 | 749 | // have we met before? |
751 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
750 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
752 | 751 | // did we find an already existing record for this attendee ? |
753 | - if ( $attendee instanceof EE_Attendee ) { |
|
754 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
752 | + if ($attendee instanceof EE_Attendee) { |
|
753 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
755 | 754 | } else { |
756 | 755 | // ensure critical details are set for additional attendees |
757 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ]; |
|
758 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
756 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link]; |
|
757 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
759 | 758 | } |
760 | 759 | // who's #1 ? |
761 | - if ( $att_nmbr == 1 ) { |
|
760 | + if ($att_nmbr == 1) { |
|
762 | 761 | $this->checkout->primary_attendee_obj = $attendee; |
763 | 762 | } |
764 | 763 | } |
765 | 764 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
766 | 765 | // add relation to registration, set attendee ID, and cache attendee |
767 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
768 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
769 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
766 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
767 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
768 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
770 | 769 | return FALSE; |
771 | 770 | } |
772 | 771 | /** @type EE_Registration_Processor $registration_processor */ |
773 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
772 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
774 | 773 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
775 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
774 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
776 | 775 | /** @type EE_Transaction_Processor $transaction_processor */ |
777 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
776 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
778 | 777 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
779 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
778 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
780 | 779 | // if we've gotten this far, then let's save what we have |
781 | 780 | $registration->save(); |
782 | 781 | // add relation between TXN and registration |
783 | - $this->_associate_registration_with_transaction( $registration ); |
|
782 | + $this->_associate_registration_with_transaction($registration); |
|
784 | 783 | |
785 | 784 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
786 | 785 | |
787 | - } else { |
|
788 | - 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__ ); |
|
786 | + } else { |
|
787 | + 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__); |
|
789 | 788 | // remove malformed data |
790 | - unset( $valid_data[ $reg_url_link ] ); |
|
789 | + unset($valid_data[$reg_url_link]); |
|
791 | 790 | return FALSE; |
792 | 791 | } |
793 | 792 | |
@@ -805,22 +804,22 @@ discard block |
||
805 | 804 | * @param string $input_value |
806 | 805 | * @return boolean |
807 | 806 | */ |
808 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
807 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
809 | 808 | //echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span> <b style="font-size:10px;"> ' . __LINE__ . ' </b></h3>'; |
810 | 809 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
811 | 810 | // allow for plugins to hook in and do their own processing of the form input. |
812 | 811 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
813 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
812 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
814 | 813 | return TRUE; |
815 | 814 | } |
816 | 815 | |
817 | 816 | // grab related answer objects |
818 | 817 | $answers = $registration->answers(); |
819 | 818 | // $answer_cache_id is the key used to find the EE_Answer we want |
820 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
821 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
819 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
820 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
822 | 821 | //rename form_inputs if they are EE_Attendee properties |
823 | - switch( (string)$form_input ) { |
|
822 | + switch ((string) $form_input) { |
|
824 | 823 | |
825 | 824 | case 'state' : |
826 | 825 | case 'STA_ID' : |
@@ -835,33 +834,33 @@ discard block |
||
835 | 834 | break; |
836 | 835 | |
837 | 836 | default : |
838 | - $ATT_input = 'ATT_' . $form_input; |
|
837 | + $ATT_input = 'ATT_'.$form_input; |
|
839 | 838 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
840 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
841 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
839 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
840 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
842 | 841 | } |
843 | 842 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
844 | 843 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
845 | 844 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
846 | 845 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
847 | 846 | // if this form input has a corresponding attendee property |
848 | - if ( $attendee_property ) { |
|
849 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
850 | - if ( $answer_is_obj ) { |
|
847 | + if ($attendee_property) { |
|
848 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
849 | + if ($answer_is_obj) { |
|
851 | 850 | // and delete the corresponding answer since we won't be storing this data in that object |
852 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
853 | - $answers[ $answer_cache_id ]->delete_permanently(); |
|
851 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
852 | + $answers[$answer_cache_id]->delete_permanently(); |
|
854 | 853 | } |
855 | 854 | return TRUE; |
856 | - } elseif ( $answer_is_obj ) { |
|
855 | + } elseif ($answer_is_obj) { |
|
857 | 856 | // save this data to the answer object |
858 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
859 | - $result = $answers[ $answer_cache_id ]->save(); |
|
857 | + $answers[$answer_cache_id]->set_value($input_value); |
|
858 | + $result = $answers[$answer_cache_id]->save(); |
|
860 | 859 | return $result !== false ? true : false; |
861 | 860 | } else { |
862 | - foreach ( $answers as $answer ) { |
|
863 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
864 | - $answer->set_value( $input_value ); |
|
861 | + foreach ($answers as $answer) { |
|
862 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
863 | + $answer->set_value($input_value); |
|
865 | 864 | $result = $answer->save(); |
866 | 865 | return $result !== false ? true : false; |
867 | 866 | } |
@@ -879,31 +878,31 @@ discard block |
||
879 | 878 | * @param string $input_value |
880 | 879 | * @return boolean |
881 | 880 | */ |
882 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
883 | - if ( empty( $input_value )) { |
|
881 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
882 | + if (empty($input_value)) { |
|
884 | 883 | // if the form input isn't marked as being required, then just return |
885 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
884 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
886 | 885 | return true; |
887 | 886 | } |
888 | - switch( $form_input ) { |
|
887 | + switch ($form_input) { |
|
889 | 888 | case 'fname' : |
890 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
889 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
891 | 890 | return FALSE; |
892 | 891 | break; |
893 | 892 | case 'lname' : |
894 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
893 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
895 | 894 | return FALSE; |
896 | 895 | break; |
897 | 896 | case 'email' : |
898 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
897 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
899 | 898 | return FALSE; |
900 | 899 | break; |
901 | 900 | } |
902 | - } else if ( $form_input === 'email' ) { |
|
901 | + } else if ($form_input === 'email') { |
|
903 | 902 | // check that an email was entered |
904 | - if ( empty( $input_value ) ) { |
|
903 | + if (empty($input_value)) { |
|
905 | 904 | // whoops!!! |
906 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
905 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
907 | 906 | return FALSE; |
908 | 907 | } |
909 | 908 | } |
@@ -931,14 +930,14 @@ discard block |
||
931 | 930 | * @param array $attendee_data |
932 | 931 | * @return boolean |
933 | 932 | */ |
934 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
933 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
935 | 934 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
936 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
937 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
938 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
935 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
936 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
937 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
939 | 938 | // but only if those have values |
940 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
941 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
939 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
940 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
942 | 941 | 'ATT_fname' => $ATT_fname, |
943 | 942 | 'ATT_lname' => $ATT_lname, |
944 | 943 | 'ATT_email' => $ATT_email |
@@ -946,7 +945,7 @@ discard block |
||
946 | 945 | } else { |
947 | 946 | $existing_attendee = NULL; |
948 | 947 | } |
949 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
948 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
950 | 949 | } |
951 | 950 | |
952 | 951 | |
@@ -958,13 +957,13 @@ discard block |
||
958 | 957 | * @param array $attendee_data |
959 | 958 | * @return \EE_Attendee |
960 | 959 | */ |
961 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
960 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
962 | 961 | // first remove fname, lname, and email from attendee data |
963 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
962 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
964 | 963 | // now loop thru what's left and add to attendee CPT |
965 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
966 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
967 | - $existing_attendee->set( $property_name, $property_value ); |
|
964 | + foreach ($attendee_data as $property_name => $property_value) { |
|
965 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
966 | + $existing_attendee->set($property_name, $property_value); |
|
968 | 967 | } |
969 | 968 | } |
970 | 969 | // better save that now |
@@ -981,11 +980,11 @@ discard block |
||
981 | 980 | * @param EE_Attendee $attendee |
982 | 981 | * @return void |
983 | 982 | */ |
984 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
983 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
985 | 984 | // add relation to attendee |
986 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
987 | - $registration->set_attendee_id( $attendee->ID() ); |
|
988 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
985 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
986 | + $registration->set_attendee_id($attendee->ID()); |
|
987 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
989 | 988 | } |
990 | 989 | |
991 | 990 | |
@@ -996,10 +995,10 @@ discard block |
||
996 | 995 | * @param EE_Registration $registration |
997 | 996 | * @return void |
998 | 997 | */ |
999 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
998 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1000 | 999 | // add relation to attendee |
1001 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1002 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1000 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1001 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1003 | 1002 | } |
1004 | 1003 | |
1005 | 1004 | |
@@ -1011,17 +1010,17 @@ discard block |
||
1011 | 1010 | * @param array $attendee_data |
1012 | 1011 | * @return array |
1013 | 1012 | */ |
1014 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1013 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1015 | 1014 | // bare minimum critical details include first name, last name, email address |
1016 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1015 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1017 | 1016 | // add address info to critical details? |
1018 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
1019 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
1020 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1017 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
1018 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
1019 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1021 | 1020 | } |
1022 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1023 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
1024 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
1021 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1022 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
1023 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
1025 | 1024 | } |
1026 | 1025 | } |
1027 | 1026 | return $attendee_data; |
@@ -1036,11 +1035,11 @@ discard block |
||
1036 | 1035 | * @param array $attendee_data |
1037 | 1036 | * @return \EE_Attendee |
1038 | 1037 | */ |
1039 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1038 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1040 | 1039 | // create new attendee object |
1041 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1040 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1042 | 1041 | // set author to event creator |
1043 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1042 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1044 | 1043 | $new_attendee->save(); |
1045 | 1044 | return $new_attendee; |
1046 | 1045 | } |
@@ -1056,7 +1055,7 @@ discard block |
||
1056 | 1055 | */ |
1057 | 1056 | public function update_reg_step() { |
1058 | 1057 | // save everything |
1059 | - if ( $this->process_reg_step() ) { |
|
1058 | + if ($this->process_reg_step()) { |
|
1060 | 1059 | $this->checkout->redirect = TRUE; |
1061 | 1060 | $this->checkout->redirect_url = add_query_arg( |
1062 | 1061 | array( |
@@ -1065,7 +1064,7 @@ discard block |
||
1065 | 1064 | ), |
1066 | 1065 | $this->checkout->thank_you_page_url |
1067 | 1066 | ); |
1068 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1067 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1069 | 1068 | return TRUE; |
1070 | 1069 | } |
1071 | 1070 | return FALSE; |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <p class="spco-attendee-info-not-required-pg smaller-text lt-grey-text"> |
2 | - <?php echo apply_filters( 'FHEE__registration_page_attendee_information__attendee_info_not_required_pg', __( 'This ticket type does not require any information for additional attendees, so attendee #1\'s information will be used for its registration purposes.', 'event_espresso' ));?> |
|
2 | + <?php echo apply_filters('FHEE__registration_page_attendee_information__attendee_info_not_required_pg', __('This ticket type does not require any information for additional attendees, so attendee #1\'s information will be used for its registration purposes.', 'event_espresso')); ?> |
|
3 | 3 | </p> |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <p id="spco-auto-copy-attendee-pg" class="smaller-text lt-grey-text"> |
2 | - <?php echo apply_filters( 'FHEE__registration_page_attendee_information__auto_copy_attendee_pg', __('The above information will be used for any additional tickets/attendees.', 'event_espresso' ));?> |
|
2 | + <?php echo apply_filters('FHEE__registration_page_attendee_information__auto_copy_attendee_pg', __('The above information will be used for any additional tickets/attendees.', 'event_espresso')); ?> |
|
3 | 3 | </p> |
4 | 4 | \ No newline at end of file |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <div id="spco-copy-attendee-dv" class="hide-if-no-js"> |
2 | 2 | |
3 | 3 | <p class="spco-copy-all-attendee-pg"> |
4 | - <label class="ee-checkbox-label-before ee-checkbox-label-wide"><?php _e('Use Attendee #1\'s information for ALL attendees', 'event_espresso');?> |
|
4 | + <label class="ee-checkbox-label-before ee-checkbox-label-wide"><?php _e('Use Attendee #1\'s information for ALL attendees', 'event_espresso'); ?> |
|
5 | 5 | <input id="spco-copy-all-attendee-chk" class="spco-copy-all-attendee-chk ee-do-not-validate" type="checkbox" value="copy-all"> |
6 | 6 | </label> |
7 | 7 | </p> |
8 | 8 | |
9 | - <p class="spco-copy-attendee-pg"><?php echo apply_filters( 'FHEE__registration_page_attendee_information__copy_attendee_pg', sprintf( __('This option allows you to use the above information for all additional attendee question fields. %sPlease note:%s some events may have additional questions that you may still be required to answer in order to complete your registration.', 'event_espresso'), '<strong>', '</strong>' )); ?></p> |
|
9 | + <p class="spco-copy-attendee-pg"><?php echo apply_filters('FHEE__registration_page_attendee_information__copy_attendee_pg', sprintf(__('This option allows you to use the above information for all additional attendee question fields. %sPlease note:%s some events may have additional questions that you may still be required to answer in order to complete your registration.', 'event_espresso'), '<strong>', '</strong>')); ?></p> |
|
10 | 10 | |
11 | - <a id="display-more-attendee-copy-options" class="display-the-hidden smaller-text float-right" rel="more-attendee-copy-options" ><span class="dashicons dashicons-arrow-right"></span><?php _e('advanced copy options', 'event_espresso');?></a> |
|
12 | - <a id="hide-more-attendee-copy-options" class="hide-the-displayed smaller-text float-right" rel="more-attendee-copy-options" style="display: none;"><span class="dashicons dashicons-arrow-down"></span><?php _e('basic copy options', 'event_espresso');?></a> |
|
11 | + <a id="display-more-attendee-copy-options" class="display-the-hidden smaller-text float-right" rel="more-attendee-copy-options" ><span class="dashicons dashicons-arrow-right"></span><?php _e('advanced copy options', 'event_espresso'); ?></a> |
|
12 | + <a id="hide-more-attendee-copy-options" class="hide-the-displayed smaller-text float-right" rel="more-attendee-copy-options" style="display: none;"><span class="dashicons dashicons-arrow-down"></span><?php _e('basic copy options', 'event_espresso'); ?></a> |
|
13 | 13 | |
14 | 14 | <div id="more-attendee-copy-options-dv" class="" style="display: none;"> |
15 | 15 | |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | <?php _e('Only copy the above information to the following selected additional attendees.', 'event_espresso'); ?> |
18 | 18 | </p> |
19 | 19 | |
20 | - <?php foreach ( $spco_copy_attendee_chk as $spco_copy_chk ) { echo $spco_copy_chk; } ?> |
|
20 | + <?php foreach ($spco_copy_attendee_chk as $spco_copy_chk) { echo $spco_copy_chk; } ?> |
|
21 | 21 | |
22 | 22 | </div> |
23 | 23 | <div class="clear-float"></div> |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Finalize_Registration |
|
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_SPCO_Reg_Step_Finalize_Registration |
|
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_SPCO_Reg_Step_Finalize_Registration extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param EE_Checkout $checkout |
21 | 21 | * @return \EE_SPCO_Reg_Step_Finalize_Registration |
22 | 22 | */ |
23 | - public function __construct( EE_Checkout $checkout ) { |
|
23 | + public function __construct(EE_Checkout $checkout) { |
|
24 | 24 | $this->_slug = 'finalize_registration'; |
25 | 25 | $this->_name = __('Finalize Registration', 'event_espresso'); |
26 | 26 | $this->_submit_button_text = $this->_name; |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | public function initialize_reg_step() { |
48 | 48 | |
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 | - $this->checkout->action = $_REQUEST[ 'action' ] = 'process_reg_step'; |
|
52 | + $this->checkout->action = $_REQUEST['action'] = 'process_reg_step'; |
|
53 | 53 | $this->checkout->generate_reg_form = false; |
54 | 54 | } |
55 | 55 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function process_reg_step() { |
74 | 74 | // ensure all data gets refreshed from the db |
75 | - $this->checkout->refresh_all_entities( true ); |
|
75 | + $this->checkout->refresh_all_entities(true); |
|
76 | 76 | // ensures that all details and statuses for transaction, registration, and payments are updated |
77 | 77 | $txn_update_params = $this->_finalize_transaction(); |
78 | 78 | // DEBUG LOG |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | // ) |
87 | 87 | //); |
88 | 88 | // set a hook point |
89 | - do_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params ); |
|
89 | + do_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params); |
|
90 | 90 | // check if transaction has a primary registrant and that it has a related Attendee object |
91 | - if ( $this->checkout->transaction_has_primary_registrant() ) { |
|
91 | + if ($this->checkout->transaction_has_primary_registrant()) { |
|
92 | 92 | // setup URL for redirect |
93 | 93 | $this->checkout->redirect_url = add_query_arg( |
94 | - array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ), |
|
94 | + array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()), |
|
95 | 95 | $this->checkout->thank_you_page_url |
96 | 96 | ); |
97 | 97 | } else { |
98 | - EE_Error::add_error( __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
98 | + EE_Error::add_error(__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
99 | 99 | $this->checkout->redirect = false; |
100 | 100 | $this->checkout->continue_reg = false; |
101 | 101 | return false; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | // you don't have to go home but you can't stay here ! |
104 | 104 | $this->checkout->redirect = true; |
105 | 105 | $this->checkout->continue_reg = true; |
106 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
107 | - if ( ! ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) ) { |
|
106 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
107 | + if ( ! ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site())) { |
|
108 | 108 | // mark this reg step as completed |
109 | 109 | $this->checkout->current_step->set_completed(); |
110 | 110 | } |
@@ -121,43 +121,43 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected function _finalize_transaction() { |
123 | 123 | /** @type EE_Transaction_Processor $transaction_processor */ |
124 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
124 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
125 | 125 | //set revisit flag in txn processor |
126 | - $transaction_processor->set_revisit( $this->checkout->revisit ); |
|
126 | + $transaction_processor->set_revisit($this->checkout->revisit); |
|
127 | 127 | // at this point we'll consider a TXN to not have been abandoned |
128 | - $transaction_processor->toggle_abandoned_transaction_status( $this->checkout->transaction ); |
|
129 | - if ( $this->checkout->cart instanceof EE_Cart ) { |
|
128 | + $transaction_processor->toggle_abandoned_transaction_status($this->checkout->transaction); |
|
129 | + if ($this->checkout->cart instanceof EE_Cart) { |
|
130 | 130 | // save TXN data to the cart |
131 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
131 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
132 | 132 | } |
133 | 133 | /** @type EE_Transaction_Payments $transaction_payments */ |
134 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
134 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
135 | 135 | // maybe update status, but don't save transaction just yet |
136 | - $transaction_payments->update_transaction_status_based_on_total_paid( $this->checkout->transaction, false ); |
|
136 | + $transaction_payments->update_transaction_status_based_on_total_paid($this->checkout->transaction, false); |
|
137 | 137 | // If the selected method of payment used an off-site gateway... |
138 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
139 | - $is_revisit = filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN ); |
|
140 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) { |
|
141 | - $gateway= $this->checkout->payment_method->type_obj()->get_gateway(); |
|
142 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
138 | + if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
139 | + $is_revisit = filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN); |
|
140 | + if ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site()) { |
|
141 | + $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
|
142 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
143 | 143 | // do NOT trigger notifications because it was already done during the IPN |
144 | - remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' ); |
|
145 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
146 | - } else if ( ! $is_revisit ) { |
|
147 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
144 | + remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
145 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
146 | + } else if ( ! $is_revisit) { |
|
147 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
148 | 148 | } |
149 | 149 | } else if ( |
150 | 150 | // if SPCO revisit and TXN status has changed due to a payment |
151 | - $is_revisit && ( $this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated() ) |
|
151 | + $is_revisit && ($this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated()) |
|
152 | 152 | ) { |
153 | 153 | // send out notifications |
154 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
155 | - } else if ( ! $is_revisit ) { |
|
156 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
154 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
155 | + } else if ( ! $is_revisit) { |
|
156 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | // this will result in the base session properties getting saved to the TXN_Session_data field |
160 | - $this->checkout->transaction->set_txn_session_data( EE_Registry::instance()->SSN->get_session_data( null, true )); |
|
160 | + $this->checkout->transaction->set_txn_session_data(EE_Registry::instance()->SSN->get_session_data(null, true)); |
|
161 | 161 | |
162 | 162 | // update the TXN if payment conditions have changed |
163 | 163 | return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @return boolean |
175 | 175 | */ |
176 | 176 | public function update_reg_step() { |
177 | - EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
|
177 | + EE_Error::doing_it_wrong(__CLASS__.'::'.__FILE__, __('Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | /** |
28 | 28 | * Applies all teh individual item validation strategies on each item in the array |
29 | 29 | * @param array $normalized_value |
30 | - * @return boolean |
|
30 | + * @return boolean|null |
|
31 | 31 | */ |
32 | 32 | function validate($normalized_value) { |
33 | 33 | if( is_array($normalized_value)){ |