@@ -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,14 +356,14 @@ 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() ) { |
|
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 | 362 | // advance to the next step |
363 | - $this->set_current_step( $this->next_step->slug() ); |
|
364 | - $step_to_skip->set_is_current_step( false ); |
|
363 | + $this->set_current_step($this->next_step->slug()); |
|
364 | + $step_to_skip->set_is_current_step(false); |
|
365 | 365 | $step_to_skip->set_completed(); |
366 | - $this->set_reg_step_initiated( $this->current_step ); |
|
366 | + $this->set_reg_step_initiated($this->current_step); |
|
367 | 367 | } |
368 | 368 | } |
369 | 369 | |
@@ -377,16 +377,16 @@ discard block |
||
377 | 377 | * @param bool $reset whether to reset reg steps after removal |
378 | 378 | * @throws EE_Error |
379 | 379 | */ |
380 | - public function remove_reg_step( $reg_step_slug = '', $reset = true ) { |
|
381 | - unset( $this->reg_steps[ $reg_step_slug ] ); |
|
382 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
380 | + public function remove_reg_step($reg_step_slug = '', $reset = true) { |
|
381 | + unset($this->reg_steps[$reg_step_slug]); |
|
382 | + if ($this->transaction instanceof EE_Transaction) { |
|
383 | 383 | /** @type EE_Transaction_Processor $transaction_processor */ |
384 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
384 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
385 | 385 | // now remove reg step from TXN and save |
386 | - $transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug ); |
|
386 | + $transaction_processor->remove_reg_step($this->transaction, $reg_step_slug); |
|
387 | 387 | $this->transaction->save(); |
388 | 388 | } |
389 | - if ( $reset ) { |
|
389 | + if ($reset) { |
|
390 | 390 | $this->reset_reg_steps(); |
391 | 391 | } |
392 | 392 | } |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | * @param int $order |
402 | 402 | * @return void |
403 | 403 | */ |
404 | - public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
|
405 | - if ( isset( $this->reg_steps[ $reg_step_slug ] )) { |
|
406 | - $this->reg_steps[ $reg_step_slug ]->set_order( $order ); |
|
404 | + public function set_reg_step_order($reg_step_slug = '', $order = 100) { |
|
405 | + if (isset($this->reg_steps[$reg_step_slug])) { |
|
406 | + $this->reg_steps[$reg_step_slug]->set_order($order); |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | |
@@ -416,25 +416,25 @@ discard block |
||
416 | 416 | * @param string $current_step |
417 | 417 | * @return void |
418 | 418 | */ |
419 | - public function set_current_step( $current_step ) { |
|
419 | + public function set_current_step($current_step) { |
|
420 | 420 | // grab what step we're on |
421 | - $this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps ); |
|
421 | + $this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps); |
|
422 | 422 | // verify instance |
423 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step ) { |
|
423 | + if ($this->current_step instanceof EE_SPCO_Reg_Step) { |
|
424 | 424 | // we don't want to repeat completed steps if this is the first time through SPCO |
425 | - if ( $this->continue_reg && $this->current_step->completed() && ! $this->revisit ) { |
|
425 | + if ($this->continue_reg && $this->current_step->completed() && ! $this->revisit) { |
|
426 | 426 | // so advance to the next step |
427 | 427 | $this->set_next_step(); |
428 | - if ( $this->next_step instanceof EE_SPCO_Reg_Step ) { |
|
428 | + if ($this->next_step instanceof EE_SPCO_Reg_Step) { |
|
429 | 429 | // and attempt to set it as the current step |
430 | - $this->set_current_step( $this->next_step->slug() ); |
|
430 | + $this->set_current_step($this->next_step->slug()); |
|
431 | 431 | } |
432 | 432 | return; |
433 | 433 | } |
434 | - $this->current_step->set_is_current_step( TRUE ); |
|
434 | + $this->current_step->set_is_current_step(TRUE); |
|
435 | 435 | } else { |
436 | 436 | EE_Error::add_error( |
437 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
437 | + __('The current step could not be set.', 'event_espresso'), |
|
438 | 438 | __FILE__, __FUNCTION__, __LINE__ |
439 | 439 | ); |
440 | 440 | } |
@@ -451,20 +451,20 @@ discard block |
||
451 | 451 | */ |
452 | 452 | public function set_next_step() { |
453 | 453 | // set pointer to start of array |
454 | - reset( $this->reg_steps ); |
|
454 | + reset($this->reg_steps); |
|
455 | 455 | // if there is more than one step |
456 | - if ( count( $this->reg_steps ) > 1 ) { |
|
456 | + if (count($this->reg_steps) > 1) { |
|
457 | 457 | // advance to the current step and set pointer |
458 | - while ( key( $this->reg_steps ) != $this->current_step->slug() && key( $this->reg_steps ) != '' ) { |
|
459 | - next( $this->reg_steps ); |
|
458 | + while (key($this->reg_steps) != $this->current_step->slug() && key($this->reg_steps) != '') { |
|
459 | + next($this->reg_steps); |
|
460 | 460 | } |
461 | 461 | } |
462 | 462 | // advance one more spot ( if it exists ) |
463 | - $this->next_step = next( $this->reg_steps ); |
|
463 | + $this->next_step = next($this->reg_steps); |
|
464 | 464 | // verify instance |
465 | - $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
465 | + $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
466 | 466 | // then back to current step to reset |
467 | - prev( $this->reg_steps ); |
|
467 | + prev($this->reg_steps); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | * @return EE_SPCO_Reg_Step | null |
479 | 479 | */ |
480 | 480 | public function get_next_reg_step() { |
481 | - $next = next( $this->reg_steps ); |
|
482 | - prev( $this->reg_steps ); |
|
481 | + $next = next($this->reg_steps); |
|
482 | + prev($this->reg_steps); |
|
483 | 483 | return $next instanceof EE_SPCO_Reg_Step ? $next : null; |
484 | 484 | } |
485 | 485 | |
@@ -494,8 +494,8 @@ discard block |
||
494 | 494 | * @return EE_SPCO_Reg_Step | null |
495 | 495 | */ |
496 | 496 | public function get_prev_reg_step() { |
497 | - $prev = prev( $this->reg_steps ); |
|
498 | - next( $this->reg_steps ); |
|
497 | + $prev = prev($this->reg_steps); |
|
498 | + next($this->reg_steps); |
|
499 | 499 | return $prev instanceof EE_SPCO_Reg_Step ? $prev : null; |
500 | 500 | } |
501 | 501 | |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | * @return void |
509 | 509 | */ |
510 | 510 | public function sort_reg_steps() { |
511 | - $reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' ); |
|
512 | - uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback )); |
|
511 | + $reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback'); |
|
512 | + uasort($this->reg_steps, array($this, $reg_step_sorting_callback)); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | |
@@ -522,19 +522,19 @@ discard block |
||
522 | 522 | * @param string $reg_step_slug |
523 | 523 | * @return EE_SPCO_Reg_Step|null |
524 | 524 | */ |
525 | - public function find_reg_step( $reg_step_slug = '' ) { |
|
526 | - if ( ! empty( $reg_step_slug ) ) { |
|
525 | + public function find_reg_step($reg_step_slug = '') { |
|
526 | + if ( ! empty($reg_step_slug)) { |
|
527 | 527 | // copy reg step array |
528 | 528 | $reg_steps = $this->reg_steps; |
529 | 529 | // set pointer to start of array |
530 | - reset( $reg_steps ); |
|
530 | + reset($reg_steps); |
|
531 | 531 | // if there is more than one step |
532 | - if ( count( $reg_steps ) > 1 ) { |
|
532 | + if (count($reg_steps) > 1) { |
|
533 | 533 | // advance to the current step and set pointer |
534 | - while ( key( $reg_steps ) != $reg_step_slug && key( $reg_steps ) != '' ) { |
|
535 | - next( $reg_steps ); |
|
534 | + while (key($reg_steps) != $reg_step_slug && key($reg_steps) != '') { |
|
535 | + next($reg_steps); |
|
536 | 536 | } |
537 | - return current( $reg_steps ); |
|
537 | + return current($reg_steps); |
|
538 | 538 | } |
539 | 539 | } |
540 | 540 | return null; |
@@ -550,17 +550,17 @@ discard block |
||
550 | 550 | * @param EE_SPCO_Reg_Step $reg_step_B |
551 | 551 | * @return array() |
552 | 552 | */ |
553 | - public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
|
553 | + public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) { |
|
554 | 554 | // send finalize_registration step to the end of the array |
555 | - if ( $reg_step_A->slug() == 'finalize_registration' ) { |
|
555 | + if ($reg_step_A->slug() == 'finalize_registration') { |
|
556 | 556 | return 1; |
557 | - } else if ( $reg_step_B->slug() == 'finalize_registration' ) { |
|
557 | + } else if ($reg_step_B->slug() == 'finalize_registration') { |
|
558 | 558 | return -1; |
559 | 559 | } |
560 | - if ( $reg_step_A->order() == $reg_step_B->order() ) { |
|
560 | + if ($reg_step_A->order() == $reg_step_B->order()) { |
|
561 | 561 | return 0; |
562 | 562 | } |
563 | - return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1; |
|
563 | + return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | * @access public |
572 | 572 | * @param EE_SPCO_Reg_Step $reg_step |
573 | 573 | */ |
574 | - public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) { |
|
574 | + public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) { |
|
575 | 575 | // call set_reg_step_initiated ??? |
576 | 576 | if ( |
577 | 577 | // first time visiting SPCO ? |
@@ -580,13 +580,13 @@ discard block |
||
580 | 580 | && $this->action === 'display_spco_reg_step' |
581 | 581 | ) { |
582 | 582 | /** @type EE_Transaction_Processor $transaction_processor */ |
583 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
583 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
584 | 584 | // set the start time for this reg step |
585 | - if ( ! $transaction_processor->set_reg_step_initiated( $this->transaction, $reg_step->slug() ) ) { |
|
586 | - if ( WP_DEBUG ) { |
|
585 | + if ( ! $transaction_processor->set_reg_step_initiated($this->transaction, $reg_step->slug())) { |
|
586 | + if (WP_DEBUG) { |
|
587 | 587 | EE_Error::add_error( |
588 | 588 | sprintf( |
589 | - __( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), |
|
589 | + __('The "%1$s" registration step was not initialized properly.', 'event_espresso'), |
|
590 | 590 | $reg_step->name() |
591 | 591 | ), |
592 | 592 | __FILE__, __FUNCTION__, __LINE__ |
@@ -605,10 +605,10 @@ discard block |
||
605 | 605 | * @return void |
606 | 606 | */ |
607 | 607 | public function set_reg_step_JSON_info() { |
608 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array(); |
|
608 | + EE_Registry::$i18n_js_strings['reg_steps'] = array(); |
|
609 | 609 | // pass basic reg step data to JS |
610 | - foreach ( $this->reg_steps as $reg_step ) { |
|
611 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug(); |
|
610 | + foreach ($this->reg_steps as $reg_step) { |
|
611 | + EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug(); |
|
612 | 612 | } |
613 | 613 | // reset reg step html |
614 | 614 | // $this->json_response->set_reg_step_html( '' ); |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | */ |
625 | 625 | public function reset_reg_steps() { |
626 | 626 | $this->sort_reg_steps(); |
627 | - $this->set_current_step( EE_Registry::instance()->REQ->get( 'step' )); |
|
627 | + $this->set_current_step(EE_Registry::instance()->REQ->get('step')); |
|
628 | 628 | $this->set_next_step(); |
629 | 629 | // the text that appears on the reg step form submit button |
630 | 630 | $this->current_step->set_submit_button_text(); |
@@ -641,9 +641,9 @@ discard block |
||
641 | 641 | */ |
642 | 642 | public function get_registration_time_limit() { |
643 | 643 | |
644 | - $registration_time_limit = (float)( EE_Registry::instance() ->SSN->expiration() - time() ); |
|
644 | + $registration_time_limit = (float) (EE_Registry::instance() ->SSN->expiration() - time()); |
|
645 | 645 | $time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s'; |
646 | - $registration_time_limit = gmdate( $time_limit_format, $registration_time_limit ); |
|
646 | + $registration_time_limit = gmdate($time_limit_format, $registration_time_limit); |
|
647 | 647 | return apply_filters( |
648 | 648 | 'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit', |
649 | 649 | $registration_time_limit |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | // overpaid TXN |
664 | 664 | // free TXN ( total = 0.00 ) |
665 | 665 | // then payment required is TRUE |
666 | - return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE; |
|
666 | + return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE; |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | |
@@ -676,8 +676,8 @@ discard block |
||
676 | 676 | */ |
677 | 677 | public function initialize_txn_reg_steps_array() { |
678 | 678 | $txn_reg_steps_array = array(); |
679 | - foreach ( $this->reg_steps as $reg_step ) { |
|
680 | - $txn_reg_steps_array[ $reg_step->slug() ] = FALSE; |
|
679 | + foreach ($this->reg_steps as $reg_step) { |
|
680 | + $txn_reg_steps_array[$reg_step->slug()] = FALSE; |
|
681 | 681 | } |
682 | 682 | return $txn_reg_steps_array; |
683 | 683 | } |
@@ -693,13 +693,13 @@ discard block |
||
693 | 693 | public function update_txn_reg_steps_array() { |
694 | 694 | $updated = FALSE; |
695 | 695 | /** @type EE_Transaction_Processor $transaction_processor */ |
696 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
697 | - foreach ( $this->reg_steps as $reg_step ) { |
|
698 | - if ( $reg_step->completed() ) { |
|
699 | - $updated = $transaction_processor->set_reg_step_completed( $this->transaction, $reg_step->slug() ) ? TRUE : $updated; |
|
696 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
697 | + foreach ($this->reg_steps as $reg_step) { |
|
698 | + if ($reg_step->completed()) { |
|
699 | + $updated = $transaction_processor->set_reg_step_completed($this->transaction, $reg_step->slug()) ? TRUE : $updated; |
|
700 | 700 | } |
701 | 701 | } |
702 | - if ( $updated ) { |
|
702 | + if ($updated) { |
|
703 | 703 | $this->transaction->save(); |
704 | 704 | } |
705 | 705 | return $updated; |
@@ -714,14 +714,14 @@ discard block |
||
714 | 714 | * @return void |
715 | 715 | */ |
716 | 716 | public function stash_transaction_and_checkout() { |
717 | - if ( ! $this->revisit ) { |
|
717 | + if ( ! $this->revisit) { |
|
718 | 718 | $this->update_txn_reg_steps_array(); |
719 | 719 | } |
720 | 720 | $this->track_transaction_and_registration_status_updates(); |
721 | 721 | // save all data to the db, but suppress errors |
722 | 722 | //$this->save_all_data( FALSE ); |
723 | 723 | // cache the checkout in the session |
724 | - EE_Registry::instance()->SSN->set_checkout( $this ); |
|
724 | + EE_Registry::instance()->SSN->set_checkout($this); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | |
@@ -737,21 +737,21 @@ discard block |
||
737 | 737 | */ |
738 | 738 | public function track_transaction_and_registration_status_updates() { |
739 | 739 | // verify the transaction |
740 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
740 | + if ($this->transaction instanceof EE_Transaction) { |
|
741 | 741 | /** @type EE_Transaction_Payments $transaction_payments */ |
742 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
742 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
743 | 743 | /** @type EE_Transaction_Processor $transaction_processor */ |
744 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
744 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
745 | 745 | // has there been a TXN status change during this checkout? |
746 | - if ( $transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated() ) { |
|
746 | + if ($transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated()) { |
|
747 | 747 | $this->txn_status_updated = true; |
748 | 748 | } |
749 | 749 | /** @type EE_Registration_Processor $registration_processor */ |
750 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
750 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
751 | 751 | // grab the saved registrations from the transaction |
752 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
753 | - if ( $registration_processor->reg_status_updated( $registration->ID() ) ) { |
|
754 | - $this->set_reg_status_updated( $registration->ID(), true ); |
|
752 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
753 | + if ($registration_processor->reg_status_updated($registration->ID())) { |
|
754 | + $this->set_reg_status_updated($registration->ID(), true); |
|
755 | 755 | } |
756 | 756 | } |
757 | 757 | } |
@@ -773,8 +773,8 @@ discard block |
||
773 | 773 | * @param EE_Registration $registration |
774 | 774 | * @return bool |
775 | 775 | */ |
776 | - public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
|
777 | - return ! $this->revisit || $this->primary_revisit || ( $this->revisit && $this->reg_url_link == $registration->reg_url_link() ) ? TRUE : FALSE; |
|
776 | + public function visit_allows_processing_of_this_registration(EE_Registration $registration) { |
|
777 | + return ! $this->revisit || $this->primary_revisit || ($this->revisit && $this->reg_url_link == $registration->reg_url_link()) ? TRUE : FALSE; |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | |
@@ -799,18 +799,18 @@ discard block |
||
799 | 799 | * @param bool $show_errors |
800 | 800 | * @return bool |
801 | 801 | */ |
802 | - public function save_all_data( $show_errors = TRUE ) { |
|
802 | + public function save_all_data($show_errors = TRUE) { |
|
803 | 803 | // verify the transaction |
804 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
804 | + if ($this->transaction instanceof EE_Transaction) { |
|
805 | 805 | // save to ensure that TXN has ID |
806 | 806 | $this->transaction->save(); |
807 | 807 | // grab the saved registrations from the transaction |
808 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
809 | - $this->_save_registration( $registration, $show_errors ); |
|
808 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
809 | + $this->_save_registration($registration, $show_errors); |
|
810 | 810 | } |
811 | 811 | } else { |
812 | - if ( $show_errors ) { |
|
813 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
812 | + if ($show_errors) { |
|
813 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
814 | 814 | } |
815 | 815 | return FALSE; |
816 | 816 | } |
@@ -825,32 +825,32 @@ discard block |
||
825 | 825 | * @param bool $show_errors |
826 | 826 | * @return void |
827 | 827 | */ |
828 | - private function _save_registration( $registration, $show_errors = TRUE ) { |
|
828 | + private function _save_registration($registration, $show_errors = TRUE) { |
|
829 | 829 | // verify object |
830 | - if ( $registration instanceof EE_Registration ) { |
|
830 | + if ($registration instanceof EE_Registration) { |
|
831 | 831 | // should this registration be processed during this visit ? |
832 | - if ( $this->visit_allows_processing_of_this_registration( $registration ) ) { |
|
832 | + if ($this->visit_allows_processing_of_this_registration($registration)) { |
|
833 | 833 | //set TXN ID |
834 | - if ( ! $registration->transaction_ID() ) { |
|
835 | - $registration->set_transaction_id( $this->transaction->ID() ); |
|
834 | + if ( ! $registration->transaction_ID()) { |
|
835 | + $registration->set_transaction_id($this->transaction->ID()); |
|
836 | 836 | } |
837 | 837 | // verify and save the attendee |
838 | - $this->_save_registration_attendee( $registration, $show_errors ); |
|
838 | + $this->_save_registration_attendee($registration, $show_errors); |
|
839 | 839 | // save answers to reg form questions |
840 | - $this->_save_registration_answers( $registration, $show_errors ); |
|
840 | + $this->_save_registration_answers($registration, $show_errors); |
|
841 | 841 | // save changes |
842 | 842 | $registration->save(); |
843 | 843 | // update txn cache |
844 | - if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) { |
|
845 | - if ( $show_errors ) { |
|
846 | - EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
844 | + if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) { |
|
845 | + if ($show_errors) { |
|
846 | + EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
847 | 847 | } |
848 | 848 | } |
849 | 849 | } |
850 | 850 | } else { |
851 | - if ( $show_errors ) { |
|
851 | + if ($show_errors) { |
|
852 | 852 | EE_Error::add_error( |
853 | - __( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
853 | + __('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
854 | 854 | __FILE__, __FUNCTION__, __LINE__ |
855 | 855 | ); |
856 | 856 | } |
@@ -866,26 +866,26 @@ discard block |
||
866 | 866 | * @param bool $show_errors |
867 | 867 | * @return void |
868 | 868 | */ |
869 | - private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
|
870 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
869 | + private function _save_registration_attendee($registration, $show_errors = TRUE) { |
|
870 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
871 | 871 | // save so that ATT has ID |
872 | 872 | $registration->attendee()->save(); |
873 | - if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() )) { |
|
874 | - if ( $show_errors ) { |
|
873 | + if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) { |
|
874 | + if ($show_errors) { |
|
875 | 875 | EE_Error::add_error( |
876 | - __( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ), |
|
876 | + __('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'), |
|
877 | 877 | __FILE__, __FUNCTION__, __LINE__ |
878 | 878 | ); |
879 | 879 | } |
880 | 880 | } |
881 | 881 | } else { |
882 | - if ( $show_errors ) { |
|
882 | + if ($show_errors) { |
|
883 | 883 | ob_start(); |
884 | - var_dump( $registration->attendee() ); |
|
884 | + var_dump($registration->attendee()); |
|
885 | 885 | EE_Error::add_error( |
886 | 886 | sprintf( |
887 | 887 | '%1$s||%1$s $attendee = %2$s', |
888 | - __( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
888 | + __('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
889 | 889 | ob_get_clean() |
890 | 890 | ), |
891 | 891 | __FILE__, __FUNCTION__, __LINE__ |
@@ -903,25 +903,25 @@ discard block |
||
903 | 903 | * @param bool $show_errors |
904 | 904 | * @return void |
905 | 905 | */ |
906 | - private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
|
906 | + private function _save_registration_answers($registration, $show_errors = TRUE) { |
|
907 | 907 | // now save the answers |
908 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
908 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
909 | 909 | // verify object |
910 | - if ( $answer instanceof EE_Answer ) { |
|
911 | - $answer->set_registration( $registration->ID() ); |
|
910 | + if ($answer instanceof EE_Answer) { |
|
911 | + $answer->set_registration($registration->ID()); |
|
912 | 912 | $answer->save(); |
913 | - if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) { |
|
914 | - if ( $show_errors ) { |
|
913 | + if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { |
|
914 | + if ($show_errors) { |
|
915 | 915 | EE_Error::add_error( |
916 | - __( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ), |
|
916 | + __('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), |
|
917 | 917 | __FILE__, __FUNCTION__, __LINE__ |
918 | 918 | ); |
919 | 919 | } |
920 | 920 | } |
921 | 921 | } else { |
922 | - if ( $show_errors ) { |
|
922 | + if ($show_errors) { |
|
923 | 923 | EE_Error::add_error( |
924 | - __( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
924 | + __('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
925 | 925 | __FILE__, __FUNCTION__, __LINE__ |
926 | 926 | ); |
927 | 927 | } |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | * @param bool $from_db |
940 | 940 | * @return bool |
941 | 941 | */ |
942 | - public function refresh_all_entities( $from_db = false ) { |
|
942 | + public function refresh_all_entities($from_db = false) { |
|
943 | 943 | $from_db = $this->current_step->is_final_step() || $this->action == 'process_gateway_response' ? true : $from_db; |
944 | 944 | //$this->log( |
945 | 945 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -960,11 +960,11 @@ discard block |
||
960 | 960 | */ |
961 | 961 | protected function refresh_from_db() { |
962 | 962 | // verify the transaction |
963 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
963 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
964 | 964 | // pull fresh TXN data from the db |
965 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() ); |
|
965 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); |
|
966 | 966 | // update EE_Checkout's cached primary_attendee object |
967 | - $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction ); |
|
967 | + $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); |
|
968 | 968 | // update EE_Checkout's cached payment object |
969 | 969 | $payment = $this->transaction->last_payment(); |
970 | 970 | $this->payment = $payment instanceof EE_Payment ? $payment : $this->payment; |
@@ -972,15 +972,15 @@ discard block |
||
972 | 972 | $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; |
973 | 973 | $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method; |
974 | 974 | //now refresh the cart, based on the TXN |
975 | - $this->cart = EE_Cart::get_cart_from_txn( $this->transaction ); |
|
975 | + $this->cart = EE_Cart::get_cart_from_txn($this->transaction); |
|
976 | 976 | // verify and update the cart because inaccurate totals are not so much fun |
977 | - if ( $this->cart instanceof EE_Cart ) { |
|
977 | + if ($this->cart instanceof EE_Cart) { |
|
978 | 978 | $this->cart->get_grand_total()->recalculate_total_including_taxes(); |
979 | 979 | } else { |
980 | - $this->cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
980 | + $this->cart = EE_Registry::instance()->load_core('Cart'); |
|
981 | 981 | } |
982 | 982 | } else { |
983 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
983 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
984 | 984 | return FALSE; |
985 | 985 | } |
986 | 986 | return TRUE; |
@@ -994,24 +994,24 @@ discard block |
||
994 | 994 | * @param EE_Transaction $transaction |
995 | 995 | * @return EE_Attendee | null |
996 | 996 | */ |
997 | - protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
|
997 | + protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) { |
|
998 | 998 | |
999 | 999 | $primary_attendee_obj = null; |
1000 | 1000 | // grab the saved registrations from the transaction |
1001 | - foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) { |
|
1001 | + foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) { |
|
1002 | 1002 | // verify object |
1003 | - if ( $registration instanceof EE_Registration ) { |
|
1003 | + if ($registration instanceof EE_Registration) { |
|
1004 | 1004 | $attendee = $registration->attendee(); |
1005 | 1005 | // verify object |
1006 | - if ( $attendee instanceof EE_Attendee ) { |
|
1006 | + if ($attendee instanceof EE_Attendee) { |
|
1007 | 1007 | // maybe cache primary_attendee_obj ? |
1008 | - if ( $registration->is_primary_registrant() ) { |
|
1008 | + if ($registration->is_primary_registrant()) { |
|
1009 | 1009 | $primary_attendee_obj = $attendee; |
1010 | 1010 | } |
1011 | 1011 | } |
1012 | 1012 | } else { |
1013 | 1013 | EE_Error::add_error( |
1014 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1014 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1015 | 1015 | __FILE__, __FUNCTION__, __LINE__ |
1016 | 1016 | ); |
1017 | 1017 | } |
@@ -1031,43 +1031,43 @@ discard block |
||
1031 | 1031 | */ |
1032 | 1032 | protected function refresh_entity_map() { |
1033 | 1033 | // verify the transaction |
1034 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1034 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1035 | 1035 | // never cache payment info |
1036 | - $this->transaction->clear_cache( 'Payment' ); |
|
1036 | + $this->transaction->clear_cache('Payment'); |
|
1037 | 1037 | /** @type EE_Transaction_Processor $transaction_processor */ |
1038 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1038 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1039 | 1039 | // is the Payment Options Reg Step completed ? |
1040 | - if ( $transaction_processor->reg_step_completed( $this->transaction, 'payment_options' ) ) { |
|
1040 | + if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) { |
|
1041 | 1041 | // then check for payments and update TXN accordingly |
1042 | 1042 | /** @type EE_Transaction_Payments $transaction_payments */ |
1043 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1044 | - $transaction_payments->calculate_total_payments_and_update_status( $this->transaction ); |
|
1043 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1044 | + $transaction_payments->calculate_total_payments_and_update_status($this->transaction); |
|
1045 | 1045 | } |
1046 | 1046 | // grab the saved registrations from the transaction |
1047 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration ) { |
|
1048 | - $this->_refresh_registration( $reg_cache_ID, $registration ); |
|
1047 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) { |
|
1048 | + $this->_refresh_registration($reg_cache_ID, $registration); |
|
1049 | 1049 | } |
1050 | 1050 | // make sure our cached TXN is added to the model entity mapper |
1051 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction ); |
|
1051 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction); |
|
1052 | 1052 | |
1053 | 1053 | } else { |
1054 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
1054 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1055 | 1055 | return FALSE; |
1056 | 1056 | } |
1057 | 1057 | // verify and update the cart because inaccurate totals are not so much fun |
1058 | - if ( $this->cart instanceof EE_Cart ) { |
|
1058 | + if ($this->cart instanceof EE_Cart) { |
|
1059 | 1059 | $grand_total = $this->cart->get_grand_total(); |
1060 | - if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) { |
|
1060 | + if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) { |
|
1061 | 1061 | $grand_total->recalculate_total_including_taxes(); |
1062 | 1062 | $grand_total = $grand_total->get_model()->refresh_entity_map_with( |
1063 | 1063 | $this->cart->get_grand_total()->ID(), |
1064 | 1064 | $this->cart->get_grand_total() |
1065 | 1065 | ); |
1066 | 1066 | } |
1067 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
1068 | - $this->cart = EE_Cart::instance( $grand_total ); |
|
1067 | + if ($grand_total instanceof EE_Line_Item) { |
|
1068 | + $this->cart = EE_Cart::instance($grand_total); |
|
1069 | 1069 | } else { |
1070 | - EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1070 | + EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1071 | 1071 | return false; |
1072 | 1072 | } |
1073 | 1073 | } |
@@ -1083,19 +1083,19 @@ discard block |
||
1083 | 1083 | * @param EE_Registration $registration |
1084 | 1084 | * @return void |
1085 | 1085 | */ |
1086 | - protected function _refresh_registration( $reg_cache_ID, $registration ) { |
|
1086 | + protected function _refresh_registration($reg_cache_ID, $registration) { |
|
1087 | 1087 | |
1088 | 1088 | // verify object |
1089 | - if ( $registration instanceof EE_Registration ) { |
|
1089 | + if ($registration instanceof EE_Registration) { |
|
1090 | 1090 | // update the entity mapper attendee |
1091 | - $this->_refresh_registration_attendee( $registration ); |
|
1091 | + $this->_refresh_registration_attendee($registration); |
|
1092 | 1092 | // update the entity mapper answers for reg form questions |
1093 | - $this->_refresh_registration_answers( $registration ); |
|
1093 | + $this->_refresh_registration_answers($registration); |
|
1094 | 1094 | // make sure the cached registration is added to the model entity mapper |
1095 | - $registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration ); |
|
1095 | + $registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration); |
|
1096 | 1096 | } else { |
1097 | 1097 | EE_Error::add_error( |
1098 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1098 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1099 | 1099 | __FILE__, __FUNCTION__, __LINE__ |
1100 | 1100 | ); |
1101 | 1101 | } |
@@ -1109,15 +1109,15 @@ discard block |
||
1109 | 1109 | * @param EE_Registration $registration |
1110 | 1110 | * @return void |
1111 | 1111 | */ |
1112 | - protected function _refresh_registration_attendee( $registration ) { |
|
1112 | + protected function _refresh_registration_attendee($registration) { |
|
1113 | 1113 | |
1114 | 1114 | $attendee = $registration->attendee(); |
1115 | 1115 | // verify object |
1116 | - if ( $attendee instanceof EE_Attendee && $attendee->ID() ) { |
|
1116 | + if ($attendee instanceof EE_Attendee && $attendee->ID()) { |
|
1117 | 1117 | // make sure the cached attendee is added to the model entity mapper |
1118 | - $registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee ); |
|
1118 | + $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee); |
|
1119 | 1119 | // maybe cache primary_attendee_obj ? |
1120 | - if ( $registration->is_primary_registrant() ) { |
|
1120 | + if ($registration->is_primary_registrant()) { |
|
1121 | 1121 | $this->primary_attendee_obj = $attendee; |
1122 | 1122 | } |
1123 | 1123 | } |
@@ -1131,19 +1131,19 @@ discard block |
||
1131 | 1131 | * @param EE_Registration $registration |
1132 | 1132 | * @return void |
1133 | 1133 | */ |
1134 | - protected function _refresh_registration_answers( $registration ) { |
|
1134 | + protected function _refresh_registration_answers($registration) { |
|
1135 | 1135 | |
1136 | 1136 | // now update the answers |
1137 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
1137 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
1138 | 1138 | // verify object |
1139 | - if ( $answer instanceof EE_Answer ) { |
|
1140 | - if ( $answer->ID() ) { |
|
1139 | + if ($answer instanceof EE_Answer) { |
|
1140 | + if ($answer->ID()) { |
|
1141 | 1141 | // make sure the cached answer is added to the model entity mapper |
1142 | - $answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer ); |
|
1142 | + $answer->get_model()->refresh_entity_map_with($answer->ID(), $answer); |
|
1143 | 1143 | } |
1144 | 1144 | } else { |
1145 | 1145 | EE_Error::add_error( |
1146 | - __( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1146 | + __('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1147 | 1147 | __FILE__, __FUNCTION__, __LINE__ |
1148 | 1148 | ); |
1149 | 1149 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
1159 | 1159 | */ |
1160 | 1160 | function __wakeup() { |
1161 | - foreach ( $this->reg_steps as $reg_step ) { |
|
1161 | + foreach ($this->reg_steps as $reg_step) { |
|
1162 | 1162 | $reg_step->checkout = $this; |
1163 | 1163 | } |
1164 | 1164 | } |
@@ -1174,11 +1174,11 @@ discard block |
||
1174 | 1174 | * @param array $info |
1175 | 1175 | * @param bool $display_request |
1176 | 1176 | */ |
1177 | - function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
|
1178 | - if ( WP_DEBUG && false ) { |
|
1179 | - $debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() ); |
|
1177 | + function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { |
|
1178 | + if (WP_DEBUG && false) { |
|
1179 | + $debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array()); |
|
1180 | 1180 | $default_data = array( |
1181 | - $class => $func . '() : ' . $line, |
|
1181 | + $class => $func.'() : '.$line, |
|
1182 | 1182 | 'request->step' => $this->step, |
1183 | 1183 | 'request->action' => $this->action, |
1184 | 1184 | 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? |
@@ -1190,24 +1190,24 @@ discard block |
||
1190 | 1190 | 'reg_url_link' => $this->reg_url_link, |
1191 | 1191 | 'REQ' => $display_request ? $_REQUEST : '', |
1192 | 1192 | ); |
1193 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
1194 | - $default_data[ 'TXN_status' ] = $this->transaction->status_ID(); |
|
1195 | - $default_data[ 'TXN_reg_steps' ] = $this->transaction->reg_steps(); |
|
1196 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) { |
|
1197 | - $default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID(); |
|
1193 | + if ($this->transaction instanceof EE_Transaction) { |
|
1194 | + $default_data['TXN_status'] = $this->transaction->status_ID(); |
|
1195 | + $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); |
|
1196 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { |
|
1197 | + $default_data['registrations'][$REG_ID] = $registration->status_ID(); |
|
1198 | 1198 | } |
1199 | - if ( $this->transaction->ID() ) { |
|
1200 | - $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); |
|
1199 | + if ($this->transaction->ID()) { |
|
1200 | + $TXN_ID = 'EE_Transaction: '.$this->transaction->ID(); |
|
1201 | 1201 | // don't serialize objects |
1202 | - $info = $this->_strip_objects( $info ); |
|
1203 | - if ( ! isset( $debug_data[ $TXN_ID ] ) ) { |
|
1204 | - $debug_data[ $TXN_ID ] = array(); |
|
1202 | + $info = $this->_strip_objects($info); |
|
1203 | + if ( ! isset($debug_data[$TXN_ID])) { |
|
1204 | + $debug_data[$TXN_ID] = array(); |
|
1205 | 1205 | } |
1206 | - $debug_data[ $TXN_ID ][ microtime() ] = array_merge( |
|
1206 | + $debug_data[$TXN_ID][microtime()] = array_merge( |
|
1207 | 1207 | $default_data, |
1208 | 1208 | $info |
1209 | 1209 | ); |
1210 | - update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data ); |
|
1210 | + update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data); |
|
1211 | 1211 | } |
1212 | 1212 | } |
1213 | 1213 | } |
@@ -1220,23 +1220,23 @@ discard block |
||
1220 | 1220 | * @param array $info |
1221 | 1221 | * @return array |
1222 | 1222 | */ |
1223 | - function _strip_objects( $info = array() ) { |
|
1224 | - foreach ( $info as $key => $value ) { |
|
1225 | - if ( is_array( $value )) { |
|
1226 | - $info[ $key ] = $this->_strip_objects( $value ); |
|
1227 | - } else if ( is_object( $value ) ) { |
|
1228 | - $object_class = get_class( $value ); |
|
1229 | - $info[ $object_class ] = array(); |
|
1230 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0; |
|
1231 | - if ( method_exists( $value, 'status' ) ) { |
|
1232 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
1233 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
1234 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
1223 | + function _strip_objects($info = array()) { |
|
1224 | + foreach ($info as $key => $value) { |
|
1225 | + if (is_array($value)) { |
|
1226 | + $info[$key] = $this->_strip_objects($value); |
|
1227 | + } else if (is_object($value)) { |
|
1228 | + $object_class = get_class($value); |
|
1229 | + $info[$object_class] = array(); |
|
1230 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0; |
|
1231 | + if (method_exists($value, 'status')) { |
|
1232 | + $info[$object_class]['status'] = $value->status(); |
|
1233 | + } else if (method_exists($value, 'status_ID')) { |
|
1234 | + $info[$object_class]['status'] = $value->status_ID(); |
|
1235 | 1235 | } |
1236 | - unset( $info[ $key ] ); |
|
1236 | + unset($info[$key]); |
|
1237 | 1237 | } |
1238 | 1238 | } |
1239 | - return (array)$info; |
|
1239 | + return (array) $info; |
|
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 |
@@ -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 | /** |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | case EEM_Question::QST_type_text : |
508 | 508 | if( $identifier == 'email' ){ |
509 | 509 | return new EE_Email_Input( $input_constructor_args ); |
510 | - }else{ |
|
510 | + } else{ |
|
511 | 511 | return new EE_Text_Input( $input_constructor_args ); |
512 | 512 | } |
513 | 513 | break; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
794 | 794 | |
795 | - } else { |
|
795 | + } else { |
|
796 | 796 | 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__ ); |
797 | 797 | // remove malformed data |
798 | 798 | unset( $valid_data[ $reg_url_link ] ); |
@@ -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'); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | EEH_Autoloader::register_line_item_display_autoloaders(); |
85 | 85 | $Line_Item_Display = new EE_Line_Item_Display(); |
86 | 86 | // calculate taxes |
87 | - $Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) ); |
|
87 | + $Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true)); |
|
88 | 88 | EE_Registry::instance()->load_helper('Line_Item'); |
89 | 89 | /** @var $subsections EE_Form_Section_Proper[] */ |
90 | 90 | $subsections = array( |
@@ -96,33 +96,33 @@ discard block |
||
96 | 96 | 'ticket_count' => array() |
97 | 97 | ); |
98 | 98 | // grab the saved registrations from the transaction |
99 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
100 | - if ( $registrations ) { |
|
101 | - foreach ( $registrations as $registration ) { |
|
102 | - if ( $registration instanceof EE_Registration ) { |
|
99 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
100 | + if ($registrations) { |
|
101 | + foreach ($registrations as $registration) { |
|
102 | + if ($registration instanceof EE_Registration) { |
|
103 | 103 | // can this registration be processed during this visit ? |
104 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
105 | - $subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration ); |
|
106 | - if ( ! $this->checkout->admin_request ) { |
|
107 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
108 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1; |
|
109 | - $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() ) ); |
|
110 | - $ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item; |
|
111 | - $template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item ); |
|
104 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
105 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
106 | + if ( ! $this->checkout->admin_request) { |
|
107 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
108 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1; |
|
109 | + $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())); |
|
110 | + $ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item; |
|
111 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item); |
|
112 | 112 | } |
113 | - if ( $registration->is_primary_registrant() ) { |
|
113 | + if ($registration->is_primary_registrant()) { |
|
114 | 114 | $primary_registrant = $registration->reg_url_link(); |
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
119 | 119 | // print_copy_info ? |
120 | - if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) { |
|
120 | + if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) { |
|
121 | 121 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
122 | 122 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info(); |
123 | 123 | // generate hidden input |
124 | - if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) { |
|
125 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
124 | + if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) { |
|
125 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -134,8 +134,7 @@ discard block |
||
134 | 134 | 'html_id' => $this->reg_form_name(), |
135 | 135 | 'subsections' => $subsections, |
136 | 136 | 'layout_strategy' => $this->checkout->admin_request ? |
137 | - new EE_Div_Per_Section_Layout() : |
|
138 | - new EE_Template_Layout( |
|
137 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
139 | 138 | array( |
140 | 139 | 'layout_template_file' => $this->_template, // layout_template |
141 | 140 | 'template_args' => $template_args |
@@ -152,61 +151,61 @@ discard block |
||
152 | 151 | * @param EE_Registration $registration |
153 | 152 | * @return EE_Form_Section_Proper |
154 | 153 | */ |
155 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
156 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
154 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
155 | + EE_Registry::instance()->load_helper('Template'); |
|
157 | 156 | static $attendee_nmbr = 1; |
158 | 157 | // array of params to pass to parent constructor |
159 | 158 | $form_args = array( |
160 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
159 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
161 | 160 | 'html_class' => 'ee-reg-form-attendee-dv', |
162 | 161 | 'html_style' => $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '', |
163 | 162 | 'subsections' => array(), |
164 | 163 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
165 | 164 | array( |
166 | 165 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
167 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
166 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
168 | 167 | ) |
169 | 168 | ) |
170 | 169 | ); |
171 | 170 | // verify that registration has valid event |
172 | - if ( $registration->event() instanceof EE_Event ) { |
|
171 | + if ($registration->event() instanceof EE_Event) { |
|
173 | 172 | $query_params = array( |
174 | 173 | array( |
175 | 174 | 'Event.EVT_ID' => $registration->event()->ID(), |
176 | 175 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
177 | 176 | ), |
178 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
177 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
179 | 178 | ); |
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 ); |
|
179 | + $question_groups = $registration->event()->question_groups($query_params); |
|
180 | + if ($question_groups) { |
|
181 | + foreach ($question_groups as $question_group) { |
|
182 | + if ($question_group instanceof EE_Question_Group) { |
|
183 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group); |
|
185 | 184 | // add hidden input |
186 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration ); |
|
185 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration); |
|
187 | 186 | } |
188 | 187 | } |
189 | 188 | // if we have question groups for additional attendees, then display the copy options |
190 | 189 | $this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info; |
191 | 190 | } else { |
192 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML( |
|
191 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML( |
|
193 | 192 | EEH_Template::locate_template( |
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()), |
|
193 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php', |
|
194 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
196 | 195 | TRUE, |
197 | 196 | TRUE |
198 | 197 | ) |
199 | 198 | ); |
200 | 199 | // add hidden input |
201 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE ); |
|
200 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE); |
|
202 | 201 | } |
203 | 202 | } |
204 | - if ( $registration->is_primary_registrant() ) { |
|
203 | + if ($registration->is_primary_registrant()) { |
|
205 | 204 | // generate hidden input |
206 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration ); |
|
205 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
207 | 206 | } |
208 | 207 | $attendee_nmbr++; |
209 | - return new EE_Form_Section_Proper( $form_args ); |
|
208 | + return new EE_Form_Section_Proper($form_args); |
|
210 | 209 | } |
211 | 210 | |
212 | 211 | |
@@ -219,11 +218,11 @@ discard block |
||
219 | 218 | * @param bool $additional_attendee_reg_info |
220 | 219 | * @return EE_Form_Input_Base |
221 | 220 | */ |
222 | - private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){ |
|
221 | + private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) { |
|
223 | 222 | // generate hidden input |
224 | 223 | return new EE_Hidden_Input( |
225 | 224 | array( |
226 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
225 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
227 | 226 | 'default' => $additional_attendee_reg_info |
228 | 227 | ) |
229 | 228 | ); |
@@ -236,22 +235,22 @@ discard block |
||
236 | 235 | * @param EE_Question_Group $question_group |
237 | 236 | * @return EE_Form_Section_Proper |
238 | 237 | */ |
239 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
238 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
240 | 239 | // array of params to pass to parent constructor |
241 | 240 | $form_args = array( |
242 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
241 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
243 | 242 | 'html_class' => $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv', |
244 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
243 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
245 | 244 | 'subsections' => array( |
246 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
245 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
247 | 246 | ), |
248 | 247 | 'layout_strategy' => $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout() |
249 | 248 | ); |
250 | 249 | // where params |
251 | - $query_params = array( 'QST_deleted' => 0 ); |
|
250 | + $query_params = array('QST_deleted' => 0); |
|
252 | 251 | // don't load admin only questions on the frontend |
253 | - if ( ! $this->checkout->admin_request ) { |
|
254 | - $query_params['QST_admin_only'] = array( '!=', TRUE ); |
|
252 | + if ( ! $this->checkout->admin_request) { |
|
253 | + $query_params['QST_admin_only'] = array('!=', TRUE); |
|
255 | 254 | } |
256 | 255 | $questions = $question_group->get_many_related( |
257 | 256 | 'Question', |
@@ -263,21 +262,21 @@ discard block |
||
263 | 262 | ) |
264 | 263 | ); |
265 | 264 | // filter for additional content before questions |
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 )); |
|
265 | + $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)); |
|
267 | 266 | // loop thru questions |
268 | - foreach ( $questions as $question ) { |
|
269 | - if( $question instanceof EE_Question ){ |
|
267 | + foreach ($questions as $question) { |
|
268 | + if ($question instanceof EE_Question) { |
|
270 | 269 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
271 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
270 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
272 | 271 | } |
273 | 272 | } |
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 ); |
|
273 | + $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); |
|
275 | 274 | |
276 | 275 | // filter for additional content after questions |
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 )); |
|
276 | + $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)); |
|
278 | 277 | // d( $form_args ); |
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 ); |
|
278 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
279 | + 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); |
|
281 | 280 | } |
282 | 281 | |
283 | 282 | |
@@ -287,12 +286,12 @@ discard block |
||
287 | 286 | * @param EE_Question_Group $question_group |
288 | 287 | * @return EE_Form_Section_HTML |
289 | 288 | */ |
290 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
289 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
291 | 290 | $html = ''; |
292 | 291 | // group_name |
293 | - if ( $question_group->show_group_name() && $question_group->name() != '' ) { |
|
292 | + if ($question_group->show_group_name() && $question_group->name() != '') { |
|
294 | 293 | EE_Registry::instance()->load_helper('HTML'); |
295 | - if ( $this->checkout->admin_request ) { |
|
294 | + if ($this->checkout->admin_request) { |
|
296 | 295 | $html .= EEH_HTML::br(); |
297 | 296 | $html .= EEH_HTML::h3( |
298 | 297 | $question_group->name(), |
@@ -306,7 +305,7 @@ discard block |
||
306 | 305 | } |
307 | 306 | } |
308 | 307 | // group_desc |
309 | - if ( $question_group->show_group_desc() && $question_group->desc() != '' ) { |
|
308 | + if ($question_group->show_group_desc() && $question_group->desc() != '') { |
|
310 | 309 | $html .= EEH_HTML::p( |
311 | 310 | $question_group->desc(), |
312 | 311 | '', |
@@ -314,7 +313,7 @@ discard block |
||
314 | 313 | ); |
315 | 314 | |
316 | 315 | } |
317 | - return new EE_Form_Section_HTML( $html ); |
|
316 | + return new EE_Form_Section_HTML($html); |
|
318 | 317 | } |
319 | 318 | |
320 | 319 | |
@@ -323,14 +322,14 @@ discard block |
||
323 | 322 | * @access public |
324 | 323 | * @return EE_Form_Section_Proper |
325 | 324 | */ |
326 | - private function _copy_attendee_info_form(){ |
|
325 | + private function _copy_attendee_info_form() { |
|
327 | 326 | // array of params to pass to parent constructor |
328 | 327 | return new EE_Form_Section_Proper( |
329 | 328 | array( |
330 | 329 | 'subsections' => $this->_copy_attendee_info_inputs(), |
331 | 330 | 'layout_strategy' => new EE_Template_Layout( |
332 | 331 | array( |
333 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template |
|
332 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template |
|
334 | 333 | 'begin_template_file' => NULL, |
335 | 334 | 'input_template_file' => NULL, |
336 | 335 | 'subsection_template_file' => NULL, |
@@ -352,8 +351,8 @@ discard block |
||
352 | 351 | private function _auto_copy_attendee_info() { |
353 | 352 | return new EE_Form_Section_HTML( |
354 | 353 | EEH_Template::locate_template( |
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()), |
|
354 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
355 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
357 | 356 | TRUE, |
358 | 357 | TRUE |
359 | 358 | ) |
@@ -372,25 +371,25 @@ discard block |
||
372 | 371 | $copy_attendee_info_inputs = array(); |
373 | 372 | $prev_ticket = NULL; |
374 | 373 | // grab the saved registrations from the transaction |
375 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
376 | - foreach ( $registrations as $registration ) { |
|
374 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
375 | + foreach ($registrations as $registration) { |
|
377 | 376 | // for all attendees other than the primary attendee |
378 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
377 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
379 | 378 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
380 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
379 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
381 | 380 | $item_name = $registration->ticket()->name(); |
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>' |
|
381 | + $item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : ''; |
|
382 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
383 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
385 | 384 | ); |
386 | 385 | $prev_ticket = $registration->ticket()->ID(); |
387 | 386 | } |
388 | 387 | |
389 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
388 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
390 | 389 | EE_Checkbox_Multi_Input( |
391 | - array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )), |
|
390 | + array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())), |
|
392 | 391 | array( |
393 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
392 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
394 | 393 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
395 | 394 | 'display_html_label_text' => FALSE |
396 | 395 | ) |
@@ -409,7 +408,7 @@ discard block |
||
409 | 408 | * @param EE_Registration $registration |
410 | 409 | * @return EE_Form_Input_Base |
411 | 410 | */ |
412 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
411 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
413 | 412 | // generate hidden input |
414 | 413 | return new EE_Hidden_Input( |
415 | 414 | array( |
@@ -427,31 +426,31 @@ discard block |
||
427 | 426 | * @param EE_Question $question |
428 | 427 | * @return EE_Form_Input_Base |
429 | 428 | */ |
430 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
429 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
431 | 430 | |
432 | 431 | // if this question was for an attendee detail, then check for that answer |
433 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->system_ID() ); |
|
432 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->system_ID()); |
|
434 | 433 | $answer = $answer_value === null |
435 | - ? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ) |
|
434 | + ? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))) |
|
436 | 435 | : null; |
437 | 436 | // 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 |
438 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
437 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
439 | 438 | // create an EE_Answer object for storing everything in |
440 | - $answer = EE_Answer::new_instance ( array( |
|
439 | + $answer = EE_Answer::new_instance(array( |
|
441 | 440 | 'QST_ID'=> $question->ID(), |
442 | 441 | 'REG_ID'=> $registration->ID() |
443 | 442 | )); |
444 | 443 | } |
445 | 444 | // verify instance |
446 | - if( $answer instanceof EE_Answer ){ |
|
447 | - if ( ! empty( $answer_value )) { |
|
448 | - $answer->set( 'ANS_value', $answer_value ); |
|
445 | + if ($answer instanceof EE_Answer) { |
|
446 | + if ( ! empty($answer_value)) { |
|
447 | + $answer->set('ANS_value', $answer_value); |
|
449 | 448 | } |
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 ); |
|
449 | + $answer->cache('Question', $question); |
|
450 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
451 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
453 | 452 | } |
454 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
453 | + return $this->_generate_question_input($registration, $question, $answer); |
|
455 | 454 | |
456 | 455 | } |
457 | 456 | |
@@ -463,7 +462,7 @@ discard block |
||
463 | 462 | * @param mixed EE_Answer|NULL $answer |
464 | 463 | * @return EE_Form_Input_Base |
465 | 464 | */ |
466 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
465 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
467 | 466 | // d( $registration ); |
468 | 467 | // d( $question ); |
469 | 468 | // d( $answer ); |
@@ -486,103 +485,103 @@ discard block |
||
486 | 485 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
487 | 486 | |
488 | 487 | $input_constructor_args = array( |
489 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
490 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
491 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
488 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
489 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
490 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
492 | 491 | 'required' => $question->required() ? TRUE : FALSE, |
493 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
492 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
494 | 493 | 'html_label_class' => 'ee-reg-qstn', |
495 | 494 | 'html_label_text' => $question->display_text(), |
496 | 495 | 'required_validation_error_message' => $question->required_text() |
497 | 496 | ); |
498 | 497 | // has this question been answered ? |
499 | - if ( $answer instanceof EE_Answer ) { |
|
500 | - if ( $answer->ID() ) { |
|
501 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
502 | - $input_constructor_args['html_id'] .= '-' . $answer->ID(); |
|
503 | - $input_constructor_args['html_label_id'] .= '-' . $answer->ID(); |
|
498 | + if ($answer instanceof EE_Answer) { |
|
499 | + if ($answer->ID()) { |
|
500 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
501 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
502 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
504 | 503 | } |
505 | 504 | $input_constructor_args['default'] = $answer->value(); |
506 | 505 | } |
507 | 506 | //add "-lbl" to the end of the label id |
508 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
509 | - $input_constructor_args = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args', |
|
507 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
508 | + $input_constructor_args = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args', |
|
510 | 509 | $input_constructor_args, |
511 | 510 | $registration, |
512 | 511 | $question, |
513 | 512 | $answer |
514 | 513 | ); |
515 | 514 | |
516 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
515 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
517 | 516 | |
518 | - switch ( $question->type() ) { |
|
517 | + switch ($question->type()) { |
|
519 | 518 | // Text |
520 | 519 | case EEM_Question::QST_type_text : |
521 | - if( $identifier == 'email' ){ |
|
522 | - return new EE_Email_Input( $input_constructor_args ); |
|
523 | - }else{ |
|
524 | - return new EE_Text_Input( $input_constructor_args ); |
|
520 | + if ($identifier == 'email') { |
|
521 | + return new EE_Email_Input($input_constructor_args); |
|
522 | + } else { |
|
523 | + return new EE_Text_Input($input_constructor_args); |
|
525 | 524 | } |
526 | 525 | break; |
527 | 526 | // Textarea |
528 | 527 | case EEM_Question::QST_type_textarea : |
529 | - return new EE_Text_Area_Input( $input_constructor_args ); |
|
528 | + return new EE_Text_Area_Input($input_constructor_args); |
|
530 | 529 | break; |
531 | 530 | // Radio Buttons |
532 | 531 | case EEM_Question::QST_type_radio : |
533 | - return new EE_Radio_Button_Input( $question->options(), $input_constructor_args ); |
|
532 | + return new EE_Radio_Button_Input($question->options(), $input_constructor_args); |
|
534 | 533 | break; |
535 | 534 | // Dropdown |
536 | 535 | case EEM_Question::QST_type_dropdown : |
537 | - return new EE_Select_Input( $question->options(), $input_constructor_args ); |
|
536 | + return new EE_Select_Input($question->options(), $input_constructor_args); |
|
538 | 537 | break; |
539 | 538 | // State Dropdown |
540 | 539 | case EEM_Question::QST_type_state : |
541 | - $state_options = array( '' => array( '' => '')); |
|
540 | + $state_options = array('' => array('' => '')); |
|
542 | 541 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
543 | - if ( ! empty( $states )) { |
|
544 | - foreach( $states as $state ){ |
|
545 | - if ( $state instanceof EE_State ) { |
|
546 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
542 | + if ( ! empty($states)) { |
|
543 | + foreach ($states as $state) { |
|
544 | + if ($state instanceof EE_State) { |
|
545 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
547 | 546 | } |
548 | 547 | } |
549 | 548 | } |
550 | - $state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer ); |
|
551 | - return new EE_State_Select_Input( $state_options, $input_constructor_args ); |
|
549 | + $state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer); |
|
550 | + return new EE_State_Select_Input($state_options, $input_constructor_args); |
|
552 | 551 | break; |
553 | 552 | // Country Dropdown |
554 | 553 | case EEM_Question::QST_type_country : |
555 | - $country_options = array( '' => '' ); |
|
554 | + $country_options = array('' => ''); |
|
556 | 555 | // get possibly cached list of countries |
557 | 556 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
558 | - if ( ! empty( $countries )) { |
|
559 | - foreach( $countries as $country ){ |
|
560 | - if ( $country instanceof EE_Country ) { |
|
561 | - $country_options[ $country->ID() ] = $country->name(); |
|
557 | + if ( ! empty($countries)) { |
|
558 | + foreach ($countries as $country) { |
|
559 | + if ($country instanceof EE_Country) { |
|
560 | + $country_options[$country->ID()] = $country->name(); |
|
562 | 561 | } |
563 | 562 | } |
564 | 563 | } |
565 | - $country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer ); |
|
566 | - return new EE_Country_Select_Input( $country_options, $input_constructor_args ); |
|
564 | + $country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer); |
|
565 | + return new EE_Country_Select_Input($country_options, $input_constructor_args); |
|
567 | 566 | break; |
568 | 567 | // Checkboxes |
569 | 568 | case EEM_Question::QST_type_checkbox : |
570 | - return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args ); |
|
569 | + return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args); |
|
571 | 570 | break; |
572 | 571 | // Date |
573 | 572 | case EEM_Question::QST_type_date : |
574 | - return new EE_Datepicker_Input( $input_constructor_args ); |
|
573 | + return new EE_Datepicker_Input($input_constructor_args); |
|
575 | 574 | break; |
576 | 575 | case EEM_Question::QST_type_html_textarea : |
577 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy(); |
|
578 | - $input = new EE_Text_Area_Input( $input_constructor_args ); |
|
579 | - $input->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' ); |
|
576 | + $input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy(); |
|
577 | + $input = new EE_Text_Area_Input($input_constructor_args); |
|
578 | + $input->remove_validation_strategy('EE_Plaintext_Validation_Strategy'); |
|
580 | 579 | return $input; |
581 | 580 | // fallback |
582 | 581 | default : |
583 | - $default_input = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args ); |
|
584 | - if( ! $default_input ){ |
|
585 | - $default_input = new EE_Text_Input( $input_constructor_args ); |
|
582 | + $default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args); |
|
583 | + if ( ! $default_input) { |
|
584 | + $default_input = new EE_Text_Input($input_constructor_args); |
|
586 | 585 | } |
587 | 586 | return $default_input; |
588 | 587 | } |
@@ -607,65 +606,65 @@ discard block |
||
607 | 606 | */ |
608 | 607 | public function process_reg_step() { |
609 | 608 | |
610 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
609 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
611 | 610 | // grab validated data from form |
612 | 611 | $valid_data = $this->checkout->current_step->valid_data(); |
613 | 612 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
614 | 613 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
615 | 614 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
616 | - if ( empty( $valid_data )) { |
|
617 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
615 | + if (empty($valid_data)) { |
|
616 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
618 | 617 | return FALSE; |
619 | 618 | } |
620 | 619 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
621 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
622 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
620 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
621 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
623 | 622 | return FALSE; |
624 | 623 | } |
625 | 624 | // get cached registrations |
626 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
625 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
627 | 626 | // verify we got the goods |
628 | - if ( empty( $registrations )) { |
|
629 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
627 | + if (empty($registrations)) { |
|
628 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
630 | 629 | return FALSE; |
631 | 630 | } |
632 | 631 | // extract attendee info from form data and save to model objects |
633 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
632 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
634 | 633 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
635 | - if ( $registrations_processed === FALSE ) { |
|
634 | + if ($registrations_processed === FALSE) { |
|
636 | 635 | // but return immediately if the previous step exited early due to errors |
637 | 636 | return FALSE; |
638 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
637 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
639 | 638 | // generate a correctly translated string for all possible singular/plural combinations |
640 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
639 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
641 | 640 | $error_msg = sprintf( |
642 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
641 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
643 | 642 | $this->checkout->total_ticket_count, |
644 | 643 | $registrations_processed |
645 | 644 | ); |
646 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
645 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
647 | 646 | $error_msg = sprintf( |
648 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
647 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
649 | 648 | $this->checkout->total_ticket_count, |
650 | 649 | $registrations_processed |
651 | 650 | ); |
652 | 651 | } else { |
653 | 652 | $error_msg = sprintf( |
654 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
653 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
655 | 654 | $this->checkout->total_ticket_count, |
656 | 655 | $registrations_processed |
657 | 656 | ); |
658 | 657 | |
659 | 658 | } |
660 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
659 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
661 | 660 | return FALSE; |
662 | 661 | } |
663 | 662 | // mark this reg step as completed |
664 | 663 | $this->checkout->current_step->set_completed(); |
665 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
664 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
666 | 665 | //do action in case a plugin wants to do something with the data submitted in step 1. |
667 | 666 | //passes EE_Single_Page_Checkout, and it's posted data |
668 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
667 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
669 | 668 | return TRUE; |
670 | 669 | |
671 | 670 | } |
@@ -679,9 +678,9 @@ discard block |
||
679 | 678 | * @param array $valid_data |
680 | 679 | * @return boolean | int |
681 | 680 | */ |
682 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
681 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
683 | 682 | // load resources and set some defaults |
684 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
683 | + EE_Registry::instance()->load_model('Attendee'); |
|
685 | 684 | // holder for primary registrant attendee object |
686 | 685 | $this->checkout->primary_attendee_obj = NULL; |
687 | 686 | // array for tracking reg form data for the primary registrant |
@@ -698,19 +697,19 @@ discard block |
||
698 | 697 | // attendee counter |
699 | 698 | $att_nmbr = 0; |
700 | 699 | // grab the saved registrations from the transaction |
701 | - foreach ( $registrations as $registration ) { |
|
700 | + foreach ($registrations as $registration) { |
|
702 | 701 | // verify EE_Registration object |
703 | - if ( ! $registration instanceof EE_Registration ) { |
|
704 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
702 | + if ( ! $registration instanceof EE_Registration) { |
|
703 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
705 | 704 | return FALSE; |
706 | 705 | } |
707 | 706 | $reg_url_link = $registration->reg_url_link(); |
708 | 707 | // reg_url_link exists ? |
709 | - if ( $reg_url_link ) { |
|
708 | + if ($reg_url_link) { |
|
710 | 709 | // should this registration be processed during this visit ? |
711 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
710 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
712 | 711 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
713 | - if ( ! $this->checkout->revisit ) { |
|
712 | + if ( ! $this->checkout->revisit) { |
|
714 | 713 | $registration->save(); |
715 | 714 | } |
716 | 715 | |
@@ -721,41 +720,41 @@ discard block |
||
721 | 720 | * @var bool if TRUE is returned by the plugin then the |
722 | 721 | * registration processing is halted. |
723 | 722 | */ |
724 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
723 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
725 | 724 | return FALSE; |
726 | 725 | } |
727 | 726 | |
728 | 727 | // Houston, we have a registration! |
729 | 728 | $att_nmbr++; |
730 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
729 | + $this->_attendee_data[$reg_url_link] = array(); |
|
731 | 730 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
732 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
731 | + if (isset($valid_data[$reg_url_link])) { |
|
733 | 732 | // do we need to copy basic info from primary attendee ? |
734 | - $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; |
|
733 | + $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; |
|
735 | 734 | // filter form input data for this registration |
736 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
735 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
737 | 736 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
738 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
739 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
740 | - unset( $valid_data['primary_attendee'] ); |
|
737 | + if (isset($valid_data['primary_attendee'])) { |
|
738 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
739 | + unset($valid_data['primary_attendee']); |
|
741 | 740 | } |
742 | 741 | // now loop through our array of valid post data && process attendee reg forms |
743 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
744 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
745 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
742 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
743 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
744 | + foreach ($form_inputs as $form_input => $input_value) { |
|
746 | 745 | // check for critical inputs |
747 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
746 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
748 | 747 | return FALSE; |
749 | 748 | } |
750 | 749 | // store a bit of data about the primary attendee |
751 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
752 | - $primary_registrant[ $form_input ] = $input_value; |
|
753 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
754 | - $input_value = $primary_registrant[ $form_input ]; |
|
750 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
751 | + $primary_registrant[$form_input] = $input_value; |
|
752 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
753 | + $input_value = $primary_registrant[$form_input]; |
|
755 | 754 | } |
756 | 755 | // now attempt to save the input data |
757 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
758 | - 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__ ); |
|
756 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
757 | + 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__); |
|
759 | 758 | return FALSE; |
760 | 759 | } |
761 | 760 | } |
@@ -764,51 +763,51 @@ discard block |
||
764 | 763 | } |
765 | 764 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
766 | 765 | // this registration does not require additional attendee information ? |
767 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
766 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
768 | 767 | // just copy the primary registrant |
769 | 768 | $attendee = $this->checkout->primary_attendee_obj; |
770 | 769 | } else { |
771 | 770 | // have we met before? |
772 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
771 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
773 | 772 | // did we find an already existing record for this attendee ? |
774 | - if ( $attendee instanceof EE_Attendee ) { |
|
775 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
773 | + if ($attendee instanceof EE_Attendee) { |
|
774 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
776 | 775 | } else { |
777 | 776 | // ensure critical details are set for additional attendees |
778 | - $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 ]; |
|
779 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
777 | + $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]; |
|
778 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
780 | 779 | } |
781 | 780 | // who's #1 ? |
782 | - if ( $att_nmbr == 1 ) { |
|
781 | + if ($att_nmbr == 1) { |
|
783 | 782 | $this->checkout->primary_attendee_obj = $attendee; |
784 | 783 | } |
785 | 784 | } |
786 | 785 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
787 | 786 | // add relation to registration, set attendee ID, and cache attendee |
788 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
789 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
790 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
787 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
788 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
789 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
791 | 790 | return FALSE; |
792 | 791 | } |
793 | 792 | /** @type EE_Registration_Processor $registration_processor */ |
794 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
793 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
795 | 794 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
796 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
795 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
797 | 796 | /** @type EE_Transaction_Processor $transaction_processor */ |
798 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
797 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
799 | 798 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
800 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
799 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
801 | 800 | // if we've gotten this far, then let's save what we have |
802 | 801 | $registration->save(); |
803 | 802 | // add relation between TXN and registration |
804 | - $this->_associate_registration_with_transaction( $registration ); |
|
803 | + $this->_associate_registration_with_transaction($registration); |
|
805 | 804 | |
806 | 805 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
807 | 806 | |
808 | - } else { |
|
809 | - 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__ ); |
|
807 | + } else { |
|
808 | + 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__); |
|
810 | 809 | // remove malformed data |
811 | - unset( $valid_data[ $reg_url_link ] ); |
|
810 | + unset($valid_data[$reg_url_link]); |
|
812 | 811 | return FALSE; |
813 | 812 | } |
814 | 813 | |
@@ -826,22 +825,22 @@ discard block |
||
826 | 825 | * @param string $input_value |
827 | 826 | * @return boolean |
828 | 827 | */ |
829 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
828 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
830 | 829 | //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>'; |
831 | 830 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
832 | 831 | // allow for plugins to hook in and do their own processing of the form input. |
833 | 832 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
834 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
833 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
835 | 834 | return TRUE; |
836 | 835 | } |
837 | 836 | |
838 | 837 | // grab related answer objects |
839 | 838 | $answers = $registration->answers(); |
840 | 839 | // $answer_cache_id is the key used to find the EE_Answer we want |
841 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
842 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
840 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
841 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
843 | 842 | //rename form_inputs if they are EE_Attendee properties |
844 | - switch( (string)$form_input ) { |
|
843 | + switch ((string) $form_input) { |
|
845 | 844 | |
846 | 845 | case 'state' : |
847 | 846 | case 'STA_ID' : |
@@ -856,33 +855,33 @@ discard block |
||
856 | 855 | break; |
857 | 856 | |
858 | 857 | default : |
859 | - $ATT_input = 'ATT_' . $form_input; |
|
858 | + $ATT_input = 'ATT_'.$form_input; |
|
860 | 859 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
861 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
862 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
860 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
861 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
863 | 862 | } |
864 | 863 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
865 | 864 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
866 | 865 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
867 | 866 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
868 | 867 | // if this form input has a corresponding attendee property |
869 | - if ( $attendee_property ) { |
|
870 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
871 | - if ( $answer_is_obj ) { |
|
868 | + if ($attendee_property) { |
|
869 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
870 | + if ($answer_is_obj) { |
|
872 | 871 | // and delete the corresponding answer since we won't be storing this data in that object |
873 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
874 | - $answers[ $answer_cache_id ]->delete_permanently(); |
|
872 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
873 | + $answers[$answer_cache_id]->delete_permanently(); |
|
875 | 874 | } |
876 | 875 | return TRUE; |
877 | - } elseif ( $answer_is_obj ) { |
|
876 | + } elseif ($answer_is_obj) { |
|
878 | 877 | // save this data to the answer object |
879 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
880 | - $result = $answers[ $answer_cache_id ]->save(); |
|
878 | + $answers[$answer_cache_id]->set_value($input_value); |
|
879 | + $result = $answers[$answer_cache_id]->save(); |
|
881 | 880 | return $result !== false ? true : false; |
882 | 881 | } else { |
883 | - foreach ( $answers as $answer ) { |
|
884 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
885 | - $answer->set_value( $input_value ); |
|
882 | + foreach ($answers as $answer) { |
|
883 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
884 | + $answer->set_value($input_value); |
|
886 | 885 | $result = $answer->save(); |
887 | 886 | return $result !== false ? true : false; |
888 | 887 | } |
@@ -900,33 +899,33 @@ discard block |
||
900 | 899 | * @param string $input_value |
901 | 900 | * @return boolean |
902 | 901 | */ |
903 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
904 | - if ( empty( $input_value )) { |
|
902 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
903 | + if (empty($input_value)) { |
|
905 | 904 | // if the form input isn't marked as being required, then just return |
906 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
905 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
907 | 906 | return true; |
908 | 907 | } |
909 | - switch( $form_input ) { |
|
908 | + switch ($form_input) { |
|
910 | 909 | case 'fname' : |
911 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
910 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
912 | 911 | return FALSE; |
913 | 912 | break; |
914 | 913 | case 'lname' : |
915 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
914 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
916 | 915 | return FALSE; |
917 | 916 | break; |
918 | 917 | case 'email' : |
919 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
918 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
920 | 919 | return FALSE; |
921 | 920 | break; |
922 | 921 | } |
923 | - } else if ( $form_input === 'email' ) { |
|
922 | + } else if ($form_input === 'email') { |
|
924 | 923 | // clean the email address |
925 | - $valid_email = sanitize_email( $input_value ); |
|
924 | + $valid_email = sanitize_email($input_value); |
|
926 | 925 | // check if it matches |
927 | - if ( $input_value != $valid_email ) { |
|
926 | + if ($input_value != $valid_email) { |
|
928 | 927 | // whoops!!! |
929 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
928 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
930 | 929 | return FALSE; |
931 | 930 | } |
932 | 931 | } |
@@ -954,14 +953,14 @@ discard block |
||
954 | 953 | * @param array $attendee_data |
955 | 954 | * @return boolean |
956 | 955 | */ |
957 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
956 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
958 | 957 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
959 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
960 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
961 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
958 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
959 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
960 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
962 | 961 | // but only if those have values |
963 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
964 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
962 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
963 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
965 | 964 | 'ATT_fname' => $ATT_fname, |
966 | 965 | 'ATT_lname' => $ATT_lname, |
967 | 966 | 'ATT_email' => $ATT_email |
@@ -969,7 +968,7 @@ discard block |
||
969 | 968 | } else { |
970 | 969 | $existing_attendee = NULL; |
971 | 970 | } |
972 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
971 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
973 | 972 | } |
974 | 973 | |
975 | 974 | |
@@ -981,13 +980,13 @@ discard block |
||
981 | 980 | * @param array $attendee_data |
982 | 981 | * @return \EE_Attendee |
983 | 982 | */ |
984 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
983 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
985 | 984 | // first remove fname, lname, and email from attendee data |
986 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
985 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
987 | 986 | // now loop thru what's left and add to attendee CPT |
988 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
989 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
990 | - $existing_attendee->set( $property_name, $property_value ); |
|
987 | + foreach ($attendee_data as $property_name => $property_value) { |
|
988 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
989 | + $existing_attendee->set($property_name, $property_value); |
|
991 | 990 | } |
992 | 991 | } |
993 | 992 | // better save that now |
@@ -1004,11 +1003,11 @@ discard block |
||
1004 | 1003 | * @param EE_Attendee $attendee |
1005 | 1004 | * @return void |
1006 | 1005 | */ |
1007 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
1006 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
1008 | 1007 | // add relation to attendee |
1009 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1010 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1011 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1008 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1009 | + $registration->set_attendee_id($attendee->ID()); |
|
1010 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1012 | 1011 | } |
1013 | 1012 | |
1014 | 1013 | |
@@ -1019,10 +1018,10 @@ discard block |
||
1019 | 1018 | * @param EE_Registration $registration |
1020 | 1019 | * @return void |
1021 | 1020 | */ |
1022 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1021 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1023 | 1022 | // add relation to attendee |
1024 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1025 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1023 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1024 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1026 | 1025 | } |
1027 | 1026 | |
1028 | 1027 | |
@@ -1034,17 +1033,17 @@ discard block |
||
1034 | 1033 | * @param array $attendee_data |
1035 | 1034 | * @return array |
1036 | 1035 | */ |
1037 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1036 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1038 | 1037 | // bare minimum critical details include first name, last name, email address |
1039 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1038 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1040 | 1039 | // add address info to critical details? |
1041 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
1042 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
1043 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1040 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
1041 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
1042 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1044 | 1043 | } |
1045 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1046 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
1047 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
1044 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1045 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
1046 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
1048 | 1047 | } |
1049 | 1048 | } |
1050 | 1049 | return $attendee_data; |
@@ -1059,11 +1058,11 @@ discard block |
||
1059 | 1058 | * @param array $attendee_data |
1060 | 1059 | * @return \EE_Attendee |
1061 | 1060 | */ |
1062 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1061 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1063 | 1062 | // create new attendee object |
1064 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1063 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1065 | 1064 | // set author to event creator |
1066 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1065 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1067 | 1066 | $new_attendee->save(); |
1068 | 1067 | return $new_attendee; |
1069 | 1068 | } |
@@ -1079,7 +1078,7 @@ discard block |
||
1079 | 1078 | */ |
1080 | 1079 | public function update_reg_step() { |
1081 | 1080 | // save everything |
1082 | - if ( $this->process_reg_step() ) { |
|
1081 | + if ($this->process_reg_step()) { |
|
1083 | 1082 | $this->checkout->redirect = TRUE; |
1084 | 1083 | $this->checkout->redirect_url = add_query_arg( |
1085 | 1084 | array( |
@@ -1088,7 +1087,7 @@ discard block |
||
1088 | 1087 | ), |
1089 | 1088 | $this->checkout->thank_you_page_url |
1090 | 1089 | ); |
1091 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1090 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1092 | 1091 | return TRUE; |
1093 | 1092 | } |
1094 | 1093 | return FALSE; |
@@ -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 ){ |
@@ -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)){ |